Version 2.15.0-126.0.dev
Merge commit '5f7a18b49289b1b18e27a536a16f8a24234b7ac2' into 'dev'
diff --git a/pkg/compiler/lib/src/js_backend/annotations.dart b/pkg/compiler/lib/src/js_backend/annotations.dart
index 98ebf0c..7ae9894 100644
--- a/pkg/compiler/lib/src/js_backend/annotations.dart
+++ b/pkg/compiler/lib/src/js_backend/annotations.dart
@@ -23,9 +23,9 @@
final bool internalOnly;
const PragmaAnnotation(this._index, this.name,
- {this.forFunctionsOnly: false,
- this.forFieldsOnly: false,
- this.internalOnly: false});
+ {this.forFunctionsOnly = false,
+ this.forFieldsOnly = false,
+ this.internalOnly = false});
int get index {
assert(_index == values.indexOf(this));
@@ -34,23 +34,22 @@
/// Tells the optimizing compiler to not inline the annotated method.
static const PragmaAnnotation noInline =
- const PragmaAnnotation(0, 'noInline', forFunctionsOnly: true);
+ PragmaAnnotation(0, 'noInline', forFunctionsOnly: true);
/// Tells the optimizing compiler to always inline the annotated method, if
/// possible.
static const PragmaAnnotation tryInline =
- const PragmaAnnotation(1, 'tryInline', forFunctionsOnly: true);
+ PragmaAnnotation(1, 'tryInline', forFunctionsOnly: true);
- static const PragmaAnnotation disableFinal = const PragmaAnnotation(
+ static const PragmaAnnotation disableFinal = PragmaAnnotation(
2, 'disableFinal',
forFunctionsOnly: true, internalOnly: true);
- static const PragmaAnnotation noElision =
- const PragmaAnnotation(3, 'noElision');
+ static const PragmaAnnotation noElision = PragmaAnnotation(3, 'noElision');
/// Tells the optimizing compiler that the annotated method cannot throw.
/// Requires @pragma('dart2js:noInline') to function correctly.
- static const PragmaAnnotation noThrows = const PragmaAnnotation(4, 'noThrows',
+ static const PragmaAnnotation noThrows = PragmaAnnotation(4, 'noThrows',
forFunctionsOnly: true, internalOnly: true);
/// Tells the optimizing compiler that the annotated method has no
@@ -58,7 +57,7 @@
/// dropped without changing the semantics of the program.
///
/// Requires @pragma('dart2js:noInline') to function correctly.
- static const PragmaAnnotation noSideEffects = const PragmaAnnotation(
+ static const PragmaAnnotation noSideEffects = PragmaAnnotation(
5, 'noSideEffects',
forFunctionsOnly: true, internalOnly: true);
@@ -66,45 +65,43 @@
/// assumptions on parameters, effectively assuming that the runtime arguments
/// could be any value. Note that the constraints due to static types still
/// apply.
- static const PragmaAnnotation assumeDynamic = const PragmaAnnotation(
+ static const PragmaAnnotation assumeDynamic = PragmaAnnotation(
6, 'assumeDynamic',
forFunctionsOnly: true, internalOnly: true);
- static const PragmaAnnotation asTrust = const PragmaAnnotation(7, 'as:trust',
+ static const PragmaAnnotation asTrust = PragmaAnnotation(7, 'as:trust',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation asCheck = const PragmaAnnotation(8, 'as:check',
+ static const PragmaAnnotation asCheck = PragmaAnnotation(8, 'as:check',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation typesTrust = const PragmaAnnotation(
- 9, 'types:trust',
+ static const PragmaAnnotation typesTrust = PragmaAnnotation(9, 'types:trust',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation typesCheck = const PragmaAnnotation(
- 10, 'types:check',
+ static const PragmaAnnotation typesCheck = PragmaAnnotation(10, 'types:check',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation parameterTrust = const PragmaAnnotation(
+ static const PragmaAnnotation parameterTrust = PragmaAnnotation(
11, 'parameter:trust',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation parameterCheck = const PragmaAnnotation(
+ static const PragmaAnnotation parameterCheck = PragmaAnnotation(
12, 'parameter:check',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation downcastTrust = const PragmaAnnotation(
+ static const PragmaAnnotation downcastTrust = PragmaAnnotation(
13, 'downcast:trust',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation downcastCheck = const PragmaAnnotation(
+ static const PragmaAnnotation downcastCheck = PragmaAnnotation(
14, 'downcast:check',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation indexBoundsTrust = const PragmaAnnotation(
+ static const PragmaAnnotation indexBoundsTrust = PragmaAnnotation(
15, 'index-bounds:trust',
forFunctionsOnly: false, internalOnly: false);
- static const PragmaAnnotation indexBoundsCheck = const PragmaAnnotation(
+ static const PragmaAnnotation indexBoundsCheck = PragmaAnnotation(
16, 'index-bounds:check',
forFunctionsOnly: false, internalOnly: false);
@@ -155,7 +152,7 @@
DiagnosticReporter reporter,
ir.Member member,
List<PragmaAnnotationData> pragmaAnnotationData) {
- EnumSet<PragmaAnnotation> annotations = new EnumSet<PragmaAnnotation>();
+ EnumSet<PragmaAnnotation> annotations = EnumSet<PragmaAnnotation>();
Uri uri = member.enclosingLibrary.importUri;
bool platformAnnotationsAllowed =
@@ -236,7 +233,7 @@
'text': "@pragma('dart2js:${annotation.name}') must not be used "
"with @pragma('dart2js:${other.name}')."
});
- (reportedExclusions[annotation] ??= new EnumSet()).add(other);
+ (reportedExclusions[annotation] ??= EnumSet()).add(other);
}
}
}
@@ -363,9 +360,9 @@
source.begin(tag);
Map<MemberEntity, EnumSet<PragmaAnnotation>> pragmaAnnotations =
source.readMemberMap(
- (MemberEntity member) => new EnumSet.fromValue(source.readInt()));
+ (MemberEntity member) => EnumSet.fromValue(source.readInt()));
source.end(tag);
- return new AnnotationsDataImpl(options, pragmaAnnotations);
+ return AnnotationsDataImpl(options, pragmaAnnotations);
}
@override
@@ -550,6 +547,6 @@
}
AnnotationsData close(CompilerOptions options) {
- return new AnnotationsDataImpl(options, pragmaAnnotations);
+ return AnnotationsDataImpl(options, pragmaAnnotations);
}
}
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 8d15b8c..699f97a 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -50,11 +50,10 @@
static const int _canInlineInLoopMayInlineOutside = 3;
static const int _canInline = 4;
- final Map<FunctionEntity, int> _cachedDecisions =
- new Map<FunctionEntity, int>();
+ final Map<FunctionEntity, int> _cachedDecisions = Map<FunctionEntity, int>();
- final Set<FunctionEntity> _noInlineFunctions = new Set<FunctionEntity>();
- final Set<FunctionEntity> _tryInlineFunctions = new Set<FunctionEntity>();
+ final Set<FunctionEntity> _noInlineFunctions = Set<FunctionEntity>();
+ final Set<FunctionEntity> _tryInlineFunctions = Set<FunctionEntity>();
FunctionInlineCache(AnnotationsData annotationsData) {
annotationsData.forEachNoInline((FunctionEntity function) {
@@ -185,7 +184,7 @@
}
}
- void markAsNonInlinable(FunctionEntity element, {bool insideLoop: true}) {
+ void markAsNonInlinable(FunctionEntity element, {bool insideLoop = true}) {
assert(checkFunction(element), failedAt(element));
int oldDecision = _cachedDecisions[element];
@@ -312,7 +311,7 @@
class CodegenInputsImpl implements CodegenInputs {
@override
- final CheckedModeHelpers checkedModeHelpers = new CheckedModeHelpers();
+ final CheckedModeHelpers checkedModeHelpers = CheckedModeHelpers();
@override
final RuntimeTypesSubstitutions rtiSubstitutions;
diff --git a/pkg/compiler/lib/src/js_backend/backend_impact.dart b/pkg/compiler/lib/src/js_backend/backend_impact.dart
index 4dcff21..59a3310 100644
--- a/pkg/compiler/lib/src/js_backend/backend_impact.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_impact.dart
@@ -33,21 +33,22 @@
final EnumSet<BackendFeature> _features;
const BackendImpact(
- {this.staticUses: const <FunctionEntity>[],
- this.globalUses: const <FunctionEntity>[],
- this.dynamicUses: const <Selector>[],
- this.instantiatedTypes: const <InterfaceType>[],
- this.instantiatedClasses: const <ClassEntity>[],
- this.globalClasses: const <ClassEntity>[],
- this.otherImpacts: const <BackendImpact>[],
- EnumSet<BackendFeature> features: const EnumSet<BackendFeature>.fixed(0)})
+ {this.staticUses = const <FunctionEntity>[],
+ this.globalUses = const <FunctionEntity>[],
+ this.dynamicUses = const <Selector>[],
+ this.instantiatedTypes = const <InterfaceType>[],
+ this.instantiatedClasses = const <ClassEntity>[],
+ this.globalClasses = const <ClassEntity>[],
+ this.otherImpacts = const <BackendImpact>[],
+ EnumSet<BackendFeature> features =
+ const EnumSet<BackendFeature>.fixed(0)})
: this._features = features;
Iterable<BackendFeature> get features =>
_features.iterable(BackendFeature.values);
WorldImpact createImpact(ElementEnvironment elementEnvironment) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl impactBuilder = WorldImpactBuilderImpl();
registerImpact(impactBuilder, elementEnvironment);
return impactBuilder;
}
@@ -57,30 +58,28 @@
ElementEnvironment elementEnvironment) {
for (FunctionEntity staticUse in staticUses) {
assert(staticUse != null);
- worldImpactBuilder
- .registerStaticUse(new StaticUse.implicitInvoke(staticUse));
+ worldImpactBuilder.registerStaticUse(StaticUse.implicitInvoke(staticUse));
}
for (FunctionEntity staticUse in globalUses) {
assert(staticUse != null);
- worldImpactBuilder
- .registerStaticUse(new StaticUse.implicitInvoke(staticUse));
+ worldImpactBuilder.registerStaticUse(StaticUse.implicitInvoke(staticUse));
}
for (Selector selector in dynamicUses) {
assert(selector != null);
worldImpactBuilder
- .registerDynamicUse(new DynamicUse(selector, null, const []));
+ .registerDynamicUse(DynamicUse(selector, null, const []));
}
for (InterfaceType instantiatedType in instantiatedTypes) {
worldImpactBuilder
- .registerTypeUse(new TypeUse.instantiation(instantiatedType));
+ .registerTypeUse(TypeUse.instantiation(instantiatedType));
}
for (ClassEntity cls in instantiatedClasses) {
worldImpactBuilder.registerTypeUse(
- new TypeUse.instantiation(elementEnvironment.getRawType(cls)));
+ TypeUse.instantiation(elementEnvironment.getRawType(cls)));
}
for (ClassEntity cls in globalClasses) {
worldImpactBuilder.registerTypeUse(
- new TypeUse.instantiation(elementEnvironment.getRawType(cls)));
+ TypeUse.instantiation(elementEnvironment.getRawType(cls)));
}
for (BackendImpact otherImpact in otherImpacts) {
otherImpact.registerImpact(worldImpactBuilder, elementEnvironment);
@@ -99,7 +98,7 @@
BackendImpact get getRuntimeTypeArgument {
return _getRuntimeTypeArgument ??=
- new BackendImpact(globalUses: [], otherImpacts: [
+ BackendImpact(globalUses: [], otherImpacts: [
newRtiImpact,
]);
}
@@ -107,7 +106,7 @@
BackendImpact _computeSignature;
BackendImpact get computeSignature {
- return _computeSignature ??= new BackendImpact(globalUses: [
+ return _computeSignature ??= BackendImpact(globalUses: [
_commonElements.setArrayType,
], otherImpacts: [
listValues
@@ -117,7 +116,7 @@
BackendImpact _mainWithArguments;
BackendImpact get mainWithArguments {
- return _mainWithArguments ??= new BackendImpact(
+ return _mainWithArguments ??= BackendImpact(
globalUses: [_commonElements.convertMainArgumentList],
instantiatedClasses: [
_commonElements.jsArrayClass,
@@ -128,7 +127,7 @@
BackendImpact _asyncBody;
- BackendImpact get asyncBody => _asyncBody ??= new BackendImpact(staticUses: [
+ BackendImpact get asyncBody => _asyncBody ??= BackendImpact(staticUses: [
_commonElements.asyncHelperAwait,
_commonElements.asyncHelperReturn,
_commonElements.asyncHelperRethrow,
@@ -140,7 +139,7 @@
BackendImpact _syncStarBody;
BackendImpact get syncStarBody {
- return _syncStarBody ??= new BackendImpact(staticUses: [
+ return _syncStarBody ??= BackendImpact(staticUses: [
_commonElements.endOfIteration,
_commonElements.yieldStar,
_commonElements.syncStarUncaughtError,
@@ -150,7 +149,7 @@
BackendImpact _asyncStarBody;
BackendImpact get asyncStarBody {
- return _asyncStarBody ??= new BackendImpact(staticUses: [
+ return _asyncStarBody ??= BackendImpact(staticUses: [
_commonElements.asyncStarHelper,
_commonElements.streamOfController,
_commonElements.yieldSingle,
@@ -163,7 +162,7 @@
BackendImpact _typeVariableBoundCheck;
BackendImpact get typeVariableBoundCheck {
- return _typeVariableBoundCheck ??= new BackendImpact(staticUses: [
+ return _typeVariableBoundCheck ??= BackendImpact(staticUses: [
_commonElements.checkTypeBound,
]);
}
@@ -172,13 +171,13 @@
BackendImpact get fallThroughError {
return _fallThroughError ??=
- new BackendImpact(staticUses: [_commonElements.fallThroughError]);
+ BackendImpact(staticUses: [_commonElements.fallThroughError]);
}
BackendImpact _asCheck;
BackendImpact get asCheck {
- return _asCheck ??= new BackendImpact(staticUses: [], otherImpacts: [
+ return _asCheck ??= BackendImpact(staticUses: [], otherImpacts: [
newRtiImpact,
]);
}
@@ -186,7 +185,7 @@
BackendImpact _throwNoSuchMethod;
BackendImpact get throwNoSuchMethod {
- return _throwNoSuchMethod ??= new BackendImpact(staticUses: [
+ return _throwNoSuchMethod ??= BackendImpact(staticUses: [
_commonElements.throwNoSuchMethod,
], otherImpacts: [
// Also register the types of the arguments passed to this method.
@@ -200,13 +199,13 @@
BackendImpact get stringValues {
return _stringValues ??=
- new BackendImpact(instantiatedClasses: [_commonElements.jsStringClass]);
+ BackendImpact(instantiatedClasses: [_commonElements.jsStringClass]);
}
BackendImpact _numValues;
BackendImpact get numValues {
- return _numValues ??= new BackendImpact(instantiatedClasses: [
+ return _numValues ??= BackendImpact(instantiatedClasses: [
_commonElements.jsIntClass,
_commonElements.jsPositiveIntClass,
_commonElements.jsUInt32Class,
@@ -224,20 +223,20 @@
BackendImpact get boolValues {
return _boolValues ??=
- new BackendImpact(instantiatedClasses: [_commonElements.jsBoolClass]);
+ BackendImpact(instantiatedClasses: [_commonElements.jsBoolClass]);
}
BackendImpact _nullValue;
BackendImpact get nullValue {
return _nullValue ??=
- new BackendImpact(instantiatedClasses: [_commonElements.jsNullClass]);
+ BackendImpact(instantiatedClasses: [_commonElements.jsNullClass]);
}
BackendImpact _listValues;
BackendImpact get listValues {
- return _listValues ??= new BackendImpact(globalClasses: [
+ return _listValues ??= BackendImpact(globalClasses: [
_commonElements.jsArrayClass,
_commonElements.jsMutableArrayClass,
_commonElements.jsFixedArrayClass,
@@ -249,7 +248,7 @@
BackendImpact _throwRuntimeError;
BackendImpact get throwRuntimeError {
- return _throwRuntimeError ??= new BackendImpact(otherImpacts: [
+ return _throwRuntimeError ??= BackendImpact(otherImpacts: [
// Also register the types of the arguments passed to this method.
stringValues
]);
@@ -258,7 +257,7 @@
BackendImpact _throwUnsupportedError;
BackendImpact get throwUnsupportedError {
- return _throwUnsupportedError ??= new BackendImpact(staticUses: [
+ return _throwUnsupportedError ??= BackendImpact(staticUses: [
_commonElements.throwUnsupportedError
], otherImpacts: [
// Also register the types of the arguments passed to this method.
@@ -269,7 +268,7 @@
BackendImpact _superNoSuchMethod;
BackendImpact get superNoSuchMethod {
- return _superNoSuchMethod ??= new BackendImpact(staticUses: [
+ return _superNoSuchMethod ??= BackendImpact(staticUses: [
_commonElements.createInvocationMirror,
_commonElements.objectNoSuchMethod
], otherImpacts: [
@@ -282,7 +281,7 @@
BackendImpact _constantMapLiteral;
BackendImpact get constantMapLiteral {
- return _constantMapLiteral ??= new BackendImpact(instantiatedClasses: [
+ return _constantMapLiteral ??= BackendImpact(instantiatedClasses: [
_commonElements.constantMapClass,
_commonElements.constantStringMapClass,
_commonElements.generalConstantMapClass,
@@ -292,7 +291,7 @@
BackendImpact _constantSetLiteral;
BackendImpact get constantSetLiteral =>
- _constantSetLiteral ??= new BackendImpact(instantiatedClasses: [
+ _constantSetLiteral ??= BackendImpact(instantiatedClasses: [
_commonElements.constSetLiteralClass,
], otherImpacts: [
constantMapLiteral
@@ -301,7 +300,7 @@
BackendImpact _constSymbol;
BackendImpact get constSymbol {
- return _constSymbol ??= new BackendImpact(
+ return _constSymbol ??= BackendImpact(
instantiatedClasses: [_commonElements.symbolImplementationClass],
staticUses: [_commonElements.symbolConstructorTarget]);
}
@@ -328,27 +327,27 @@
BackendImpact get assertWithoutMessage {
return _assertWithoutMessage ??=
- new BackendImpact(staticUses: [_commonElements.assertHelper]);
+ BackendImpact(staticUses: [_commonElements.assertHelper]);
}
BackendImpact _assertWithMessage;
BackendImpact get assertWithMessage {
- return _assertWithMessage ??= new BackendImpact(
+ return _assertWithMessage ??= BackendImpact(
staticUses: [_commonElements.assertTest, _commonElements.assertThrow]);
}
BackendImpact _asyncForIn;
BackendImpact get asyncForIn {
- return _asyncForIn ??= new BackendImpact(
- staticUses: [_commonElements.streamIteratorConstructor]);
+ return _asyncForIn ??=
+ BackendImpact(staticUses: [_commonElements.streamIteratorConstructor]);
}
BackendImpact _stringInterpolation;
BackendImpact get stringInterpolation {
- return _stringInterpolation ??= new BackendImpact(
+ return _stringInterpolation ??= BackendImpact(
dynamicUses: [Selectors.toString_],
staticUses: [_commonElements.stringInterpolationHelper],
otherImpacts: [_needsString('Strings are created.')]);
@@ -373,7 +372,7 @@
BackendImpact _catchStatement;
BackendImpact get catchStatement {
- return _catchStatement ??= new BackendImpact(staticUses: [
+ return _catchStatement ??= BackendImpact(staticUses: [
_commonElements.exceptionUnwrapper
], instantiatedClasses: [
_commonElements.jsPlainJavaScriptObjectClass,
@@ -384,7 +383,7 @@
BackendImpact _throwExpression;
BackendImpact get throwExpression {
- return _throwExpression ??= new BackendImpact(
+ return _throwExpression ??= BackendImpact(
// We don't know ahead of time whether we will need the throw in a
// statement context or an expression context, so we register both
// here, even though we may not need the throwExpression helper.
@@ -397,7 +396,7 @@
BackendImpact _lazyField;
BackendImpact get lazyField {
- return _lazyField ??= new BackendImpact(staticUses: [
+ return _lazyField ??= BackendImpact(staticUses: [
_commonElements.cyclicThrowHelper,
_commonElements.throwLateFieldADI,
]);
@@ -406,7 +405,7 @@
BackendImpact _typeLiteral;
BackendImpact get typeLiteral {
- return _typeLiteral ??= new BackendImpact(instantiatedClasses: [
+ return _typeLiteral ??= BackendImpact(instantiatedClasses: [
_commonElements.typeLiteralClass
], staticUses: [
_commonElements.createRuntimeType,
@@ -417,7 +416,7 @@
BackendImpact _stackTraceInCatch;
BackendImpact get stackTraceInCatch {
- return _stackTraceInCatch ??= new BackendImpact(
+ return _stackTraceInCatch ??= BackendImpact(
instantiatedClasses: [_commonElements.stackTraceHelperClass],
staticUses: [_commonElements.traceFromException]);
}
@@ -425,7 +424,7 @@
BackendImpact _syncForIn;
BackendImpact get syncForIn {
- return _syncForIn ??= new BackendImpact(
+ return _syncForIn ??= BackendImpact(
// The SSA builder recognizes certain for-in loops and can generate
// calls to throwConcurrentModificationError.
staticUses: [_commonElements.checkConcurrentModificationError]);
@@ -434,7 +433,7 @@
BackendImpact _typeVariableExpression;
BackendImpact get typeVariableExpression {
- return _typeVariableExpression ??= new BackendImpact(staticUses: [
+ return _typeVariableExpression ??= BackendImpact(staticUses: [
_commonElements.setArrayType,
_commonElements.createRuntimeType
], otherImpacts: [
@@ -448,13 +447,13 @@
BackendImpact get typeCheck {
return _typeCheck ??=
- new BackendImpact(otherImpacts: [boolValues, newRtiImpact]);
+ BackendImpact(otherImpacts: [boolValues, newRtiImpact]);
}
BackendImpact _genericTypeCheck;
BackendImpact get genericTypeCheck {
- return _genericTypeCheck ??= new BackendImpact(staticUses: [
+ return _genericTypeCheck ??= BackendImpact(staticUses: [
// TODO(johnniwinther): Investigate why this is needed.
_commonElements.setArrayType,
], otherImpacts: [
@@ -468,20 +467,20 @@
BackendImpact get genericIsCheck {
return _genericIsCheck ??=
- new BackendImpact(otherImpacts: [intValues, newRtiImpact]);
+ BackendImpact(otherImpacts: [intValues, newRtiImpact]);
}
BackendImpact _typeVariableTypeCheck;
BackendImpact get typeVariableTypeCheck {
return _typeVariableTypeCheck ??=
- new BackendImpact(staticUses: [], otherImpacts: [newRtiImpact]);
+ BackendImpact(staticUses: [], otherImpacts: [newRtiImpact]);
}
BackendImpact _functionTypeCheck;
BackendImpact get functionTypeCheck {
- return _functionTypeCheck ??= new BackendImpact(
+ return _functionTypeCheck ??= BackendImpact(
staticUses: [/*helpers.functionTypeTestMetaHelper*/],
otherImpacts: [newRtiImpact]);
}
@@ -490,13 +489,13 @@
BackendImpact get futureOrTypeCheck {
return _futureOrTypeCheck ??=
- new BackendImpact(staticUses: [], otherImpacts: [newRtiImpact]);
+ BackendImpact(staticUses: [], otherImpacts: [newRtiImpact]);
}
BackendImpact _nativeTypeCheck;
BackendImpact get nativeTypeCheck {
- return _nativeTypeCheck ??= new BackendImpact(staticUses: [
+ return _nativeTypeCheck ??= BackendImpact(staticUses: [
// We will need to add the "$is" and "$as" properties on the
// JavaScript object prototype, so we make sure
// [:defineProperty:] is compiled.
@@ -510,13 +509,13 @@
BackendImpact get closure {
return _closure ??=
- new BackendImpact(instantiatedClasses: [_commonElements.functionClass]);
+ BackendImpact(instantiatedClasses: [_commonElements.functionClass]);
}
BackendImpact _interceptorUse;
BackendImpact get interceptorUse {
- return _interceptorUse ??= new BackendImpact(
+ return _interceptorUse ??= BackendImpact(
staticUses: [
_commonElements.getNativeInterceptorMethod
],
@@ -525,7 +524,7 @@
_commonElements.jsPlainJavaScriptObjectClass,
_commonElements.jsJavaScriptFunctionClass
],
- features: new EnumSet<BackendFeature>.fromValues([
+ features: EnumSet<BackendFeature>.fromValues([
BackendFeature.needToInitializeDispatchProperty,
BackendFeature.needToInitializeIsolateAffinityTag
], fixed: true));
@@ -545,7 +544,7 @@
BackendImpact _numClasses;
BackendImpact get numClasses {
- return _numClasses ??= new BackendImpact(
+ return _numClasses ??= BackendImpact(
// The backend will try to optimize number operations and use the
// `iae` helper directly.
globalUses: [_commonElements.throwIllegalArgumentException]);
@@ -554,7 +553,7 @@
BackendImpact _listOrStringClasses;
BackendImpact get listOrStringClasses {
- return _listOrStringClasses ??= new BackendImpact(
+ return _listOrStringClasses ??= BackendImpact(
// The backend will try to optimize array and string access and use the
// `ioore` and `iae` _commonElements directly.
globalUses: [
@@ -566,7 +565,7 @@
BackendImpact _functionClass;
BackendImpact get functionClass {
- return _functionClass ??= new BackendImpact(globalClasses: [
+ return _functionClass ??= BackendImpact(globalClasses: [
_commonElements.closureClass,
_commonElements.closureClass0Args,
_commonElements.closureClass2Args,
@@ -576,7 +575,7 @@
BackendImpact _mapClass;
BackendImpact get mapClass {
- return _mapClass ??= new BackendImpact(
+ return _mapClass ??= BackendImpact(
// The backend will use a literal list to initialize the entries
// of the map.
globalClasses: [
@@ -587,7 +586,7 @@
BackendImpact _setClass;
- BackendImpact get setClass => _setClass ??= new BackendImpact(globalClasses: [
+ BackendImpact get setClass => _setClass ??= BackendImpact(globalClasses: [
// The backend will use a literal list to initialize the entries
// of the set.
_commonElements.listClass,
@@ -598,13 +597,13 @@
BackendImpact get boundClosureClass {
return _boundClosureClass ??=
- new BackendImpact(globalClasses: [_commonElements.boundClosureClass]);
+ BackendImpact(globalClasses: [_commonElements.boundClosureClass]);
}
BackendImpact _nativeOrExtendsClass;
BackendImpact get nativeOrExtendsClass {
- return _nativeOrExtendsClass ??= new BackendImpact(globalUses: [
+ return _nativeOrExtendsClass ??= BackendImpact(globalUses: [
_commonElements.getNativeInterceptorMethod
], globalClasses: [
_commonElements.jsInterceptorClass,
@@ -617,7 +616,7 @@
BackendImpact _mapLiteralClass;
BackendImpact get mapLiteralClass {
- return _mapLiteralClass ??= new BackendImpact(globalUses: [
+ return _mapLiteralClass ??= BackendImpact(globalUses: [
_commonElements.mapLiteralConstructor,
_commonElements.mapLiteralConstructorEmpty,
_commonElements.mapLiteralUntypedMaker,
@@ -628,7 +627,7 @@
BackendImpact _setLiteralClass;
BackendImpact get setLiteralClass =>
- _setLiteralClass ??= new BackendImpact(globalUses: [
+ _setLiteralClass ??= BackendImpact(globalUses: [
_commonElements.setLiteralConstructor,
_commonElements.setLiteralConstructorEmpty,
_commonElements.setLiteralUntypedMaker,
@@ -639,13 +638,13 @@
BackendImpact get closureClass {
return _closureClass ??=
- new BackendImpact(globalUses: [_commonElements.closureFromTearOff]);
+ BackendImpact(globalUses: [_commonElements.closureFromTearOff]);
}
BackendImpact _listClasses;
BackendImpact get listClasses {
- return _listClasses ??= new BackendImpact(
+ return _listClasses ??= BackendImpact(
// Literal lists can be translated into calls to these functions:
globalUses: [
_commonElements.jsArrayTypedConstructor,
@@ -656,7 +655,7 @@
BackendImpact _jsIndexingBehavior;
BackendImpact get jsIndexingBehavior {
- return _jsIndexingBehavior ??= new BackendImpact(
+ return _jsIndexingBehavior ??= BackendImpact(
// These two _commonElements are used by the emitter and the codegen.
// Because we cannot enqueue elements at the time of emission,
// we make sure they are always generated.
@@ -667,20 +666,20 @@
BackendImpact get traceHelper {
return _traceHelper ??=
- new BackendImpact(globalUses: [_commonElements.traceHelper]);
+ BackendImpact(globalUses: [_commonElements.traceHelper]);
}
BackendImpact _assertUnreachable;
BackendImpact get assertUnreachable {
- return _assertUnreachable ??= new BackendImpact(
- globalUses: [_commonElements.assertUnreachableMethod]);
+ return _assertUnreachable ??=
+ BackendImpact(globalUses: [_commonElements.assertUnreachableMethod]);
}
BackendImpact _runtimeTypeSupport;
BackendImpact get runtimeTypeSupport {
- return _runtimeTypeSupport ??= new BackendImpact(globalClasses: [
+ return _runtimeTypeSupport ??= BackendImpact(globalClasses: [
_commonElements.listClass
], globalUses: [
_commonElements.setArrayType,
@@ -694,7 +693,7 @@
BackendImpact get deferredLoading {
return _deferredLoading ??=
- new BackendImpact(globalUses: [_commonElements.checkDeferredIsLoaded],
+ BackendImpact(globalUses: [_commonElements.checkDeferredIsLoaded],
// Also register the types of the arguments passed to this method.
globalClasses: [_commonElements.stringClass]);
}
@@ -702,7 +701,7 @@
BackendImpact _noSuchMethodSupport;
BackendImpact get noSuchMethodSupport {
- return _noSuchMethodSupport ??= new BackendImpact(globalUses: [
+ return _noSuchMethodSupport ??= BackendImpact(globalUses: [
_commonElements.createInvocationMirror,
_commonElements.createUnmangledInvocationMirror
], dynamicUses: [
@@ -715,7 +714,7 @@
/// Backend impact for accessing a `loadLibrary` function on a deferred
/// prefix.
BackendImpact get loadLibrary {
- return _loadLibrary ??= new BackendImpact(globalUses: [
+ return _loadLibrary ??= BackendImpact(globalUses: [
// TODO(redemption): delete wrapper when we sunset the old frontend.
_commonElements.loadLibraryWrapper,
_commonElements.loadDeferredLibrary,
@@ -727,7 +726,7 @@
/// Backend impact for performing member closurization.
BackendImpact get memberClosure {
return _memberClosure ??=
- new BackendImpact(globalClasses: [_commonElements.boundClosureClass]);
+ BackendImpact(globalClasses: [_commonElements.boundClosureClass]);
}
BackendImpact _staticClosure;
@@ -736,14 +735,13 @@
/// function.
BackendImpact get staticClosure {
return _staticClosure ??=
- new BackendImpact(globalClasses: [_commonElements.closureClass]);
+ BackendImpact(globalClasses: [_commonElements.closureClass]);
}
Map<int, BackendImpact> _genericInstantiation = <int, BackendImpact>{};
BackendImpact getGenericInstantiation(int typeArgumentCount) =>
- _genericInstantiation[typeArgumentCount] ??=
- new BackendImpact(staticUses: [
+ _genericInstantiation[typeArgumentCount] ??= BackendImpact(staticUses: [
_commonElements.getInstantiateFunction(typeArgumentCount),
_commonElements.instantiatedGenericFunctionTypeNewRti,
_commonElements.closureFunctionType,
diff --git a/pkg/compiler/lib/src/js_backend/backend_usage.dart b/pkg/compiler/lib/src/js_backend/backend_usage.dart
index 425e905..0119259 100644
--- a/pkg/compiler/lib/src/js_backend/backend_usage.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_usage.dart
@@ -110,12 +110,12 @@
Setlet<ClassEntity> _globalClassDependencies;
/// List of methods that the backend may use.
- final Set<FunctionEntity> _helperFunctionsUsed = new Set<FunctionEntity>();
+ final Set<FunctionEntity> _helperFunctionsUsed = Set<FunctionEntity>();
/// List of classes that the backend may use.
- final Set<ClassEntity> _helperClassesUsed = new Set<ClassEntity>();
+ final Set<ClassEntity> _helperClassesUsed = Set<ClassEntity>();
- final Set<RuntimeTypeUse> _runtimeTypeUses = new Set<RuntimeTypeUse>();
+ final Set<RuntimeTypeUse> _runtimeTypeUses = Set<RuntimeTypeUse>();
bool _needToInitializeIsolateAffinityTag = false;
bool _needToInitializeDispatchProperty = false;
@@ -190,14 +190,14 @@
}
void _processBackendStaticUse(FunctionEntity element,
- {bool isGlobal: false}) {
+ {bool isGlobal = false}) {
registerBackendFunctionUse(element);
if (isGlobal) {
registerGlobalFunctionDependency(element);
}
}
- void _processBackendInstantiation(ClassEntity cls, {bool isGlobal: false}) {
+ void _processBackendInstantiation(ClassEntity cls, {bool isGlobal = false}) {
registerBackendClassUse(cls);
if (isGlobal) {
registerGlobalClassDependency(cls);
@@ -257,7 +257,7 @@
void registerGlobalFunctionDependency(FunctionEntity element) {
assert(element != null);
if (_globalFunctionDependencies == null) {
- _globalFunctionDependencies = new Setlet<FunctionEntity>();
+ _globalFunctionDependencies = Setlet<FunctionEntity>();
}
_globalFunctionDependencies.add(element);
}
@@ -266,7 +266,7 @@
void registerGlobalClassDependency(ClassEntity element) {
assert(element != null);
if (_globalClassDependencies == null) {
- _globalClassDependencies = new Setlet<ClassEntity>();
+ _globalClassDependencies = Setlet<ClassEntity>();
}
_globalClassDependencies.add(element);
}
@@ -372,7 +372,7 @@
RuntimeTypeUseKind kind = source.readEnum(RuntimeTypeUseKind.values);
DartType receiverType = source.readDartType();
DartType argumentType = source.readDartType(allowNull: true);
- return new RuntimeTypeUse(kind, receiverType, argumentType);
+ return RuntimeTypeUse(kind, receiverType, argumentType);
}).toSet();
bool needToInitializeIsolateAffinityTag = source.readBool();
bool needToInitializeDispatchProperty = source.readBool();
diff --git a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
index c0e2d78..6bb4fc5 100644
--- a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
@@ -17,7 +17,7 @@
StaticUse getStaticUse(CommonElements commonElements) {
// TODO(johnniwinther): Refactor this to avoid looking up directly in the
// js helper library but instead access commonElements.
- return new StaticUse.staticInvoke(
+ return StaticUse.staticInvoke(
commonElements.findHelperFunction(name), callStructure);
}
@@ -28,7 +28,7 @@
CheckedModeHelpers();
/// All the checked mode helpers.
- static const List<CheckedModeHelper> helpers = const <CheckedModeHelper>[
- const CheckedModeHelper('boolConversionCheck'),
+ static const List<CheckedModeHelper> helpers = <CheckedModeHelper>[
+ CheckedModeHelper('boolConversionCheck'),
];
}
diff --git a/pkg/compiler/lib/src/js_backend/codegen_listener.dart b/pkg/compiler/lib/src/js_backend/codegen_listener.dart
index f033b01..fe62f76 100644
--- a/pkg/compiler/lib/src/js_backend/codegen_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen_listener.dart
@@ -51,7 +51,7 @@
@override
WorldImpact registerClosurizedMember(FunctionEntity element) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl impactBuilder = WorldImpactBuilderImpl();
impactBuilder
.addImpact(_impacts.memberClosure.createImpact(_elementEnvironment));
FunctionType type = _elementEnvironment.getFunctionType(element);
@@ -72,7 +72,7 @@
@override
void registerInstantiatedType(InterfaceType type,
- {bool isGlobal: false, bool nativeUsage: false}) {
+ {bool isGlobal = false, bool nativeUsage = false}) {
if (nativeUsage) {
_nativeEnqueuer.onInstantiatedType(type);
}
@@ -80,19 +80,19 @@
/// Computes the [WorldImpact] of calling [mainMethod] as the entry point.
WorldImpact _computeMainImpact(FunctionEntity mainMethod) {
- WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl mainImpact = WorldImpactBuilderImpl();
CallStructure callStructure = mainMethod.parameterStructure.callStructure;
if (callStructure.argumentCount > 0) {
_impacts.mainWithArguments
.registerImpact(mainImpact, _elementEnvironment);
- mainImpact.registerStaticUse(
- new StaticUse.staticInvoke(mainMethod, callStructure));
+ mainImpact
+ .registerStaticUse(StaticUse.staticInvoke(mainMethod, callStructure));
}
if (mainMethod.isGetter) {
- mainImpact.registerStaticUse(new StaticUse.staticGet(mainMethod));
+ mainImpact.registerStaticUse(StaticUse.staticGet(mainMethod));
} else {
mainImpact.registerStaticUse(
- new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
+ StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
}
return mainImpact;
}
@@ -123,7 +123,7 @@
// TODO(fishythefish): Avoid registering unnecessary impacts.
if (!_isNewRtiUsed) {
- WorldImpactBuilderImpl newRtiImpact = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl newRtiImpact = WorldImpactBuilderImpl();
newRtiImpact.registerStaticUse(StaticUse.staticInvoke(
_commonElements.rtiAddRulesMethod, CallStructure.TWO_ARGS));
newRtiImpact.registerStaticUse(StaticUse.staticInvoke(
@@ -166,7 +166,7 @@
if (constant.isFunction) {
FunctionConstantValue function = constant;
impactBuilder
- .registerStaticUse(new StaticUse.staticTearOff(function.element));
+ .registerStaticUse(StaticUse.staticTearOff(function.element));
} else if (constant.isInterceptor) {
// An interceptor constant references the class's prototype chain.
InterceptorConstantValue interceptor = constant;
@@ -175,7 +175,7 @@
_elementEnvironment.getThisType(cls), impactBuilder);
} else if (constant.isType) {
impactBuilder
- .registerTypeUse(new TypeUse.instantiation(_commonElements.typeType));
+ .registerTypeUse(TypeUse.instantiation(_commonElements.typeType));
// If the type is a web component, we need to ensure the constructors are
// available to 'upgrade' the native object.
TypeConstantValue type = constant;
@@ -185,7 +185,7 @@
}
} else if (constant is InstantiationConstantValue) {
// TODO(johnniwinther): Register these using `BackendImpact`.
- impactBuilder.registerTypeUse(new TypeUse.instantiation(
+ impactBuilder.registerTypeUse(TypeUse.instantiation(
_elementEnvironment.getThisType(_commonElements
.getInstantiationClass(constant.typeArguments.length))));
@@ -200,10 +200,10 @@
void _computeImpactForInstantiatedConstantType(
DartType type, WorldImpactBuilder impactBuilder) {
if (type is InterfaceType) {
- impactBuilder.registerTypeUse(new TypeUse.instantiation(type));
+ impactBuilder.registerTypeUse(TypeUse.instantiation(type));
if (_rtiNeed.classNeedsTypeArguments(type.element)) {
FunctionEntity helper = _commonElements.setArrayType;
- impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
+ impactBuilder.registerStaticUse(StaticUse.staticInvoke(
helper, helper.parameterStructure.callStructure));
}
if (type.element == _commonElements.typeLiteralClass) {
@@ -217,15 +217,15 @@
@override
WorldImpact registerUsedConstant(ConstantValue constant) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl impactBuilder = WorldImpactBuilderImpl();
_computeImpactForCompileTimeConstant(
- constant, impactBuilder, new LinkedHashSet.identity());
+ constant, impactBuilder, LinkedHashSet.identity());
return impactBuilder;
}
@override
WorldImpact registerUsedElement(MemberEntity member) {
- WorldImpactBuilderImpl worldImpact = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl worldImpact = WorldImpactBuilderImpl();
_customElementsAnalysis.registerStaticUse(member);
if (member.isFunction && member.isInstanceMember) {
@@ -241,14 +241,14 @@
}
WorldImpact _processClass(ClassEntity cls) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl impactBuilder = WorldImpactBuilderImpl();
if (cls == _commonElements.closureClass) {
_impacts.closureClass.registerImpact(impactBuilder, _elementEnvironment);
}
void registerInstantiation(ClassEntity cls) {
impactBuilder.registerTypeUse(
- new TypeUse.instantiation(_elementEnvironment.getRawType(cls)));
+ TypeUse.instantiation(_elementEnvironment.getRawType(cls)));
}
if (cls == _commonElements.stringClass ||
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
index b05bc22..7c90ccd 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -22,9 +22,11 @@
import 'runtime_types_new.dart' show RecipeEncoder;
import 'runtime_types_resolution.dart';
-typedef jsAst.Expression _ConstantReferenceGenerator(ConstantValue constant);
+typedef _ConstantReferenceGenerator = jsAst.Expression Function(
+ ConstantValue constant);
-typedef jsAst.Expression _ConstantListGenerator(jsAst.Expression array);
+typedef _ConstantListGenerator = jsAst.Expression Function(
+ jsAst.Expression array);
/// Visitor that creates [jsAst.Expression]s for constants that are inlined
/// and therefore can be created during modular code generation.
@@ -54,15 +56,15 @@
@override
jsAst.Expression visitNull(NullConstantValue constant, [_]) {
- return new jsAst.LiteralNull();
+ return jsAst.LiteralNull();
}
@override
jsAst.Expression visitNonConstant(NonConstantValue constant, [_]) {
- return new jsAst.LiteralNull();
+ return jsAst.LiteralNull();
}
- static final _exponentialRE = new RegExp('^'
+ static final _exponentialRE = RegExp('^'
'\([-+]?\)' // 1: sign
'\([0-9]+\)' // 2: leading digit(s)
'\(\.\([0-9]*\)\)?' // 4: fraction digits
@@ -101,14 +103,14 @@
String representation = value.toString();
String alternative = null;
int cutoff = _options.enableMinification ? 10000 : 1e10.toInt();
- if (value.abs() >= new BigInt.from(cutoff)) {
+ if (value.abs() >= BigInt.from(cutoff)) {
alternative = _shortenExponentialRepresentation(
value.toDouble().toStringAsExponential());
}
if (alternative != null && alternative.length < representation.length) {
representation = alternative;
}
- return new jsAst.LiteralNumber(representation);
+ return jsAst.LiteralNumber(representation);
}
@override
@@ -122,7 +124,7 @@
return js("-1/0");
} else {
String shortened = _shortenExponentialRepresentation("$value");
- return new jsAst.LiteralNumber(shortened);
+ return jsAst.LiteralNumber(shortened);
}
}
@@ -156,7 +158,7 @@
@override
jsAst.Expression visitDummyInterceptor(DummyInterceptorConstantValue constant,
[_]) {
- return new jsAst.LiteralNumber('0');
+ return jsAst.LiteralNumber('0');
}
@override
@@ -215,7 +217,7 @@
// Matches blank lines, comment lines and trailing comments that can't be part
// of a string.
static final RegExp COMMENT_RE =
- new RegExp(r'''^ *(//.*)?\n| *//[^''"\n]*$''', multiLine: true);
+ RegExp(r'''^ *(//.*)?\n| *//[^''"\n]*$''', multiLine: true);
final JCommonElements _commonElements;
final JElementEnvironment _elementEnvironment;
@@ -247,7 +249,7 @@
List<jsAst.Expression> elements = constant.entries
.map(_constantReferenceGenerator)
.toList(growable: false);
- jsAst.ArrayInitializer array = new jsAst.ArrayInitializer(elements);
+ jsAst.ArrayInitializer array = jsAst.ArrayInitializer(elements);
jsAst.Expression value = _makeConstantList(array);
return maybeAddListTypeArgumentsNewRti(constant, constant.type, value);
}
@@ -272,7 +274,7 @@
}
jsAst.Expression constructor = _emitter.constructorAccess(classElement);
- return new jsAst.New(constructor, arguments);
+ return jsAst.New(constructor, arguments);
}
@override
@@ -291,9 +293,9 @@
jsAst.Literal keyExpression = js.string(key.stringValue);
jsAst.Expression valueExpression =
_constantReferenceGenerator(constant.values[i]);
- properties.add(new jsAst.Property(keyExpression, valueExpression));
+ properties.add(jsAst.Property(keyExpression, valueExpression));
}
- return new jsAst.ObjectInitializer(properties);
+ return jsAst.ObjectInitializer(properties);
}
jsAst.Expression jsGeneralMap() {
@@ -306,7 +308,7 @@
data.add(keyExpression);
data.add(valueExpression);
}
- return new jsAst.ArrayInitializer(data);
+ return jsAst.ArrayInitializer(data);
}
ClassEntity classElement = constant.type.element;
@@ -322,7 +324,7 @@
if (_fieldAnalysis.getFieldData(field).isElided) return;
if (field.name == constant_system.JavaScriptMapConstant.LENGTH_NAME) {
arguments
- .add(new jsAst.LiteralNumber('${constant.keyList.entries.length}'));
+ .add(jsAst.LiteralNumber('${constant.keyList.entries.length}'));
} else if (field.name ==
constant_system.JavaScriptMapConstant.JS_OBJECT_NAME) {
arguments.add(jsMap());
@@ -352,7 +354,7 @@
}
jsAst.Expression constructor = _emitter.constructorAccess(classElement);
- jsAst.Expression value = new jsAst.New(constructor, arguments);
+ jsAst.Expression value = jsAst.New(constructor, arguments);
return value;
}
@@ -390,7 +392,7 @@
if (element == _commonElements.jsConstClass) {
StringConstantValue str = constant.fields.values.single;
String value = str.stringValue;
- return new jsAst.LiteralExpression(stripComments(value));
+ return jsAst.LiteralExpression(stripComments(value));
}
jsAst.Expression constructor =
_emitter.constructorAccess(constant.type.element);
@@ -405,7 +407,7 @@
if (_rtiNeed.classNeedsTypeArguments(constant.type.element)) {
fields.add(_reifiedTypeNewRti(constant.type));
}
- return new jsAst.New(constructor, fields);
+ return jsAst.New(constructor, fields);
}
@override
@@ -419,7 +421,7 @@
fields.add(_reifiedTypeNewRti(
_commonElements.dartTypes.interfaceType(cls, constant.typeArguments)));
jsAst.Expression constructor = _emitter.constructorAccess(cls);
- return new jsAst.New(constructor, fields);
+ return jsAst.New(constructor, fields);
}
String stripComments(String rawJavaScript) {
@@ -430,7 +432,7 @@
ConstantValue constant, InterfaceType type, jsAst.Expression value) {
assert(type.element == _commonElements.jsArrayClass);
if (_rtiNeed.classNeedsTypeArguments(type.element)) {
- return new jsAst.Call(getHelperProperty(_commonElements.setArrayType),
+ return jsAst.Call(getHelperProperty(_commonElements.setArrayType),
[value, _reifiedTypeNewRti(type)]);
}
return value;
diff --git a/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart b/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
index 3642a24..d84d9a5 100644
--- a/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
@@ -89,7 +89,7 @@
CommonElements commonElements,
NativeBasicData nativeData,
BackendUsageBuilder backendUsageBuilder)
- : join = new CustomElementsAnalysisJoin(
+ : join = CustomElementsAnalysisJoin(
elementEnvironment, commonElements, nativeData,
backendUsageBuilder: backendUsageBuilder),
super(elementEnvironment, commonElements, nativeData) {
@@ -123,7 +123,7 @@
CustomElementsCodegenAnalysis(CommonElements commonElements,
ElementEnvironment elementEnvironment, NativeBasicData nativeData)
- : join = new CustomElementsAnalysisJoin(
+ : join = CustomElementsAnalysisJoin(
elementEnvironment, commonElements, nativeData),
super(elementEnvironment, commonElements, nativeData) {
// TODO(sra): Remove this work-around. We should mark allClassesSelected in
@@ -154,14 +154,14 @@
final bool forResolution;
- final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder();
+ final StagedWorldImpactBuilder impactBuilder = StagedWorldImpactBuilder();
// Classes that are candidates for needing constructors. Classes are moved to
// [activeClasses] when we know they need constructors.
- final Set<ClassEntity> instantiatedClasses = new Set<ClassEntity>();
+ final Set<ClassEntity> instantiatedClasses = Set<ClassEntity>();
// Classes explicitly named.
- final Set<ClassEntity> selectedClasses = new Set<ClassEntity>();
+ final Set<ClassEntity> selectedClasses = Set<ClassEntity>();
// True if we must conservatively include all extension classes.
bool allClassesSelected = false;
@@ -170,7 +170,7 @@
bool demanded = false;
// ClassesOutput: classes requiring metadata.
- final Set<ClassEntity> activeClasses = new Set<ClassEntity>();
+ final Set<ClassEntity> activeClasses = Set<ClassEntity>();
CustomElementsAnalysisJoin(
this._elementEnvironment, this._commonElements, this._nativeData,
@@ -180,7 +180,7 @@
WorldImpact flush() {
if (!demanded) return const WorldImpact();
- var newActiveClasses = new Set<ClassEntity>();
+ var newActiveClasses = Set<ClassEntity>();
for (ClassEntity cls in instantiatedClasses) {
bool isNative = _nativeData.isNativeClass(cls);
bool isExtension = !isNative && _nativeData.isNativeOrExtendsNative(cls);
@@ -193,8 +193,8 @@
Iterable<ConstructorEntity> escapingConstructors =
computeEscapingConstructors(cls);
for (ConstructorEntity constructor in escapingConstructors) {
- impactBuilder.registerStaticUse(new StaticUse.constructorInvoke(
- constructor, CallStructure.NO_ARGS));
+ impactBuilder.registerStaticUse(
+ StaticUse.constructorInvoke(constructor, CallStructure.NO_ARGS));
}
if (forResolution) {
escapingConstructors
@@ -203,8 +203,7 @@
// Force the generation of the type constant that is the key to an entry
// in the generated table.
ConstantValue constant = _makeTypeConstant(cls);
- impactBuilder
- .registerConstantUse(new ConstantUse.customElements(constant));
+ impactBuilder.registerConstantUse(ConstantUse.customElements(constant));
}
}
activeClasses.addAll(newActiveClasses);
diff --git a/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart b/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart
index 89f0c0e..3df93c3 100644
--- a/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart
+++ b/pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart
@@ -883,7 +883,7 @@
}
final List<String> userGlobalObjects =
- new List.from(Namer.reservedGlobalObjectNames)
+ List.from(Namer.reservedGlobalObjectNames)
..remove('C')
..remove('H')
..remove('J')
diff --git a/pkg/compiler/lib/src/js_backend/enqueuer.dart b/pkg/compiler/lib/src/js_backend/enqueuer.dart
index 51740c4..7d5e4d7 100644
--- a/pkg/compiler/lib/src/js_backend/enqueuer.dart
+++ b/pkg/compiler/lib/src/js_backend/enqueuer.dart
@@ -32,7 +32,7 @@
/// [Enqueuer] which is specific to code generation.
class CodegenEnqueuer extends EnqueuerImpl {
final String name;
- Set<ClassEntity> _recentClasses = new Setlet<ClassEntity>();
+ Set<ClassEntity> _recentClasses = Setlet<ClassEntity>();
bool _recentConstants = false;
final CodegenWorldBuilderImpl _worldBuilder;
final WorkItemBuilder _workItemBuilder;
@@ -47,22 +47,21 @@
WorldImpactVisitor _impactVisitor;
- final Queue<WorkItem> _queue = new Queue<WorkItem>();
+ final Queue<WorkItem> _queue = Queue<WorkItem>();
/// All declaration elements that have been processed by codegen.
- final Set<MemberEntity> _processedEntities = new Set<MemberEntity>();
+ final Set<MemberEntity> _processedEntities = Set<MemberEntity>();
// If not `null` this is called when the queue has been emptied. It allows for
// applying additional impacts before re-emptying the queue.
void Function() onEmptyForTesting;
- static const ImpactUseCase IMPACT_USE =
- const ImpactUseCase('CodegenEnqueuer');
+ static const ImpactUseCase IMPACT_USE = ImpactUseCase('CodegenEnqueuer');
CodegenEnqueuer(this.task, this._worldBuilder, this._workItemBuilder,
this.listener, this._annotationsData)
: this.name = 'codegen enqueuer' {
- _impactVisitor = new EnqueuerImplImpactVisitor(this);
+ _impactVisitor = EnqueuerImplImpactVisitor(this);
}
@override
@@ -106,7 +105,7 @@
}
void _registerInstantiatedType(InterfaceType type,
- {bool nativeUsage: false}) {
+ {bool nativeUsage = false}) {
task.measureSubtask('codegen.typeUse', () {
_worldBuilder.registerTypeInstantiation(type, _applyClassUse);
listener.registerInstantiatedType(type, nativeUsage: nativeUsage);
@@ -172,7 +171,7 @@
switch (staticUse.kind) {
case StaticUseKind.CONSTRUCTOR_INVOKE:
case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
- processTypeUse(member, new TypeUse.instantiation(staticUse.type));
+ processTypeUse(member, TypeUse.instantiation(staticUse.type));
break;
case StaticUseKind.INLINING:
// TODO(johnniwinther): Should this be tracked with _MemberUsage ?
diff --git a/pkg/compiler/lib/src/js_backend/field_analysis.dart b/pkg/compiler/lib/src/js_backend/field_analysis.dart
index 8b56213..4ff7751 100644
--- a/pkg/compiler/lib/src/js_backend/field_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/field_analysis.dart
@@ -69,7 +69,7 @@
requireConstant: false, implicitNull: true);
}
if (value != null && value.isConstant) {
- fieldData[fieldElement] = new AllocatorData(value);
+ fieldData[fieldElement] = AllocatorData(value);
}
}
@@ -95,7 +95,7 @@
staticTypeContext, value,
requireConstant: false, implicitNull: true);
if (constantValue != null && constantValue.isConstant) {
- initializerValue = new Initializer.direct(constantValue);
+ initializerValue = Initializer.direct(constantValue);
} else if (value is ir.VariableGet) {
ir.VariableDeclaration parameter = value.variable;
int position =
@@ -107,7 +107,7 @@
requireConstant: false, implicitNull: true);
if (constantValue != null && constantValue.isConstant) {
initializerValue =
- new Initializer.positional(position, constantValue);
+ Initializer.positional(position, constantValue);
}
}
} else {
@@ -119,7 +119,7 @@
requireConstant: false, implicitNull: true);
if (constantValue != null && constantValue.isConstant) {
initializerValue =
- new Initializer.named(parameter.name, constantValue);
+ Initializer.named(parameter.name, constantValue);
}
}
}
@@ -128,7 +128,7 @@
}
}
}
- _classData[class_] = new ClassData(constructors, fieldData);
+ _classData[class_] = ClassData(constructors, fieldData);
}
void registerStaticField(KField field, EvaluationComplexity complexity) {
@@ -149,7 +149,7 @@
}
// TODO(johnniwinther): Remove evaluation of constant when [complexity]
// holds the constant literal from CFE.
- _staticFieldData[field] = new StaticFieldData(value, complexity);
+ _staticFieldData[field] = StaticFieldData(value, complexity);
}
AllocatorData getAllocatorDataForTesting(KField field) {
@@ -232,7 +232,7 @@
case InitializerKind.complex:
return '?';
}
- throw new UnsupportedError('Unexpected kind $kind');
+ throw UnsupportedError('Unexpected kind $kind');
}
@override
@@ -255,9 +255,9 @@
DataSource source, CompilerOptions options) {
source.begin(tag);
Map<FieldEntity, FieldAnalysisData> fieldData = source.readMemberMap(
- (MemberEntity member) => new FieldAnalysisData.fromDataSource(source));
+ (MemberEntity member) => FieldAnalysisData.fromDataSource(source));
source.end(tag);
- return new JFieldAnalysis._(fieldData);
+ return JFieldAnalysis._(fieldData);
}
/// Serializes this [JFieldAnalysis] to [sink].
@@ -379,7 +379,7 @@
// because of deferred loading.
isInitializedInAllocator = true;
}
- fieldData[jField] = new FieldAnalysisData(
+ fieldData[jField] = FieldAnalysisData(
initialValue: value,
isEffectivelyFinal: isEffectivelyConstant,
isElided: isEffectivelyConstant,
@@ -526,7 +526,7 @@
}
}
- data = fieldData[jField] = new FieldAnalysisData(
+ data = fieldData[jField] = FieldAnalysisData(
initialValue: value,
isEffectivelyFinal: isEffectivelyFinal,
isElided: isElided,
@@ -562,7 +562,7 @@
dependentFields.forEach(processField);
- return new JFieldAnalysis._(fieldData);
+ return JFieldAnalysis._(fieldData);
}
// TODO(sra): Add way to let injected fields be initialized to a constant in
@@ -595,12 +595,12 @@
const FieldAnalysisData(
{this.initialValue,
- this.isInitializedInAllocator: false,
- this.isEffectivelyFinal: false,
- this.isElided: false,
- this.isEager: false,
- this.eagerCreationIndex: null,
- this.eagerFieldDependenciesForTesting: null});
+ this.isInitializedInAllocator = false,
+ this.isEffectivelyFinal = false,
+ this.isElided = false,
+ this.isEager = false,
+ this.eagerCreationIndex = null,
+ this.eagerFieldDependenciesForTesting = null});
factory FieldAnalysisData.fromDataSource(DataSource source) {
source.begin(tag);
@@ -614,7 +614,7 @@
List<FieldEntity> eagerFieldDependencies =
source.readMembers<FieldEntity>(emptyAsNull: true);
source.end(tag);
- return new FieldAnalysisData(
+ return FieldAnalysisData(
initialValue: initialValue,
isInitializedInAllocator: isInitializedInAllocator,
isEffectivelyFinal: isEffectivelyFinal,
diff --git a/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart b/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart
index f31ef40..7f624d1 100644
--- a/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart
+++ b/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart
@@ -15,15 +15,15 @@
// will return `null` and a normal field name has to be used.
jsAst.Name _minifiedInstanceFieldPropertyName(FieldEntity element) {
if (_nativeData.hasFixedBackendName(element)) {
- return new StringBackedName(_nativeData.getFixedBackendName(element));
+ return StringBackedName(_nativeData.getFixedBackendName(element));
}
_FieldNamingScope names;
if (element is JRecordField) {
- names = new _FieldNamingScope.forBox(element.box, fieldRegistry);
+ names = _FieldNamingScope.forBox(element.box, fieldRegistry);
} else {
ClassEntity cls = element.enclosingClass;
- names = new _FieldNamingScope.forClass(cls, _closedWorld, fieldRegistry);
+ names = _FieldNamingScope.forClass(cls, _closedWorld, fieldRegistry);
}
if (names.containsField(element)) {
@@ -69,7 +69,7 @@
if (index < MinifyNamer._reservedNativeProperties.length &&
MinifyNamer._reservedNativeProperties[index].length <= 2) {
nameStore.add(
- new StringBackedName(MinifyNamer._reservedNativeProperties[index]));
+ StringBackedName(MinifyNamer._reservedNativeProperties[index]));
} else {
nameStore.add(namer.getFreshName(namer.instanceScope, "field$index"));
}
@@ -144,7 +144,7 @@
factory _FieldNamingScope.forBox(Local box, _FieldNamingRegistry registry) {
return registry.scopes
- .putIfAbsent(box, () => new _BoxFieldNamingScope(box, registry));
+ .putIfAbsent(box, () => _BoxFieldNamingScope(box, registry));
}
_FieldNamingScope.rootScope(this.container, this.registry)
@@ -208,7 +208,7 @@
@override
jsAst.Name _nextName() {
jsAst.Name proposed = super._nextName();
- return new CompoundName([proposed, Namer._literalDollar]);
+ return CompoundName([proposed, Namer._literalDollar]);
}
}
diff --git a/pkg/compiler/lib/src/js_backend/frequency_namer.dart b/pkg/compiler/lib/src/js_backend/frequency_namer.dart
index cfa4155..e45e54a 100644
--- a/pkg/compiler/lib/src/js_backend/frequency_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/frequency_namer.dart
@@ -18,27 +18,27 @@
FrequencyBasedNamer(JClosedWorld closedWorld, FixedNames fixedNames)
: super(closedWorld, fixedNames) {
- fieldRegistry = new _FieldNamingRegistry(this);
+ fieldRegistry = _FieldNamingRegistry(this);
}
TokenScope newScopeFor(NamingScope scope) {
if (scope == instanceScope) {
- Set<String> illegalNames = new Set<String>.from(jsReserved);
+ Set<String> illegalNames = Set<String>.from(jsReserved);
for (String illegal in MinifyNamer._reservedNativeProperties) {
illegalNames.add(illegal);
if (MinifyNamer._hasBannedPrefix(illegal)) {
illegalNames.add(illegal.substring(1));
}
}
- return new TokenScope(illegalNames: illegalNames);
+ return TokenScope(illegalNames: illegalNames);
} else {
- return new TokenScope(illegalNames: jsReserved);
+ return TokenScope(illegalNames: jsReserved);
}
}
@override
jsAst.Name getFreshName(NamingScope scope, String proposedName,
- {bool sanitizeForNatives: false, bool sanitizeForAnnotations: false}) {
+ {bool sanitizeForNatives = false, bool sanitizeForAnnotations = false}) {
// Grab the scope for this token
TokenScope tokenScope =
_tokenScopes.putIfAbsent(scope, () => newScopeFor(scope));
@@ -48,7 +48,7 @@
sanitizeForNatives: sanitizeForNatives,
sanitizeForAnnotations: sanitizeForAnnotations);
- TokenName name = new TokenName(tokenScope, proposed);
+ TokenName name = TokenName(tokenScope, proposed);
tokens.add(name);
return name;
}
@@ -82,7 +82,7 @@
List<int> _nextName;
final Set<String> illegalNames;
- TokenScope({this.illegalNames = const {}, this.initialChar: $a}) {
+ TokenScope({this.illegalNames = const {}, this.initialChar = $a}) {
_nextName = [initialChar];
}
@@ -125,7 +125,7 @@
String getNextName() {
String proposal;
do {
- proposal = new String.fromCharCodes(_nextName);
+ proposal = String.fromCharCodes(_nextName);
_incrementName();
} while (MinifyNamer._hasBannedPrefix(proposal) ||
illegalNames.contains(proposal));
diff --git a/pkg/compiler/lib/src/js_backend/impact_transformer.dart b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
index a51c0d0..6427bee 100644
--- a/pkg/compiler/lib/src/js_backend/impact_transformer.dart
+++ b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
@@ -62,8 +62,7 @@
@override
WorldImpact transformResolutionImpact(ResolutionImpact worldImpact) {
- TransformedWorldImpact transformed =
- new TransformedWorldImpact(worldImpact);
+ TransformedWorldImpact transformed = TransformedWorldImpact(worldImpact);
void registerImpact(BackendImpact impact) {
impact.registerImpact(transformed, _elementEnvironment);
@@ -95,8 +94,8 @@
break;
case Feature.FIELD_WITHOUT_INITIALIZER:
case Feature.LOCAL_WITHOUT_INITIALIZER:
- transformed.registerTypeUse(
- new TypeUse.instantiation(_commonElements.nullType));
+ transformed
+ .registerTypeUse(TypeUse.instantiation(_commonElements.nullType));
registerImpact(_impacts.nullLiteral);
break;
case Feature.LAZY_FIELD:
@@ -213,7 +212,7 @@
if (hasTypeLiteral) {
transformed
- .registerTypeUse(new TypeUse.instantiation(_commonElements.typeType));
+ .registerTypeUse(TypeUse.instantiation(_commonElements.typeType));
registerImpact(_impacts.typeLiteral);
}
@@ -223,8 +222,7 @@
if (mapLiteralUse.isConstant) {
registerImpact(_impacts.constantMapLiteral);
} else {
- transformed
- .registerTypeUse(new TypeUse.instantiation(mapLiteralUse.type));
+ transformed.registerTypeUse(TypeUse.instantiation(mapLiteralUse.type));
}
}
@@ -232,16 +230,14 @@
if (setLiteralUse.isConstant) {
registerImpact(_impacts.constantSetLiteral);
} else {
- transformed
- .registerTypeUse(new TypeUse.instantiation(setLiteralUse.type));
+ transformed.registerTypeUse(TypeUse.instantiation(setLiteralUse.type));
}
}
for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) {
// TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when
// factory constructors are registered directly.
- transformed
- .registerTypeUse(new TypeUse.instantiation(listLiteralUse.type));
+ transformed.registerTypeUse(TypeUse.instantiation(listLiteralUse.type));
}
for (RuntimeTypeUse runtimeTypeUse in worldImpact.runtimeTypeUses) {
@@ -398,7 +394,7 @@
}
WorldImpact transformCodegenImpact(CodegenImpact impact) {
- TransformedWorldImpact transformed = new TransformedWorldImpact(impact);
+ TransformedWorldImpact transformed = TransformedWorldImpact(impact);
for (TypeUse typeUse in impact.typeUses) {
DartType type = typeUse.type;
diff --git a/pkg/compiler/lib/src/js_backend/inferred_data.dart b/pkg/compiler/lib/src/js_backend/inferred_data.dart
index b84035c..a432c15 100644
--- a/pkg/compiler/lib/src/js_backend/inferred_data.dart
+++ b/pkg/compiler/lib/src/js_backend/inferred_data.dart
@@ -19,9 +19,9 @@
DataSource source, JClosedWorld closedWorld) {
bool isTrivial = source.readBool();
if (isTrivial) {
- return new TrivialInferredData();
+ return TrivialInferredData();
} else {
- return new InferredDataImpl.readFromDataSource(source, closedWorld);
+ return InferredDataImpl.readFromDataSource(source, closedWorld);
}
}
@@ -104,7 +104,7 @@
source.begin(tag);
Set<MemberEntity> functionsCalledInLoop = source.readMembers().toSet();
Map<FunctionEntity, SideEffects> sideEffects = source.readMemberMap(
- (MemberEntity member) => new SideEffects.readFromDataSource(source));
+ (MemberEntity member) => SideEffects.readFromDataSource(source));
Set<FunctionEntity> sideEffectsFreeElements =
source.readMembers<FunctionEntity>().toSet();
Set<FunctionEntity> elementsThatCannotThrow =
@@ -112,7 +112,7 @@
Set<FunctionEntity> functionsThatMightBePassedToApply =
source.readMembers<FunctionEntity>().toSet();
source.end(tag);
- return new InferredDataImpl(
+ return InferredDataImpl(
closedWorld,
functionsCalledInLoop,
sideEffects,
@@ -142,9 +142,9 @@
// We're not tracking side effects of closures.
if (selector.isClosureCall ||
_closedWorld.includesClosureCall(selector, receiver)) {
- return new SideEffects();
+ return SideEffects();
}
- SideEffects sideEffects = new SideEffects.empty();
+ SideEffects sideEffects = SideEffects.empty();
for (MemberEntity e in _closedWorld.locateMembers(selector, receiver)) {
if (e.isField) {
if (selector.isGetter) {
@@ -175,7 +175,7 @@
return _sideEffects.putIfAbsent(element, _makeSideEffects);
}
- static SideEffects _makeSideEffects() => new SideEffects();
+ static SideEffects _makeSideEffects() => SideEffects();
@override
bool isCalledInLoop(MemberEntity element) {
@@ -205,20 +205,17 @@
}
class InferredDataBuilderImpl implements InferredDataBuilder {
- final Set<MemberEntity> _functionsCalledInLoop = new Set<MemberEntity>();
+ final Set<MemberEntity> _functionsCalledInLoop = Set<MemberEntity>();
Map<MemberEntity, SideEffectsBuilder> _sideEffectsBuilders =
<MemberEntity, SideEffectsBuilder>{};
- final Set<FunctionEntity> prematureSideEffectAccesses =
- new Set<FunctionEntity>();
+ final Set<FunctionEntity> prematureSideEffectAccesses = Set<FunctionEntity>();
- final Set<FunctionEntity> _sideEffectsFreeElements =
- new Set<FunctionEntity>();
+ final Set<FunctionEntity> _sideEffectsFreeElements = Set<FunctionEntity>();
- final Set<FunctionEntity> _elementsThatCannotThrow =
- new Set<FunctionEntity>();
+ final Set<FunctionEntity> _elementsThatCannotThrow = Set<FunctionEntity>();
final Set<FunctionEntity> _functionsThatMightBePassedToApply =
- new Set<FunctionEntity>();
+ Set<FunctionEntity>();
InferredDataBuilderImpl(AnnotationsData annotationsData) {
annotationsData.forEachNoThrows(registerCannotThrow);
@@ -227,14 +224,14 @@
@override
SideEffectsBuilder getSideEffectsBuilder(MemberEntity member) {
- return _sideEffectsBuilders[member] ??= new SideEffectsBuilder(member);
+ return _sideEffectsBuilders[member] ??= SideEffectsBuilder(member);
}
@override
void registerSideEffectsFree(FunctionEntity element) {
_sideEffectsFreeElements.add(element);
assert(!_sideEffectsBuilders.containsKey(element));
- _sideEffectsBuilders[element] = new SideEffectsBuilder.free(element);
+ _sideEffectsBuilders[element] = SideEffectsBuilder.free(element);
}
/// Compute [SideEffects] for all registered [SideEffectBuilder]s.
@@ -252,7 +249,7 @@
}
_sideEffectsBuilders = null;
- return new InferredDataImpl(
+ return InferredDataImpl(
closedWorld,
_functionsCalledInLoop,
_sideEffects,
@@ -263,8 +260,8 @@
static void emptyWorkList(Iterable<SideEffectsBuilder> sideEffectsBuilders) {
// TODO(johnniwinther): Optimize this algorithm.
- Queue<SideEffectsBuilder> queue = new Queue<SideEffectsBuilder>();
- Set<SideEffectsBuilder> inQueue = new Set<SideEffectsBuilder>();
+ Queue<SideEffectsBuilder> queue = Queue<SideEffectsBuilder>();
+ Set<SideEffectsBuilder> inQueue = Set<SideEffectsBuilder>();
for (SideEffectsBuilder builder in sideEffectsBuilders) {
queue.addLast(builder);
@@ -305,7 +302,7 @@
}
class TrivialInferredData implements InferredData {
- final SideEffects _allSideEffects = new SideEffects();
+ final SideEffects _allSideEffects = SideEffects();
@override
void writeToDataSink(DataSink sink) {
diff --git a/pkg/compiler/lib/src/js_backend/interceptor_data.dart b/pkg/compiler/lib/src/js_backend/interceptor_data.dart
index e92b0ce..11340cd 100644
--- a/pkg/compiler/lib/src/js_backend/interceptor_data.dart
+++ b/pkg/compiler/lib/src/js_backend/interceptor_data.dart
@@ -98,12 +98,12 @@
/// These members must be invoked with a correct explicit receiver even when
/// the receiver is not an intercepted class.
final Map<String, Set<MemberEntity>> _interceptedMixinElements =
- new Map<String, Set<MemberEntity>>();
+ Map<String, Set<MemberEntity>>();
final Map<String, Set<ClassEntity>> _interceptedClassesCache =
- new Map<String, Set<ClassEntity>>();
+ Map<String, Set<ClassEntity>>();
- final Set<ClassEntity> _noClasses = new Set<ClassEntity>();
+ final Set<ClassEntity> _noClasses = Set<ClassEntity>();
InterceptorDataImpl(
this._nativeData,
@@ -126,12 +126,8 @@
Set<ClassEntity> classesMixedIntoInterceptedClasses =
source.readClasses().toSet();
source.end(tag);
- return new InterceptorDataImpl(
- nativeData,
- commonElements,
- interceptedMembers,
- interceptedClasses,
- classesMixedIntoInterceptedClasses);
+ return InterceptorDataImpl(nativeData, commonElements, interceptedMembers,
+ interceptedClasses, classesMixedIntoInterceptedClasses);
}
@override
@@ -224,7 +220,7 @@
return _interceptedClassesCache.putIfAbsent(name, () {
// Populate the cache by running through all the elements and
// determine if the given selector applies to them.
- Set<ClassEntity> result = new Set<ClassEntity>();
+ Set<ClassEntity> result = Set<ClassEntity>();
for (MemberEntity element in intercepted) {
ClassEntity classElement = element.enclosingClass;
if (_isCompileTimeOnlyClass(classElement)) continue;
@@ -250,7 +246,7 @@
closedWorld.classHierarchy.forEachStrictSubclassOf(use,
(ClassEntity subclass) {
if (_nativeData.isNativeOrExtendsNative(subclass)) {
- if (result == null) result = new Set<ClassEntity>();
+ if (result == null) result = Set<ClassEntity>();
result.add(subclass);
}
return IterationStep.CONTINUE;
@@ -298,20 +294,20 @@
<String, Set<MemberEntity>>{};
/// Set of classes whose methods are intercepted.
- final Set<ClassEntity> _interceptedClasses = new Set<ClassEntity>();
+ final Set<ClassEntity> _interceptedClasses = Set<ClassEntity>();
/// Set of classes used as mixins on intercepted (native and primitive)
/// classes. Methods on these classes might also be mixed in to regular Dart
/// (unintercepted) classes.
final Set<ClassEntity> _classesMixedIntoInterceptedClasses =
- new Set<ClassEntity>();
+ Set<ClassEntity>();
InterceptorDataBuilderImpl(
this._nativeData, this._elementEnvironment, this._commonElements);
@override
InterceptorData close() {
- return new InterceptorDataImpl(
+ return InterceptorDataImpl(
_nativeData,
_commonElements,
_interceptedElements,
@@ -327,7 +323,7 @@
// All methods on [Object] are shadowed by [Interceptor].
if (cls == _commonElements.objectClass) return;
Set<MemberEntity> set =
- _interceptedElements[member.name] ??= new Set<MemberEntity>();
+ _interceptedElements[member.name] ??= Set<MemberEntity>();
set.add(member);
});
@@ -345,7 +341,7 @@
// All methods on [Object] are shadowed by [Interceptor].
if (cls == _commonElements.objectClass) return;
Set<MemberEntity> set =
- _interceptedElements[member.name] ??= new Set<MemberEntity>();
+ _interceptedElements[member.name] ??= Set<MemberEntity>();
set.add(member);
});
}
@@ -391,7 +387,7 @@
Map<String, OneShotInterceptor> interceptors =
_oneShotInterceptors[selector] ??= {};
OneShotInterceptor interceptor =
- interceptors[key] ??= new OneShotInterceptor(key, selector);
+ interceptors[key] ??= OneShotInterceptor(key, selector);
interceptor.classes.addAll(classes);
registerSpecializedGetInterceptor(classes, namer);
return namer.nameForOneShotInterceptor(selector, classes);
@@ -406,7 +402,7 @@
}
String key = suffixForGetInterceptor(_commonElements, _nativeData, classes);
SpecializedGetInterceptor interceptor =
- _specializedGetInterceptors[key] ??= new SpecializedGetInterceptor(key);
+ _specializedGetInterceptors[key] ??= SpecializedGetInterceptor(key);
interceptor.classes.addAll(classes);
}
}
diff --git a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
index 5137d62..b74afb2 100644
--- a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
@@ -27,7 +27,7 @@
int argumentCount = selector.argumentCount;
String candidateParameterNames =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- List<String> parameters = new List<String>.generate(
+ List<String> parameters = List<String>.generate(
argumentCount, (i) => candidateParameterNames[i]);
jsAst.Name name = namer.invocationName(selector);
@@ -37,7 +37,7 @@
}
});
});
- return new jsAst.Block(statements);
+ return jsAst.Block(statements);
}
FunctionType buildJsFunctionType(DartTypes dartTypes) {
@@ -47,7 +47,7 @@
return dartTypes.functionType(
dartTypes.dynamicType(),
const <DartType>[],
- new List<DartType>.filled(16, dartTypes.dynamicType()),
+ List<DartType>.filled(16, dartTypes.dynamicType()),
const <String>[],
const <String>{},
const <DartType>[],
diff --git a/pkg/compiler/lib/src/js_backend/minify_namer.dart b/pkg/compiler/lib/src/js_backend/minify_namer.dart
index 236a687..61d0628 100644
--- a/pkg/compiler/lib/src/js_backend/minify_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/minify_namer.dart
@@ -13,7 +13,7 @@
MinifyNamer(JClosedWorld closedWorld, FixedNames fixedNames)
: super(closedWorld, fixedNames) {
reserveBackendNames();
- fieldRegistry = new _FieldNamingRegistry(this);
+ fieldRegistry = _FieldNamingRegistry(this);
}
@override
@@ -32,7 +32,7 @@
/// minified names will always avoid clashing with annotated names or natives.
@override
String _generateFreshStringForName(String proposedName, NamingScope scope,
- {bool sanitizeForNatives: false, bool sanitizeForAnnotations: false}) {
+ {bool sanitizeForNatives = false, bool sanitizeForAnnotations = false}) {
String freshName;
String suggestion = scope.suggestName(proposedName);
if (suggestion != null && scope.isUnused(suggestion)) {
@@ -48,7 +48,7 @@
// variables) because they clash with names from the DOM. However, it is
// OK to use them as fields, as we only access fields directly if we know
// the receiver type.
- static const List<String> _reservedNativeProperties = const <String>[
+ static const List<String> _reservedNativeProperties = <String>[
'a', 'b', 'c', 'd', 'e', 'f', 'r', 'x', 'y', 'z', 'Q',
// 2-letter:
'ch', 'cx', 'cy', 'db', 'dx', 'dy', 'fr', 'fx', 'fy', 'go', 'id', 'k1',
@@ -184,7 +184,7 @@
do {
assert(c != $Z);
c = (c == $z) ? $A : c + 1;
- letter = new String.fromCharCodes([c]);
+ letter = String.fromCharCodes([c]);
} while (_hasBannedPrefix(letter) || scope.isUsed(letter));
assert(!scope.hasSuggestion(name));
scope.addSuggestion(name, letter);
@@ -214,7 +214,7 @@
codes.add(_alphaNumericNumber(h2));
h2 ~/= ALPHANUMERIC_CHARACTERS;
}
- final candidate = new String.fromCharCodes(codes);
+ final candidate = String.fromCharCodes(codes);
if (scope.isUnused(candidate) &&
!jsReserved.contains(candidate) &&
!_hasBannedPrefix(candidate) &&
@@ -251,14 +251,13 @@
/// Remember bad hashes to avoid using a the same character with long numbers
/// for frequent hashes. For example, `closure` is a very common name.
- Map<int, int> _badNames = new Map<int, int>();
+ Map<int, int> _badNames = Map<int, int>();
/// If we can't find a hash based name in the three-letter space, then base
/// the name on a letter and a counter.
String _badName(int hash, NamingScope scope) {
int count = _badNames.putIfAbsent(hash, () => 0);
- String startLetter =
- new String.fromCharCodes([_letterNumber(hash + count)]);
+ String startLetter = String.fromCharCodes([_letterNumber(hash + count)]);
_badNames[hash] = count + 1;
String name;
int i = 0;
@@ -333,14 +332,14 @@
return registry.putIfAbsent(cls, () {
ClassEntity superclass = environment.getSuperClass(cls);
if (superclass == null) {
- return new _ConstructorBodyNamingScope.rootScope(cls, environment);
+ return _ConstructorBodyNamingScope.rootScope(cls, environment);
} else if (environment.isMixinApplication(cls)) {
- return new _ConstructorBodyNamingScope.forMixinApplication(cls,
- new _ConstructorBodyNamingScope(superclass, registry, environment));
+ return _ConstructorBodyNamingScope.forMixinApplication(cls,
+ _ConstructorBodyNamingScope(superclass, registry, environment));
} else {
- return new _ConstructorBodyNamingScope.forClass(
+ return _ConstructorBodyNamingScope.forClass(
cls,
- new _ConstructorBodyNamingScope(superclass, registry, environment),
+ _ConstructorBodyNamingScope(superclass, registry, environment),
environment);
}
});
@@ -362,11 +361,11 @@
abstract class _MinifyConstructorBodyNamer implements Namer {
Map<ClassEntity, _ConstructorBodyNamingScope> _constructorBodyScopes =
- new Map<ClassEntity, _ConstructorBodyNamingScope>();
+ Map<ClassEntity, _ConstructorBodyNamingScope>();
@override
jsAst.Name constructorBodyName(ConstructorBodyEntity method) {
- _ConstructorBodyNamingScope scope = new _ConstructorBodyNamingScope(
+ _ConstructorBodyNamingScope scope = _ConstructorBodyNamingScope(
method.enclosingClass, _constructorBodyScopes, _elementEnvironment);
String key = scope.constructorBodyKeyFor(method);
return _disambiguateMemberByKey(
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 359d642..6d60ea5 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -135,7 +135,7 @@
/// For local variables, the [Namer] only provides *proposed names*. These names
/// must be disambiguated elsewhere.
class Namer extends ModularNamer {
- static const List<String> javaScriptKeywords = const <String>[
+ static const List<String> javaScriptKeywords = <String>[
// ES5 7.6.1.1 Keywords.
'break',
'do',
@@ -238,7 +238,7 @@
// Other words to avoid due to non-standard keyword-like behavior.
];
- static const List<String> reservedPropertySymbols = const <String>[
+ static const List<String> reservedPropertySymbols = <String>[
"__proto__", "prototype", "constructor", "call",
// "use strict" disallows the use of "arguments" and "eval" as
// variable names or property names. See ECMA-262, Edition 5.1,
@@ -249,7 +249,7 @@
/// A set of all capitalized global symbols.
/// This set is so [DeferredHolderFinalizer] can use names like:
/// [A-Z][_0-9a-zA-Z]* without collisions
- static const Set<String> reservedCapitalizedGlobalSymbols = const {
+ static const Set<String> reservedCapitalizedGlobalSymbols = {
// Section references are from Ecma-262
// (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf)
@@ -304,7 +304,7 @@
/// Symbols that we might be using in our JS snippets. Some of the symbols in
/// these sections are in [reservedGlobalUpperCaseSymbols] above.
- static const List<String> reservedGlobalSymbols = const <String>[
+ static const List<String> reservedGlobalSymbols = <String>[
// Section references are from Ecma-262
// (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf)
@@ -394,7 +394,7 @@
// TODO(joshualitt): Stop reserving these names after local naming is updated
// to use frequencies.
- static const List<String> reservedGlobalObjectNames = const <String>[
+ static const List<String> reservedGlobalObjectNames = <String>[
"A",
"B",
"C", // Global object for *C*onstants.
@@ -423,12 +423,12 @@
"Z",
];
- static const List<String> reservedGlobalHelperFunctions = const <String>[
+ static const List<String> reservedGlobalHelperFunctions = <String>[
"init",
];
static final List<String> userGlobalObjects =
- new List.from(reservedGlobalObjectNames)
+ List.from(reservedGlobalObjectNames)
..remove('C')
..remove('H')
..remove('J')
@@ -471,7 +471,7 @@
/// The non-minifying namer's [callPrefix] with a dollar after it.
static const String _callPrefixDollar = r'call$';
- static final jsAst.Name _literalDollar = new StringBackedName(r'$');
+ static final jsAst.Name _literalDollar = StringBackedName(r'$');
jsAst.Name _literalGetterPrefix;
jsAst.Name _literalSetterPrefix;
@@ -480,10 +480,10 @@
@override
jsAst.Name get rtiFieldJsName =>
- _rtiFieldJsName ??= new StringBackedName(fixedNames.rtiName);
+ _rtiFieldJsName ??= StringBackedName(fixedNames.rtiName);
- static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$');
- static final RegExp NON_IDENTIFIER_CHAR = new RegExp(r'[^A-Za-z_0-9$]');
+ static final RegExp IDENTIFIER = RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$');
+ static final RegExp NON_IDENTIFIER_CHAR = RegExp(r'[^A-Za-z_0-9$]');
final JClosedWorld _closedWorld;
@@ -555,7 +555,7 @@
}
/// Used to disambiguate names for constants in [constantName].
- final NamingScope _constantScope = new NamingScope();
+ final NamingScope _constantScope = NamingScope();
/// Used to store scopes for instances of [PrivatelyNamedJsEntity]
final Map<Entity, NamingScope> _privateNamingScopes = {};
@@ -580,8 +580,8 @@
_TypeConstantRepresentationVisitor _typeConstantRepresenter;
Namer(this._closedWorld, this.fixedNames) {
- _literalGetterPrefix = new StringBackedName(fixedNames.getterPrefix);
- _literalSetterPrefix = new StringBackedName(fixedNames.setterPrefix);
+ _literalGetterPrefix = StringBackedName(fixedNames.getterPrefix);
+ _literalSetterPrefix = StringBackedName(fixedNames.setterPrefix);
_typeConstantRepresenter = _TypeConstantRepresentationVisitor(this);
}
@@ -599,7 +599,7 @@
NamingScope _getPrivateScopeFor(PrivatelyNamedJSEntity entity) {
return _privateNamingScopes.putIfAbsent(
- entity.rootOfScope, () => new NamingScope());
+ entity.rootOfScope, () => NamingScope());
}
/// Disambiguated name for [constant].
@@ -623,8 +623,8 @@
String constantLongName(ConstantValue constant) {
String longName = _constantLongNames[constant];
if (longName == null) {
- _constantHasher ??= new ConstantCanonicalHasher(this, _closedWorld);
- longName = new ConstantNamingVisitor(this, _closedWorld, _constantHasher)
+ _constantHasher ??= ConstantCanonicalHasher(this, _closedWorld);
+ longName = ConstantNamingVisitor(this, _closedWorld, _constantHasher)
.getName(constant);
_constantLongNames[constant] = longName;
}
@@ -707,7 +707,7 @@
if (method is JGeneratorBody) {
return generatorBodyInstanceMethodName(method);
}
- return invocationName(new Selector.fromElement(method));
+ return invocationName(Selector.fromElement(method));
}
/// Returns the annotated name for a variant of `call`.
@@ -719,8 +719,7 @@
/// concatenation at runtime, by applyFunction in js_helper.dart.
jsAst.Name deriveCallMethodName(List<String> suffix) {
// TODO(asgerf): Avoid clashes when named parameters contain $ symbols.
- return new StringBackedName(
- '${fixedNames.callPrefix}\$${suffix.join(r'$')}');
+ return StringBackedName('${fixedNames.callPrefix}\$${suffix.join(r'$')}');
}
/// The suffix list for the pattern:
@@ -796,7 +795,7 @@
jsAst.Name specialSelectorName(Selector selector) {
assert(selector.kind == SelectorKind.SPECIAL);
if (selector.memberName == Names.genericInstantiation) {
- return new StringBackedName('${genericInstantiationPrefix}'
+ return StringBackedName('${genericInstantiationPrefix}'
'${selector.callStructure.typeArgumentCount}');
}
@@ -852,7 +851,7 @@
ClassEntity enclosingClass = element.enclosingClass;
if (_nativeData.hasFixedBackendName(element)) {
- return new StringBackedName(_nativeData.getFixedBackendName(element));
+ return StringBackedName(_nativeData.getFixedBackendName(element));
}
// Some elements, like e.g. instances of BoxFieldElement are special.
@@ -887,7 +886,7 @@
// No superclass uses the disambiguated name as a property name, so we can
// use it for this field. This generates nicer field names since otherwise
// the field name would have to be mangled.
- return _disambiguateMember(new Name(element.name, element.library));
+ return _disambiguateMember(Name(element.name, element.library));
}
bool _isShadowingSuperField(FieldEntity element) {
@@ -933,7 +932,7 @@
// We dynamically create setters from the field-name. The setter name must
// therefore be derived from the instance field-name.
return userSetters[disambiguatedName] ??=
- new SetterName(_literalSetterPrefix, disambiguatedName);
+ SetterName(_literalSetterPrefix, disambiguatedName);
}
/// Annotated name for the setter of any member with [disambiguatedName].
@@ -941,7 +940,7 @@
// We dynamically create getters from the field-name. The getter name must
// therefore be derived from the instance field-name.
return userGetters[disambiguatedName] ??=
- new GetterName(_literalGetterPrefix, disambiguatedName);
+ GetterName(_literalGetterPrefix, disambiguatedName);
}
/// Annotated name for the getter of [element].
@@ -1090,7 +1089,7 @@
String key = '$libraryPrefix@$originalName@$suffix';
assert(!userInstanceMembers.containsKey(key));
assert(!instanceScope.isUsed(disambiguatedName));
- userInstanceMembers[key] = new StringBackedName(disambiguatedName);
+ userInstanceMembers[key] = StringBackedName(disambiguatedName);
userInstanceMembersOriginalName[key] = originalName;
instanceScope.registerUse(disambiguatedName);
}
@@ -1139,7 +1138,7 @@
}
String _generateFreshStringForName(String proposedName, NamingScope scope,
- {bool sanitizeForAnnotations: false, bool sanitizeForNatives: false}) {
+ {bool sanitizeForAnnotations = false, bool sanitizeForNatives = false}) {
if (sanitizeForAnnotations) {
proposedName = _sanitizeForAnnotations(proposedName);
}
@@ -1176,11 +1175,11 @@
/// Note that [MinifyNamer] overrides this method with one that produces
/// minified names.
jsAst.Name getFreshName(NamingScope scope, String proposedName,
- {bool sanitizeForAnnotations: false, bool sanitizeForNatives: false}) {
+ {bool sanitizeForAnnotations = false, bool sanitizeForNatives = false}) {
String candidate = _generateFreshStringForName(proposedName, scope,
sanitizeForAnnotations: sanitizeForAnnotations,
sanitizeForNatives: sanitizeForNatives);
- return new StringBackedName(candidate);
+ return StringBackedName(candidate);
}
/// Returns a variant of [name] that cannot clash with the annotated version
@@ -1337,8 +1336,7 @@
jsAst.Name root = invocationName(selector);
String suffix = _getSuffixForInterceptedClasses(classes);
- return new CompoundName(
- [root, _literalDollar, new StringBackedName(suffix)]);
+ return CompoundName([root, _literalDollar, StringBackedName(suffix)]);
}
@override
@@ -1398,10 +1396,8 @@
@override
jsAst.Name operatorIs(ClassEntity element) {
// TODO(erikcorry): Reduce from $isx to ix when we are minifying.
- return new CompoundName([
- new StringBackedName(fixedNames.operatorIsPrefix),
- className(element)
- ]);
+ return CompoundName(
+ [StringBackedName(fixedNames.operatorIsPrefix), className(element)]);
}
/// Returns a name that does not clash with reserved JS keywords.
@@ -1417,16 +1413,16 @@
jsAst.Name asName(String name) {
if (name.startsWith(fixedNames.getterPrefix) &&
name.length > fixedNames.getterPrefix.length) {
- return new GetterName(_literalGetterPrefix,
- new StringBackedName(name.substring(fixedNames.getterPrefix.length)));
+ return GetterName(_literalGetterPrefix,
+ StringBackedName(name.substring(fixedNames.getterPrefix.length)));
}
if (name.startsWith(fixedNames.setterPrefix) &&
name.length > fixedNames.setterPrefix.length) {
- return new GetterName(_literalSetterPrefix,
- new StringBackedName(name.substring(fixedNames.setterPrefix.length)));
+ return GetterName(_literalSetterPrefix,
+ StringBackedName(name.substring(fixedNames.setterPrefix.length)));
}
- return new StringBackedName(name);
+ return StringBackedName(name);
}
String operatorNameToIdentifier(String name) {
@@ -1531,7 +1527,7 @@
// legal JavaScript identifier.
if (type.typeArguments.isEmpty) return name;
String arguments =
- new List.filled(type.typeArguments.length, 'dynamic').join(', ');
+ List.filled(type.typeArguments.length, 'dynamic').join(', ');
return '$name<$arguments>';
}
@@ -1599,7 +1595,7 @@
/// EventKeyProvider_keyup // const EventKeyProvider('keyup')
///
class ConstantNamingVisitor implements ConstantValueVisitor {
- static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$');
+ static final RegExp IDENTIFIER = RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$');
static const MAX_FRAGMENTS = 5;
static const MAX_EXTRA_LENGTH = 30;
static const DEFAULT_TAG_LENGTH = 3;
@@ -1632,7 +1628,7 @@
String hashWord(int hash, int length) {
hash &= 0x1fffffff;
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
for (int i = 0; i < length; i++) {
int digit = hash % 62;
sb.write('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'[
@@ -2273,7 +2269,7 @@
jsAst.Name _literalAsyncPrefix;
ModularNamer() {
- _literalAsyncPrefix = new StringBackedName(asyncPrefix);
+ _literalAsyncPrefix = StringBackedName(asyncPrefix);
}
/// Returns a safe variable name for use in async rewriting.
@@ -2289,7 +2285,7 @@
/// Returns the name for the async body of the method with the [original]
/// name.
jsAst.Name deriveAsyncBodyName(jsAst.Name original) {
- return new AsyncName(_literalAsyncPrefix, original);
+ return AsyncName(_literalAsyncPrefix, original);
}
/// Returns the label name for [label] used as a break target.
@@ -2439,14 +2435,14 @@
@override
jsAst.Name get rtiFieldJsName {
- jsAst.Name name = new ModularName(ModularNameKind.rtiField);
+ jsAst.Name name = ModularName(ModularNameKind.rtiField);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name className(ClassEntity element) {
- jsAst.Name name = new ModularName(ModularNameKind.className, data: element);
+ jsAst.Name name = ModularName(ModularNameKind.className, data: element);
_registry.registerModularName(name);
return name;
}
@@ -2454,47 +2450,42 @@
@override
jsAst.Name aliasedSuperMemberPropertyName(MemberEntity member) {
jsAst.Name name =
- new ModularName(ModularNameKind.aliasedSuperMember, data: member);
+ ModularName(ModularNameKind.aliasedSuperMember, data: member);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name staticClosureName(FunctionEntity element) {
- jsAst.Name name =
- new ModularName(ModularNameKind.staticClosure, data: element);
+ jsAst.Name name = ModularName(ModularNameKind.staticClosure, data: element);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name methodPropertyName(FunctionEntity method) {
- jsAst.Name name =
- new ModularName(ModularNameKind.methodProperty, data: method);
+ jsAst.Name name = ModularName(ModularNameKind.methodProperty, data: method);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name instanceFieldPropertyName(FieldEntity element) {
- jsAst.Name name =
- new ModularName(ModularNameKind.instanceField, data: element);
+ jsAst.Name name = ModularName(ModularNameKind.instanceField, data: element);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name instanceMethodName(FunctionEntity method) {
- jsAst.Name name =
- new ModularName(ModularNameKind.instanceMethod, data: method);
+ jsAst.Name name = ModularName(ModularNameKind.instanceMethod, data: method);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name invocationName(Selector selector) {
- jsAst.Name name =
- new ModularName(ModularNameKind.invocation, data: selector);
+ jsAst.Name name = ModularName(ModularNameKind.invocation, data: selector);
_registry.registerModularName(name);
return name;
}
@@ -2502,40 +2493,37 @@
@override
jsAst.Name lazyInitializerName(FieldEntity element) {
jsAst.Name name =
- new ModularName(ModularNameKind.lazyInitializer, data: element);
+ ModularName(ModularNameKind.lazyInitializer, data: element);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name operatorIs(ClassEntity element) {
- jsAst.Name name =
- new ModularName(ModularNameKind.operatorIs, data: element);
+ jsAst.Name name = ModularName(ModularNameKind.operatorIs, data: element);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name globalPropertyNameForClass(ClassEntity element) {
- jsAst.Name name = new ModularName(
- ModularNameKind.globalPropertyNameForClass,
- data: element);
+ jsAst.Name name =
+ ModularName(ModularNameKind.globalPropertyNameForClass, data: element);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name globalPropertyNameForMember(MemberEntity element) {
- jsAst.Name name = new ModularName(
- ModularNameKind.globalPropertyNameForMember,
- data: element);
+ jsAst.Name name =
+ ModularName(ModularNameKind.globalPropertyNameForMember, data: element);
_registry.registerModularName(name);
return name;
}
@override
jsAst.Name globalNameForInterfaceTypeVariable(TypeVariableEntity element) {
- jsAst.Name name = new ModularName(
+ jsAst.Name name = ModularName(
ModularNameKind.globalNameForInterfaceTypeVariable,
data: element);
_registry.registerModularName(name);
@@ -2545,7 +2533,7 @@
@override
jsAst.Name nameForGetInterceptor(Set<ClassEntity> classes) {
jsAst.Name name =
- new ModularName(ModularNameKind.nameForGetInterceptor, set: classes);
+ ModularName(ModularNameKind.nameForGetInterceptor, set: classes);
_registry.registerModularName(name);
return name;
}
@@ -2553,7 +2541,7 @@
@override
jsAst.Name nameForOneShotInterceptor(
Selector selector, Set<ClassEntity> classes) {
- jsAst.Name name = new ModularName(ModularNameKind.nameForOneShotInterceptor,
+ jsAst.Name name = ModularName(ModularNameKind.nameForOneShotInterceptor,
data: selector, set: classes);
_registry.registerModularName(name);
return name;
@@ -2561,7 +2549,7 @@
@override
jsAst.Name asName(String text) {
- jsAst.Name name = new ModularName(ModularNameKind.asName, data: text);
+ jsAst.Name name = ModularName(ModularNameKind.asName, data: text);
_registry.registerModularName(name);
return name;
}
diff --git a/pkg/compiler/lib/src/js_backend/native_data.dart b/pkg/compiler/lib/src/js_backend/native_data.dart
index 3519633..11c8e41 100644
--- a/pkg/compiler/lib/src/js_backend/native_data.dart
+++ b/pkg/compiler/lib/src/js_backend/native_data.dart
@@ -151,7 +151,7 @@
/// class [element], other the js interop name is expected to be computed
/// later.
void markAsJsInteropClass(ClassEntity element,
- {String name, bool isAnonymous: false});
+ {String name, bool isAnonymous = false});
/// Marks [element] as an explicit part of js interop and sets the explicit js
/// interop [name] for the member [element].
@@ -196,7 +196,7 @@
Map<ClassEntity, String> jsInteropClasses = <ClassEntity, String>{};
/// JavaScript interop classes annotated with `@anonymous`
- Set<ClassEntity> anonymousJsInteropClasses = new Set<ClassEntity>();
+ Set<ClassEntity> anonymousJsInteropClasses = Set<ClassEntity>();
/// The JavaScript members implemented via typed JavaScript interop.
Map<MemberEntity, String> jsInteropMembers = <MemberEntity, String>{};
@@ -222,7 +222,7 @@
"Native tag info set inconsistently on $cls: "
"Existing tag info '${nativeClassTagInfo[cls]}', "
"new tag info '$tagText'."));
- nativeClassTagInfo[cls] = new NativeClassTag(tagText);
+ nativeClassTagInfo[cls] = NativeClassTag(tagText);
}
@override
@@ -238,7 +238,7 @@
@override
void markAsJsInteropClass(ClassEntity element,
- {String name, bool isAnonymous: false}) {
+ {String name, bool isAnonymous = false}) {
assert(
!_closed,
failedAt(
@@ -265,7 +265,7 @@
@override
NativeBasicData close(ElementEnvironment environment) {
_closed = true;
- return new NativeBasicDataImpl(
+ return NativeBasicDataImpl(
environment,
false,
nativeClassTagInfo,
@@ -324,7 +324,7 @@
Map<MemberEntity, String> jsInteropMembers = {};
data.forEachNativeClass((ir.Class node, String text) {
- nativeClassTagInfo[map.getClass(node)] = new NativeClassTag(text);
+ nativeClassTagInfo[map.getClass(node)] = NativeClassTag(text);
});
data.forEachJsInteropLibrary((ir.Library node, String name) {
jsInteropLibraries[env.lookupLibrary(node.importUri, required: true)] =
@@ -343,7 +343,7 @@
jsInteropMembers[map.getMember(node)] = name;
});
- return new NativeBasicDataImpl(
+ return NativeBasicDataImpl(
env,
false,
nativeClassTagInfo,
@@ -361,7 +361,7 @@
source.readClassMap(() {
List<String> names = source.readStrings();
bool isNonLeaf = source.readBool();
- return new NativeClassTag.internal(names, isNonLeaf);
+ return NativeClassTag.internal(names, isNonLeaf);
});
Map<LibraryEntity, String> jsInteropLibraries =
source.readLibraryMap(source.readString);
@@ -371,7 +371,7 @@
Map<MemberEntity, String> jsInteropMembers =
source.readMemberMap((MemberEntity member) => source.readString());
source.end(tag);
- return new NativeBasicDataImpl(
+ return NativeBasicDataImpl(
elementEnvironment,
isAllowInteropUsed,
nativeClassTagInfo,
@@ -524,7 +524,7 @@
}
@override
- NativeData close() => new NativeDataImpl(_nativeBasicData, nativeMemberName,
+ NativeData close() => NativeDataImpl(_nativeBasicData, nativeMemberName,
nativeMethodBehavior, nativeFieldLoadBehavior, nativeFieldStoreBehavior);
}
@@ -561,8 +561,7 @@
this.nativeFieldStoreBehavior);
factory NativeDataImpl.fromIr(KernelToElementMap map, IrAnnotationData data) {
- NativeBasicDataImpl nativeBasicData =
- new NativeBasicDataImpl.fromIr(map, data);
+ NativeBasicDataImpl nativeBasicData = NativeBasicDataImpl.fromIr(map, data);
Map<MemberEntity, String> nativeMemberName = {};
Map<FunctionEntity, NativeBehavior> nativeMethodBehavior = {};
Map<MemberEntity, NativeBehavior> nativeFieldLoadBehavior = {};
@@ -594,7 +593,7 @@
map.getNativeBehaviorForFieldStore(node);
});
- return new NativeDataImpl(
+ return NativeDataImpl(
nativeBasicData,
nativeMemberName,
nativeMethodBehavior,
@@ -606,20 +605,20 @@
DataSource source, ElementEnvironment elementEnvironment) {
source.begin(tag);
NativeBasicData nativeBasicData =
- new NativeBasicData.readFromDataSource(source, elementEnvironment);
+ NativeBasicData.readFromDataSource(source, elementEnvironment);
Map<MemberEntity, String> nativeMemberName =
source.readMemberMap((MemberEntity member) => source.readString());
Map<FunctionEntity, NativeBehavior> nativeMethodBehavior =
- source.readMemberMap((MemberEntity member) =>
- new NativeBehavior.readFromDataSource(source));
+ source.readMemberMap(
+ (MemberEntity member) => NativeBehavior.readFromDataSource(source));
Map<MemberEntity, NativeBehavior> nativeFieldLoadBehavior =
- source.readMemberMap((MemberEntity member) =>
- new NativeBehavior.readFromDataSource(source));
+ source.readMemberMap(
+ (MemberEntity member) => NativeBehavior.readFromDataSource(source));
Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior =
- source.readMemberMap((MemberEntity member) =>
- new NativeBehavior.readFromDataSource(source));
+ source.readMemberMap(
+ (MemberEntity member) => NativeBehavior.readFromDataSource(source));
source.end(tag);
- return new NativeDataImpl(
+ return NativeDataImpl(
nativeBasicData,
nativeMemberName,
nativeMethodBehavior,
@@ -813,10 +812,12 @@
if (element.isConstructor) {
return _fixedBackendClassPath(element.enclosingClass);
}
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write(_jsLibraryNameHelper(element.library));
if (element.enclosingClass != null) {
- sb..write('.')..write(_jsClassNameHelper(element.enclosingClass));
+ sb
+ ..write('.')
+ ..write(_jsClassNameHelper(element.enclosingClass));
}
return sb.toString();
}
@@ -884,13 +885,13 @@
List<String> tags = tagText.split(',');
List<String> names = tags.where((s) => !s.startsWith('!')).toList();
bool isNonLeaf = tags.contains('!nonleaf');
- return new NativeClassTag.internal(names, isNonLeaf);
+ return NativeClassTag.internal(names, isNonLeaf);
}
NativeClassTag.internal(this.names, this.isNonLeaf);
String get text {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write(names.join(','));
if (isNonLeaf) {
if (names.isNotEmpty) {
diff --git a/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart b/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
index 3589a76..ffca921 100644
--- a/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
+++ b/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
@@ -67,25 +67,25 @@
class NoSuchMethodRegistryImpl implements NoSuchMethodRegistry {
/// The implementations that fall into category A, described above.
- final Set<FunctionEntity> defaultImpls = new Set<FunctionEntity>();
+ final Set<FunctionEntity> defaultImpls = Set<FunctionEntity>();
/// The implementations that fall into category B, described above.
- final Set<FunctionEntity> throwingImpls = new Set<FunctionEntity>();
+ final Set<FunctionEntity> throwingImpls = Set<FunctionEntity>();
/// The implementations that fall into category C, described above.
// TODO(johnniwinther): Remove this category when Dart 1 is no longer
// supported.
- final Set<FunctionEntity> notApplicableImpls = new Set<FunctionEntity>();
+ final Set<FunctionEntity> notApplicableImpls = Set<FunctionEntity>();
/// The implementations that fall into category D, described above.
- final Set<FunctionEntity> otherImpls = new Set<FunctionEntity>();
+ final Set<FunctionEntity> otherImpls = Set<FunctionEntity>();
/// The implementations that have not yet been categorized.
- final Set<FunctionEntity> _uncategorizedImpls = new Set<FunctionEntity>();
+ final Set<FunctionEntity> _uncategorizedImpls = Set<FunctionEntity>();
/// The implementations that a forwarding syntax as defined by
/// [NoSuchMethodResolver.hasForwardSyntax].
- final Set<FunctionEntity> forwardingSyntaxImpls = new Set<FunctionEntity>();
+ final Set<FunctionEntity> forwardingSyntaxImpls = Set<FunctionEntity>();
final CommonElements _commonElements;
final NoSuchMethodResolver _resolver;
@@ -167,7 +167,7 @@
@override
NoSuchMethodData close() {
- return new NoSuchMethodDataImpl(
+ return NoSuchMethodDataImpl(
throwingImpls, otherImpls, forwardingSyntaxImpls);
}
}
@@ -210,10 +210,10 @@
final Set<FunctionEntity> otherImpls;
/// The implementations that fall into category D1
- final Set<FunctionEntity> complexNoReturnImpls = new Set<FunctionEntity>();
+ final Set<FunctionEntity> complexNoReturnImpls = Set<FunctionEntity>();
/// The implementations that fall into category D2
- final Set<FunctionEntity> complexReturningImpls = new Set<FunctionEntity>();
+ final Set<FunctionEntity> complexReturningImpls = Set<FunctionEntity>();
final Set<FunctionEntity> forwardingSyntaxImpls;
@@ -233,7 +233,7 @@
List<FunctionEntity> complexReturningImpls =
source.readMembers<FunctionEntity>();
source.end(tag);
- return new NoSuchMethodDataImpl(
+ return NoSuchMethodDataImpl(
throwingImpls, otherImpls, forwardingSyntaxImpls)
..complexNoReturnImpls.addAll(complexNoReturnImpls)
..complexReturningImpls.addAll(complexReturningImpls);
diff --git a/pkg/compiler/lib/src/js_backend/resolution_listener.dart b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
index 0239d25..3bccb68 100644
--- a/pkg/compiler/lib/src/js_backend/resolution_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
@@ -71,13 +71,13 @@
void _addInterceptors(ClassEntity cls, WorldImpactBuilder impactBuilder) {
_interceptorData.addInterceptors(cls);
impactBuilder.registerTypeUse(
- new TypeUse.instantiation(_elementEnvironment.getRawType(cls)));
+ TypeUse.instantiation(_elementEnvironment.getRawType(cls)));
_backendUsage.registerBackendClassUse(cls);
}
@override
WorldImpact registerClosurizedMember(FunctionEntity element) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl impactBuilder = WorldImpactBuilderImpl();
_backendUsage.processBackendImpact(_impacts.memberClosure);
impactBuilder
.addImpact(_impacts.memberClosure.createImpact(_elementEnvironment));
@@ -101,7 +101,7 @@
@override
void registerInstantiatedType(InterfaceType type,
- {bool isGlobal: false, bool nativeUsage: false}) {
+ {bool isGlobal = false, bool nativeUsage = false}) {
if (isGlobal) {
_backendUsage.registerGlobalClassDependency(type.element);
}
@@ -112,20 +112,20 @@
/// Computes the [WorldImpact] of calling [mainMethod] as the entry point.
WorldImpact _computeMainImpact(FunctionEntity mainMethod) {
- WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl mainImpact = WorldImpactBuilderImpl();
CallStructure callStructure = mainMethod.parameterStructure.callStructure;
if (callStructure.argumentCount > 0) {
_impacts.mainWithArguments
.registerImpact(mainImpact, _elementEnvironment);
_backendUsage.processBackendImpact(_impacts.mainWithArguments);
- mainImpact.registerStaticUse(
- new StaticUse.staticInvoke(mainMethod, callStructure));
+ mainImpact
+ .registerStaticUse(StaticUse.staticInvoke(mainMethod, callStructure));
}
if (mainMethod.isGetter) {
- mainImpact.registerStaticUse(new StaticUse.staticGet(mainMethod));
+ mainImpact.registerStaticUse(StaticUse.staticGet(mainMethod));
} else {
mainImpact.registerStaticUse(
- new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
+ StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
}
return mainImpact;
}
@@ -216,7 +216,7 @@
if (constant.isFunction) {
FunctionConstantValue function = constant;
impactBuilder
- .registerStaticUse(new StaticUse.staticTearOff(function.element));
+ .registerStaticUse(StaticUse.staticTearOff(function.element));
} else if (constant.isInterceptor) {
// An interceptor constant references the class's prototype chain.
InterceptorConstantValue interceptor = constant;
@@ -224,24 +224,24 @@
_computeImpactForInstantiatedConstantType(type, impactBuilder);
} else if (constant.isType) {
FunctionEntity helper = _commonElements.createRuntimeType;
- impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
+ impactBuilder.registerStaticUse(StaticUse.staticInvoke(
helper, helper.parameterStructure.callStructure));
_backendUsage.registerBackendFunctionUse(helper);
impactBuilder
- .registerTypeUse(new TypeUse.instantiation(_commonElements.typeType));
+ .registerTypeUse(TypeUse.instantiation(_commonElements.typeType));
}
}
void _computeImpactForInstantiatedConstantType(
DartType type, WorldImpactBuilder impactBuilder) {
if (type is InterfaceType) {
- impactBuilder.registerTypeUse(new TypeUse.instantiation(type));
+ impactBuilder.registerTypeUse(TypeUse.instantiation(type));
if (type.element == _commonElements.typeLiteralClass) {
// If we use a type literal in a constant, the compile time
// constant emitter will generate a call to the createRuntimeType
// helper so we register a use of that.
FunctionEntity helper = _commonElements.createRuntimeType;
- impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
+ impactBuilder.registerStaticUse(StaticUse.staticInvoke(
helper, helper.parameterStructure.callStructure));
}
}
@@ -249,14 +249,14 @@
@override
WorldImpact registerUsedConstant(ConstantValue constant) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl impactBuilder = WorldImpactBuilderImpl();
_computeImpactForCompileTimeConstant(constant, impactBuilder);
return impactBuilder;
}
@override
WorldImpact registerUsedElement(MemberEntity member) {
- WorldImpactBuilderImpl worldImpact = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl worldImpact = WorldImpactBuilderImpl();
_customElementsAnalysis.registerStaticUse(member);
if (member.isFunction) {
@@ -272,8 +272,8 @@
for (var type in allParameterTypes) {
if (type.withoutNullability is FunctionType) {
var closureConverter = _commonElements.closureConverter;
- worldImpact.registerStaticUse(
- new StaticUse.implicitInvoke(closureConverter));
+ worldImpact
+ .registerStaticUse(StaticUse.implicitInvoke(closureConverter));
_backendUsage.registerBackendFunctionUse(closureConverter);
_backendUsage.registerGlobalFunctionDependency(closureConverter);
break;
@@ -323,7 +323,7 @@
}
WorldImpact _processClass(ClassEntity cls) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl impactBuilder = WorldImpactBuilderImpl();
// TODO(johnniwinther): Extract an `implementationClassesOf(...)` function
// for these into [CommonElements] or [BackendImpacts].
// Register any helper that will be needed by the backend.
@@ -426,7 +426,7 @@
/// Compute the [WorldImpact] for backend helper methods.
WorldImpact computeHelpersImpact() {
assert(_commonElements.interceptorsLibrary != null);
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl impactBuilder = WorldImpactBuilderImpl();
// TODO(ngeoffray): Not enqueuing those two classes currently make
// the compiler potentially crash. However, any reasonable program
// will instantiate those two classes.
@@ -459,7 +459,7 @@
staticUses.add(helper.getStaticUse(_commonElements).element);
}
_registerBackendImpact(
- impactBuilder, new BackendImpact(globalUses: staticUses));
+ impactBuilder, BackendImpact(globalUses: staticUses));
}
@override
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 90b7b7c..ef78879 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -18,7 +18,8 @@
import 'runtime_types_codegen.dart';
import 'runtime_types_resolution.dart';
-typedef jsAst.Expression OnVariableCallback(TypeVariableType variable);
+typedef OnVariableCallback = jsAst.Expression Function(
+ TypeVariableType variable);
/// Interface for the needed runtime type checks.
abstract class RuntimeTypesChecks {
@@ -84,7 +85,7 @@
for (ClassEntity cls in _closedWorld.classHierarchy
.getClassSet(_closedWorld.commonElements.objectClass)
.subtypes()) {
- ClassUse classUse = new ClassUse()
+ ClassUse classUse = ClassUse()
..directInstance = true
..checkedInstance = true
..typeArgument = true
@@ -95,7 +96,7 @@
}
TypeChecks typeChecks = _substitutions._requiredChecks =
_substitutions._computeChecks(classUseMap);
- return new TrivialTypesChecks(typeChecks);
+ return TrivialTypesChecks(typeChecks);
}
Set<ClassEntity> computeCheckedClasses(
@@ -108,7 +109,7 @@
Set<FunctionType> computeCheckedFunctions(
CodegenWorldBuilder codegenWorldBuilder, Set<DartType> implicitIsChecks) {
- return new Set<FunctionType>();
+ return Set<FunctionType>();
}
}
@@ -130,18 +131,18 @@
// Run through the combination of instantiated and checked
// arguments and record all combination where the element of a checked
// argument is a superclass of the element of an instantiated type.
- TypeCheckMapping result = new TypeCheckMapping();
- Set<ClassEntity> handled = new Set<ClassEntity>();
+ TypeCheckMapping result = TypeCheckMapping();
+ Set<ClassEntity> handled = Set<ClassEntity>();
// Empty usage object for classes with no direct rti usage.
- final ClassUse emptyUse = new ClassUse();
+ final ClassUse emptyUse = ClassUse();
/// Compute the $isX and $asX functions need for [cls].
ClassChecks computeChecks(ClassEntity cls) {
if (!handled.add(cls)) return result[cls];
ClassUse classUse = classUseMap[cls] ?? emptyUse;
- ClassChecks checks = new ClassChecks(classUse.functionType);
+ ClassChecks checks = ClassChecks(classUse.functionType);
result[cls] = checks;
// Find the superclass from which [cls] inherits checks.
@@ -174,14 +175,14 @@
// We need [cls] at runtime - even if [cls] is not instantiated. Either
// as a type argument, for a type literal or for an is-test if [cls] is
// native.
- checks.add(new TypeCheck(cls, substitution, needsIs: isNativeClass));
+ checks.add(TypeCheck(cls, substitution, needsIs: isNativeClass));
}
// Compute the set of classes that [cls] inherited properties from.
//
// This set reflects the emitted class hierarchy and therefore uses
// `getEffectiveMixinClass` to find the inherited mixins.
- Set<ClassEntity> inheritedClasses = new Set<ClassEntity>();
+ Set<ClassEntity> inheritedClasses = Set<ClassEntity>();
ClassEntity other = cls;
while (other != null) {
inheritedClasses.add(other);
@@ -277,14 +278,14 @@
if (extendsSuperClassTrivially) {
// [cls] implements [checkedClass] the same way as [superClass]
// so the inherited substitution function already works.
- checks.add(new TypeCheck(checkedClass, null, needsIs: false));
+ checks.add(TypeCheck(checkedClass, null, needsIs: false));
} else {
// [cls] implements [checkedClass] differently from [superClass]
// so the inherited substitution function needs to be replaced.
if (implementsCheckedTrivially) {
// We need an explicit trivial substitution function for
// [checkedClass] that overrides the inherited function.
- checks.add(new TypeCheck(checkedClass,
+ checks.add(TypeCheck(checkedClass,
isCheckedGeneric ? const Substitution.trivial() : null,
needsIs: false));
} else {
@@ -292,8 +293,8 @@
// [checkedClass].
Substitution substitution =
computeSubstitution(cls, checkedClass);
- checks.add(
- new TypeCheck(checkedClass, substitution, needsIs: false));
+ checks
+ .add(TypeCheck(checkedClass, substitution, needsIs: false));
assert(substitution != null);
for (DartType argument in substitution.arguments) {
@@ -310,14 +311,14 @@
// We don't add an explicit substitution function for
// [checkedClass] because the substitution is trivial and doesn't
// need to override an inherited function.
- checks.add(new TypeCheck(checkedClass, null, needsIs: needsIs));
+ checks.add(TypeCheck(checkedClass, null, needsIs: needsIs));
} else {
// We need a non-trivial substitution function for
// [checkedClass].
Substitution substitution =
computeSubstitution(cls, checkedClass);
- checks.add(
- new TypeCheck(checkedClass, substitution, needsIs: needsIs));
+ checks
+ .add(TypeCheck(checkedClass, substitution, needsIs: needsIs));
assert(substitution != null);
for (DartType argument in substitution.arguments) {
@@ -353,8 +354,8 @@
@override
Set<ClassEntity> getClassesUsedInSubstitutions(TypeChecks checks) {
- Set<ClassEntity> instantiated = new Set<ClassEntity>();
- ArgumentCollector collector = new ArgumentCollector();
+ Set<ClassEntity> instantiated = Set<ClassEntity>();
+ ArgumentCollector collector = ArgumentCollector();
for (ClassEntity target in checks.classes) {
ClassChecks classChecks = checks[target];
for (TypeCheck check in classChecks.checks) {
@@ -430,7 +431,7 @@
}
Substitution computeSubstitution(ClassEntity cls, ClassEntity check,
- {bool alwaysGenerateFunction: false}) {
+ {bool alwaysGenerateFunction = false}) {
if (isTrivialSubstitution(cls, check)) return null;
// Unnamed mixin application classes do not need substitutions, because they
@@ -443,11 +444,11 @@
int typeArguments = target.typeArguments.length;
// Generic JS-interop class need an explicit substitution to mark
// the type arguments as `any` type.
- return new Substitution.jsInterop(typeArguments);
+ return Substitution.jsInterop(typeArguments);
} else if (typeVariables.isEmpty && !alwaysGenerateFunction) {
- return new Substitution.list(target.typeArguments);
+ return Substitution.list(target.typeArguments);
} else {
- return new Substitution.function(target.typeArguments, typeVariables);
+ return Substitution.function(target.typeArguments, typeVariables);
}
}
}
@@ -473,7 +474,7 @@
@override
Iterable<ClassEntity> get requiredClasses {
- Set<ClassEntity> required = new Set<ClassEntity>();
+ Set<ClassEntity> required = Set<ClassEntity>();
required.addAll(_typeArguments);
required.addAll(_typeLiterals);
required
@@ -489,9 +490,9 @@
final JClosedWorld _closedWorld;
// The set of type arguments tested against type variable bounds.
- final Set<DartType> checkedTypeArguments = new Set<DartType>();
+ final Set<DartType> checkedTypeArguments = Set<DartType>();
// The set of tested type variable bounds.
- final Set<DartType> checkedBounds = new Set<DartType>();
+ final Set<DartType> checkedBounds = Set<DartType>();
TypeChecks cachedRequiredChecks;
@@ -513,7 +514,7 @@
Map<ClassEntity, ClassUse> classUseMapForTesting;
final Set<GenericInstantiation> _genericInstantiations =
- new Set<GenericInstantiation>();
+ Set<GenericInstantiation>();
@override
void registerTypeVariableBoundsSubtypeCheck(
@@ -530,11 +531,8 @@
@override
RuntimeTypesChecks computeRequiredChecks(
CodegenWorld codegenWorld, CompilerOptions options) {
- TypeVariableTests typeVariableTests = new TypeVariableTests(
- _elementEnvironment,
- _commonElements,
- codegenWorld,
- _genericInstantiations,
+ TypeVariableTests typeVariableTests = TypeVariableTests(_elementEnvironment,
+ _commonElements, codegenWorld, _genericInstantiations,
forRtiNeeds: false);
Set<DartType> explicitIsChecks = typeVariableTests.explicitIsChecks;
Set<DartType> implicitIsChecks = typeVariableTests.implicitIsChecks;
@@ -544,9 +542,9 @@
classUseMapForTesting = classUseMap;
}
- Set<FunctionType> checkedFunctionTypes = new Set<FunctionType>();
- Set<ClassEntity> typeLiterals = new Set<ClassEntity>();
- Set<ClassEntity> typeArguments = new Set<ClassEntity>();
+ Set<FunctionType> checkedFunctionTypes = Set<FunctionType>();
+ Set<ClassEntity> typeLiterals = Set<ClassEntity>();
+ Set<ClassEntity> typeArguments = Set<ClassEntity>();
// The [liveTypeVisitor] is used to register class use in the type of
// instantiated objects like `new T` and the function types of
@@ -562,8 +560,8 @@
//
// makes A and B live but C tested.
TypeVisitor liveTypeVisitor =
- new TypeVisitor(onClass: (ClassEntity cls, {TypeVisitorState state}) {
- ClassUse classUse = classUseMap.putIfAbsent(cls, () => new ClassUse());
+ TypeVisitor(onClass: (ClassEntity cls, {TypeVisitorState state}) {
+ ClassUse classUse = classUseMap.putIfAbsent(cls, () => ClassUse());
switch (state) {
case TypeVisitorState.covariantTypeArgument:
classUse.typeArgument = true;
@@ -596,8 +594,8 @@
//
// makes A and B tested but C live.
TypeVisitor testedTypeVisitor =
- new TypeVisitor(onClass: (ClassEntity cls, {TypeVisitorState state}) {
- ClassUse classUse = classUseMap.putIfAbsent(cls, () => new ClassUse());
+ TypeVisitor(onClass: (ClassEntity cls, {TypeVisitorState state}) {
+ ClassUse classUse = classUseMap.putIfAbsent(cls, () => ClassUse());
switch (state) {
case TypeVisitorState.covariantTypeArgument:
classUse.typeArgument = true;
@@ -617,7 +615,7 @@
});
codegenWorld.instantiatedClasses.forEach((ClassEntity cls) {
- ClassUse classUse = classUseMap.putIfAbsent(cls, () => new ClassUse());
+ ClassUse classUse = classUseMap.putIfAbsent(cls, () => ClassUse());
classUse.instance = true;
});
@@ -625,7 +623,7 @@
codegenWorld.instantiatedTypes.forEach((InterfaceType type) {
liveTypeVisitor.visitType(type, TypeVisitorState.direct);
ClassUse classUse =
- classUseMap.putIfAbsent(type.element, () => new ClassUse());
+ classUseMap.putIfAbsent(type.element, () => ClassUse());
classUse.directInstance = true;
FunctionType callType = _types.getCallType(type);
if (callType != null) {
@@ -706,7 +704,7 @@
ClassFunctionType functionType =
_computeFunctionType(_elementEnvironment, cls);
if (functionType != null) {
- ClassUse classUse = classUseMap.putIfAbsent(cls, () => new ClassUse());
+ ClassUse classUse = classUseMap.putIfAbsent(cls, () => ClassUse());
classUse.functionType = functionType;
}
}
@@ -740,7 +738,7 @@
cachedRequiredChecks = _computeChecks(classUseMap);
rtiChecksBuilderClosed = true;
- return new _RuntimeTypesChecks(
+ return _RuntimeTypesChecks(
this, cachedRequiredChecks, typeArguments, typeLiterals);
}
}
@@ -770,13 +768,13 @@
if (call != null && call.isFunction) {
FunctionEntity callFunction = call;
FunctionType callType = elementEnvironment.getFunctionType(callFunction);
- return new ClassFunctionType(callFunction, callType, signatureFunction);
+ return ClassFunctionType(callFunction, callType, signatureFunction);
}
return null;
}
class TypeCheckMapping implements TypeChecks {
- final Map<ClassEntity, ClassChecks> map = new Map<ClassEntity, ClassChecks>();
+ final Map<ClassEntity, ClassChecks> map = Map<ClassEntity, ClassChecks>();
@override
ClassChecks operator [](ClassEntity element) {
@@ -793,7 +791,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
for (ClassEntity holder in classes) {
for (TypeCheck check in this[holder].checks) {
sb.write('${holder.name} <: ${check.cls.name}, ');
@@ -804,7 +802,7 @@
}
class ArgumentCollector extends DartTypeVisitor<void, void> {
- final Set<ClassEntity> classes = new Set<ClassEntity>();
+ final Set<ClassEntity> classes = Set<ClassEntity>();
void addClass(ClassEntity cls) {
classes.add(cls);
@@ -878,7 +876,7 @@
class TypeVisitor extends DartTypeVisitor<void, TypeVisitorState> {
Set<FunctionTypeVariable> _visitedFunctionTypeVariables =
- new Set<FunctionTypeVariable>();
+ Set<FunctionTypeVariable>();
final void Function(ClassEntity entity, {TypeVisitorState state}) onClass;
final void Function(TypeVariableEntity entity, {TypeVisitorState state})
@@ -902,7 +900,7 @@
case TypeVisitorState.typeLiteral:
return TypeVisitorState.typeLiteral;
}
- throw new UnsupportedError("Unexpected TypeVisitorState $state");
+ throw UnsupportedError("Unexpected TypeVisitorState $state");
}
TypeVisitorState contravariantArgument(TypeVisitorState state) {
@@ -916,7 +914,7 @@
case TypeVisitorState.typeLiteral:
return TypeVisitorState.typeLiteral;
}
- throw new UnsupportedError("Unexpected TypeVisitorState $state");
+ throw UnsupportedError("Unexpected TypeVisitorState $state");
}
void visitTypes(List<DartType> types, TypeVisitorState state) {
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart b/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
index 76e240e..5ccf8c3 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
@@ -34,7 +34,7 @@
final int hashCode = _nextHash = (_nextHash + 100003).toUnsigned(30);
static int _nextHash = 0;
- TypeCheck(this.cls, this.substitution, {this.needsIs: true});
+ TypeCheck(this.cls, this.substitution, {this.needsIs = true});
@override
String toString() =>
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart b/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
index 258fe15..efc3f30 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
@@ -48,7 +48,7 @@
// [entity]!
return false;
}
- _dependencies ??= new Set<RtiNode>();
+ _dependencies ??= Set<RtiNode>();
return _dependencies.add(node);
}
@@ -106,7 +106,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write(kind);
sb.write(':');
sb.write(entity);
@@ -138,7 +138,7 @@
final bool isNoSuchMethod;
MethodNode(this.function, this.parameterStructure,
- {this.isCallTarget, this.instanceName, this.isNoSuchMethod: false});
+ {this.isCallTarget, this.instanceName, this.isNoSuchMethod = false});
@override
Entity get entity => function;
@@ -156,7 +156,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('MethodNode(');
sb.write('function=$function');
sb.write(',parameterStructure=$parameterStructure');
@@ -214,11 +214,11 @@
final Set<DartType> explicitIsChecks;
/// All implicit is-tests.
- final Set<DartType> implicitIsChecks = new Set<DartType>();
+ final Set<DartType> implicitIsChecks = Set<DartType>();
TypeVariableTests(this._elementEnvironment, this._commonElements, this._world,
this._genericInstantiations,
- {this.forRtiNeeds: true})
+ {this.forRtiNeeds = true})
: explicitIsChecks = _world.isChecks.toSet() {
_setupDependencies();
_propagateTests();
@@ -351,14 +351,14 @@
isCallTarget = _world.closurizedStatics.contains(function);
isNoSuchMethod = false;
}
- node = new MethodNode(function, function.parameterStructure,
+ node = MethodNode(function, function.parameterStructure,
isCallTarget: isCallTarget,
instanceName: instanceName,
isNoSuchMethod: isNoSuchMethod);
} else {
- ParameterStructure parameterStructure = new ParameterStructure.fromType(
+ ParameterStructure parameterStructure = ParameterStructure.fromType(
_elementEnvironment.getLocalFunctionType(function));
- node = new MethodNode(function, parameterStructure, isCallTarget: true);
+ node = MethodNode(function, parameterStructure, isCallTarget: true);
}
return node;
});
@@ -531,7 +531,7 @@
}
void _propagateTests() {
- void processTypeVariableType(TypeVariableType type, {bool direct: true}) {
+ void processTypeVariableType(TypeVariableType type, {bool direct = true}) {
TypeVariableEntity variable = type.element;
if (variable.typeDeclaration is ClassEntity) {
_getClassNode(variable.typeDeclaration).markTest(direct: direct);
@@ -540,7 +540,7 @@
}
}
- void processType(DartType type, {bool direct: true}) {
+ void processType(DartType type, {bool direct = true}) {
var typeWithoutNullability = type.withoutNullability;
if (typeWithoutNullability is FutureOrType) {
_getClassNode(_commonElements.futureClass).markIndirectTest();
@@ -567,8 +567,8 @@
});
}
- String dump({bool verbose: false}) {
- StringBuffer sb = new StringBuffer();
+ String dump({bool verbose = false}) {
+ StringBuffer sb = StringBuffer();
void addNode(RtiNode node) {
if (node.hasUse || node.dependencies.isNotEmpty || verbose) {
@@ -753,8 +753,7 @@
if (isTrivial) {
return TrivialRuntimeTypesNeed(elementEnvironment);
}
- return new RuntimeTypesNeedImpl.readFromDataSource(
- source, elementEnvironment);
+ return RuntimeTypesNeedImpl.readFromDataSource(source, elementEnvironment);
}
/// Serializes this [RuntimeTypesNeed] to [sink].
@@ -895,11 +894,11 @@
Set<FunctionEntity> methodsNeedingTypeArguments =
source.readMembers<FunctionEntity>().toSet();
Set<Selector> selectorsNeedingTypeArguments =
- source.readList(() => new Selector.readFromDataSource(source)).toSet();
+ source.readList(() => Selector.readFromDataSource(source)).toSet();
Set<int> instantiationsNeedingTypeArguments =
source.readList(source.readInt).toSet();
source.end(tag);
- return new RuntimeTypesNeedImpl(
+ return RuntimeTypesNeedImpl(
elementEnvironment,
classesNeedingTypeArguments,
methodsNeedingSignature,
@@ -1005,13 +1004,12 @@
class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
final ElementEnvironment _elementEnvironment;
- final Set<ClassEntity> classesUsingTypeVariableLiterals =
- new Set<ClassEntity>();
+ final Set<ClassEntity> classesUsingTypeVariableLiterals = Set<ClassEntity>();
final Set<FunctionEntity> methodsUsingTypeVariableLiterals =
- new Set<FunctionEntity>();
+ Set<FunctionEntity>();
- final Set<Local> localFunctionsUsingTypeVariableLiterals = new Set<Local>();
+ final Set<Local> localFunctionsUsingTypeVariableLiterals = Set<Local>();
Map<Selector, Set<Entity>> selectorsNeedingTypeArgumentsForTesting;
@@ -1022,7 +1020,7 @@
_instantiatedEntitiesNeedingTypeArgumentsForTesting ?? const {};
final Set<GenericInstantiation> _genericInstantiations =
- new Set<GenericInstantiation>();
+ Set<GenericInstantiation>();
TypeVariableTests typeVariableTestsForTesting;
@@ -1051,17 +1049,17 @@
@override
RuntimeTypesNeed computeRuntimeTypesNeed(
KClosedWorld closedWorld, CompilerOptions options) {
- TypeVariableTests typeVariableTests = new TypeVariableTests(
+ TypeVariableTests typeVariableTests = TypeVariableTests(
closedWorld.elementEnvironment,
closedWorld.commonElements,
closedWorld,
_genericInstantiations);
- Set<ClassEntity> classesNeedingTypeArguments = new Set<ClassEntity>();
- Set<FunctionEntity> methodsNeedingSignature = new Set<FunctionEntity>();
- Set<FunctionEntity> methodsNeedingTypeArguments = new Set<FunctionEntity>();
- Set<Local> localFunctionsNeedingSignature = new Set<Local>();
- Set<Local> localFunctionsNeedingTypeArguments = new Set<Local>();
- Set<Entity> processedEntities = new Set<Entity>();
+ Set<ClassEntity> classesNeedingTypeArguments = Set<ClassEntity>();
+ Set<FunctionEntity> methodsNeedingSignature = Set<FunctionEntity>();
+ Set<FunctionEntity> methodsNeedingTypeArguments = Set<FunctionEntity>();
+ Set<Local> localFunctionsNeedingSignature = Set<Local>();
+ Set<Local> localFunctionsNeedingTypeArguments = Set<Local>();
+ Set<Entity> processedEntities = Set<Entity>();
// Find the classes that need type arguments at runtime. Such
// classes are:
@@ -1141,14 +1139,14 @@
}
});
localFunctionsNeedingSignature.add(function);
- localFunctionsToRemove ??= new Set<Local>();
+ localFunctionsToRemove ??= Set<Local>();
localFunctionsToRemove.add(function);
}
}
for (FunctionEntity function in closurizedMembers) {
if (checkFunctionType(_elementEnvironment.getFunctionType(function))) {
methodsNeedingSignature.add(function);
- closurizedMembersToRemove ??= new Set<FunctionEntity>();
+ closurizedMembersToRemove ??= Set<FunctionEntity>();
closurizedMembersToRemove.add(function);
}
}
@@ -1249,7 +1247,7 @@
/// Set to `true` if subclasses of `Function` need runtimeType.
bool neededOnFunctions = false;
- Set<ClassEntity> classesDirectlyNeedingRuntimeType = new Set<ClassEntity>();
+ Set<ClassEntity> classesDirectlyNeedingRuntimeType = Set<ClassEntity>();
Iterable<ClassEntity> impliedClasses(DartType type) {
type = type.withoutNullability;
@@ -1277,7 +1275,7 @@
return impliedClasses(
_elementEnvironment.getTypeVariableBound(type.element));
}
- throw new UnsupportedError('Unexpected type $type');
+ throw UnsupportedError('Unexpected type $type');
}
void addClass(ClassEntity cls) {
@@ -1348,7 +1346,7 @@
.subclassesOf(commonElements.objectClass)
.toSet();
} else {
- allClassesNeedingRuntimeType = new Set<ClassEntity>();
+ allClassesNeedingRuntimeType = Set<ClassEntity>();
// TODO(johnniwinther): Support this operation directly in
// [ClosedWorld] using the [ClassSet]s.
for (ClassEntity cls in classesDirectlyNeedingRuntimeType) {
@@ -1381,7 +1379,7 @@
}
}
- Set<Selector> selectorsNeedingTypeArguments = new Set<Selector>();
+ Set<Selector> selectorsNeedingTypeArguments = Set<Selector>();
typeVariableTests
.forEachAppliedSelector((Selector selector, Set<Entity> targets) {
for (Entity target in targets) {
@@ -1393,7 +1391,7 @@
selectorsNeedingTypeArgumentsForTesting ??=
<Selector, Set<Entity>>{};
selectorsNeedingTypeArgumentsForTesting
- .putIfAbsent(selector, () => new Set<Entity>())
+ .putIfAbsent(selector, () => Set<Entity>())
.add(target);
} else {
return;
@@ -1401,7 +1399,7 @@
}
}
});
- Set<int> instantiationsNeedingTypeArguments = new Set<int>();
+ Set<int> instantiationsNeedingTypeArguments = Set<int>();
typeVariableTests.forEachInstantiatedEntity(
(Entity target, Set<GenericInstantiation> instantiations) {
if (methodsNeedingTypeArguments.contains(target) ||
@@ -1445,7 +1443,7 @@
print('instantiationsNeedingTypeArguments: '
'$instantiationsNeedingTypeArguments');*/
- return new RuntimeTypesNeedImpl(
+ return RuntimeTypesNeedImpl(
_elementEnvironment,
classesNeedingTypeArguments,
methodsNeedingSignature,
diff --git a/tools/VERSION b/tools/VERSION
index 3b4a0db..c53a7a2 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 125
+PRERELEASE 126
PRERELEASE_PATCH 0
\ No newline at end of file