diff --git a/CHANGELOG.md b/CHANGELOG.md index 926f7c2e807..9d35e018e95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,10 @@ not match the non-nullable type and this will now throw. In the future this will likely be a compile-time error and will be entirely disallowed. +#### Dart to Javascript Compiler (dart2js) + +Removed the `--experiment-new-rti` and `--use-old-rti` flags. + ## 3.7.0 **Released on:** 2025-02-12 diff --git a/benchmarks/SoundSplayTreeSieve/dart/README.md b/benchmarks/SoundSplayTreeSieve/dart/README.md index 7a8baecf392..d60a944edc5 100644 --- a/benchmarks/SoundSplayTreeSieve/dart/README.md +++ b/benchmarks/SoundSplayTreeSieve/dart/README.md @@ -15,17 +15,17 @@ CollectionSieves-SoundSplayTreeSet-removeLoop(RunTime): 4344.902386117137 us. **Dart2JS** ``` -$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --experiment-new-rti --out=soundsplay_d2js.js +$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --out=soundsplay_d2js.js $ third_party/d8/linux/d8 soundsplay_d2js.js ``` **Dart2JS (Omit implicit checks)** ``` -$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --experiment-new-rti --omit-implicit-checks --out=soundsplay_d2js_omit.js --lax-runtime-type-to-string +$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --omit-implicit-checks --out=soundsplay_d2js_omit.js --lax-runtime-type-to-string $ third_party/d8/linux/d8 soundsplay_d2js_omit.js ``` **DDK** ``` $ pkg/dev_compiler/tool/ddb -d -r chrome --enable-experiment=variance -k benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart -``` \ No newline at end of file +``` diff --git a/benchmarks/SoundSplayTreeSieve/dart2/README.md b/benchmarks/SoundSplayTreeSieve/dart2/README.md index 7a8baecf392..d60a944edc5 100644 --- a/benchmarks/SoundSplayTreeSieve/dart2/README.md +++ b/benchmarks/SoundSplayTreeSieve/dart2/README.md @@ -15,17 +15,17 @@ CollectionSieves-SoundSplayTreeSet-removeLoop(RunTime): 4344.902386117137 us. **Dart2JS** ``` -$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --experiment-new-rti --out=soundsplay_d2js.js +$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --out=soundsplay_d2js.js $ third_party/d8/linux/d8 soundsplay_d2js.js ``` **Dart2JS (Omit implicit checks)** ``` -$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --experiment-new-rti --omit-implicit-checks --out=soundsplay_d2js_omit.js --lax-runtime-type-to-string +$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --omit-implicit-checks --out=soundsplay_d2js_omit.js --lax-runtime-type-to-string $ third_party/d8/linux/d8 soundsplay_d2js_omit.js ``` **DDK** ``` $ pkg/dev_compiler/tool/ddb -d -r chrome --enable-experiment=variance -k benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart -``` \ No newline at end of file +``` diff --git a/pkg/compiler/lib/src/commandline_options.dart b/pkg/compiler/lib/src/commandline_options.dart index 9dc830f43a3..e9299e14f4c 100644 --- a/pkg/compiler/lib/src/commandline_options.dart +++ b/pkg/compiler/lib/src/commandline_options.dart @@ -58,8 +58,6 @@ class Flags { static const String experimentCallInstrumentation = '--experiment-call-instrumentation'; - static const String experimentNewRti = '--experiment-new-rti'; - static const String enableLanguageExperiments = '--enable-experiment'; static const String fastStartup = '--fast-startup'; @@ -107,7 +105,6 @@ class Flags { '--experimental-trust-js-interop-type-annotations'; static const String useMultiSourceInfo = '--use-multi-source-info'; static const String useNewSourceInfo = '--use-new-source-info'; - static const String useOldRti = '--use-old-rti'; static const String useSimpleLoadIds = '--simple-load-ids'; static const String verbose = '--verbose'; static const String verbosity = '--verbosity'; diff --git a/pkg/compiler/lib/src/common/elements.dart b/pkg/compiler/lib/src/common/elements.dart index e68c86210cb..c381ce56df7 100644 --- a/pkg/compiler/lib/src/common/elements.dart +++ b/pkg/compiler/lib/src/common/elements.dart @@ -1109,7 +1109,7 @@ abstract class CommonElements { FunctionEntity get specializedAsStringNullable => _findRtiFunction('_asStringQ'); - FunctionEntity get instantiatedGenericFunctionTypeNewRti => + FunctionEntity get instantiatedGenericFunctionType => _findRtiFunction('instantiatedGenericFunctionType'); FunctionEntity get closureFunctionType => diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart index c08a3023dc8..184131c7d3c 100644 --- a/pkg/compiler/lib/src/dart2js.dart +++ b/pkg/compiler/lib/src/dart2js.dart @@ -531,7 +531,6 @@ Future compile( _OneOption(Flags.generateCodeWithCompileTimeErrors, ignoreOption), _OneOption(Flags.useMultiSourceInfo, passThrough), _OneOption(Flags.useNewSourceInfo, passThrough), - _OneOption(Flags.useOldRti, passThrough), _OneOption(Flags.useSimpleLoadIds, passThrough), _OneOption(Flags.testMode, passThrough), _OneOption('${Flags.dumpSsa}=.+', passThrough), @@ -552,7 +551,6 @@ Future compile( _OneOption(Flags.experimentToBoolean, passThrough), _OneOption(Flags.experimentUnreachableMethodsThrow, passThrough), _OneOption(Flags.experimentCallInstrumentation, passThrough), - _OneOption(Flags.experimentNewRti, ignoreOption), _OneOption('${Flags.mergeFragmentsThreshold}=.+', passThrough), // Wire up feature flags. diff --git a/pkg/compiler/lib/src/deferred_load/entity_data_info.dart b/pkg/compiler/lib/src/deferred_load/entity_data_info.dart index 98ee3927fc1..908fd9682b3 100644 --- a/pkg/compiler/lib/src/deferred_load/entity_data_info.dart +++ b/pkg/compiler/lib/src/deferred_load/entity_data_info.dart @@ -237,7 +237,7 @@ class EntityDataInfoBuilder { break; case TypeUseKind.rtiValue: case TypeUseKind.typeArgument: - case TypeUseKind.namedTypeVariableNewRti: + case TypeUseKind.namedTypeVariable: case TypeUseKind.constructorReference: failedAt(parent!, "Unexpected type use: $typeUse."); } diff --git a/pkg/compiler/lib/src/js_backend/backend_impact.dart b/pkg/compiler/lib/src/js_backend/backend_impact.dart index df333c93852..409467496ab 100644 --- a/pkg/compiler/lib/src/js_backend/backend_impact.dart +++ b/pkg/compiler/lib/src/js_backend/backend_impact.dart @@ -98,7 +98,7 @@ class BackendImpacts { late final BackendImpact getRuntimeTypeArgument = BackendImpact( globalUses: [], - otherImpacts: [newRtiImpact], + otherImpacts: [rtiImpact], ); late final BackendImpact computeSignature = BackendImpact( @@ -153,7 +153,7 @@ class BackendImpacts { late final BackendImpact asCheck = BackendImpact( staticUses: [], - otherImpacts: [newRtiImpact], + otherImpacts: [rtiImpact], ); late final BackendImpact stringValues = BackendImpact( @@ -322,7 +322,7 @@ class BackendImpacts { ); late final BackendImpact typeCheck = BackendImpact( - otherImpacts: [boolValues, newRtiImpact], + otherImpacts: [boolValues, rtiImpact], ); late final BackendImpact genericTypeCheck = BackendImpact( @@ -330,26 +330,26 @@ class BackendImpacts { // TODO(johnniwinther): Investigate why this is needed. _commonElements.setArrayType, ], - otherImpacts: [listValues, getRuntimeTypeArgument, newRtiImpact], + otherImpacts: [listValues, getRuntimeTypeArgument, rtiImpact], ); late final BackendImpact genericIsCheck = BackendImpact( - otherImpacts: [intValues, newRtiImpact], + otherImpacts: [intValues, rtiImpact], ); late final BackendImpact typeVariableTypeCheck = BackendImpact( staticUses: [], - otherImpacts: [newRtiImpact], + otherImpacts: [rtiImpact], ); late final BackendImpact functionTypeCheck = BackendImpact( staticUses: [/*helpers.functionTypeTestMetaHelper*/], - otherImpacts: [newRtiImpact], + otherImpacts: [rtiImpact], ); late final BackendImpact futureOrTypeCheck = BackendImpact( staticUses: [], - otherImpacts: [newRtiImpact], + otherImpacts: [rtiImpact], ); late final BackendImpact nativeTypeCheck = BackendImpact( @@ -359,7 +359,7 @@ class BackendImpacts { // [:defineProperty:] is compiled. _commonElements.defineProperty, ], - otherImpacts: [newRtiImpact], + otherImpacts: [rtiImpact], ); late final BackendImpact closure = BackendImpact( @@ -532,7 +532,7 @@ class BackendImpacts { _genericInstantiation[typeArgumentCount] ??= BackendImpact( staticUses: [ _commonElements.getInstantiateFunction(typeArgumentCount), - _commonElements.instantiatedGenericFunctionTypeNewRti, + _commonElements.instantiatedGenericFunctionType, _commonElements.closureFunctionType, ], instantiatedClasses: [ @@ -541,7 +541,7 @@ class BackendImpacts { ); // TODO(sra): Split into refined impacts. - late final BackendImpact newRtiImpact = BackendImpact( + late final BackendImpact rtiImpact = BackendImpact( staticUses: [ if (_options.interopNullAssertions) _commonElements.interopNullAssertion, _commonElements.findType, diff --git a/pkg/compiler/lib/src/js_backend/codegen_listener.dart b/pkg/compiler/lib/src/js_backend/codegen_listener.dart index bd63d782c8f..eb9653d3d7a 100644 --- a/pkg/compiler/lib/src/js_backend/codegen_listener.dart +++ b/pkg/compiler/lib/src/js_backend/codegen_listener.dart @@ -45,7 +45,7 @@ class CodegenEnqueuerListener extends EnqueuerListener { final CodegenWorldBuilder _worldBuilder; bool _isNoSuchMethodUsed = false; - bool _isNewRtiUsed = false; + bool _isRtiUsed = false; CodegenEnqueuerListener( this._options, @@ -149,30 +149,30 @@ class CodegenEnqueuerListener extends EnqueuerListener { } // TODO(fishythefish): Avoid registering unnecessary impacts. - if (!_isNewRtiUsed) { - WorldImpactBuilderImpl newRtiImpact = WorldImpactBuilderImpl(); - newRtiImpact.registerStaticUse( + if (!_isRtiUsed) { + WorldImpactBuilderImpl rtiImpact = WorldImpactBuilderImpl(); + rtiImpact.registerStaticUse( StaticUse.staticInvoke( _commonElements.rtiAddRulesMethod, CallStructure.twoArgs, ), ); - newRtiImpact.registerStaticUse( + rtiImpact.registerStaticUse( StaticUse.staticInvoke( _commonElements.rtiAddErasedTypesMethod, CallStructure.twoArgs, ), ); if (_options.enableVariance) { - newRtiImpact.registerStaticUse( + rtiImpact.registerStaticUse( StaticUse.staticInvoke( _commonElements.rtiAddTypeParameterVariancesMethod, CallStructure.twoArgs, ), ); } - enqueuer.applyImpact(newRtiImpact); - _isNewRtiUsed = true; + enqueuer.applyImpact(rtiImpact); + _isRtiUsed = true; } if (_nativeData.isAllowInteropUsed) { @@ -257,7 +257,7 @@ class CodegenEnqueuerListener extends EnqueuerListener { impactBuilder.registerStaticUse( StaticUse.staticInvoke( - _commonElements.instantiatedGenericFunctionTypeNewRti, + _commonElements.instantiatedGenericFunctionType, CallStructure.twoArgs, ), ); diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart index 5ed468f6cb4..6a91a64fdac 100644 --- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart +++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart @@ -273,7 +273,7 @@ class ConstantEmitter extends ModularConstantEmitter { .toList(growable: false); js_ast.ArrayInitializer array = js_ast.ArrayInitializer(elements); js_ast.Expression value = _makeConstantList(array); - return maybeAddListTypeArgumentsNewRti(constant, constant.type, value); + return maybeAddListTypeArguments(constant, constant.type, value); } @override @@ -296,7 +296,7 @@ class ConstantEmitter extends ModularConstantEmitter { _constantReferenceGenerator(constant.indexObject!), js.number(constant.length), if (_rtiNeed.classNeedsTypeArguments(classElement)) - _reifiedTypeNewRti(sourceType), + _reifiedType(sourceType), ]; js_ast.Expression constructor = _emitter.constructorAccess(classElement); return js_ast.New(constructor, arguments); @@ -313,7 +313,7 @@ class ConstantEmitter extends ModularConstantEmitter { _constantReferenceGenerator(value), ]), if (_rtiNeed.classNeedsTypeArguments(classElement)) - _reifiedTypeNewRti(sourceType), + _reifiedType(sourceType), ]; js_ast.Expression constructor = _emitter.constructorAccess(classElement); return js_ast.New(constructor, arguments); @@ -412,7 +412,7 @@ class ConstantEmitter extends ModularConstantEmitter { } if (_rtiNeed.classNeedsTypeArguments(classElement)) { - arguments.add(_reifiedTypeNewRti(constant.type)); + arguments.add(_reifiedType(constant.type)); } js_ast.Expression constructor = _emitter.constructorAccess(classElement); @@ -491,7 +491,7 @@ class ConstantEmitter extends ModularConstantEmitter { } }); if (_rtiNeed.classNeedsTypeArguments(constant.type.element)) { - fields.add(_reifiedTypeNewRti(constant.type)); + fields.add(_reifiedType(constant.type)); } return js_ast.New(constructor, fields); } @@ -527,7 +527,7 @@ class ConstantEmitter extends ModularConstantEmitter { _constantReferenceGenerator(constant.function), ]; fields.add( - _reifiedTypeNewRti( + _reifiedType( _commonElements.dartTypes.interfaceType(cls, constant.typeArguments), ), ); @@ -539,7 +539,7 @@ class ConstantEmitter extends ModularConstantEmitter { return rawJavaScript.replaceAll(commentRE, ''); } - js_ast.Expression maybeAddListTypeArgumentsNewRti( + js_ast.Expression maybeAddListTypeArguments( ConstantValue constant, InterfaceType type, js_ast.Expression value, @@ -548,13 +548,13 @@ class ConstantEmitter extends ModularConstantEmitter { if (_rtiNeed.classNeedsTypeArguments(type.element)) { return js_ast.Call(getHelperProperty(_commonElements.setArrayType), [ value, - _reifiedTypeNewRti(type), + _reifiedType(type), ]); } return value; } - js_ast.Expression _reifiedTypeNewRti(DartType type) { + js_ast.Expression _reifiedType(DartType type) { assert(!type.containsTypeVariables); return TypeReference(TypeExpressionRecipe(type))..forConstant = true; } diff --git a/pkg/compiler/lib/src/js_backend/enqueuer.dart b/pkg/compiler/lib/src/js_backend/enqueuer.dart index ccc3648ad2f..1f710b6b015 100644 --- a/pkg/compiler/lib/src/js_backend/enqueuer.dart +++ b/pkg/compiler/lib/src/js_backend/enqueuer.dart @@ -240,8 +240,8 @@ class CodegenEnqueuer extends Enqueuer { break; case TypeUseKind.constInstantiation: failedAt(currentElementSpannable, "Unexpected type use: $typeUse."); - case TypeUseKind.namedTypeVariableNewRti: - _registerNamedTypeVariableNewRti(type as TypeVariableType); + case TypeUseKind.namedTypeVariable: + _registerNamedTypeVariable(type as TypeVariableType); break; } } @@ -260,8 +260,8 @@ class CodegenEnqueuer extends Enqueuer { worldBuilder.registerIsCheck(type); } - void _registerNamedTypeVariableNewRti(TypeVariableType type) { - worldBuilder.registerNamedTypeVariableNewRti(type); + void _registerNamedTypeVariable(TypeVariableType type) { + worldBuilder.registerNamedTypeVariable(type); } void _registerClosurizedMember(FunctionEntity element) { diff --git a/pkg/compiler/lib/src/js_backend/runtime_types_new.dart b/pkg/compiler/lib/src/js_backend/runtime_types_new.dart index 77b817f9011..6b73c237058 100644 --- a/pkg/compiler/lib/src/js_backend/runtime_types_new.dart +++ b/pkg/compiler/lib/src/js_backend/runtime_types_new.dart @@ -259,7 +259,7 @@ class _RecipeGenerator implements DartTypeVisitor { return; } - js_ast.Name name = _emitter.typeVariableAccessNewRti(type.element); + js_ast.Name name = _emitter.typeVariableAccess(type.element); _emitName(name); typeVariables.add(type); return; @@ -295,7 +295,7 @@ class _RecipeGenerator implements DartTypeVisitor { @override void visitInterfaceType(InterfaceType type, _) { - js_ast.Name name = _emitter.typeAccessNewRti(type.element); + js_ast.Name name = _emitter.typeAccess(type.element); if (type.typeArguments.isEmpty) { // Push the name, which is later converted by an implicit toType // operation. @@ -543,11 +543,11 @@ class RulesetEncoder { MapEntry redirection, ) => js.concatenateStrings([ _doubleQuote, - _emitter.typeAccessNewRti(redirection.key), + _emitter.typeAccess(redirection.key), _doubleQuote, _colon, _doubleQuote, - _emitter.typeAccessNewRti(redirection.value), + _emitter.typeAccess(redirection.value), _doubleQuote, ]); @@ -555,7 +555,7 @@ class RulesetEncoder { MapEntry entry, ) => js.concatenateStrings([ _doubleQuote, - _emitter.typeAccessNewRti(entry.key.element), + _emitter.typeAccess(entry.key.element), _doubleQuote, _colon, _leftBrace, @@ -576,7 +576,7 @@ class RulesetEncoder { InterfaceType supertype, ) => js.concatenateStrings([ _doubleQuote, - _emitter.typeAccessNewRti(supertype.element), + _emitter.typeAccess(supertype.element), _doubleQuote, _colon, _leftBracket, @@ -596,7 +596,7 @@ class RulesetEncoder { DartType supertypeArgument, ) => js.concatenateStrings([ _doubleQuote, - _emitter.typeVariableAccessNewRti(typeVariable.element), + _emitter.typeVariableAccess(typeVariable.element), _doubleQuote, _colon, _encodeSupertypeArgument(targetType, supertypeArgument), @@ -627,7 +627,7 @@ class RulesetEncoder { MapEntry entry, ) => js.concatenateStrings([ _doubleQuote, - _emitter.typeAccessNewRti(entry.key), + _emitter.typeAccess(entry.key), _doubleQuote, _colon, js.number(entry.value), @@ -648,7 +648,7 @@ class RulesetEncoder { MapEntry> classEntry, ) => js.concatenateStrings([ _doubleQuote, - _emitter.typeAccessNewRti(classEntry.key), + _emitter.typeAccess(classEntry.key), _doubleQuote, _colon, _leftBracket, @@ -710,4 +710,4 @@ int? indexTypeVariable( bool mustCheckAllSubtypes(JClosedWorld world, ClassEntity cls) => world.isUsedAsMixin(cls) || - world.extractTypeArgumentsInterfacesNewRti.contains(cls); + world.extractTypeArgumentsInterfaces.contains(cls); diff --git a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart index 5b702703fc5..5b1f4df07c2 100644 --- a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart +++ b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart @@ -178,10 +178,10 @@ abstract class ModularEmitter { js_ast.Expression constructorAccess(ClassEntity e); /// Returns the JS name representing the type [e]. - js_ast.Name typeAccessNewRti(ClassEntity e); + js_ast.Name typeAccess(ClassEntity e); /// Returns the JS name representing the type variable [e]. - js_ast.Name typeVariableAccessNewRti(TypeVariableEntity e); + js_ast.Name typeVariableAccess(TypeVariableEntity e); /// Returns the JS code for accessing the embedded [global]. js_ast.Expression generateEmbeddedGlobalAccess(String global); diff --git a/pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart index 46e64e9448d..78003e5db18 100644 --- a/pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart +++ b/pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart @@ -114,7 +114,7 @@ class InstantiationStubGenerator { /// /// ``` /// $signature:: function() { - /// return H.instantiatedGenericFunctionTypeNewRti( + /// return H.instantiatedGenericFunctionType( /// H.closureFunctionType(this._genericClosure), /// this.$ti); /// } @@ -124,7 +124,7 @@ class InstantiationStubGenerator { _namer.fixedNames.operatorSignature, ); - js_ast.Fun function = _generateSignatureNewRti(functionField); + js_ast.Fun function = _generateSignature(functionField); // TODO(sra): Generate source information for stub that has no member. // TODO(sra): .withSourceInformation(sourceInformation); @@ -137,10 +137,10 @@ class InstantiationStubGenerator { ); } - js_ast.Fun _generateSignatureNewRti(FieldEntity functionField) => + js_ast.Fun _generateSignature(FieldEntity functionField) => js('function() { return #(#(this.#), this.#); }', [ _emitter.staticFunctionAccess( - _commonElements.instantiatedGenericFunctionTypeNewRti, + _commonElements.instantiatedGenericFunctionType, ), _emitter.staticFunctionAccess(_commonElements.closureFunctionType), _namer.instanceFieldPropertyName(functionField), diff --git a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart index 00ae9adc475..b61e5dcee92 100644 --- a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart +++ b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart @@ -145,7 +145,7 @@ class MetadataCollector implements js_ast.TokenFinalizer { return _addTypeInOutputUnit(type, outputUnit); } - js_ast.Expression _computeTypeRepresentationNewRti(DartType type) { + js_ast.Expression _computeTypeRepresentation(DartType type) { return _rtiRecipeEncoder.encodeGroundRecipe( _emitter, TypeExpressionRecipe(type), @@ -156,7 +156,7 @@ class MetadataCollector implements js_ast.TokenFinalizer { final typeMap = _typesMap[outputUnit] ??= {}; final metadataEntryList = (typeMap[type] ??= [ - BoundMetadataEntry(_computeTypeRepresentationNewRti(type)), + BoundMetadataEntry(_computeTypeRepresentation(type)), ]); return metadataEntryList.single; } diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart index 1fd05916469..33ca725226c 100644 --- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart +++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart @@ -101,7 +101,7 @@ class ProgramBuilder { /// True if the program should store function types in the metadata. bool _storeFunctionTypesInMetadata = false; - final Set _lateNamedTypeVariablesNewRti = {}; + final Set _lateNamedTypeVariables = {}; ClassHierarchy get _classHierarchy => _closedWorld.classHierarchy; DartTypes get _dartTypes => _closedWorld.dartTypes; @@ -262,7 +262,7 @@ class ProgramBuilder { _markEagerClasses(); - associateNamedTypeVariablesNewRti(); + associateNamedTypeVariables(); bool needsNativeSupport = _nativeCodegenEnqueuer.hasInstantiatedNativeClasses || @@ -914,9 +914,9 @@ class ProgramBuilder { () => ClassTypeData(cls, _rtiChecks.requiredChecks[cls]), ); - void associateNamedTypeVariablesNewRti() { - for (TypeVariableType typeVariable in _codegenWorld.namedTypeVariablesNewRti - .union(_lateNamedTypeVariablesNewRti)) { + void associateNamedTypeVariables() { + for (TypeVariableType typeVariable in _codegenWorld.namedTypeVariables + .union(_lateNamedTypeVariables)) { final declaration = typeVariable.element.typeDeclaration as ClassEntity; Iterable subtypes = new_rti.mustCheckAllSubtypes(_closedWorld, declaration) @@ -1086,12 +1086,6 @@ class ProgramBuilder { ClassEntity? enclosingClass, FunctionType type, OutputUnit outputUnit, - ) => _generateFunctionTypeNewRti(enclosingClass, type, outputUnit); - - js.Expression _generateFunctionTypeNewRti( - ClassEntity? enclosingClass, - FunctionType type, - OutputUnit outputUnit, ) { InterfaceType? enclosingType; if (enclosingClass != null && type.containsTypeVariables) { @@ -1118,7 +1112,7 @@ class ProgramBuilder { FullTypeEnvironmentStructure(classType: enclosingType), TypeExpressionRecipe(type), ); - _lateNamedTypeVariablesNewRti.addAll(encoding.typeVariables); + _lateNamedTypeVariables.addAll(encoding.typeVariables); return encoding.recipe; } else { return _task.metadataCollector.reifyType(type, outputUnit); diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart index 34e9ec02a0c..4edfb3aeca8 100644 --- a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart +++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart @@ -79,12 +79,12 @@ abstract class ModularEmitterBase implements ModularEmitter { } @override - js.Name typeAccessNewRti(ClassEntity element) { + js.Name typeAccess(ClassEntity element) { return _namer.className(element); } @override - js.Name typeVariableAccessNewRti(TypeVariableEntity element) { + js.Name typeVariableAccess(TypeVariableEntity element) { return _namer.globalNameForInterfaceTypeVariable(element); } diff --git a/pkg/compiler/lib/src/js_model/js_world.dart b/pkg/compiler/lib/src/js_model/js_world.dart index 3de8f3deab5..773602aa305 100644 --- a/pkg/compiler/lib/src/js_model/js_world.dart +++ b/pkg/compiler/lib/src/js_model/js_world.dart @@ -101,7 +101,7 @@ class JClosedWorld implements World { /// Returns the set of interfaces passed as type arguments to the internal /// `extractTypeArguments` function. - final Set extractTypeArgumentsInterfacesNewRti; + final Set extractTypeArgumentsInterfaces; final ClassHierarchy classHierarchy; @@ -133,7 +133,7 @@ class JClosedWorld implements World { this.liveAbstractInstanceMembers, this.assignedInstanceMembers, this.processedMembers, - this.extractTypeArgumentsInterfacesNewRti, + this.extractTypeArgumentsInterfaces, this.mixinUses, this.typesImplementedBySubclasses, this.classHierarchy, @@ -192,7 +192,7 @@ class JClosedWorld implements World { Set implementedClasses = source.readClasses().toSet(); Set liveNativeClasses = source.readClasses().toSet(); - Set extractTypeArgumentsInterfacesNewRti = + Set extractTypeArgumentsInterfaces = source.readClasses().toSet(); Set liveInstanceMembers = source.readMembers().toSet(); Set liveAbstractInstanceMembers = @@ -242,7 +242,7 @@ class JClosedWorld implements World { liveAbstractInstanceMembers, assignedInstanceMembers, processedMembers, - extractTypeArgumentsInterfacesNewRti, + extractTypeArgumentsInterfaces, mixinUses, typesImplementedBySubclasses, classHierarchy, @@ -268,7 +268,7 @@ class JClosedWorld implements World { noSuchMethodData.writeToDataSink(sink); sink.writeClasses(implementedClasses); sink.writeClasses(liveNativeClasses); - sink.writeClasses(extractTypeArgumentsInterfacesNewRti); + sink.writeClasses(extractTypeArgumentsInterfaces); sink.writeMembers(liveInstanceMembers); sink.writeMembers(liveAbstractInstanceMembers); sink.writeMembers(assignedInstanceMembers); @@ -704,7 +704,7 @@ class JClosedWorld implements World { /// Registers [interface] as a type argument to `extractTypeArguments`. void registerExtractTypeArguments(ClassEntity interface) { - extractTypeArgumentsInterfacesNewRti.add(interface); + extractTypeArgumentsInterfaces.add(interface); } late final Set _defaultSuperclasses = { diff --git a/pkg/compiler/lib/src/js_model/js_world_builder.dart b/pkg/compiler/lib/src/js_model/js_world_builder.dart index e05dc7394b5..f0cc48c8526 100644 --- a/pkg/compiler/lib/src/js_model/js_world_builder.dart +++ b/pkg/compiler/lib/src/js_model/js_world_builder.dart @@ -150,7 +150,7 @@ class JClosedWorldBuilder { closedWorld.liveMemberUsage.keys, ); - Set extractTypeArgumentsInterfacesNewRti = {}; + Set extractTypeArgumentsInterfaces = {}; RuntimeTypesNeed rtiNeed; @@ -281,7 +281,7 @@ class JClosedWorldBuilder { liveAbstractInstanceMembers, assignedInstanceMembers, processedMembers, - extractTypeArgumentsInterfacesNewRti, + extractTypeArgumentsInterfaces, mixinUses, typesImplementedBySubclasses, ClassHierarchyImpl( diff --git a/pkg/compiler/lib/src/kernel/kernel_world.dart b/pkg/compiler/lib/src/kernel/kernel_world.dart index 34c3f47f19b..03a3199fb8f 100644 --- a/pkg/compiler/lib/src/kernel/kernel_world.dart +++ b/pkg/compiler/lib/src/kernel/kernel_world.dart @@ -61,7 +61,7 @@ class KClosedWorld implements BuiltWorld { final Set isChecks; @override - final Set namedTypeVariablesNewRti; + final Set namedTypeVariables; final Map> staticTypeArgumentDependencies; @@ -114,7 +114,7 @@ class KClosedWorld implements BuiltWorld { required this.classHierarchy, required this.annotationsData, required this.isChecks, - required this.namedTypeVariablesNewRti, + required this.namedTypeVariables, required this.staticTypeArgumentDependencies, required this.dynamicTypeArgumentDependencies, required this.typeVariableTypeLiterals, diff --git a/pkg/compiler/lib/src/resolution/enqueuer.dart b/pkg/compiler/lib/src/resolution/enqueuer.dart index 60c684d5e6a..1a128a37d89 100644 --- a/pkg/compiler/lib/src/resolution/enqueuer.dart +++ b/pkg/compiler/lib/src/resolution/enqueuer.dart @@ -256,8 +256,8 @@ class ResolutionEnqueuer extends Enqueuer { case TypeUseKind.typeArgument: case TypeUseKind.constructorReference: failedAt(currentElementSpannable, "Unexpected type use: $typeUse."); - case TypeUseKind.namedTypeVariableNewRti: - _registerNamedTypeVariableNewRti(type as TypeVariableType); + case TypeUseKind.namedTypeVariable: + _registerNamedTypeVariable(type as TypeVariableType); break; } } @@ -270,8 +270,8 @@ class ResolutionEnqueuer extends Enqueuer { worldBuilder.registerIsCheck(type); } - void _registerNamedTypeVariableNewRti(TypeVariableType type) { - worldBuilder.registerNamedTypeVariableNewRti(type); + void _registerNamedTypeVariable(TypeVariableType type) { + worldBuilder.registerNamedTypeVariable(type); } void _registerClosurizedMember(FunctionEntity element) { diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart index 849e50e3168..646a5cd0f39 100644 --- a/pkg/compiler/lib/src/ssa/builder.dart +++ b/pkg/compiler/lib/src/ssa/builder.dart @@ -568,7 +568,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault "$targetElement inside a non-closure: $target", ); } - _buildMethodSignatureNewRti(originalClosureNode); + _buildMethodSignature(originalClosureNode); break; case MemberKind.parameterStub: _buildParameterStub( @@ -1380,7 +1380,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault } /// Constructs a special signature function for a closure. - void _buildMethodSignatureNewRti(ir.FunctionNode originalClosureNode) { + void _buildMethodSignature(ir.FunctionNode originalClosureNode) { // The signature function has no corresponding ir.Node, so we just use the // targetElement to set up the type environment. _openFunction(targetElement, checks: TargetChecks.none); diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart index 8341e1f081c..26fabe46920 100644 --- a/pkg/compiler/lib/src/ssa/codegen.dart +++ b/pkg/compiler/lib/src/ssa/codegen.dart @@ -3880,7 +3880,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { js.Expression recipe = encoding.recipe; for (TypeVariableType typeVariable in encoding.typeVariables) { - _registry.registerTypeUse(TypeUse.namedTypeVariableNewRti(typeVariable)); + _registry.registerTypeUse(TypeUse.namedTypeVariable(typeVariable)); } final method = _commonElements.rtiEvalMethod; diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart index 2e2f98b4a6f..01959eb6f84 100644 --- a/pkg/compiler/lib/src/ssa/ssa.dart +++ b/pkg/compiler/lib/src/ssa/ssa.dart @@ -250,7 +250,7 @@ class SsaFunctionCompiler implements FunctionCompiler { /// added as a function parameter to the rewritten code. // TODO(sra): We could also return an empty list if the generator takes no // type (e.g. due to rtiNeed optimization). - List? _fetchItemTypeNewRti( + List? _fetchItemType( CommonElements commonElements, CodegenRegistry registry, DartType? type, @@ -277,7 +277,7 @@ class SsaFunctionCompiler implements FunctionCompiler { FunctionEntity startFunction = commonElements.asyncHelperStartSync; FunctionEntity completerFactory = commonElements.asyncAwaitCompleterFactory; - final itemTypeExpression = _fetchItemTypeNewRti( + final itemTypeExpression = _fetchItemType( commonElements, registry, elementType, @@ -353,7 +353,7 @@ class SsaFunctionCompiler implements FunctionCompiler { DartType? asyncTypeParameter, js.Name name, ) { - final itemTypeExpression = _fetchItemTypeNewRti( + final itemTypeExpression = _fetchItemType( commonElements, registry, asyncTypeParameter, diff --git a/pkg/compiler/lib/src/universe/codegen_world_builder.dart b/pkg/compiler/lib/src/universe/codegen_world_builder.dart index 81bfb601bcf..fa9f49ff245 100644 --- a/pkg/compiler/lib/src/universe/codegen_world_builder.dart +++ b/pkg/compiler/lib/src/universe/codegen_world_builder.dart @@ -161,7 +161,7 @@ class CodegenWorldBuilder extends WorldBuilder { final Set _constTypeLiterals = {}; final Set _liveTypeArguments = {}; - final Set _namedTypeVariablesNewRti = {}; + final Set _namedTypeVariables = {}; final Set _constructorReferences = {}; final Map> _parameterStubs = {}; @@ -362,8 +362,8 @@ class CodegenWorldBuilder extends WorldBuilder { _isChecks.add(type); } - void registerNamedTypeVariableNewRti(TypeVariableType type) { - _namedTypeVariablesNewRti.add(type); + void registerNamedTypeVariable(TypeVariableType type) { + _namedTypeVariables.add(type); } void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) { @@ -884,7 +884,7 @@ class CodegenWorldBuilder extends WorldBuilder { typeVariableTypeLiterals: typeVariableTypeLiterals, instantiatedClasses: instantiatedClasses, isChecks: _isChecks, - namedTypeVariablesNewRti: _namedTypeVariablesNewRti, + namedTypeVariables: _namedTypeVariables, instantiatedTypes: _instantiatedTypes, liveTypeArguments: _liveTypeArguments, compiledConstants: _compiledConstants, @@ -924,7 +924,7 @@ class CodegenWorldImpl implements CodegenWorld { final Iterable isChecks; @override - final Set namedTypeVariablesNewRti; + final Set namedTypeVariables; @override final Iterable instantiatedTypes; @@ -959,7 +959,7 @@ class CodegenWorldImpl implements CodegenWorld { required this.typeVariableTypeLiterals, required this.instantiatedClasses, required this.isChecks, - required this.namedTypeVariablesNewRti, + required this.namedTypeVariables, required this.instantiatedTypes, required this.liveTypeArguments, required Map> parameterStubs, diff --git a/pkg/compiler/lib/src/universe/resolution_world_builder.dart b/pkg/compiler/lib/src/universe/resolution_world_builder.dart index 60949af2ffe..8fd33d8c81d 100644 --- a/pkg/compiler/lib/src/universe/resolution_world_builder.dart +++ b/pkg/compiler/lib/src/universe/resolution_world_builder.dart @@ -241,7 +241,7 @@ class ResolutionWorldBuilder extends WorldBuilder implements World { final Set _fieldSetters = {}; final Set _isChecks = {}; - final Set _namedTypeVariablesNewRti = {}; + final Set _namedTypeVariables = {}; final Set _instantiatedRecordTypes = {}; @@ -563,8 +563,8 @@ class ResolutionWorldBuilder extends WorldBuilder implements World { _isChecks.add(type); } - void registerNamedTypeVariableNewRti(TypeVariableType type) { - _namedTypeVariablesNewRti.add(type); + void registerNamedTypeVariable(TypeVariableType type) { + _namedTypeVariables.add(type); } /// Register the constant [use] with this world builder. Returns `true` if @@ -1115,7 +1115,7 @@ class ResolutionWorldBuilder extends WorldBuilder implements World { localFunctions: _localFunctions, instantiatedTypes: instantiatedTypes, instantiatedRecordTypes: _instantiatedRecordTypes, - namedTypeVariablesNewRti: _namedTypeVariablesNewRti, + namedTypeVariables: _namedTypeVariables, ); if (retainDataForTesting) { _closedWorldCache = closedWorld; diff --git a/pkg/compiler/lib/src/universe/use.dart b/pkg/compiler/lib/src/universe/use.dart index b33ea060317..90fa7934168 100644 --- a/pkg/compiler/lib/src/universe/use.dart +++ b/pkg/compiler/lib/src/universe/use.dart @@ -964,7 +964,7 @@ enum TypeUseKind { parameterCheck, rtiValue, typeArgument, - namedTypeVariableNewRti, + namedTypeVariable, typeVariableBoundCheck, } @@ -1041,7 +1041,7 @@ class TypeUse { case TypeUseKind.typeArgument: sb.write('typeArg:'); break; - case TypeUseKind.namedTypeVariableNewRti: + case TypeUseKind.namedTypeVariable: sb.write('named:'); break; case TypeUseKind.typeVariableBoundCheck: @@ -1141,8 +1141,8 @@ class TypeUse { } /// [type] used as a named type variable in a recipe. - factory TypeUse.namedTypeVariableNewRti(TypeVariableType type) => - TypeUse.internal(type, TypeUseKind.namedTypeVariableNewRti); + factory TypeUse.namedTypeVariable(TypeVariableType type) => + TypeUse.internal(type, TypeUseKind.namedTypeVariable); /// [type] used as a bound on a type variable. factory TypeUse.typeVariableBoundCheck(DartType type) => diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart index a1fbdc0de4e..9f4e1d8668e 100644 --- a/pkg/compiler/lib/src/world.dart +++ b/pkg/compiler/lib/src/world.dart @@ -22,7 +22,7 @@ abstract class BuiltWorld { Iterable get isChecks; /// All type variables named in recipes. - Set get namedTypeVariablesNewRti; + Set get namedTypeVariables; /// All directly instantiated types, that is, the types of /// [directlyInstantiatedClasses]. diff --git a/sdk/lib/_internal/js_runtime/lib/instantiation.dart b/sdk/lib/_internal/js_runtime/lib/instantiation.dart index bcf943f35de..8baf79fc167 100644 --- a/sdk/lib/_internal/js_runtime/lib/instantiation.dart +++ b/sdk/lib/_internal/js_runtime/lib/instantiation.dart @@ -18,7 +18,7 @@ abstract final class Instantiation extends Closure { if (JS('bool', 'false')) { // [instantiatedGenericFunctionType] is called from injected $signature // methods with runtime type representations. - newRti.instantiatedGenericFunctionType(JS('', '0'), JS('', '0')); + rti.instantiatedGenericFunctionType(JS('', '0'), JS('', '0')); } } @@ -107,133 +107,318 @@ final class Instantiation12 List get _types => [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]; } -final class Instantiation13 extends Instantiation { +final class Instantiation13< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13 +> + extends Instantiation { Instantiation13(Closure f) : super(f); List get _types => [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]; } -final class Instantiation14 extends Instantiation { +final class Instantiation14< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14 +> + extends Instantiation { Instantiation14(Closure f) : super(f); - List get _types => - [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]; + List get _types => [ + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + ]; } -final class Instantiation15 extends Instantiation { +final class Instantiation15< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15 +> + extends Instantiation { Instantiation15(Closure f) : super(f); - List get _types => - [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]; + List get _types => [ + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + ]; } -final class Instantiation16 extends Instantiation { +final class Instantiation16< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16 +> + extends Instantiation { Instantiation16(Closure f) : super(f); - List get _types => - [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]; + List get _types => [ + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + ]; } -final class Instantiation17 extends Instantiation { +final class Instantiation17< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17 +> + extends Instantiation { Instantiation17(Closure f) : super(f); List get _types => [ - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15, - T16, - T17 - ]; + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + ]; } -final class Instantiation18 extends Instantiation { +final class Instantiation18< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18 +> + extends Instantiation { Instantiation18(Closure f) : super(f); List get _types => [ - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15, - T16, - T17, - T18 - ]; + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + ]; } -final class Instantiation19 extends Instantiation { +final class Instantiation19< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19 +> + extends Instantiation { Instantiation19(Closure f) : super(f); List get _types => [ - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15, - T16, - T17, - T18, - T19 - ]; + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + ]; } -final class Instantiation20 extends Instantiation { +final class Instantiation20< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20 +> + extends Instantiation { Instantiation20(Closure f) : super(f); List get _types => [ - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15, - T16, - T17, - T18, - T19, - T20 - ]; + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20, + ]; } Instantiation instantiate1(Closure f) { @@ -273,66 +458,331 @@ Instantiation instantiate9(Closure f) { } Instantiation instantiate10( - Closure f) { + Closure f, +) { return Instantiation10(f); } Instantiation instantiate11( - Closure f) { + Closure f, +) { return Instantiation11(f); } Instantiation instantiate12( - Closure f) { + Closure f, +) { return Instantiation12(f); } -Instantiation - instantiate13( - Closure f) { - return Instantiation13(f); +Instantiation instantiate13< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13 +>(Closure f) { + return Instantiation13< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13 + >(f); } -Instantiation - instantiate14( - Closure f) { - return Instantiation14(f); +Instantiation instantiate14< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14 +>(Closure f) { + return Instantiation14< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14 + >(f); } -Instantiation instantiate15(Closure f) { - return Instantiation15(f); +Instantiation instantiate15< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15 +>(Closure f) { + return Instantiation15< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15 + >(f); } -Instantiation instantiate16(Closure f) { - return Instantiation16(f); +Instantiation instantiate16< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16 +>(Closure f) { + return Instantiation16< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16 + >(f); } -Instantiation instantiate17(Closure f) { - return Instantiation17(f); +Instantiation instantiate17< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17 +>(Closure f) { + return Instantiation17< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17 + >(f); } -Instantiation instantiate18(Closure f) { - return Instantiation18(f); +Instantiation instantiate18< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18 +>(Closure f) { + return Instantiation18< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18 + >(f); } -Instantiation instantiate19(Closure f) { - return Instantiation19(f); +Instantiation instantiate19< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19 +>(Closure f) { + return Instantiation19< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19 + >(f); } -Instantiation instantiate20(Closure f) { - return Instantiation20(f); +Instantiation instantiate20< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20 +>(Closure f) { + return Instantiation20< + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + T14, + T15, + T16, + T17, + T18, + T19, + T20 + >(f); } diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart index 5404cfee5bb..a207670bc6b 100644 --- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart +++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart @@ -64,7 +64,8 @@ import 'dart:_native_typed_data'; import 'dart:_js_names' show unmangleGlobalNameIfPreservedAnyways; -import 'dart:_rti' as newRti +import 'dart:_rti' + as rti show createRuntimeType, evalInInstance, @@ -111,7 +112,10 @@ String unminifyOrTag(String rawClassName) { @pragma('dart2js:tryInline') getMetadata(int index) { return JS_BUILTIN( - 'returns:var;effects:none;depends:none', JsBuiltin.getMetadata, index); + 'returns:var;effects:none;depends:none', + JsBuiltin.getMetadata, + index, + ); } /// Returns the type of the given [index]. @@ -119,7 +123,10 @@ getMetadata(int index) { @pragma('dart2js:tryInline') getType(int index) { return JS_BUILTIN( - 'returns:var;effects:none;depends:none', JsBuiltin.getType, index); + 'returns:var;effects:none;depends:none', + JsBuiltin.getType, + index, + ); } /// No-op method that is called to inform the compiler that preambles might @@ -152,24 +159,51 @@ String S(value) { var result = value.toString(); if (result is! String) { throw ArgumentError.value( - value, 'object', "toString method returned 'null'"); + value, + 'object', + "toString method returned 'null'", + ); } return result; } // Called from generated code. createInvocationMirror( - String name, internalName, kind, arguments, argumentNames, types) { + String name, + internalName, + kind, + arguments, + argumentNames, + types, +) { // TODO(sra): [types] (the number of type arguments) could be omitted in the // generated stub code to save an argument. Then we would use `types ?? 0`. return JSInvocationMirror( - name, internalName, kind, arguments, argumentNames, types); + name, + internalName, + kind, + arguments, + argumentNames, + types, + ); } createUnmangledInvocationMirror( - Symbol symbol, internalName, kind, arguments, argumentNames, types) { + Symbol symbol, + internalName, + kind, + arguments, + argumentNames, + types, +) { return JSInvocationMirror( - symbol, internalName, kind, arguments, argumentNames, types); + symbol, + internalName, + kind, + arguments, + argumentNames, + types, + ); } void throwInvalidReflectionError(String memberName) { @@ -194,8 +228,8 @@ void traceHelper(dynamic /*int*/ id, dynamic /*String*/ qualifiedName) { // overflow. This approach here is simpler than making the compiler smart // about how to generate traceHelper calls more carefully. JS( - '', - r''' + '', + r''' (function (id, name) { var hook = self.dartCallInstrumentation; if (typeof hook === "function") { @@ -210,8 +244,9 @@ void traceHelper(dynamic /*int*/ id, dynamic /*String*/ qualifiedName) { this.callInstrumentationCache[id] = true; } })(#, #)''', - id, - qualifiedName); + id, + qualifiedName, + ); } class JSInvocationMirror implements Invocation { @@ -224,8 +259,14 @@ class JSInvocationMirror implements Invocation { final List _namedArgumentNames; final int _typeArgumentCount; - JSInvocationMirror(this._memberName, this._internalName, this._kind, - this._arguments, this._namedArgumentNames, this._typeArgumentCount); + JSInvocationMirror( + this._memberName, + this._internalName, + this._kind, + this._arguments, + this._namedArgumentNames, + this._typeArgumentCount, + ); Symbol get memberName { if (_memberName is Symbol) return _memberName; @@ -242,7 +283,7 @@ class JSInvocationMirror implements Invocation { int start = _arguments.length - _typeArgumentCount; var list = []; for (int index = 0; index < _typeArgumentCount; index++) { - list.add(newRti.createRuntimeType(_arguments[start + index])); + list.add(rti.createRuntimeType(_arguments[start + index])); } return JSArray.markUnmodifiableList(list); } @@ -372,10 +413,11 @@ class Primitives { // - a Dart double literal // We do allow leading or trailing whitespace. if (!JS( - 'bool', - r'/^\s*[+-]?(?:Infinity|NaN|' - r'(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s*$/.test(#)', - source)) { + 'bool', + r'/^\s*[+-]?(?:Infinity|NaN|' + r'(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s*$/.test(#)', + source, + )) { return null; } double result = JS('double', r'parseFloat(#)', source); @@ -396,14 +438,14 @@ class Primitives { return source == "true" ? true : source == "false" - ? false - : null; + ? false + : null; } return _compareIgnoreCase(source, "true") ? true : _compareIgnoreCase(source, "false") - ? false - : null; + ? false + : null; } static bool _compareIgnoreCase(String input, String lowerCaseTarget) { @@ -426,19 +468,12 @@ class Primitives { /// them with 'minified:'. @pragma('dart2js:noInline') static String objectTypeName(Object? object) { - return _objectTypeNameNewRti(object); - } - - /// Returns the type of [object] as a string (including type arguments). - /// Tries to return a sensible name for non-Dart objects. - /// - /// In minified mode, uses the unminified names if available, otherwise tags - /// them with 'minified:'. - static String _objectTypeNameNewRti(Object? object) { var dartObjectConstructor = JS_BUILTIN( - 'depends:none;effects:none;', JsBuiltin.dartObjectConstructor); + 'depends:none;effects:none;', + JsBuiltin.dartObjectConstructor, + ); if (JS('bool', '# instanceof #', object, dartObjectConstructor)) { - return newRti.instanceTypeName(object); + return rti.instanceTypeName(object); } var interceptor = getInterceptor(object); @@ -473,7 +508,7 @@ class Primitives { } } - return newRti.instanceTypeName(object); + return rti.instanceTypeName(object); } static bool _saneNativeClassName(name) => @@ -558,12 +593,13 @@ class Primitives { for (int i = 0; i < end; i += kMaxApply) { int chunkEnd = (i + kMaxApply < end) ? i + kMaxApply : end; result = JS( - 'String', - r'# + String.fromCharCode.apply(null, #.slice(#, #))', - result, - array, - i, - chunkEnd); + 'String', + r'# + String.fromCharCode.apply(null, #.slice(#, #))', + result, + array, + i, + chunkEnd, + ); } return result; } @@ -595,7 +631,10 @@ class Primitives { // [start] and [end] are validated. static String stringFromNativeUint8List( - NativeUint8List charCodes, int start, int end) { + NativeUint8List charCodes, + int start, + int end, + ) { const kMaxApply = 500; if (end <= kMaxApply && start == 0 && end == charCodes.length) { return JS('String', r'String.fromCharCode.apply(null, #)', charCodes); @@ -604,12 +643,13 @@ class Primitives { for (int i = start; i < end; i += kMaxApply) { int chunkEnd = (i + kMaxApply < end) ? i + kMaxApply : end; result = JS( - 'String', - r'# + String.fromCharCode.apply(null, #.subarray(#, #))', - result, - charCodes, - i, - chunkEnd); + 'String', + r'# + String.fromCharCode.apply(null, #.subarray(#, #))', + result, + charCodes, + i, + chunkEnd, + ); } return result; } @@ -617,15 +657,22 @@ class Primitives { static String stringFromCharCode(int charCode) { if (0 <= charCode) { if (charCode <= 0xffff) { - return JS('returns:String;effects:none;depends:none', - 'String.fromCharCode(#)', charCode); + return JS( + 'returns:String;effects:none;depends:none', + 'String.fromCharCode(#)', + charCode, + ); } if (charCode <= 0x10ffff) { var bits = charCode - 0x10000; var low = 0xDC00 | (bits & 0x3ff); var high = 0xD800 | (bits >> 10); - return JS('returns:String;effects:none;depends:none', - 'String.fromCharCode(#, #)', high, low); + return JS( + 'returns:String;effects:none;depends:none', + 'String.fromCharCode(#, #)', + high, + low, + ); } } throw RangeError.range(charCode, 0, 0x10ffff); @@ -636,8 +683,13 @@ class Primitives { } static String flattenString(String str) { - return JS('returns:String;depends:none;effects:none;throws:never;gvn:true', - '#.charCodeAt(0) == 0 ? # : #', str, str, str); + return JS( + 'returns:String;depends:none;effects:none;throws:never;gvn:true', + '#.charCodeAt(0) == 0 ? # : #', + str, + str, + str, + ); } static String getTimeZoneName(DateTime receiver) { @@ -651,19 +703,20 @@ class Primitives { // Internet Explorer 10+ emits the zone name without parenthesis: // Example: Thu Oct 31 14:07:44 PDT 2013 match = JS( - 'JSArray|Null', - // Thu followed by a space. - r'/^[A-Z,a-z]{3}\s' - // Oct 31 followed by space. - r'[A-Z,a-z]{3}\s\d+\s' - // Time followed by a space. - r'\d{2}:\d{2}:\d{2}\s' - // The time zone name followed by a space. - r'([A-Z]{3,5})\s' - // The year. - r'\d{4}$/' - '.exec(#.toString())', - d); + 'JSArray|Null', + // Thu followed by a space. + r'/^[A-Z,a-z]{3}\s' + // Oct 31 followed by space. + r'[A-Z,a-z]{3}\s\d+\s' + // Time followed by a space. + r'\d{2}:\d{2}:\d{2}\s' + // The time zone name followed by a space. + r'([A-Z]{3,5})\s' + // The year. + r'\d{4}$/' + '.exec(#.toString())', + d, + ); if (match != null) return match[1]; // IE 9 and Opera don't provide the zone name. We fall back to emitting the @@ -679,21 +732,25 @@ class Primitives { // Note that JavaScript's Date and and Dart's DateTime disagree on the sign // of the offset. Subtract to avoid -0.0. The offset in minutes could // contain 'seconds' as fractional minutes. - num offsetInMinutes = - JS('num', r'#.getTimezoneOffset()', lazyAsJsDate(receiver)); + num offsetInMinutes = JS( + 'num', + r'#.getTimezoneOffset()', + lazyAsJsDate(receiver), + ); return (0 - offsetInMinutes * 60).toInt(); } static int? valueFromDecomposedDate( - int years, - int month, - int day, - int hours, - int minutes, - int seconds, - int milliseconds, - int microseconds, - bool isUtc) { + int years, + int month, + int day, + int hours, + int minutes, + int seconds, + int milliseconds, + int microseconds, + bool isUtc, + ) { final int MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; checkInt(years); checkInt(month); @@ -720,11 +777,29 @@ class Primitives { microseconds = remainder; num value; if (isUtc) { - value = JS('num', r'Date.UTC(#, #, #, #, #, #, #)', years, jsMonth, day, - hours, minutes, seconds, milliseconds); + value = JS( + 'num', + r'Date.UTC(#, #, #, #, #, #, #)', + years, + jsMonth, + day, + hours, + minutes, + seconds, + milliseconds, + ); } else { - value = JS('num', r'new Date(#, #, #, #, #, #, #).valueOf()', years, - jsMonth, day, hours, minutes, seconds, milliseconds); + value = JS( + 'num', + r'new Date(#, #, #, #, #, #, #).valueOf()', + years, + jsMonth, + day, + hours, + minutes, + seconds, + milliseconds, + ); } if (value.isNaN || value < -MAX_MILLISECONDS_SINCE_EPOCH || @@ -738,8 +813,12 @@ class Primitives { // Lazily keep a JS Date stored in the JS object. static lazyAsJsDate(DateTime receiver) { if (JS('bool', r'#.date === (void 0)', receiver)) { - JS('void', r'#.date = new Date(#)', receiver, - receiver.millisecondsSinceEpoch); + JS( + 'void', + r'#.date = new Date(#)', + receiver, + receiver.millisecondsSinceEpoch, + ); } return JS('var', r'#.date', receiver); } @@ -818,7 +897,10 @@ class Primitives { static int getMilliseconds(DateTime receiver) { return (receiver.isUtc) ? JS( - 'JSUInt31', r'(#.getUTCMilliseconds() + 0)', lazyAsJsDate(receiver)) + 'JSUInt31', + r'(#.getUTCMilliseconds() + 0)', + lazyAsJsDate(receiver), + ) : JS('JSUInt31', r'(#.getMilliseconds() + 0)', lazyAsJsDate(receiver)); } @@ -826,9 +908,10 @@ class Primitives { @pragma('dart2js:noThrows') @pragma('dart2js:noInline') static int getWeekday(DateTime receiver) { - int weekday = (receiver.isUtc) - ? JS('int', r'#.getUTCDay() + 0', lazyAsJsDate(receiver)) - : JS('int', r'#.getDay() + 0', lazyAsJsDate(receiver)); + int weekday = + (receiver.isUtc) + ? JS('int', r'#.getUTCDay() + 0', lazyAsJsDate(receiver)) + : JS('int', r'#.getDay() + 0', lazyAsJsDate(receiver)); // Adjust by one because JS weeks start on Sunday. return (weekday + 6) % 7 + 1; } @@ -847,8 +930,11 @@ class Primitives { JS('void', '#[#] = #', object, key, value); } - static functionNoSuchMethod(function, List? positionalArguments, - Map? namedArguments) { + static functionNoSuchMethod( + function, + List? positionalArguments, + Map? namedArguments, + ) { int argumentCount = 0; List arguments = []; List namedArgumentList = []; @@ -871,8 +957,16 @@ class Primitives { String selectorName = '${JS_GET_NAME(JsGetName.CALL_PREFIX)}\$$argumentCount$names'; - return function.noSuchMethod(createUnmangledInvocationMirror( - #call, selectorName, mirrors.method, arguments, namedArgumentList, 0)); + return function.noSuchMethod( + createUnmangledInvocationMirror( + #call, + selectorName, + mirrors.method, + arguments, + namedArgumentList, + 0, + ), + ); } /// Implements [Function.apply] for the lazy and startup emitters. @@ -906,8 +1000,11 @@ class Primitives { /// instead. For example, if the catch-all property contains the string /// "call$4", then the object's "call$4" property should be used as if it was /// the value of the catch-all property. - static applyFunction(Function function, List? positionalArguments, - Map? namedArguments) { + static applyFunction( + Function function, + List? positionalArguments, + Map? namedArguments, + ) { // Fast path for common cases. if (positionalArguments is JSArray && (namedArguments == null || namedArguments.isEmpty)) { @@ -926,34 +1023,56 @@ class Primitives { } else if (argumentCount == 2) { String selectorName = JS_GET_NAME(JsGetName.CALL_PREFIX2); if (JS('bool', '!!#[#]', function, selectorName)) { - return JS('', '#[#](#[0],#[1])', function, selectorName, arguments, - arguments); + return JS( + '', + '#[#](#[0],#[1])', + function, + selectorName, + arguments, + arguments, + ); } } else if (argumentCount == 3) { String selectorName = JS_GET_NAME(JsGetName.CALL_PREFIX3); if (JS('bool', '!!#[#]', function, selectorName)) { - return JS('', '#[#](#[0],#[1],#[2])', function, selectorName, - arguments, arguments, arguments); + return JS( + '', + '#[#](#[0],#[1],#[2])', + function, + selectorName, + arguments, + arguments, + arguments, + ); } } else if (argumentCount == 4) { String selectorName = JS_GET_NAME(JsGetName.CALL_PREFIX4); if (JS('bool', '!!#[#]', function, selectorName)) { - return JS('', '#[#](#[0],#[1],#[2],#[3])', function, selectorName, - arguments, arguments, arguments, arguments); + return JS( + '', + '#[#](#[0],#[1],#[2],#[3])', + function, + selectorName, + arguments, + arguments, + arguments, + arguments, + ); } } else if (argumentCount == 5) { String selectorName = JS_GET_NAME(JsGetName.CALL_PREFIX5); if (JS('bool', '!!#[#]', function, selectorName)) { return JS( - '', - '#[#](#[0],#[1],#[2],#[3],#[4])', - function, - selectorName, - arguments, - arguments, - arguments, - arguments, - arguments); + '', + '#[#](#[0],#[1],#[2],#[3],#[4])', + function, + selectorName, + arguments, + arguments, + arguments, + arguments, + arguments, + ); } } String selectorName = @@ -967,8 +1086,11 @@ class Primitives { return _generalApplyFunction(function, positionalArguments, namedArguments); } - static _generalApplyFunction(Function function, List? positionalArguments, - Map? namedArguments) { + static _generalApplyFunction( + Function function, + List? positionalArguments, + Map? namedArguments, + ) { List arguments; if (positionalArguments != null) { if (positionalArguments is JSArray) { @@ -982,15 +1104,23 @@ class Primitives { int argumentCount = arguments.length; - int requiredParameterCount = JS('int', r'#[#]', function, - JS_GET_NAME(JsGetName.REQUIRED_PARAMETER_PROPERTY)); + int requiredParameterCount = JS( + 'int', + r'#[#]', + function, + JS_GET_NAME(JsGetName.REQUIRED_PARAMETER_PROPERTY), + ); if (argumentCount < requiredParameterCount) { return functionNoSuchMethod(function, arguments, namedArguments); } - var defaultValuesClosure = JS('var', r'#[#]', function, - JS_GET_NAME(JsGetName.DEFAULT_VALUES_PROPERTY)); + var defaultValuesClosure = JS( + 'var', + r'#[#]', + function, + JS_GET_NAME(JsGetName.DEFAULT_VALUES_PROPERTY), + ); bool acceptsOptionalArguments = defaultValuesClosure != null; @@ -1000,8 +1130,12 @@ class Primitives { acceptsOptionalArguments ? JS('', '#()', defaultValuesClosure) : null; var interceptor = getInterceptor(function); - var jsFunction = - JS('', '#[#]', interceptor, JS_GET_NAME(JsGetName.CALL_CATCH_ALL)); + var jsFunction = JS( + '', + '#[#]', + interceptor, + JS_GET_NAME(JsGetName.CALL_CATCH_ALL), + ); if (jsFunction is String) { // Anonymous closures redirect to the catch-all property instead of // storing the catch-all method directly in the catch-all property. @@ -1036,8 +1170,12 @@ class Primitives { return functionNoSuchMethod(function, arguments, null); } if (argumentCount < maxArguments) { - List missingDefaults = JS('JSArray', '#.slice(#)', defaultValues, - argumentCount - requiredParameterCount); + List missingDefaults = JS( + 'JSArray', + '#.slice(#)', + defaultValues, + argumentCount - requiredParameterCount, + ); if (identical(arguments, positionalArguments)) { // Defensive copy to avoid modifying passed-in List. arguments = List.of(arguments); @@ -1137,8 +1275,12 @@ Error diagnoseIndexError(indexable, index) { // [IndexError.check] with no optional parameters // provided. if (index < 0 || index >= length) { - return IndexError.withLength(index, length, - indexable: indexable, name: 'index'); + return IndexError.withLength( + index, + length, + indexable: indexable, + name: 'index', + ); } // The above should always match, but if it does not, use the following. return RangeError.value(index, 'index'); @@ -1227,8 +1369,12 @@ initializeExceptionWrapper(ex, wrapper) { // (https://code.google.com/p/v8/issues/detail?id=2519). The default // toString on Error returns the value of 'message' if 'name' is // empty. Setting toString directly doesn't work, see the bug. - JS('void', 'Object.defineProperty(#, "message", { get: # })', wrapper, - DART_CLOSURE_TO_JS(toStringWrapper)); + JS( + 'void', + 'Object.defineProperty(#, "message", { get: # })', + wrapper, + DART_CLOSURE_TO_JS(toStringWrapper), + ); JS('void', '#.name = ""', wrapper); } else { // In the unlikely event the browser doesn't support Object.defineProperty, @@ -1279,7 +1425,10 @@ Never throwUnsupportedOperation(Object o, [Object? operation, Object? verb]) { @pragma('dart2js:never-inline') Error _diagnoseUnsupportedOperation( - Object o, Object encodedOperation, Object encodedVerb) { + Object o, + Object encodedOperation, + Object encodedVerb, +) { String operation; String verb; @@ -1387,56 +1536,71 @@ class TypeErrorDecoder { /// Pattern used to recognize a NoSuchMethodError error (and /// possibly extract the method name). - static final TypeErrorDecoder noSuchMethodPattern = - extractPattern(provokeCallErrorOn(buildJavaScriptObject())); + static final TypeErrorDecoder noSuchMethodPattern = extractPattern( + provokeCallErrorOn(buildJavaScriptObject()), + ); /// Pattern used to recognize an "object not a closure" error (and /// possibly extract the method name). - static final TypeErrorDecoder notClosurePattern = - extractPattern(provokeCallErrorOn(buildJavaScriptObjectWithNonClosure())); + static final TypeErrorDecoder notClosurePattern = extractPattern( + provokeCallErrorOn(buildJavaScriptObjectWithNonClosure()), + ); /// Pattern used to recognize a NoSuchMethodError on JavaScript null /// call. - static final TypeErrorDecoder nullCallPattern = - extractPattern(provokeCallErrorOn(JS('', 'null'))); + static final TypeErrorDecoder nullCallPattern = extractPattern( + provokeCallErrorOn(JS('', 'null')), + ); /// Pattern used to recognize a NoSuchMethodError on JavaScript literal null /// call. - static final TypeErrorDecoder nullLiteralCallPattern = - extractPattern(provokeCallErrorOnNull()); + static final TypeErrorDecoder nullLiteralCallPattern = extractPattern( + provokeCallErrorOnNull(), + ); /// Pattern used to recognize a NoSuchMethodError on JavaScript /// undefined call. - static final TypeErrorDecoder undefinedCallPattern = - extractPattern(provokeCallErrorOn(JS('', 'void 0'))); + static final TypeErrorDecoder undefinedCallPattern = extractPattern( + provokeCallErrorOn(JS('', 'void 0')), + ); /// Pattern used to recognize a NoSuchMethodError on JavaScript literal /// undefined call. - static final TypeErrorDecoder undefinedLiteralCallPattern = - extractPattern(provokeCallErrorOnUndefined()); + static final TypeErrorDecoder undefinedLiteralCallPattern = extractPattern( + provokeCallErrorOnUndefined(), + ); /// Pattern used to recognize a NoSuchMethodError on JavaScript null /// property access. - static final TypeErrorDecoder nullPropertyPattern = - extractPattern(provokePropertyErrorOn(JS('', 'null'))); + static final TypeErrorDecoder nullPropertyPattern = extractPattern( + provokePropertyErrorOn(JS('', 'null')), + ); /// Pattern used to recognize a NoSuchMethodError on JavaScript literal null /// property access. - static final TypeErrorDecoder nullLiteralPropertyPattern = - extractPattern(provokePropertyErrorOnNull()); + static final TypeErrorDecoder nullLiteralPropertyPattern = extractPattern( + provokePropertyErrorOnNull(), + ); /// Pattern used to recognize a NoSuchMethodError on JavaScript /// undefined property access. - static final TypeErrorDecoder undefinedPropertyPattern = - extractPattern(provokePropertyErrorOn(JS('', 'void 0'))); + static final TypeErrorDecoder undefinedPropertyPattern = extractPattern( + provokePropertyErrorOn(JS('', 'void 0')), + ); /// Pattern used to recognize a NoSuchMethodError on JavaScript literal /// undefined property access. static final TypeErrorDecoder undefinedLiteralPropertyPattern = extractPattern(provokePropertyErrorOnUndefined()); - TypeErrorDecoder(this._arguments, this._argumentsExpr, this._expr, - this._method, this._receiver, this._pattern); + TypeErrorDecoder( + this._arguments, + this._argumentsExpr, + this._expr, + this._method, + this._receiver, + this._pattern, + ); /// Returns a JavaScript object literal (map) with at most the /// following keys: @@ -1461,7 +1625,11 @@ class TypeErrorDecoder { /// "[object Object]" in recent versions. matchTypeError(message) { var match = JS( - 'JSExtendableArray|Null', 'new RegExp(#).exec(#)', _pattern, message); + 'JSExtendableArray|Null', + 'new RegExp(#).exec(#)', + _pattern, + message, + ); if (match == null) return null; var result = JS('', 'Object.create(null)'); if (_arguments != -1) { @@ -1493,9 +1661,10 @@ class TypeErrorDecoder { /// r"$receiver$". The property "$method" is defined, but is not a function. static buildJavaScriptObjectWithNonClosure() { return JS( - '', - r'{ $method$: null, ' - r'toString: function() { return "$receiver$"; } }'); + '', + r'{ $method$: null, ' + r'toString: function() { return "$receiver$"; } }', + ); } /// Extract a pattern from a JavaScript TypeError message. @@ -1524,8 +1693,11 @@ class TypeErrorDecoder { // Look for the special pattern \$camelCase\$ (all the $ symbols // have been escaped already), as we will soon be inserting // regular expression syntax that we want interpreted by RegExp. - List? match = - JS('JSExtendableArray|Null', r'#.match(/\\\$[a-zA-Z]+\\\$/g)', message); + List? match = JS( + 'JSExtendableArray|Null', + r'#.match(/\\\$[a-zA-Z]+\\\$/g)', + message, + ); if (match == null) match = []; // Find the positions within the substring matches of the error message @@ -1541,19 +1713,26 @@ class TypeErrorDecoder { // Note: in a perfect world, one would use "(.*)", but not in // JavaScript, "." does not match newlines. String pattern = JS( - 'String', - r'#.replace(new RegExp("\\\\\\$arguments\\\\\\$", "g"), ' - r'"((?:x|[^x])*)")' - r'.replace(new RegExp("\\\\\\$argumentsExpr\\\\\\$", "g"), ' - r'"((?:x|[^x])*)")' - r'.replace(new RegExp("\\\\\\$expr\\\\\\$", "g"), "((?:x|[^x])*)")' - r'.replace(new RegExp("\\\\\\$method\\\\\\$", "g"), "((?:x|[^x])*)")' - r'.replace(new RegExp("\\\\\\$receiver\\\\\\$", "g"), ' - r'"((?:x|[^x])*)")', - message); + 'String', + r'#.replace(new RegExp("\\\\\\$arguments\\\\\\$", "g"), ' + r'"((?:x|[^x])*)")' + r'.replace(new RegExp("\\\\\\$argumentsExpr\\\\\\$", "g"), ' + r'"((?:x|[^x])*)")' + r'.replace(new RegExp("\\\\\\$expr\\\\\\$", "g"), "((?:x|[^x])*)")' + r'.replace(new RegExp("\\\\\\$method\\\\\\$", "g"), "((?:x|[^x])*)")' + r'.replace(new RegExp("\\\\\\$receiver\\\\\\$", "g"), ' + r'"((?:x|[^x])*)")', + message, + ); return TypeErrorDecoder( - arguments, argumentsExpr, expr, method, receiver, pattern); + arguments, + argumentsExpr, + expr, + method, + receiver, + pattern, + ); } /// Provokes a TypeError and returns its message. @@ -1703,9 +1882,8 @@ class JsNoSuchMethodError extends Error implements NoSuchMethodError { final String? _receiver; JsNoSuchMethodError(this._message, match) - : _method = match == null ? null : JS('String|Null', '#.method', match), - _receiver = - match == null ? null : JS('String|Null', '#.receiver', match); + : _method = match == null ? null : JS('String|Null', '#.method', match), + _receiver = match == null ? null : JS('String|Null', '#.receiver', match); String toString() { if (_method == null) return 'NoSuchMethodError: $_message'; @@ -1811,7 +1989,9 @@ Object _unwrapNonDartException(Object ex) { switch (ieErrorCode) { case 438: return saveStackTrace( - ex, JsNoSuchMethodError('$message (Error $ieErrorCode)', null)); + ex, + JsNoSuchMethodError('$message (Error $ieErrorCode)', null), + ); case 445: case 5007: return saveStackTrace(ex, NullError('$message (Error $ieErrorCode)')); @@ -1855,7 +2035,9 @@ Object _unwrapNonDartException(Object ex) { // to reporting this as a generic error. It's probably better than // nothing. return saveStackTrace( - ex, UnknownJsTypeError(message is String ? message : '')); + ex, + UnknownJsTypeError(message is String ? message : ''), + ); } if (JS('bool', r'# instanceof RangeError', ex)) { @@ -1876,9 +2058,10 @@ Object _unwrapNonDartException(Object ex) { // Check for the Firefox specific stack overflow signal. if (JS( - 'bool', - r'typeof InternalError == "function" && # instanceof InternalError', - ex)) { + 'bool', + r'typeof InternalError == "function" && # instanceof InternalError', + ex, + )) { if (message is String && message == 'too much recursion') { return StackOverflowError(); } @@ -1894,17 +2077,14 @@ String? tryStringifyException(ex) { // Since this function is called from [unwrapException] which is called from // code injected into a catch-clause, use JavaScript try-catch to avoid a // potential loop if stringifying crashes. - return JS( - 'String|Null', - r''' + return JS('String|Null', r''' (function(ex) { try { return String(ex); } catch (e) {} return null; })(#) - ''', - ex); + ''', ex); } /// Called by generated code to fetch the stack trace from an @@ -2032,8 +2212,14 @@ int getLength(var array) { return JS('int', r'#.length', array); } -_invokeClosure(Function closure, int numberOfArguments, var arg1, var arg2, - var arg3, var arg4) { +_invokeClosure( + Function closure, + int numberOfArguments, + var arg1, + var arg2, + var arg3, + var arg4, +) { switch (numberOfArguments) { case 0: return closure(); @@ -2097,16 +2283,17 @@ convertDartClosureToJSUncached(Object closure, int arity) { // call sites in `_invokeClosure` to retain the entry points). return JS( - 'var', - r''' + 'var', + r''' (function(closure, arity, invoke) { return function(a1, a2, a3, a4) { return invoke(closure, arity, a1, a2, a3, a4); }; })(#,#,#)''', - closure, - arity, - DART_CLOSURE_TO_JS(_invokeClosure)); + closure, + arity, + DART_CLOSURE_TO_JS(_invokeClosure), + ); } /// Superclass for Dart closures. @@ -2148,22 +2335,50 @@ abstract final class Closure implements Function { getType(JS('int', '0')); }); - Object? container = - JS('', '#.#', parameters, TearOffParametersPropertyNames.container); + Object? container = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.container, + ); - bool isStatic = - JS('', '#.#', parameters, TearOffParametersPropertyNames.isStatic); - bool isIntercepted = - JS('', '#.#', parameters, TearOffParametersPropertyNames.isIntercepted); - bool needsDirectAccess = JS('', '#.#', parameters, - TearOffParametersPropertyNames.needsDirectAccess); - int applyTrampolineIndex = - JS('', '#.#', parameters, TearOffParametersPropertyNames.applyIndex); + bool isStatic = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.isStatic, + ); + bool isIntercepted = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.isIntercepted, + ); + bool needsDirectAccess = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.needsDirectAccess, + ); + int applyTrampolineIndex = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.applyIndex, + ); - JSArray funsOrNames = - JS('', '#.#', parameters, TearOffParametersPropertyNames.funsOrNames); - JSArray callNames = - JS('', '#.#', parameters, TearOffParametersPropertyNames.callNames); + JSArray funsOrNames = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.funsOrNames, + ); + JSArray callNames = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.callNames, + ); // The first function is the primary entry point. It is always a string, the // property name of the first function within the container. @@ -2205,27 +2420,36 @@ abstract final class Closure implements Function { // Object.create to create the desired prototype. // // TODO(sra): Cache the prototype to avoid the allocation. - var prototype = isStatic - ? JS('StaticClosure', 'Object.create(#.constructor.prototype)', - StaticClosure()) - : JS('BoundClosure', 'Object.create(#.constructor.prototype)', - BoundClosure(null, null)); + var prototype = + isStatic + ? JS( + 'StaticClosure', + 'Object.create(#.constructor.prototype)', + StaticClosure(), + ) + : JS( + 'BoundClosure', + 'Object.create(#.constructor.prototype)', + BoundClosure(null, null), + ); JS('', '#.\$initialize = #', prototype, JS('', '#.constructor', prototype)); // The constructor functions have names to prevent the JavaScript // implementation from inventing a name that might have special meaning // (e.g. clashing with minified 'Object' or 'Interceptor'). - var constructor = isStatic - ? JS('', 'function static_tear_off(){this.\$initialize()}') - : isCsp + var constructor = + isStatic + ? JS('', 'function static_tear_off(){this.\$initialize()}') + : isCsp ? JS('', 'function tear_off(a,b) {this.\$initialize(a,b)}') : JS( - '', - 'new Function("a,b" + #,' - ' "this.\$initialize(a,b" + # + ")")', - functionCounter, - functionCounter++); + '', + 'new Function("a,b" + #,' + ' "this.\$initialize(a,b" + # + ")")', + functionCounter, + functionCounter++, + ); // It is necessary to set the constructor property, otherwise it will be // "Object". @@ -2239,18 +2463,30 @@ abstract final class Closure implements Function { // Create a closure and "monkey" patch it with call stubs. var trampoline = function; if (!isStatic) { - trampoline = - forwardCallTo(name, function, isIntercepted, needsDirectAccess); + trampoline = forwardCallTo( + name, + function, + isIntercepted, + needsDirectAccess, + ); } else { // TODO(sra): Can this be removed? JS('', '#[#] = #', prototype, STATIC_FUNCTION_NAME_PROPERTY_NAME, name); } - var signatureFunction = - _computeSignatureFunctionNewRti(functionType, isStatic, isIntercepted); + var signatureFunction = _computeSignatureFunction( + functionType, + isStatic, + isIntercepted, + ); - JS('', '#[#] = #', prototype, JS_GET_NAME(JsGetName.SIGNATURE_NAME), - signatureFunction); + JS( + '', + '#[#] = #', + prototype, + JS_GET_NAME(JsGetName.SIGNATURE_NAME), + signatureFunction, + ); var applyTrampoline = trampoline; JS('', '#[#] = #', prototype, callName, trampoline); @@ -2268,8 +2504,12 @@ abstract final class Closure implements Function { // otherwise unused, e.g. `foo({bool strange = true})...` if (stubCallName != null) { if (!isStatic) { - stub = - forwardCallTo(stubName, stub, isIntercepted, needsDirectAccess); + stub = forwardCallTo( + stubName, + stub, + isIntercepted, + needsDirectAccess, + ); } JS('', '#[#] = #', prototype, stubCallName, stub); } @@ -2278,25 +2518,46 @@ abstract final class Closure implements Function { } } - JS('', '#[#] = #', prototype, JS_GET_NAME(JsGetName.CALL_CATCH_ALL), - applyTrampoline); + JS( + '', + '#[#] = #', + prototype, + JS_GET_NAME(JsGetName.CALL_CATCH_ALL), + applyTrampoline, + ); String reqArgProperty = JS_GET_NAME(JsGetName.REQUIRED_PARAMETER_PROPERTY); - Object? requiredParameterCount = JS('', '#.#', parameters, - TearOffParametersPropertyNames.requiredParameterCount); + Object? requiredParameterCount = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.requiredParameterCount, + ); JS('', '#.# = #', prototype, reqArgProperty, requiredParameterCount); String defValProperty = JS_GET_NAME(JsGetName.DEFAULT_VALUES_PROPERTY); - Object? optionalParameterDefaultValues = JS('', '#.#', parameters, - TearOffParametersPropertyNames.optionalParameterDefaultValues); - JS('', '#.# = #', prototype, defValProperty, - optionalParameterDefaultValues); + Object? optionalParameterDefaultValues = JS( + '', + '#.#', + parameters, + TearOffParametersPropertyNames.optionalParameterDefaultValues, + ); + JS( + '', + '#.# = #', + prototype, + defValProperty, + optionalParameterDefaultValues, + ); return constructor; } - static _computeSignatureFunctionNewRti( - Object functionType, bool isStatic, bool isIntercepted) { + static _computeSignatureFunction( + Object functionType, + bool isStatic, + bool isIntercepted, + ) { if (JS('bool', 'typeof # == "number"', functionType)) { // Index into types table. Handled in rti.dart. return functionType; @@ -2309,20 +2570,25 @@ abstract final class Closure implements Function { } final typeEvalMethod = RAW_DART_FUNCTION_REF(BoundClosure.evalRecipe); return JS( - '', - ' function(recipe, evalOnReceiver) {' - ' return function() {' - ' return evalOnReceiver(this, recipe);' - ' };' - '}(#,#)', - functionType, - typeEvalMethod); + '', + ' function(recipe, evalOnReceiver) {' + ' return function() {' + ' return evalOnReceiver(this, recipe);' + ' };' + '}(#,#)', + functionType, + typeEvalMethod, + ); } throw 'Error in functionType of tearoff'; } static cspForwardCall( - int arity, bool needsDirectAccess, String? stubName, function) { + int arity, + bool needsDirectAccess, + String? stubName, + function, + ) { var getReceiver = RAW_DART_FUNCTION_REF(BoundClosure.receiverOf); // We have the target method (or an arity stub for the method) in @@ -2341,82 +2607,93 @@ abstract final class Closure implements Function { switch (arity) { case 0: return JS( - '', - 'function(entry, receiverOf){' - 'return function(){' - 'return receiverOf(this)[entry]()' - '}' - '}(#,#)', - stubName, - getReceiver); + '', + 'function(entry, receiverOf){' + 'return function(){' + 'return receiverOf(this)[entry]()' + '}' + '}(#,#)', + stubName, + getReceiver, + ); case 1: return JS( - '', - 'function(entry, receiverOf){' - 'return function(a){' - 'return receiverOf(this)[entry](a)' - '}' - '}(#,#)', - stubName, - getReceiver); + '', + 'function(entry, receiverOf){' + 'return function(a){' + 'return receiverOf(this)[entry](a)' + '}' + '}(#,#)', + stubName, + getReceiver, + ); case 2: return JS( - '', - 'function(entry, receiverOf){' - 'return function(a, b){' - 'return receiverOf(this)[entry](a, b)' - '}' - '}(#,#)', - stubName, - getReceiver); + '', + 'function(entry, receiverOf){' + 'return function(a, b){' + 'return receiverOf(this)[entry](a, b)' + '}' + '}(#,#)', + stubName, + getReceiver, + ); case 3: return JS( - '', - 'function(entry, receiverOf){' - 'return function(a, b, c){' - 'return receiverOf(this)[entry](a, b, c)' - '}' - '}(#,#)', - stubName, - getReceiver); + '', + 'function(entry, receiverOf){' + 'return function(a, b, c){' + 'return receiverOf(this)[entry](a, b, c)' + '}' + '}(#,#)', + stubName, + getReceiver, + ); case 4: return JS( - '', - 'function(entry, receiverOf){' - 'return function(a, b, c, d){' - 'return receiverOf(this)[entry](a, b, c, d)' - '}' - '}(#,#)', - stubName, - getReceiver); + '', + 'function(entry, receiverOf){' + 'return function(a, b, c, d){' + 'return receiverOf(this)[entry](a, b, c, d)' + '}' + '}(#,#)', + stubName, + getReceiver, + ); case 5: return JS( - '', - 'function(entry, receiverOf){' - 'return function(a, b, c, d, e){' - 'return receiverOf(this)[entry](a, b, c, d, e)' - '}' - '}(#,#)', - stubName, - getReceiver); + '', + 'function(entry, receiverOf){' + 'return function(a, b, c, d, e){' + 'return receiverOf(this)[entry](a, b, c, d, e)' + '}' + '}(#,#)', + stubName, + getReceiver, + ); default: // Here we use `Function.prototype.apply`. return JS( - '', - 'function(f, receiverOf){' - 'return function(){' - 'return f.apply(receiverOf(this), arguments)' - '}' - '}(#,#)', - function, - getReceiver); + '', + 'function(f, receiverOf){' + 'return function(){' + 'return f.apply(receiverOf(this), arguments)' + '}' + '}(#,#)', + function, + getReceiver, + ); } } static bool get isCsp => JS_GET_FLAG('USE_CONTENT_SECURITY_POLICY'); static forwardCallTo( - String stubName, function, bool isIntercepted, bool needsDirectAccess) { + String stubName, + function, + bool isIntercepted, + bool needsDirectAccess, + ) { if (isIntercepted) return forwardInterceptedCallTo(stubName, function, needsDirectAccess); int arity = JS('int', '#.length', function); @@ -2429,27 +2706,36 @@ abstract final class Closure implements Function { // Incorporate functionCounter into a local. String selfName = 'self${functionCounter++}'; return JS( - '', - '(new Function(#))()', - 'return function(){' - 'var $selfName = this.${BoundClosure.receiverFieldName()};' - 'return $selfName.$stubName();' - '}'); - } - assert(1 <= arity && arity < 27); - String arguments = JS('String', - '"abcdefghijklmnopqrstuvwxyz".split("").splice(0,#).join(",")', arity); - arguments += '${functionCounter++}'; - return JS( '', '(new Function(#))()', - 'return function($arguments){' - 'return this.${BoundClosure.receiverFieldName()}.$stubName($arguments);' - '}'); + 'return function(){' + 'var $selfName = this.${BoundClosure.receiverFieldName()};' + 'return $selfName.$stubName();' + '}', + ); + } + assert(1 <= arity && arity < 27); + String arguments = JS( + 'String', + '"abcdefghijklmnopqrstuvwxyz".split("").splice(0,#).join(",")', + arity, + ); + arguments += '${functionCounter++}'; + return JS( + '', + '(new Function(#))()', + 'return function($arguments){' + 'return this.${BoundClosure.receiverFieldName()}.$stubName($arguments);' + '}', + ); } static cspForwardInterceptedCall( - int arity, bool needsDirectAccess, String? stubName, function) { + int arity, + bool needsDirectAccess, + String? stubName, + function, + ) { var getReceiver = RAW_DART_FUNCTION_REF(BoundClosure.receiverOf); var getInterceptor = RAW_DART_FUNCTION_REF(BoundClosure.interceptorOf); // Handle intercepted stub-names with the default slow case. @@ -2461,88 +2747,98 @@ abstract final class Closure implements Function { throw RuntimeError('Intercepted function with no arguments.'); case 1: return JS( - '', - 'function(entry, interceptorOf, receiverOf){' - 'return function(){' - 'return interceptorOf(this)[entry](receiverOf(this))' - '}' - '}(#,#,#)', - stubName, - getInterceptor, - getReceiver); + '', + 'function(entry, interceptorOf, receiverOf){' + 'return function(){' + 'return interceptorOf(this)[entry](receiverOf(this))' + '}' + '}(#,#,#)', + stubName, + getInterceptor, + getReceiver, + ); case 2: return JS( - '', - 'function(entry, interceptorOf, receiverOf){' - 'return function(a){' - 'return interceptorOf(this)[entry](receiverOf(this), a)' - '}' - '}(#,#,#)', - stubName, - getInterceptor, - getReceiver); + '', + 'function(entry, interceptorOf, receiverOf){' + 'return function(a){' + 'return interceptorOf(this)[entry](receiverOf(this), a)' + '}' + '}(#,#,#)', + stubName, + getInterceptor, + getReceiver, + ); case 3: return JS( - '', - 'function(entry, interceptorOf, receiverOf){' - 'return function(a, b){' - 'return interceptorOf(this)[entry](receiverOf(this), a, b)' - '}' - '}(#,#,#)', - stubName, - getInterceptor, - getReceiver); + '', + 'function(entry, interceptorOf, receiverOf){' + 'return function(a, b){' + 'return interceptorOf(this)[entry](receiverOf(this), a, b)' + '}' + '}(#,#,#)', + stubName, + getInterceptor, + getReceiver, + ); case 4: return JS( - '', - 'function(entry, interceptorOf, receiverOf){' - 'return function(a, b, c){' - 'return interceptorOf(this)[entry](receiverOf(this), a, b, c)' - '}' - '}(#,#,#)', - stubName, - getInterceptor, - getReceiver); + '', + 'function(entry, interceptorOf, receiverOf){' + 'return function(a, b, c){' + 'return interceptorOf(this)[entry](receiverOf(this), a, b, c)' + '}' + '}(#,#,#)', + stubName, + getInterceptor, + getReceiver, + ); case 5: return JS( - '', - 'function(entry, interceptorOf, receiverOf){' - 'return function(a, b, c, d){' - 'return interceptorOf(this)[entry](receiverOf(this), a, b, c, d)' - '}' - '}(#,#,#)', - stubName, - getInterceptor, - getReceiver); + '', + 'function(entry, interceptorOf, receiverOf){' + 'return function(a, b, c, d){' + 'return interceptorOf(this)[entry](receiverOf(this), a, b, c, d)' + '}' + '}(#,#,#)', + stubName, + getInterceptor, + getReceiver, + ); case 6: return JS( - '', - 'function(entry, interceptorOf, receiverOf){' - 'return function(a, b, c, d, e){' - 'return interceptorOf(this)[entry](receiverOf(this), a, b, c, d, e)' - '}' - '}(#,#,#)', - stubName, - getInterceptor, - getReceiver); + '', + 'function(entry, interceptorOf, receiverOf){' + 'return function(a, b, c, d, e){' + 'return interceptorOf(this)[entry](receiverOf(this), a, b, c, d, e)' + '}' + '}(#,#,#)', + stubName, + getInterceptor, + getReceiver, + ); default: return JS( - '', - 'function(f, interceptorOf, receiverOf){' - 'return function(){' - 'var a = [receiverOf(this)];' - 'Array.prototype.push.apply(a, arguments);' - 'return f.apply(interceptorOf(this), a)' - '}' - '}(#,#,#)', - function, - getInterceptor, - getReceiver); + '', + 'function(f, interceptorOf, receiverOf){' + 'return function(){' + 'var a = [receiverOf(this)];' + 'Array.prototype.push.apply(a, arguments);' + 'return f.apply(interceptorOf(this), a)' + '}' + '}(#,#,#)', + function, + getInterceptor, + getReceiver, + ); } } static forwardInterceptedCallTo( - String stubName, function, bool needsDirectAccess) { + String stubName, + function, + bool needsDirectAccess, + ) { String interceptorField = BoundClosure.interceptorFieldName(); String receiverField = BoundClosure.receiverFieldName(); int arity = JS('int', '#.length', function); @@ -2550,29 +2846,36 @@ abstract final class Closure implements Function { if (isCsp || needsDirectAccess || arity >= 28) { return cspForwardInterceptedCall( - arity, needsDirectAccess, stubName, function); + arity, + needsDirectAccess, + stubName, + function, + ); } if (arity == 1) { return JS( - '', - '(new Function(#))()', - 'return function(){' - 'return this.$interceptorField.$stubName(this.$receiverField);' - '${functionCounter++}' - '}'); + '', + '(new Function(#))()', + 'return function(){' + 'return this.$interceptorField.$stubName(this.$receiverField);' + '${functionCounter++}' + '}', + ); } assert(1 < arity && arity < 28); String arguments = JS( - 'String', - '"abcdefghijklmnopqrstuvwxyz".split("").splice(0,#).join(",")', - arity - 1); + 'String', + '"abcdefghijklmnopqrstuvwxyz".split("").splice(0,#).join(",")', + arity - 1, + ); return JS( - '', - '(new Function(#))()', - 'return function($arguments){' - 'return this.$interceptorField.$stubName(this.$receiverField, $arguments);' - '${functionCounter++}' - '}'); + '', + '(new Function(#))()', + 'return function($arguments){' + 'return this.$interceptorField.$stubName(this.$receiverField, $arguments);' + '${functionCounter++}' + '}', + ); } // The backend adds a special getter of the form @@ -2592,7 +2895,7 @@ abstract final class Closure implements Function { return "Closure '${unminifyOrTag(name)}'"; } - Type get runtimeType => newRti.getRuntimeTypeOfClosure(this); + Type get runtimeType => rti.getRuntimeTypeOfClosure(this); } /// This is called by the fragment emitter. @@ -2612,8 +2915,12 @@ abstract final class TearOffClosure extends Closure {} final class StaticClosure extends TearOffClosure { String toString() { - String? name = - JS('String|Null', '#[#]', this, STATIC_FUNCTION_NAME_PROPERTY_NAME); + String? name = JS( + 'String|Null', + '#[#]', + this, + STATIC_FUNCTION_NAME_PROPERTY_NAME, + ); if (name == null) return 'Closure of unknown static method'; return "Closure '${unminifyOrTag(name)}'"; } @@ -2668,7 +2975,7 @@ final class BoundClosure extends TearOffClosure { @pragma('dart2js:parameter:trust') static evalRecipe(BoundClosure closure, String recipe) { - return newRti.evalInInstance(closure._receiver, recipe); + return rti.evalInInstance(closure._receiver, recipe); } @pragma('dart2js:noInline') @@ -2692,7 +2999,8 @@ final class BoundClosure extends TearOffClosure { static String _computeFieldNamed(String fieldName) { var template = BoundClosure('receiver', 'interceptor'); var names = JSArray.markFixedList( - JS('', 'Object.getOwnPropertyNames(#)', template)); + JS('', 'Object.getOwnPropertyNames(#)', template), + ); for (int i = 0; i < names.length; i++) { var name = names[i]; if (JS('bool', '#[#] === #', template, name, fieldName)) { @@ -2820,7 +3128,7 @@ bool assertTest(condition) { if (false == condition) return true; bool checked = condition as bool; if (null == condition) { - newRti.throwTypeError('assert condition must not be null'); + rti.throwTypeError('assert condition must not be null'); } return !checked; } @@ -2924,11 +3232,12 @@ typedef DeferredLoadCallback = void Function(); DeferredLoadCallback? deferredLoadHook; /// Add events to global initialization event log. -void _addEvent( - {required String part, - required String event, - String? loadId, - String? hash}) { +void _addEvent({ + required String part, + required String event, + String? loadId, + String? hash, +}) { var initializationEventLog = JS_EMBEDDED_GLOBAL('', INITIALIZATION_EVENT_LOG); var dataObj = JS('=Object', '{p: #, e: #}', part, event); if (hash != null) JS('', '#.h = #', dataObj, hash); @@ -2945,14 +3254,15 @@ String _getEventLog() { var initializationEventLog = JS_EMBEDDED_GLOBAL('', INITIALIZATION_EVENT_LOG); final o = JS('', 'Array.from(#).reverse()', initializationEventLog); JS( - '', - '#.reduce((p, e, i, a) => {e.i = a.length - i; ' - 'if (p == null) return e.s; ' - 'if (e.s == null) return p; ' - 'if (e.s === p) { delete e.s; return p; }' - 'return e.s;}' - ', null)', - o); + '', + '#.reduce((p, e, i, a) => {e.i = a.length - i; ' + 'if (p == null) return e.s; ' + 'if (e.s == null) return p; ' + 'if (e.s === p) { delete e.s; return p; }' + 'return e.s;}' + ', null)', + o, + ); return JS('String', '#.map((e) => JSON.stringify(e)).join("\\n")', o); } @@ -3002,7 +3312,11 @@ Future loadDeferredLibrary(String loadId, String priority) { var hash = hashes[i]; if (JS('bool', '#(#)', isHunkInitialized, hash)) { _addEvent( - part: uri, hash: hash, event: 'alreadyInitialized', loadId: loadId); + part: uri, + hash: hash, + event: 'alreadyInitialized', + loadId: loadId, + ); continue; } // This check is just an extra precaution, `isHunkLoaded(hash)` should @@ -3014,9 +3328,11 @@ Future loadDeferredLibrary(String loadId, String priority) { } else { _addEvent(part: uri, hash: hash, event: 'missing', loadId: loadId); - throw DeferredLoadException("Loading ${uris[i]} failed: " - "the code with hash '${hash}' was not loaded.\n" - "event log:\n${_getEventLog()}\n"); + throw DeferredLoadException( + "Loading ${uris[i]} failed: " + "the code with hash '${hash}' was not loaded.\n" + "event log:\n${_getEventLog()}\n", + ); } } } @@ -3032,13 +3348,20 @@ Future loadDeferredLibrary(String loadId, String priority) { } } - var deferredLibraryMultiLoader = - JS('', 'self.dartDeferredLibraryMultiLoader'); + var deferredLibraryMultiLoader = JS( + '', + 'self.dartDeferredLibraryMultiLoader', + ); if (JS('bool', 'typeof # === "function"', deferredLibraryMultiLoader)) { return _loadAllHunks( - deferredLibraryMultiLoader, uris, hashes, loadId, priority, 0) - .then((_) { + deferredLibraryMultiLoader, + uris, + hashes, + loadId, + priority, + 0, + ).then((_) { waitingForLoad = List.filled(total, false); finalizeLoad(); }); @@ -3119,8 +3442,13 @@ Object _computePolicy() { final Object? policyFactory = JS('', 'self.trustedTypes'); if (policyFactory == null) return fallbackPolicy; - final Object? newPolicy = JS('', '#.createPolicy(#, #)', policyFactory, - _deferredLoadingTrustedTypesPolicyName, policyOptions); + final Object? newPolicy = JS( + '', + '#.createPolicy(#, #)', + policyFactory, + _deferredLoadingTrustedTypesPolicyName, + policyOptions, + ); return newPolicy ?? fallbackPolicy; } @@ -3172,10 +3500,11 @@ String _computeThisScriptFromTrace() { // property is not set until the exception is thrown. The stack // property was not provided until IE10. stack = JS( - 'String|Null', - '(function() {' - 'try { throw new Error() } catch(e) { return e.stack }' - '})()'); + 'String|Null', + '(function() {' + 'try { throw new Error() } catch(e) { return e.stack }' + '})()', + ); if (stack == null) throw UnsupportedError('No stack trace'); } var pattern, matches; @@ -3201,11 +3530,19 @@ String _computeThisScriptFromTrace() { Object _buildTrustedScriptUriWithRetry(String hunkName, int retryCount) { return _getBasedScriptUrl( - hunkName, retryCount > 0 ? '?dart2jsRetry=$retryCount' : ''); + hunkName, + retryCount > 0 ? '?dart2jsRetry=$retryCount' : '', + ); } -Future _loadAllHunks(Object loader, List hunkNames, List hashes, - String loadId, String priority, int retryCount) { +Future _loadAllHunks( + Object loader, + List hunkNames, + List hashes, + String loadId, + String priority, + int retryCount, +) { const int maxRetries = 3; var isHunkLoaded = JS_EMBEDDED_GLOBAL('', IS_HUNK_LOADED); @@ -3226,8 +3563,10 @@ Future _loadAllHunks(Object loader, List hunkNames, List hashes, } else { hunksToLoad.add(hunkName); hashesToLoad.add(hash); - Object trustedScriptUri = - _buildTrustedScriptUriWithRetry(hunkName, retryCount); + Object trustedScriptUri = _buildTrustedScriptUriWithRetry( + hunkName, + retryCount, + ); // [trustedScriptUri] is either a String, in which case `toString()` is // an identity function, or it is a TrustedScriptURL and `toString()` // returns the sanitized URL. @@ -3247,30 +3586,46 @@ Future _loadAllHunks(Object loader, List hunkNames, List hashes, hunksToLoad.forEach((hunkName) => _loadingLibraries[hunkName] = completer); _addEvent(part: loadedHunksString, event: 'downloadMulti', loadId: loadId); - void failure(error, String context, StackTrace? stackTrace, - List? hunksToRetry, List? hashesToRetry) { + void failure( + error, + String context, + StackTrace? stackTrace, + List? hunksToRetry, + List? hashesToRetry, + ) { if (retryCount < maxRetries && hunksToRetry != null) { _addEvent( - part: hunksToRetry.join(';'), - event: 'retry$retryCount', - loadId: loadId); + part: hunksToRetry.join(';'), + event: 'retry$retryCount', + loadId: loadId, + ); for (var i = 0; i < hunksToRetry.length; i++) { _loadingLibraries[hunksToRetry[i]] = null; } - _loadAllHunks(loader, hunksToRetry, hashesToRetry!, loadId, priority, - retryCount + 1) - .then((_) => completer.complete(null), - onError: completer.completeError); + _loadAllHunks( + loader, + hunksToRetry, + hashesToRetry!, + loadId, + priority, + retryCount + 1, + ).then((_) => completer.complete(null), onError: completer.completeError); } else { _addEvent( - part: loadedHunksString, event: 'downloadFailure', loadId: loadId); + part: loadedHunksString, + event: 'downloadFailure', + loadId: loadId, + ); hunksToLoad.forEach((hunkName) => _loadingLibraries[hunkName] = null); stackTrace ??= StackTrace.current; completer.completeError( - DeferredLoadException('Loading $loadedHunksString failed: $error\n' - 'Context: $context\n' - 'event log:\n${_getEventLog()}\n'), - stackTrace); + DeferredLoadException( + 'Loading $loadedHunksString failed: $error\n' + 'Context: $context\n' + 'event log:\n${_getEventLog()}\n', + ), + stackTrace, + ); } } @@ -3286,7 +3641,10 @@ Future _loadAllHunks(Object loader, List hunkNames, List hashes, } if (hunksToRetry.isEmpty) { _addEvent( - part: loadedHunksString, event: 'downloadSuccess', loadId: loadId); + part: loadedHunksString, + event: 'downloadSuccess', + loadId: loadId, + ); completer.complete(null); } else { failure( @@ -3312,18 +3670,36 @@ Future _loadAllHunks(Object loader, List hunkNames, List hashes, }, 1); try { - JS('void', '#(#, #, #, #, #)', loader, urisToLoad, jsSuccess, jsFailure, - loadId, priority); + JS( + 'void', + '#(#, #, #, #, #)', + loader, + urisToLoad, + jsSuccess, + jsFailure, + loadId, + priority, + ); } catch (error, stackTrace) { - failure(error, "invoking dartDeferredLibraryMultiLoader hook", stackTrace, - hunksToLoad, hashesToLoad); + failure( + error, + "invoking dartDeferredLibraryMultiLoader hook", + stackTrace, + hunksToLoad, + hashesToLoad, + ); } return Future.wait([...pendingLoads, completer.future]); } -Future _loadHunk(String hunkName, String loadId, String priority, - String hash, int retryCount) { +Future _loadHunk( + String hunkName, + String loadId, + String priority, + String hash, + int retryCount, +) { const int maxRetries = 3; var completer = _loadingLibraries[hunkName]; @@ -3334,8 +3710,10 @@ Future _loadHunk(String hunkName, String loadId, String priority, } completer ??= _loadingLibraries[hunkName] = Completer(); - Object trustedScriptUri = - _buildTrustedScriptUriWithRetry(hunkName, retryCount); + Object trustedScriptUri = _buildTrustedScriptUriWithRetry( + hunkName, + retryCount, + ); String uriAsString = JS('', '#.toString()', trustedScriptUri); _addEvent(part: hunkName, event: 'download', loadId: loadId); @@ -3351,10 +3729,13 @@ Future _loadHunk(String hunkName, String loadId, String priority, _loadingLibraries[hunkName] = null; stackTrace ??= StackTrace.current; completer!.completeError( - DeferredLoadException('Loading $uriAsString failed: $error\n' - 'Context: $context\n' - 'event log:\n${_getEventLog()}\n'), - stackTrace); + DeferredLoadException( + 'Loading $uriAsString failed: $error\n' + 'Context: $context\n' + 'event log:\n${_getEventLog()}\n', + ), + stackTrace, + ); } } @@ -3366,22 +3747,36 @@ Future _loadHunk(String hunkName, String loadId, String priority, completer!.complete(null); } else { failure( - 'Success callback invoked but part $hunkName not loaded.', '', null); + 'Success callback invoked but part $hunkName not loaded.', + '', + null, + ); } } var jsSuccess = convertDartClosureToJS(success, 0); var jsFailure = convertDartClosureToJS((error) { - failure(unwrapException(error), 'js-failure-wrapper', - getTraceFromException(error)); + failure( + unwrapException(error), + 'js-failure-wrapper', + getTraceFromException(error), + ); }, 1); if (JS('bool', 'typeof # === "function"', deferredLibraryLoader)) { try { // Share the loadId that hunk belongs to, this will allow for any // additional loadId based bundling optimizations. - JS('void', '#(#, #, #, #, #)', deferredLibraryLoader, uriAsString, - jsSuccess, jsFailure, loadId, priority); + JS( + 'void', + '#(#, #, #, #, #)', + deferredLibraryLoader, + uriAsString, + jsSuccess, + jsFailure, + loadId, + priority, + ); } catch (error, stackTrace) { failure(error, "invoking dartDeferredLibraryLoader hook", stackTrace); } @@ -3390,24 +3785,25 @@ Future _loadHunk(String hunkName, String loadId, String priority, var xhr = JS('var', 'new XMLHttpRequest()'); JS('void', '#.open("GET", #)', xhr, uriAsString); JS( - 'void', - '#.addEventListener("load", #, false)', - xhr, - convertDartClosureToJS((event) { - int status = JS('int', '#.status', xhr); - if (status != 200) { - failure('Request status: $status', 'worker xhr', null); - } - String code = JS('String', '#.responseText', xhr); - try { - // Create a new function to avoid getting access to current function - // context. - JS('void', '(new Function(#))()', code); - success(); - } catch (error, stackTrace) { - failure(error, 'evaluating the code in worker xhr', stackTrace); - } - }, 1)); + 'void', + '#.addEventListener("load", #, false)', + xhr, + convertDartClosureToJS((event) { + int status = JS('int', '#.status', xhr); + if (status != 200) { + failure('Request status: $status', 'worker xhr', null); + } + String code = JS('String', '#.responseText', xhr); + try { + // Create a new function to avoid getting access to current function + // context. + JS('void', '(new Function(#))()', code); + success(); + } catch (error, stackTrace) { + failure(error, 'evaluating the code in worker xhr', stackTrace); + } + }, 1), + ); JS('void', '#.addEventListener("error", #, false)', xhr, (e) { failure(e, 'xhr error handler', null); @@ -3485,8 +3881,9 @@ void applyTestExtensions(List names) {} // See tests/web/platform_environment_variable1_test.dart const String testPlatformEnvironmentVariableValue = String.fromEnvironment( - 'dart2js.test.platform.environment.variable', - defaultValue: 'not-specified'); + 'dart2js.test.platform.environment.variable', + defaultValue: 'not-specified', +); String testingGetPlatformEnvironmentVariable() { return testPlatformEnvironmentVariableValue; @@ -3510,8 +3907,10 @@ bool isJSFunction(Function f) => JS('bool', 'typeof(#) == "function"', f); /// /// This function does not recurse if [value] is a collection. void assertInterop(Object? value) { - assert(value is! Function || isJSFunction(value), - 'Dart function requires `allowInterop` to be passed to JavaScript.'); + assert( + value is! Function || isJSFunction(value), + 'Dart function requires `allowInterop` to be passed to JavaScript.', + ); } /// Like [assertInterop], except iterates over a list of arguments @@ -3520,8 +3919,10 @@ void assertInterop(Object? value) { /// This function intentionally avoids using [assertInterop] so that this /// function can become a no-op if assertions are disabled. void assertInteropArgs(List args) { - assert(args.every((arg) => arg is! Function || isJSFunction(arg)), - 'Dart function requires `allowInterop` to be passed to JavaScript.'); + assert( + args.every((arg) => arg is! Function || isJSFunction(arg)), + 'Dart function requires `allowInterop` to be passed to JavaScript.', + ); } Object? rawStartupMetrics() { diff --git a/sdk/lib/_internal/js_runtime/lib/records.dart b/sdk/lib/_internal/js_runtime/lib/records.dart index 49de8535107..d688fc03316 100644 --- a/sdk/lib/_internal/js_runtime/lib/records.dart +++ b/sdk/lib/_internal/js_runtime/lib/records.dart @@ -8,8 +8,12 @@ part of _js_helper; abstract final class _Record implements Record { const _Record(); - int get _shapeTag => JS('JSUInt31', '#[#]', this, - JS_GET_NAME(JsGetName.RECORD_SHAPE_TAG_PROPERTY)); + int get _shapeTag => JS( + 'JSUInt31', + '#[#]', + this, + JS_GET_NAME(JsGetName.RECORD_SHAPE_TAG_PROPERTY), + ); bool _sameShape(_Record other) => _shapeTag == other._shapeTag; @@ -19,13 +23,17 @@ abstract final class _Record implements Record { Type get runtimeType { // TODO(51040): Consider caching. - return newRti.getRuntimeTypeOfRecord(this); + return rti.getRuntimeTypeOfRecord(this); } - newRti.Rti _getRti() { - String recipe = - JS('', '#[#]', this, JS_GET_NAME(JsGetName.RECORD_SHAPE_TYPE_PROPERTY)); - return newRti.evaluateRtiForRecord(recipe, _getFieldValues()); + rti.Rti _getRti() { + String recipe = JS( + '', + '#[#]', + this, + JS_GET_NAME(JsGetName.RECORD_SHAPE_TYPE_PROPERTY), + ); + return rti.evaluateRtiForRecord(recipe, _getFieldValues()); } @override @@ -67,8 +75,12 @@ abstract final class _Record implements Record { } List _computeFieldKeys() { - String recipe = - JS('', '#[#]', this, JS_GET_NAME(JsGetName.RECORD_SHAPE_TYPE_PROPERTY)); + String recipe = JS( + '', + '#[#]', + this, + JS_GET_NAME(JsGetName.RECORD_SHAPE_TYPE_PROPERTY), + ); // TODO(50081): The Rti recipe format is agnostic to what the record shape // key is. We happen to use a comma-separated list of the names for the @@ -103,7 +115,7 @@ abstract final class _Record implements Record { /// Entrypoint for rti library. Calls rti.evaluateRtiForRecord with components /// of the record. @pragma('dart2js:as:trust') -newRti.Rti getRtiForRecord(Object? record) { +rti.Rti getRtiForRecord(Object? record) { return (record as _Record)._getRti(); } @@ -249,7 +261,7 @@ void _recordImpactModel() { r3 == anything(); rN == anything(); - newRti.pairwiseIsTest(anything() as JSArray, anything() as JSArray); + rti.pairwiseIsTest(anything() as JSArray, anything() as JSArray); } // TODO(50081): Can this be `external`? diff --git a/tests/web/internal/rti/constant_type_test.dart b/tests/web/internal/rti/constant_type_test.dart index 7e71eb7231b..21d7a333949 100644 --- a/tests/web/internal/rti/constant_type_test.dart +++ b/tests/web/internal/rti/constant_type_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti --no-minify +// dart2jsOptions=--no-minify import "package:expect/expect.dart"; diff --git a/tests/web/internal/rti/runtime_type_1_test.dart b/tests/web/internal/rti/runtime_type_1_test.dart index a3bcf059023..4a141f4c20c 100644 --- a/tests/web/internal/rti/runtime_type_1_test.dart +++ b/tests/web/internal/rti/runtime_type_1_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti --no-minify +// dart2jsOptions=--no-minify import 'dart:_rti' as rti; import "package:expect/expect.dart"; diff --git a/tests/web/internal/rti/runtime_type_2_test.dart b/tests/web/internal/rti/runtime_type_2_test.dart index d8cd5346291..bf0f4531115 100644 --- a/tests/web/internal/rti/runtime_type_2_test.dart +++ b/tests/web/internal/rti/runtime_type_2_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti --no-minify +// dart2jsOptions=--no-minify import "package:expect/expect.dart"; diff --git a/tests/web/internal/rti/runtime_type_3_test.dart b/tests/web/internal/rti/runtime_type_3_test.dart index 89b8c8b3a32..a16288755dd 100644 --- a/tests/web/internal/rti/runtime_type_3_test.dart +++ b/tests/web/internal/rti/runtime_type_3_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti --no-minify +// dart2jsOptions=--no-minify import "package:expect/expect.dart"; import "dart:_foreign_helper" show JS; diff --git a/tests/web/internal/rti/simple_is_function_type2_test.dart b/tests/web/internal/rti/simple_is_function_type2_test.dart index 06e490d95af..06e12406bd5 100644 --- a/tests/web/internal/rti/simple_is_function_type2_test.dart +++ b/tests/web/internal/rti/simple_is_function_type2_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti - import "package:expect/expect.dart"; int fnInt2Int(int x) => x; diff --git a/tests/web/internal/rti/simple_is_function_type3_test.dart b/tests/web/internal/rti/simple_is_function_type3_test.dart index 78c5469b37c..dabdb001b68 100644 --- a/tests/web/internal/rti/simple_is_function_type3_test.dart +++ b/tests/web/internal/rti/simple_is_function_type3_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti - // Test that some closures are 'is Function'. import "package:expect/expect.dart"; diff --git a/tests/web/internal/rti/simple_is_function_type_test.dart b/tests/web/internal/rti/simple_is_function_type_test.dart index 2f32edc7254..7ee2e796e86 100644 --- a/tests/web/internal/rti/simple_is_function_type_test.dart +++ b/tests/web/internal/rti/simple_is_function_type_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti - import 'dart:_rti' as rti; import "package:expect/expect.dart"; diff --git a/tests/web/internal/rti/simple_is_test.dart b/tests/web/internal/rti/simple_is_test.dart index fb82ac49fde..3f0bac7e58e 100644 --- a/tests/web/internal/rti/simple_is_test.dart +++ b/tests/web/internal/rti/simple_is_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti --no-minify +// dart2jsOptions=--no-minify import 'dart:_rti' as rti; import "package:expect/expect.dart"; diff --git a/tests/web/internal/rti/simple_type_bound_test.dart b/tests/web/internal/rti/simple_type_bound_test.dart index 29a87617e96..6268d0ec347 100644 --- a/tests/web/internal/rti/simple_type_bound_test.dart +++ b/tests/web/internal/rti/simple_type_bound_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--experiment-new-rti - import "package:expect/expect.dart"; @pragma('dart2js:noInline') diff --git a/tests/web/lax_runtime_type_closure_to_string3_test.dart b/tests/web/lax_runtime_type_closure_to_string3_test.dart index 5f0edfff171..3c4d521fa67 100644 --- a/tests/web/lax_runtime_type_closure_to_string3_test.dart +++ b/tests/web/lax_runtime_type_closure_to_string3_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--omit-implicit-checks --lax-runtime-type-to-string --experiment-new-rti +// dart2jsOptions=--omit-implicit-checks --lax-runtime-type-to-string import 'package:expect/expect.dart'; diff --git a/tests/web/runtime_type_to_string1_test.dart b/tests/web/runtime_type_to_string1_test.dart index d61335fed84..76848fb8f75 100644 --- a/tests/web/runtime_type_to_string1_test.dart +++ b/tests/web/runtime_type_to_string1_test.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// dart2jsOptions=--strong --omit-implicit-checks --lax-runtime-type-to-string --experiment-new-rti +// dart2jsOptions=--strong --omit-implicit-checks --lax-runtime-type-to-string import 'package:expect/expect.dart';