Add override annotations consistently
This makes it easier to follow class hierarchies and understand where a
class is changing the interface. I hit this when I found a class that
had the annotation on some methods it was overriding, but not all, which
made it confusing.
Prepares for adding the lint rule and enforcing it.
40% of overridden methods were annotated - add annotations to the remaining 60%.
Change-Id: I02472f4b6c5026a820cf9ff1a7ada663a60f1868
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96666
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/pkg/compiler/lib/compiler.dart b/pkg/compiler/lib/compiler.dart
index 11816ed..3da6d59 100644
--- a/pkg/compiler/lib/compiler.dart
+++ b/pkg/compiler/lib/compiler.dart
@@ -170,5 +170,6 @@
/// diagnostic kinds.
const Diagnostic(this.ordinal, this.name);
+ @override
String toString() => name;
}
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index f54520a..17c84a4 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -22,7 +22,9 @@
/// Implements the [Compiler] using a [api.CompilerInput] for supplying the
/// sources.
class CompilerImpl extends Compiler {
+ @override
final Measurer measurer;
+ @override
api.CompilerInput provider;
api.CompilerDiagnostics handler;
@@ -81,6 +83,7 @@
return future;
}
+ @override
Future<bool> run(Uri uri) {
Duration setupDuration = measurer.elapsedWallClock;
return selfTask.measureSubtask("impl.run", () {
@@ -146,6 +149,7 @@
' (${percent.toStringAsFixed(2)}%)');
}
+ @override
void reportDiagnostic(DiagnosticMessage message,
List<DiagnosticMessage> infos, api.Diagnostic kind) {
_reportDiagnosticMessage(message, kind);
@@ -197,6 +201,7 @@
_Environment(this.definitions);
+ @override
String valueOf(String name) {
var result = definitions[name];
if (result != null || definitions.containsKey(name)) return result;
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 467dfe1c3..343d58b 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -307,14 +307,18 @@
BoxLocal(this.container);
+ @override
String get name => container.name;
+ @override
bool operator ==(other) {
return other is BoxLocal && other.container == container;
}
+ @override
int get hashCode => container.hashCode;
+ @override
String toString() => 'BoxLocal($name)';
}
@@ -324,12 +328,15 @@
ThisLocal(this.enclosingClass);
+ @override
String get name => 'this';
+ @override
bool operator ==(other) {
return other is ThisLocal && other.enclosingClass == enclosingClass;
}
+ @override
int get hashCode => enclosingClass.hashCode;
}
@@ -339,15 +346,19 @@
TypeVariableLocal(this.typeVariable);
+ @override
String get name => typeVariable.element.name;
+ @override
int get hashCode => typeVariable.hashCode;
+ @override
bool operator ==(other) {
if (other is! TypeVariableLocal) return false;
return typeVariable == other.typeVariable;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('type_variable_local(');
diff --git a/pkg/compiler/lib/src/common/codegen.dart b/pkg/compiler/lib/src/common/codegen.dart
index a0c99af..ec92751 100644
--- a/pkg/compiler/lib/src/common/codegen.dart
+++ b/pkg/compiler/lib/src/common/codegen.dart
@@ -46,6 +46,7 @@
_CodegenImpact();
+ @override
void apply(WorldImpactVisitor visitor) {
staticUses.forEach(visitor.visitStaticUse);
dynamicUses.forEach(visitor.visitDynamicUse);
@@ -59,6 +60,7 @@
.add(new Pair<DartType, DartType>(subtype, supertype));
}
+ @override
Iterable<Pair<DartType, DartType>> get typeVariableBoundsSubtypeChecks {
return _typeVariableBoundsSubtypeChecks != null
? _typeVariableBoundsSubtypeChecks
@@ -70,6 +72,7 @@
_constSymbols.add(name);
}
+ @override
Iterable<String> get constSymbols {
return _constSymbols != null ? _constSymbols : const <String>[];
}
@@ -79,6 +82,7 @@
_specializedGetInterceptors.add(classes);
}
+ @override
Iterable<Set<ClassEntity>> get specializedGetInterceptors {
return _specializedGetInterceptors != null
? _specializedGetInterceptors
@@ -89,6 +93,7 @@
_usesInterceptor = true;
}
+ @override
bool get usesInterceptor => _usesInterceptor;
void registerAsyncMarker(AsyncMarker asyncMarker) {
@@ -96,6 +101,7 @@
_asyncMarkers.add(asyncMarker);
}
+ @override
Iterable<AsyncMarker> get asyncMarkers {
return _asyncMarkers != null
? _asyncMarkers.iterable(AsyncMarker.values)
@@ -125,6 +131,7 @@
bool get isForResolution => false;
+ @override
String toString() => 'CodegenRegistry for $currentElement';
@deprecated
diff --git a/pkg/compiler/lib/src/common/tasks.dart b/pkg/compiler/lib/src/common/tasks.dart
index 83a1e0d..ebf692e 100644
--- a/pkg/compiler/lib/src/common/tasks.dart
+++ b/pkg/compiler/lib/src/common/tasks.dart
@@ -208,6 +208,7 @@
}
class GenericTask extends CompilerTask {
+ @override
final String name;
GenericTask(this.name, Measurer measurer) : super(measurer);
}
@@ -230,6 +231,7 @@
final bool enableTaskMeasurements;
static int _hashCodeGenerator = 197;
+ @override
final int hashCode = _hashCodeGenerator++;
Measurer({this.enableTaskMeasurements: false});
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart
index 5f1612e..9a3d3c6 100644
--- a/pkg/compiler/lib/src/common_elements.dart
+++ b/pkg/compiler/lib/src/common_elements.dart
@@ -598,136 +598,165 @@
/// The `Object` class defined in 'dart:core'.
ClassEntity _objectClass;
+ @override
ClassEntity get objectClass =>
_objectClass ??= _findClass(coreLibrary, 'Object');
/// The `bool` class defined in 'dart:core'.
ClassEntity _boolClass;
+ @override
ClassEntity get boolClass => _boolClass ??= _findClass(coreLibrary, 'bool');
/// The `num` class defined in 'dart:core'.
ClassEntity _numClass;
+ @override
ClassEntity get numClass => _numClass ??= _findClass(coreLibrary, 'num');
/// The `int` class defined in 'dart:core'.
ClassEntity _intClass;
+ @override
ClassEntity get intClass => _intClass ??= _findClass(coreLibrary, 'int');
/// The `double` class defined in 'dart:core'.
ClassEntity _doubleClass;
+ @override
ClassEntity get doubleClass =>
_doubleClass ??= _findClass(coreLibrary, 'double');
/// The `String` class defined in 'dart:core'.
ClassEntity _stringClass;
+ @override
ClassEntity get stringClass =>
_stringClass ??= _findClass(coreLibrary, 'String');
/// The `Function` class defined in 'dart:core'.
ClassEntity _functionClass;
+ @override
ClassEntity get functionClass =>
_functionClass ??= _findClass(coreLibrary, 'Function');
/// The `Resource` class defined in 'dart:core'.
ClassEntity _resourceClass;
+ @override
ClassEntity get resourceClass =>
_resourceClass ??= _findClass(coreLibrary, 'Resource');
/// The `Symbol` class defined in 'dart:core'.
ClassEntity _symbolClass;
+ @override
ClassEntity get symbolClass =>
_symbolClass ??= _findClass(coreLibrary, 'Symbol');
/// The `Null` class defined in 'dart:core'.
ClassEntity _nullClass;
+ @override
ClassEntity get nullClass => _nullClass ??= _findClass(coreLibrary, 'Null');
/// The `Type` class defined in 'dart:core'.
ClassEntity _typeClass;
+ @override
ClassEntity get typeClass => _typeClass ??= _findClass(coreLibrary, 'Type');
/// The `StackTrace` class defined in 'dart:core';
ClassEntity _stackTraceClass;
+ @override
ClassEntity get stackTraceClass =>
_stackTraceClass ??= _findClass(coreLibrary, 'StackTrace');
/// The `List` class defined in 'dart:core';
ClassEntity _listClass;
+ @override
ClassEntity get listClass => _listClass ??= _findClass(coreLibrary, 'List');
/// The `Set` class defined in 'dart:core'.
ClassEntity _setClass;
+ @override
ClassEntity get setClass => _setClass ??= _findClass(coreLibrary, 'Set');
/// The `Map` class defined in 'dart:core';
ClassEntity _mapClass;
+ @override
ClassEntity get mapClass => _mapClass ??= _findClass(coreLibrary, 'Map');
/// The `_UnmodifiableSet` class defined in 'dart:collection';
ClassEntity _unmodifiableSetClass;
+ @override
ClassEntity get unmodifiableSetClass => _unmodifiableSetClass ??=
_findClass(_env.lookupLibrary(Uris.dart_collection), '_UnmodifiableSet');
/// The `Iterable` class defined in 'dart:core';
ClassEntity _iterableClass;
+ @override
ClassEntity get iterableClass =>
_iterableClass ??= _findClass(coreLibrary, 'Iterable');
/// The `Future` class defined in 'async';.
ClassEntity _futureClass;
+ @override
ClassEntity get futureClass =>
_futureClass ??= _findClass(asyncLibrary, 'Future');
/// The `Stream` class defined in 'async';
ClassEntity _streamClass;
+ @override
ClassEntity get streamClass =>
_streamClass ??= _findClass(asyncLibrary, 'Stream');
/// The dart:core library.
LibraryEntity _coreLibrary;
+ @override
LibraryEntity get coreLibrary =>
_coreLibrary ??= _env.lookupLibrary(Uris.dart_core, required: true);
/// The dart:async library.
LibraryEntity _asyncLibrary;
+ @override
LibraryEntity get asyncLibrary =>
_asyncLibrary ??= _env.lookupLibrary(Uris.dart_async);
/// The dart:mirrors library. Null if the program doesn't access dart:mirrors.
LibraryEntity _mirrorsLibrary;
+ @override
LibraryEntity get mirrorsLibrary =>
_mirrorsLibrary ??= _env.lookupLibrary(Uris.dart_mirrors);
/// The dart:typed_data library.
LibraryEntity _typedDataLibrary;
+ @override
LibraryEntity get typedDataLibrary =>
_typedDataLibrary ??= _env.lookupLibrary(Uris.dart__native_typed_data);
LibraryEntity _jsHelperLibrary;
+ @override
LibraryEntity get jsHelperLibrary =>
_jsHelperLibrary ??= _env.lookupLibrary(Uris.dart__js_helper);
LibraryEntity _interceptorsLibrary;
+ @override
LibraryEntity get interceptorsLibrary =>
_interceptorsLibrary ??= _env.lookupLibrary(Uris.dart__interceptors);
LibraryEntity _foreignLibrary;
+ @override
LibraryEntity get foreignLibrary =>
_foreignLibrary ??= _env.lookupLibrary(Uris.dart__foreign_helper);
/// Reference to the internal library to lookup functions to always inline.
LibraryEntity _internalLibrary;
+ @override
LibraryEntity get internalLibrary => _internalLibrary ??=
_env.lookupLibrary(Uris.dart__internal, required: true);
/// The `NativeTypedData` class from dart:typed_data.
ClassEntity _typedDataClass;
+ @override
ClassEntity get typedDataClass =>
_typedDataClass ??= _findClass(typedDataLibrary, 'NativeTypedData');
/// Constructor of the `Symbol` class in dart:internal. This getter will
/// ensure that `Symbol` is resolved and lookup the constructor on demand.
ConstructorEntity _symbolConstructorTarget;
+ @override
ConstructorEntity get symbolConstructorTarget {
// TODO(johnniwinther): Kernel does not include redirecting factories
// so this cannot be found in kernel. Find a consistent way to handle
@@ -764,6 +793,7 @@
/// Whether [element] is the same as [symbolConstructor]. Used to check
/// for the constructor without computing it until it is likely to be seen.
+ @override
bool isSymbolConstructor(ConstructorEntity element) {
assert(element != null);
_ensureSymbolConstructorDependencies();
@@ -773,17 +803,20 @@
/// The function `identical` in dart:core.
FunctionEntity _identicalFunction;
+ @override
FunctionEntity get identicalFunction =>
_identicalFunction ??= _findLibraryMember(coreLibrary, 'identical');
/// Whether [element] is the `Function.apply` method. This will not
/// resolve the apply method if it hasn't been seen yet during compilation.
+ @override
bool isFunctionApplyMethod(MemberEntity element) =>
element.name == 'apply' && element.enclosingClass == functionClass;
/// Returns `true` if [element] is the unnamed constructor of `List`. This
/// will not resolve the constructor if it hasn't been seen yet during
/// compilation.
+ @override
bool isUnnamedListConstructor(ConstructorEntity element) =>
(element.name == '' && element.enclosingClass == listClass) ||
(element.name == 'list' && element.enclosingClass == jsArrayClass);
@@ -791,54 +824,70 @@
/// Returns `true` if [element] is the 'filled' constructor of `List`. This
/// will not resolve the constructor if it hasn't been seen yet during
/// compilation.
+ @override
bool isFilledListConstructor(ConstructorEntity element) =>
element.name == 'filled' && element.enclosingClass == listClass;
/// The `dynamic` type.
+ @override
DynamicType get dynamicType => _env.dynamicType;
/// The `Object` type defined in 'dart:core'.
+ @override
InterfaceType get objectType => _getRawType(objectClass);
/// The `bool` type defined in 'dart:core'.
+ @override
InterfaceType get boolType => _getRawType(boolClass);
/// The `num` type defined in 'dart:core'.
+ @override
InterfaceType get numType => _getRawType(numClass);
/// The `int` type defined in 'dart:core'.
+ @override
InterfaceType get intType => _getRawType(intClass);
/// The `double` type defined in 'dart:core'.
+ @override
InterfaceType get doubleType => _getRawType(doubleClass);
/// The `Resource` type defined in 'dart:core'.
+ @override
InterfaceType get resourceType => _getRawType(resourceClass);
/// The `String` type defined in 'dart:core'.
+ @override
InterfaceType get stringType => _getRawType(stringClass);
/// The `Symbol` type defined in 'dart:core'.
+ @override
InterfaceType get symbolType => _getRawType(symbolClass);
/// The `Function` type defined in 'dart:core'.
+ @override
InterfaceType get functionType => _getRawType(functionClass);
/// The `Null` type defined in 'dart:core'.
+ @override
InterfaceType get nullType => _getRawType(nullClass);
/// The `Type` type defined in 'dart:core'.
+ @override
InterfaceType get typeType => _getRawType(typeClass);
+ @override
InterfaceType get typeLiteralType => _getRawType(typeLiteralClass);
/// The `StackTrace` type defined in 'dart:core';
+ @override
InterfaceType get stackTraceType => _getRawType(stackTraceClass);
/// Returns an instance of the `List` type defined in 'dart:core' with
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
+ @override
InterfaceType listType([DartType elementType]) {
if (elementType == null) {
return _getRawType(listClass);
@@ -850,6 +899,7 @@
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
+ @override
InterfaceType setType([DartType elementType]) {
if (elementType == null) {
return _getRawType(setClass);
@@ -861,6 +911,7 @@
/// [keyType] and [valueType] as its type arguments.
///
/// If no type arguments are provided, the canonical raw type is returned.
+ @override
InterfaceType mapType([DartType keyType, DartType valueType]) {
if (keyType == null && valueType == null) {
return _getRawType(mapClass);
@@ -876,6 +927,7 @@
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
+ @override
InterfaceType iterableType([DartType elementType]) {
if (elementType == null) {
return _getRawType(iterableClass);
@@ -887,6 +939,7 @@
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
+ @override
InterfaceType futureType([DartType elementType]) {
if (elementType == null) {
return _getRawType(futureClass);
@@ -898,6 +951,7 @@
/// [elementType] as its type argument.
///
/// If no type argument is provided, the canonical raw type is returned.
+ @override
InterfaceType streamType([DartType elementType]) {
if (elementType == null) {
return _getRawType(streamClass);
@@ -906,16 +960,19 @@
}
/// Returns `true` if [element] is a superclass of `String` or `num`.
+ @override
bool isNumberOrStringSupertype(ClassEntity element) {
return element == _findClass(coreLibrary, 'Comparable', required: false);
}
/// Returns `true` if [element] is a superclass of `String`.
+ @override
bool isStringOnlySupertype(ClassEntity element) {
return element == _findClass(coreLibrary, 'Pattern', required: false);
}
/// Returns `true` if [element] is a superclass of `List`.
+ @override
bool isListSupertype(ClassEntity element) => element == iterableClass;
ClassEntity _findClass(LibraryEntity library, String name,
@@ -953,6 +1010,7 @@
return _env.createInterfaceType(cls, typeArguments);
}
+ @override
InterfaceType getConstantMapTypeFor(InterfaceType sourceType,
{bool hasProtoKey: false, bool onlyStringKeys: false}) {
ClassEntity classElement = onlyStringKeys
@@ -966,17 +1024,21 @@
}
}
+ @override
InterfaceType getConstantSetTypeFor(InterfaceType sourceType) =>
sourceType.treatAsRaw
? _env.getRawType(constSetLiteralClass)
: _env.createInterfaceType(
constSetLiteralClass, sourceType.typeArguments);
+ @override
FieldEntity get symbolField => symbolImplementationField;
+ @override
InterfaceType get symbolImplementationType =>
_env.getRawType(symbolImplementationClass);
+ @override
bool isDefaultEqualityImplementation(MemberEntity element) {
assert(element.name == '==');
ClassEntity classElement = element.enclosingClass;
@@ -988,6 +1050,7 @@
// From dart:core
ClassEntity _mapLiteralClass;
+ @override
ClassEntity get mapLiteralClass {
if (_mapLiteralClass == null) {
_mapLiteralClass = _env.lookupClass(coreLibrary, 'LinkedHashMap');
@@ -1016,27 +1079,32 @@
_env.lookupLocalClassMember(mapLiteralClass, '_makeEmpty');
}
+ @override
ConstructorEntity get mapLiteralConstructor {
_ensureMapLiteralHelpers();
return _mapLiteralConstructor;
}
+ @override
ConstructorEntity get mapLiteralConstructorEmpty {
_ensureMapLiteralHelpers();
return _mapLiteralConstructorEmpty;
}
+ @override
FunctionEntity get mapLiteralUntypedMaker {
_ensureMapLiteralHelpers();
return _mapLiteralUntypedMaker;
}
+ @override
FunctionEntity get mapLiteralUntypedEmptyMaker {
_ensureMapLiteralHelpers();
return _mapLiteralUntypedEmptyMaker;
}
ClassEntity _setLiteralClass;
+ @override
ClassEntity get setLiteralClass => _setLiteralClass ??=
_findClass(_env.lookupLibrary(Uris.dart_collection), 'LinkedHashSet');
@@ -1058,32 +1126,38 @@
_env.lookupLocalClassMember(setLiteralClass, '_makeEmpty');
}
+ @override
ConstructorEntity get setLiteralConstructor {
_ensureSetLiteralHelpers();
return _setLiteralConstructor;
}
+ @override
ConstructorEntity get setLiteralConstructorEmpty {
_ensureSetLiteralHelpers();
return _setLiteralConstructorEmpty;
}
+ @override
FunctionEntity get setLiteralUntypedMaker {
_ensureSetLiteralHelpers();
return _setLiteralUntypedMaker;
}
+ @override
FunctionEntity get setLiteralUntypedEmptyMaker {
_ensureSetLiteralHelpers();
return _setLiteralUntypedEmptyMaker;
}
FunctionEntity _objectNoSuchMethod;
+ @override
FunctionEntity get objectNoSuchMethod {
return _objectNoSuchMethod ??=
_env.lookupLocalClassMember(objectClass, Identifiers.noSuchMethod_);
}
+ @override
bool isDefaultNoSuchMethodImplementation(FunctionEntity element) {
ClassEntity classElement = element.enclosingClass;
return classElement == objectClass ||
@@ -1098,59 +1172,78 @@
FunctionEntity _findAsyncHelperFunction(String name) =>
_findLibraryMember(asyncLibrary, name);
+ @override
FunctionEntity get asyncHelperStartSync =>
_findAsyncHelperFunction("_asyncStartSync");
+ @override
FunctionEntity get asyncHelperAwait =>
_findAsyncHelperFunction("_asyncAwait");
+ @override
FunctionEntity get asyncHelperReturn =>
_findAsyncHelperFunction("_asyncReturn");
+ @override
FunctionEntity get asyncHelperRethrow =>
_findAsyncHelperFunction("_asyncRethrow");
+ @override
FunctionEntity get wrapBody =>
_findAsyncHelperFunction("_wrapJsFunctionForAsync");
+ @override
FunctionEntity get yieldStar => _env.lookupLocalClassMember(
_findAsyncHelperClass("_IterationMarker"), "yieldStar");
+ @override
FunctionEntity get yieldSingle => _env.lookupLocalClassMember(
_findAsyncHelperClass("_IterationMarker"), "yieldSingle");
+ @override
FunctionEntity get syncStarUncaughtError => _env.lookupLocalClassMember(
_findAsyncHelperClass("_IterationMarker"), "uncaughtError");
+ @override
FunctionEntity get asyncStarHelper =>
_findAsyncHelperFunction("_asyncStarHelper");
+ @override
FunctionEntity get streamOfController =>
_findAsyncHelperFunction("_streamOfController");
+ @override
FunctionEntity get endOfIteration => _env.lookupLocalClassMember(
_findAsyncHelperClass("_IterationMarker"), "endOfIteration");
+ @override
ClassEntity get syncStarIterable =>
_findAsyncHelperClass("_SyncStarIterable");
+ @override
ClassEntity get futureImplementation => _findAsyncHelperClass('_Future');
+ @override
ClassEntity get controllerStream =>
_findAsyncHelperClass("_ControllerStream");
+ @override
ClassEntity get streamIterator => _findAsyncHelperClass("StreamIterator");
+ @override
ConstructorEntity get streamIteratorConstructor =>
_env.lookupConstructor(streamIterator, "");
FunctionEntity _syncStarIterableFactory;
+ @override
FunctionEntity get syncStarIterableFactory => _syncStarIterableFactory ??=
_findAsyncHelperFunction('_makeSyncStarIterable');
FunctionEntity _asyncAwaitCompleterFactory;
+ @override
FunctionEntity get asyncAwaitCompleterFactory =>
_asyncAwaitCompleterFactory ??=
_findAsyncHelperFunction('_makeAsyncAwaitCompleter');
FunctionEntity _asyncStarStreamControllerFactory;
+ @override
FunctionEntity get asyncStarStreamControllerFactory =>
_asyncStarStreamControllerFactory ??=
_findAsyncHelperFunction('_makeAsyncStarStreamController');
@@ -1163,92 +1256,114 @@
_findLibraryMember(interceptorsLibrary, name);
ClassEntity _jsInterceptorClass;
+ @override
ClassEntity get jsInterceptorClass =>
_jsInterceptorClass ??= _findInterceptorsClass('Interceptor');
ClassEntity _jsStringClass;
+ @override
ClassEntity get jsStringClass =>
_jsStringClass ??= _findInterceptorsClass('JSString');
ClassEntity _jsArrayClass;
+ @override
ClassEntity get jsArrayClass =>
_jsArrayClass ??= _findInterceptorsClass('JSArray');
ClassEntity _jsNumberClass;
+ @override
ClassEntity get jsNumberClass =>
_jsNumberClass ??= _findInterceptorsClass('JSNumber');
ClassEntity _jsIntClass;
+ @override
ClassEntity get jsIntClass => _jsIntClass ??= _findInterceptorsClass('JSInt');
ClassEntity _jsDoubleClass;
+ @override
ClassEntity get jsDoubleClass =>
_jsDoubleClass ??= _findInterceptorsClass('JSDouble');
ClassEntity _jsNullClass;
+ @override
ClassEntity get jsNullClass =>
_jsNullClass ??= _findInterceptorsClass('JSNull');
ClassEntity _jsBoolClass;
+ @override
ClassEntity get jsBoolClass =>
_jsBoolClass ??= _findInterceptorsClass('JSBool');
ClassEntity _jsPlainJavaScriptObjectClass;
+ @override
ClassEntity get jsPlainJavaScriptObjectClass =>
_jsPlainJavaScriptObjectClass ??=
_findInterceptorsClass('PlainJavaScriptObject');
ClassEntity _jsUnknownJavaScriptObjectClass;
+ @override
ClassEntity get jsUnknownJavaScriptObjectClass =>
_jsUnknownJavaScriptObjectClass ??=
_findInterceptorsClass('UnknownJavaScriptObject');
ClassEntity _jsJavaScriptFunctionClass;
+ @override
ClassEntity get jsJavaScriptFunctionClass => _jsJavaScriptFunctionClass ??=
_findInterceptorsClass('JavaScriptFunction');
ClassEntity _jsJavaScriptObjectClass;
+ @override
ClassEntity get jsJavaScriptObjectClass =>
_jsJavaScriptObjectClass ??= _findInterceptorsClass('JavaScriptObject');
ClassEntity _jsIndexableClass;
+ @override
ClassEntity get jsIndexableClass =>
_jsIndexableClass ??= _findInterceptorsClass('JSIndexable');
ClassEntity _jsMutableIndexableClass;
+ @override
ClassEntity get jsMutableIndexableClass =>
_jsMutableIndexableClass ??= _findInterceptorsClass('JSMutableIndexable');
ClassEntity _jsMutableArrayClass;
+ @override
ClassEntity get jsMutableArrayClass =>
_jsMutableArrayClass ??= _findInterceptorsClass('JSMutableArray');
ClassEntity _jsFixedArrayClass;
+ @override
ClassEntity get jsFixedArrayClass =>
_jsFixedArrayClass ??= _findInterceptorsClass('JSFixedArray');
ClassEntity _jsExtendableArrayClass;
+ @override
ClassEntity get jsExtendableArrayClass =>
_jsExtendableArrayClass ??= _findInterceptorsClass('JSExtendableArray');
ClassEntity _jsUnmodifiableArrayClass;
+ @override
ClassEntity get jsUnmodifiableArrayClass => _jsUnmodifiableArrayClass ??=
_findInterceptorsClass('JSUnmodifiableArray');
ClassEntity _jsPositiveIntClass;
+ @override
ClassEntity get jsPositiveIntClass =>
_jsPositiveIntClass ??= _findInterceptorsClass('JSPositiveInt');
ClassEntity _jsUInt32Class;
+ @override
ClassEntity get jsUInt32Class =>
_jsUInt32Class ??= _findInterceptorsClass('JSUInt32');
ClassEntity _jsUInt31Class;
+ @override
ClassEntity get jsUInt31Class =>
_jsUInt31Class ??= _findInterceptorsClass('JSUInt31');
/// Returns `true` member is the 'findIndexForNativeSubclassType' method
/// declared in `dart:_interceptors`.
+ @override
bool isFindIndexForNativeSubclassType(MemberEntity member) {
return member.name == 'findIndexForNativeSubclassType' &&
member.isTopLevel &&
@@ -1256,24 +1371,29 @@
}
FunctionEntity _getNativeInterceptorMethod;
+ @override
FunctionEntity get getNativeInterceptorMethod =>
_getNativeInterceptorMethod ??=
_findInterceptorsFunction('getNativeInterceptor');
/// Returns `true` if [selector] applies to `JSIndexable.length`.
+ @override
bool appliesToJsIndexableLength(Selector selector) {
return selector.name == 'length' && (selector.isGetter || selector.isCall);
}
ConstructorEntity _jsArrayTypedConstructor;
+ @override
ConstructorEntity get jsArrayTypedConstructor =>
_jsArrayTypedConstructor ??= _findConstructor(jsArrayClass, 'typed');
FunctionEntity _jsArrayRemoveLast;
+ @override
FunctionEntity get jsArrayRemoveLast =>
_jsArrayRemoveLast ??= _findClassMember(jsArrayClass, 'removeLast');
FunctionEntity _jsArrayAdd;
+ @override
FunctionEntity get jsArrayAdd =>
_jsArrayAdd ??= _findClassMember(jsArrayClass, 'add');
@@ -1281,6 +1401,7 @@
return cls.name == 'JSString' && cls.library == interceptorsLibrary;
}
+ @override
bool isJsStringSplit(MemberEntity member) {
return member.name == 'split' &&
member.isInstanceMember &&
@@ -1291,6 +1412,7 @@
/// in the given [world].
///
/// Returns `false` if `JSString.split` is not available.
+ @override
bool appliesToJsStringSplit(Selector selector, AbstractValue receiver,
AbstractValueDomain abstractValueDomain) {
if (_jsStringSplit == null) {
@@ -1308,23 +1430,28 @@
}
FunctionEntity _jsStringSplit;
+ @override
FunctionEntity get jsStringSplit =>
_jsStringSplit ??= _findClassMember(jsStringClass, 'split');
FunctionEntity _jsStringToString;
+ @override
FunctionEntity get jsStringToString =>
_jsStringToString ??= _findClassMember(jsStringClass, 'toString');
FunctionEntity _jsStringOperatorAdd;
+ @override
FunctionEntity get jsStringOperatorAdd =>
_jsStringOperatorAdd ??= _findClassMember(jsStringClass, '+');
ClassEntity _jsConstClass;
+ @override
ClassEntity get jsConstClass =>
_jsConstClass ??= _findClass(foreignLibrary, 'JS_CONST');
// From package:js
ClassEntity _jsAnnotationClass;
+ @override
ClassEntity get jsAnnotationClass {
if (_jsAnnotationClass == null) {
LibraryEntity library = _env.lookupLibrary(Uris.package_js);
@@ -1335,6 +1462,7 @@
}
ClassEntity _jsAnonymousClass;
+ @override
ClassEntity get jsAnonymousClass {
if (_jsAnonymousClass == null) {
LibraryEntity library = _env.lookupLibrary(Uris.package_js);
@@ -1346,6 +1474,7 @@
// From dart:_js_helper
// TODO(johnniwinther): Avoid the need for this (from [CheckedModeHelper]).
+ @override
FunctionEntity findHelperFunction(String name) => _findHelperFunction(name);
FunctionEntity _findHelperFunction(String name) =>
@@ -1355,47 +1484,58 @@
_findClass(jsHelperLibrary, name);
ClassEntity _closureClass;
+ @override
ClassEntity get closureClass => _closureClass ??= _findHelperClass('Closure');
ClassEntity _boundClosureClass;
+ @override
ClassEntity get boundClosureClass =>
_boundClosureClass ??= _findHelperClass('BoundClosure');
ClassEntity _typeLiteralClass;
+ @override
ClassEntity get typeLiteralClass =>
_typeLiteralClass ??= _findHelperClass('TypeImpl');
ClassEntity _constMapLiteralClass;
+ @override
ClassEntity get constMapLiteralClass =>
_constMapLiteralClass ??= _findHelperClass('ConstantMap');
// TODO(fishythefish): Implement a `ConstantSet` class and update the backend
// impacts + constant emitter accordingly.
ClassEntity _constSetLiteralClass;
+ @override
ClassEntity get constSetLiteralClass =>
_constSetLiteralClass ??= unmodifiableSetClass;
ClassEntity _typeVariableClass;
+ @override
ClassEntity get typeVariableClass =>
_typeVariableClass ??= _findHelperClass('TypeVariable');
ClassEntity _pragmaClass;
+ @override
ClassEntity get pragmaClass =>
_pragmaClass ??= _findClass(coreLibrary, 'pragma');
FieldEntity _pragmaClassNameField;
+ @override
FieldEntity get pragmaClassNameField =>
_pragmaClassNameField ??= _findClassMember(pragmaClass, 'name');
FieldEntity _pragmaClassOptionsField;
+ @override
FieldEntity get pragmaClassOptionsField =>
_pragmaClassOptionsField ??= _findClassMember(pragmaClass, 'options');
ClassEntity _jsInvocationMirrorClass;
+ @override
ClassEntity get jsInvocationMirrorClass =>
_jsInvocationMirrorClass ??= _findHelperClass('JSInvocationMirror');
MemberEntity _invocationTypeArgumentGetter;
+ @override
MemberEntity get invocationTypeArgumentGetter =>
_invocationTypeArgumentGetter ??=
_findClassMember(jsInvocationMirrorClass, 'typeArguments');
@@ -1403,110 +1543,143 @@
/// Interface used to determine if an object has the JavaScript
/// indexing behavior. The interface is only visible to specific libraries.
ClassEntity _jsIndexingBehaviorInterface;
+ @override
ClassEntity get jsIndexingBehaviorInterface =>
_jsIndexingBehaviorInterface ??=
_findHelperClass('JavaScriptIndexingBehavior');
+ @override
ClassEntity get stackTraceHelperClass => _findHelperClass('_StackTrace');
+ @override
ClassEntity get constantMapClass =>
_findHelperClass(constant_system.JavaScriptMapConstant.DART_CLASS);
+ @override
ClassEntity get constantStringMapClass =>
_findHelperClass(constant_system.JavaScriptMapConstant.DART_STRING_CLASS);
+ @override
ClassEntity get constantProtoMapClass =>
_findHelperClass(constant_system.JavaScriptMapConstant.DART_PROTO_CLASS);
+ @override
ClassEntity get generalConstantMapClass => _findHelperClass(
constant_system.JavaScriptMapConstant.DART_GENERAL_CLASS);
+ @override
ClassEntity get annotationCreatesClass => _findHelperClass('Creates');
+ @override
ClassEntity get annotationReturnsClass => _findHelperClass('Returns');
+ @override
ClassEntity get annotationJSNameClass => _findHelperClass('JSName');
/// The class for native annotations defined in dart:_js_helper.
ClassEntity _nativeAnnotationClass;
+ @override
ClassEntity get nativeAnnotationClass =>
_nativeAnnotationClass ??= _findHelperClass('Native');
ConstructorEntity _typeVariableConstructor;
+ @override
ConstructorEntity get typeVariableConstructor => _typeVariableConstructor ??=
_env.lookupConstructor(typeVariableClass, '');
FunctionEntity _assertTest;
+ @override
FunctionEntity get assertTest =>
_assertTest ??= _findHelperFunction('assertTest');
FunctionEntity _assertThrow;
+ @override
FunctionEntity get assertThrow =>
_assertThrow ??= _findHelperFunction('assertThrow');
FunctionEntity _assertHelper;
+ @override
FunctionEntity get assertHelper =>
_assertHelper ??= _findHelperFunction('assertHelper');
FunctionEntity _assertUnreachableMethod;
+ @override
FunctionEntity get assertUnreachableMethod =>
_assertUnreachableMethod ??= _findHelperFunction('assertUnreachable');
/// Holds the method "getIsolateAffinityTag" when dart:_js_helper has been
/// loaded.
FunctionEntity _getIsolateAffinityTagMarker;
+ @override
FunctionEntity get getIsolateAffinityTagMarker =>
_getIsolateAffinityTagMarker ??=
_findHelperFunction('getIsolateAffinityTag');
/// Holds the method "requiresPreamble" in _js_helper.
FunctionEntity _requiresPreambleMarker;
+ @override
FunctionEntity get requiresPreambleMarker =>
_requiresPreambleMarker ??= _findHelperFunction('requiresPreamble');
+ @override
FunctionEntity get loadLibraryWrapper =>
_findHelperFunction("_loadLibraryWrapper");
+ @override
FunctionEntity get loadDeferredLibrary =>
_findHelperFunction("loadDeferredLibrary");
+ @override
FunctionEntity get boolConversionCheck =>
_findHelperFunction('boolConversionCheck');
+ @override
FunctionEntity get traceHelper => _findHelperFunction('traceHelper');
+ @override
FunctionEntity get closureFromTearOff =>
_findHelperFunction('closureFromTearOff');
+ @override
FunctionEntity get isJsIndexable => _findHelperFunction('isJsIndexable');
+ @override
FunctionEntity get throwIllegalArgumentException =>
_findHelperFunction('iae');
+ @override
FunctionEntity get throwIndexOutOfRangeException =>
_findHelperFunction('ioore');
+ @override
FunctionEntity get exceptionUnwrapper =>
_findHelperFunction('unwrapException');
+ @override
FunctionEntity get throwRuntimeError =>
_findHelperFunction('throwRuntimeError');
+ @override
FunctionEntity get throwUnsupportedError =>
_findHelperFunction('throwUnsupportedError');
+ @override
FunctionEntity get throwTypeError => _findHelperFunction('throwTypeError');
+ @override
FunctionEntity get throwAbstractClassInstantiationError =>
_findHelperFunction('throwAbstractClassInstantiationError');
FunctionEntity _cachedCheckConcurrentModificationError;
+ @override
FunctionEntity get checkConcurrentModificationError =>
_cachedCheckConcurrentModificationError ??=
_findHelperFunction('checkConcurrentModificationError');
+ @override
FunctionEntity get throwConcurrentModificationError =>
_findHelperFunction('throwConcurrentModificationError');
/// Return `true` if [member] is the 'checkInt' function defined in
/// dart:_js_helpers.
+ @override
bool isCheckInt(MemberEntity member) {
return member.isFunction &&
member.isTopLevel &&
@@ -1516,6 +1689,7 @@
/// Return `true` if [member] is the 'checkNum' function defined in
/// dart:_js_helpers.
+ @override
bool isCheckNum(MemberEntity member) {
return member.isFunction &&
member.isTopLevel &&
@@ -1525,6 +1699,7 @@
/// Return `true` if [member] is the 'checkString' function defined in
/// dart:_js_helpers.
+ @override
bool isCheckString(MemberEntity member) {
return member.isFunction &&
member.isTopLevel &&
@@ -1532,92 +1707,123 @@
member.name == 'checkString';
}
+ @override
FunctionEntity get stringInterpolationHelper => _findHelperFunction('S');
+ @override
FunctionEntity get wrapExceptionHelper =>
_findHelperFunction('wrapException');
+ @override
FunctionEntity get throwExpressionHelper =>
_findHelperFunction('throwExpression');
+ @override
FunctionEntity get closureConverter =>
_findHelperFunction('convertDartClosureToJS');
+ @override
FunctionEntity get traceFromException =>
_findHelperFunction('getTraceFromException');
+ @override
FunctionEntity get setRuntimeTypeInfo =>
_findHelperFunction('setRuntimeTypeInfo');
+ @override
FunctionEntity get getRuntimeTypeInfo =>
_findHelperFunction('getRuntimeTypeInfo');
+ @override
FunctionEntity get getTypeArgumentByIndex =>
_findHelperFunction('getTypeArgumentByIndex');
+ @override
FunctionEntity get computeSignature =>
_findHelperFunction('computeSignature');
+ @override
FunctionEntity get getRuntimeTypeArguments =>
_findHelperFunction('getRuntimeTypeArguments');
+ @override
FunctionEntity get getRuntimeTypeArgument =>
_findHelperFunction('getRuntimeTypeArgument');
+ @override
FunctionEntity get getRuntimeTypeArgumentIntercepted =>
_findHelperFunction('getRuntimeTypeArgumentIntercepted');
+ @override
FunctionEntity get assertIsSubtype => _findHelperFunction('assertIsSubtype');
+ @override
FunctionEntity get checkSubtype => _findHelperFunction('checkSubtype');
+ @override
FunctionEntity get assertSubtype => _findHelperFunction('assertSubtype');
+ @override
FunctionEntity get subtypeCast => _findHelperFunction('subtypeCast');
+ @override
FunctionEntity get functionTypeTest =>
_findHelperFunction('functionTypeTest');
+ @override
FunctionEntity get futureOrTest => _findHelperFunction('futureOrTest');
+ @override
FunctionEntity get checkSubtypeOfRuntimeType =>
_findHelperFunction('checkSubtypeOfRuntimeType');
+ @override
FunctionEntity get assertSubtypeOfRuntimeType =>
_findHelperFunction('assertSubtypeOfRuntimeType');
+ @override
FunctionEntity get subtypeOfRuntimeTypeCast =>
_findHelperFunction('subtypeOfRuntimeTypeCast');
+ @override
FunctionEntity get checkDeferredIsLoaded =>
_findHelperFunction('checkDeferredIsLoaded');
+ @override
FunctionEntity get throwNoSuchMethod =>
_findHelperFunction('throwNoSuchMethod');
+ @override
FunctionEntity get createRuntimeType =>
_findHelperFunction('createRuntimeType');
+ @override
FunctionEntity get fallThroughError =>
_findHelperFunction("getFallThroughError");
+ @override
FunctionEntity get createInvocationMirror =>
_findHelperFunction('createInvocationMirror');
+ @override
bool isCreateInvocationMirrorHelper(MemberEntity member) {
return member.isTopLevel &&
member.name == '_createInvocationMirror' &&
member.library == coreLibrary;
}
+ @override
FunctionEntity get createUnmangledInvocationMirror =>
_findHelperFunction('createUnmangledInvocationMirror');
+ @override
FunctionEntity get cyclicThrowHelper =>
_findHelperFunction("throwCyclicInit");
+ @override
FunctionEntity get defineProperty => _findHelperFunction('defineProperty');
+ @override
bool isExtractTypeArguments(FunctionEntity member) {
return member.name == 'extractTypeArguments' &&
member.library == internalLibrary;
@@ -1634,22 +1840,27 @@
}
}
+ @override
ClassEntity getInstantiationClass(int typeArgumentCount) {
_checkTypeArgumentCount(typeArgumentCount);
return _findHelperClass('Instantiation$typeArgumentCount');
}
+ @override
FunctionEntity getInstantiateFunction(int typeArgumentCount) {
_checkTypeArgumentCount(typeArgumentCount);
return _findHelperFunction('instantiate$typeArgumentCount');
}
+ @override
FunctionEntity get instantiatedGenericFunctionType =>
_findHelperFunction('instantiatedGenericFunctionType');
+ @override
FunctionEntity get extractFunctionTypeObjectFromInternal =>
_findHelperFunction('extractFunctionTypeObjectFromInternal');
+ @override
bool isInstantiationClass(ClassEntity cls) {
return cls.library == _jsHelperLibrary &&
cls.name != 'Instantiation' &&
@@ -1659,15 +1870,19 @@
// From dart:_internal
ClassEntity _symbolImplementationClass;
+ @override
ClassEntity get symbolImplementationClass =>
_symbolImplementationClass ??= _findClass(internalLibrary, 'Symbol');
/// Used to annotate items that have the keyword "native".
ClassEntity _externalNameClass;
+ @override
ClassEntity get externalNameClass =>
_externalNameClass ??= _findClass(internalLibrary, 'ExternalName');
+ @override
InterfaceType get externalNameType => _getRawType(externalNameClass);
+ @override
ConstructorEntity get symbolValidatedConstructor =>
_symbolValidatedConstructor ??=
_findConstructor(symbolImplementationClass, 'validated');
@@ -1680,6 +1895,7 @@
required: true);
ConstructorEntity _symbolValidatedConstructor;
+ @override
bool isSymbolValidatedConstructor(ConstructorEntity element) {
if (_symbolValidatedConstructor != null) {
return element == _symbolValidatedConstructor;
@@ -1690,11 +1906,13 @@
// From dart:_native_typed_data
ClassEntity _typedArrayOfIntClass;
+ @override
ClassEntity get typedArrayOfIntClass => _typedArrayOfIntClass ??= _findClass(
_env.lookupLibrary(Uris.dart__native_typed_data, required: true),
'NativeTypedArrayOfInt');
ClassEntity _typedArrayOfDoubleClass;
+ @override
ClassEntity get typedArrayOfDoubleClass =>
_typedArrayOfDoubleClass ??= _findClass(
_env.lookupLibrary(Uris.dart__native_typed_data, required: true),
@@ -1704,12 +1922,14 @@
/// Holds the class for the [JsGetName] enum.
ClassEntity _jsGetNameEnum;
+ @override
ClassEntity get jsGetNameEnum => _jsGetNameEnum ??= _findClass(
_env.lookupLibrary(Uris.dart__js_embedded_names, required: true),
'JsGetName');
/// Holds the class for the [JsBuiltins] enum.
ClassEntity _jsBuiltinEnum;
+ @override
ClassEntity get jsBuiltinEnum => _jsBuiltinEnum ??= _findClass(
_env.lookupLibrary(Uris.dart__js_embedded_names, required: true),
'JsBuiltin');
@@ -1734,22 +1954,26 @@
}
}
+ @override
ClassEntity get metaNoInlineClass {
_ensureMetaAnnotations();
return _metaNoInlineClass;
}
+ @override
ClassEntity get metaTryInlineClass {
_ensureMetaAnnotations();
return _metaTryInlineClass;
}
+ @override
bool isForeign(MemberEntity element) => element.library == foreignLibrary;
/// Returns `true` if [member] is a "foreign helper", that is, a member whose
/// semantics is defined synthetically and not through Dart code.
///
/// Most foreign helpers are located in the `dart:_foreign_helper` library.
+ @override
bool isForeignHelper(MemberEntity member) {
return member.library == foreignLibrary ||
isCreateInvocationMirrorHelper(member);
@@ -1762,6 +1986,7 @@
///
/// This returns `false` for JS interop members which therefore must be
/// allowed to be external through the JS interop annotation handling.
+ @override
bool isExternalAllowed(FunctionEntity function) {
return isForeignHelper(function) ||
(function is ConstructorEntity &&
@@ -1774,6 +1999,7 @@
/// Returns `true` if the implementation of the 'operator ==' [function] is
/// known to handle `null` as argument.
+ @override
bool operatorEqHandlesNullArgument(FunctionEntity function) {
assert(function.name == '==',
failedAt(function, "Unexpected function $function."));
@@ -1783,6 +2009,7 @@
cls == jsNullClass;
}
+ @override
ClassEntity getDefaultSuperclass(
ClassEntity cls, NativeBasicData nativeBasicData) {
if (nativeBasicData.isJsInteropClass(cls)) {
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index baffff3..2eb6455 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -673,6 +673,7 @@
class CompilerDiagnosticReporter extends DiagnosticReporter {
final Compiler compiler;
+ @override
final DiagnosticOptions options;
Entity _currentElement;
@@ -690,6 +691,7 @@
Entity get currentElement => _currentElement;
+ @override
DiagnosticMessage createMessage(Spannable spannable, MessageKind messageKind,
[Map arguments = const {}]) {
SourceSpan span = spanFromSpannable(spannable);
@@ -698,22 +700,26 @@
return new DiagnosticMessage(span, spannable, message);
}
+ @override
void reportError(DiagnosticMessage message,
[List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
reportDiagnosticInternal(message, infos, api.Diagnostic.ERROR);
}
+ @override
void reportWarning(DiagnosticMessage message,
[List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
reportDiagnosticInternal(message, infos, api.Diagnostic.WARNING);
}
+ @override
void reportHint(DiagnosticMessage message,
[List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
reportDiagnosticInternal(message, infos, api.Diagnostic.HINT);
}
@deprecated
+ @override
void reportInfo(Spannable node, MessageKind messageKind,
[Map arguments = const {}]) {
reportDiagnosticInternal(createMessage(node, messageKind, arguments),
@@ -779,6 +785,7 @@
/// Perform an operation, [f], returning the return value from [f]. If an
/// error occurs then report it as having occurred during compilation of
/// [element]. Can be nested.
+ @override
withCurrentElement(Entity element, f()) {
Entity old = currentElement;
_currentElement = element;
@@ -832,6 +839,7 @@
throw 'No error location.';
}
+ @override
SourceSpan spanFromSpannable(Spannable spannable) {
if (spannable == CURRENT_ELEMENT_SPANNABLE) {
spannable = currentElement;
@@ -852,6 +860,7 @@
}
}
+ @override
internalError(Spannable spannable, reason) {
String message = tryToString(reason);
reportDiagnosticInternal(
@@ -886,6 +895,7 @@
return element != null ? element : currentElement;
}
+ @override
void log(message) {
Message msg = MessageTemplate.TEMPLATES[MessageKind.GENERIC]
.message({'text': '$message'});
@@ -953,11 +963,13 @@
final Map<Entity, WorldImpact> _impactCache;
_MapImpactCacheDeleter(this._impactCache);
+ @override
void uncacheWorldImpact(Entity element) {
if (retainDataForTesting) return;
_impactCache.remove(element);
}
+ @override
void emptyCache() {
if (retainDataForTesting) return;
_impactCache.clear();
@@ -967,6 +979,7 @@
class _EmptyEnvironment implements Environment {
const _EmptyEnvironment();
+ @override
String valueOf(String key) => null;
}
@@ -990,6 +1003,7 @@
ProgressImpl(this._reporter);
+ @override
void showProgress(String prefix, int count, String suffix) {
if (_stopwatch.elapsedMilliseconds > 500) {
_reporter.log('$prefix$count$suffix');
@@ -997,6 +1011,7 @@
}
}
+ @override
void startPhase() {
_stopwatch.reset();
}
@@ -1008,12 +1023,14 @@
class InteractiveProgress implements Progress {
final Stopwatch _stopwatchPhase = new Stopwatch()..start();
final Stopwatch _stopwatchInterval = new Stopwatch()..start();
+ @override
void startPhase() {
print('');
_stopwatchPhase.reset();
_stopwatchInterval.reset();
}
+ @override
void showProgress(String prefix, int count, String suffix) {
if (_stopwatchInterval.elapsedMilliseconds > 500) {
var time = _stopwatchPhase.elapsedMilliseconds / 1000;
diff --git a/pkg/compiler/lib/src/constants/constant_system.dart b/pkg/compiler/lib/src/constants/constant_system.dart
index 701fc39..40ef21c 100644
--- a/pkg/compiler/lib/src/constants/constant_system.dart
+++ b/pkg/compiler/lib/src/constants/constant_system.dart
@@ -1001,8 +1001,10 @@
List<ConstantValue> values, this.protoValue, this.onlyStringKeys)
: this.keyList = keyList,
super(type, keyList.entries, values);
+ @override
bool get isMap => true;
+ @override
List<ConstantValue> getDependencies() {
List<ConstantValue> result = <ConstantValue>[];
if (onlyStringKeys) {
diff --git a/pkg/compiler/lib/src/constants/constructors.dart b/pkg/compiler/lib/src/constants/constructors.dart
index e575b5a..3b9fb60 100644
--- a/pkg/compiler/lib/src/constants/constructors.dart
+++ b/pkg/compiler/lib/src/constants/constructors.dart
@@ -74,13 +74,16 @@
GenerativeConstantConstructor(this.type, this.defaultValues, this.fieldMap,
this.assertions, this.superConstructorInvocation);
+ @override
ConstantConstructorKind get kind => ConstantConstructorKind.GENERATIVE;
+ @override
InterfaceType computeInstanceType(
EvaluationEnvironment environment, InterfaceType newType) {
return environment.substByContext(type, newType);
}
+ @override
InstanceData computeInstanceData(EvaluationEnvironment environment,
List<ConstantExpression> arguments, CallStructure callStructure) {
NormalizedArguments args =
@@ -96,10 +99,12 @@
return appliedInstanceData;
}
+ @override
accept(ConstantConstructorVisitor visitor, arg) {
return visitor.visitGenerative(this, arg);
}
+ @override
int get hashCode {
int hash = Hashing.objectHash(type);
hash = Hashing.mapHash(defaultValues, hash);
@@ -107,6 +112,7 @@
return Hashing.objectHash(superConstructorInvocation, hash);
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! GenerativeConstantConstructor) return false;
@@ -116,6 +122,7 @@
mapEquals(fieldMap, other.fieldMap);
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write("{'type': $type");
@@ -181,16 +188,19 @@
RedirectingGenerativeConstantConstructor(
this.defaultValues, this.thisConstructorInvocation);
+ @override
ConstantConstructorKind get kind {
return ConstantConstructorKind.REDIRECTING_GENERATIVE;
}
+ @override
InterfaceType computeInstanceType(
EvaluationEnvironment environment, InterfaceType newType) {
return environment.substByContext(
thisConstructorInvocation.computeInstanceType(environment), newType);
}
+ @override
InstanceData computeInstanceData(EvaluationEnvironment environment,
List<ConstantExpression> arguments, CallStructure callStructure) {
NormalizedArguments args =
@@ -201,15 +211,18 @@
return appliedInstanceData;
}
+ @override
accept(ConstantConstructorVisitor visitor, arg) {
return visitor.visitRedirectingGenerative(this, arg);
}
+ @override
int get hashCode {
int hash = Hashing.objectHash(thisConstructorInvocation);
return Hashing.mapHash(defaultValues, hash);
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! RedirectingGenerativeConstantConstructor) return false;
@@ -218,6 +231,7 @@
defaultValues, other.defaultValues);
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write("{'type': ${thisConstructorInvocation.type}");
@@ -236,16 +250,19 @@
RedirectingFactoryConstantConstructor(this.targetConstructorInvocation);
+ @override
ConstantConstructorKind get kind {
return ConstantConstructorKind.REDIRECTING_FACTORY;
}
+ @override
InterfaceType computeInstanceType(
EvaluationEnvironment environment, InterfaceType newType) {
return environment.substByContext(
targetConstructorInvocation.computeInstanceType(environment), newType);
}
+ @override
InstanceData computeInstanceData(EvaluationEnvironment environment,
List<ConstantExpression> arguments, CallStructure callStructure) {
ConstantConstructor constantConstructor =
@@ -254,20 +271,24 @@
environment, arguments, callStructure);
}
+ @override
accept(ConstantConstructorVisitor visitor, arg) {
return visitor.visitRedirectingFactory(this, arg);
}
+ @override
int get hashCode {
return Hashing.objectHash(targetConstructorInvocation);
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! RedirectingFactoryConstantConstructor) return false;
return targetConstructorInvocation == other.targetConstructorInvocation;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write("{");
diff --git a/pkg/compiler/lib/src/constants/evaluation.dart b/pkg/compiler/lib/src/constants/evaluation.dart
index e9ac77a..f360735 100644
--- a/pkg/compiler/lib/src/constants/evaluation.dart
+++ b/pkg/compiler/lib/src/constants/evaluation.dart
@@ -71,6 +71,7 @@
abstract class EvaluationEnvironmentBase implements EvaluationEnvironment {
Link<Spannable> _spannableStack = const Link<Spannable>();
+ @override
InterfaceType enclosingConstructedType;
final Set<FieldEntity> _currentlyEvaluatedFields = new Set<FieldEntity>();
final bool constantRequired;
@@ -79,6 +80,7 @@
_spannableStack = _spannableStack.prepend(spannable);
}
+ @override
bool get checkCasts => true;
DiagnosticReporter get reporter;
@@ -239,6 +241,7 @@
return value;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('NormalizedArguments[');
diff --git a/pkg/compiler/lib/src/constants/expressions.dart b/pkg/compiler/lib/src/constants/expressions.dart
index d0abc41..bb24531 100644
--- a/pkg/compiler/lib/src/constants/expressions.dart
+++ b/pkg/compiler/lib/src/constants/expressions.dart
@@ -99,10 +99,12 @@
int _computeHashCode();
+ @override
int get hashCode => _hashCode ??= _computeHashCode();
bool _equals(covariant ConstantExpression other);
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! ConstantExpression) return false;
@@ -111,6 +113,7 @@
return _equals(other);
}
+ @override
String toString() {
assertDebugMode('Use ConstantExpression.toDartText() or '
'ConstantExpression.toStructuredText() instead of '
@@ -136,8 +139,10 @@
/// A synthetic constant used to recover from errors.
class ErroneousConstantExpression extends ConstantExpression {
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.ERRONEOUS;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
// Do nothing. This is an error.
}
@@ -166,8 +171,10 @@
BoolConstantExpression(this.boolValue);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.BOOL;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitBool(this, context);
}
@@ -201,8 +208,10 @@
IntConstantExpression(this.intValue);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.INT;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitInt(this, context);
}
@@ -236,8 +245,10 @@
DoubleConstantExpression(this.doubleValue);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.DOUBLE;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitDouble(this, context);
}
@@ -271,8 +282,10 @@
StringConstantExpression(this.stringValue);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.STRING;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitString(this, context);
}
@@ -304,8 +317,10 @@
class NullConstantExpression extends ConstantExpression {
NullConstantExpression();
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.NULL;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitNull(this, context);
}
@@ -338,8 +353,10 @@
ListConstantExpression(this.type, this.values);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.LIST;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitList(this, context);
}
@@ -362,6 +379,7 @@
type, values.map((v) => v.evaluate(environment)).toList());
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new ListConstantExpression(
type, values.map((v) => v.apply(arguments)).toList());
@@ -475,8 +493,10 @@
MapConstantExpression(this.type, this.keys, this.values);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.MAP;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitMap(this, context);
}
@@ -519,6 +539,7 @@
});
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new MapConstantExpression(
type,
@@ -571,8 +592,10 @@
assert(!arguments.contains(null));
}
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.CONSTRUCTED;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitConstructed(this, context);
}
@@ -605,6 +628,7 @@
.computeInstanceType(environment, type);
}
+ @override
ConstructedConstantExpression apply(NormalizedArguments arguments) {
return new ConstructedConstantExpression(type, target, callStructure,
this.arguments.map((a) => a.apply(arguments)).toList());
@@ -683,8 +707,10 @@
ConcatenateConstantExpression(this.expressions);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.CONCATENATE;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitConcatenate(this, context);
}
@@ -701,6 +727,7 @@
sb.write('])');
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new ConcatenateConstantExpression(
expressions.map((a) => a.apply(arguments)).toList());
@@ -782,8 +809,10 @@
SymbolConstantExpression(this.name);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.SYMBOL;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitSymbol(this, context);
}
@@ -822,8 +851,10 @@
"Unexpected type constant type: $type");
}
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.TYPE;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitType(this, context);
}
@@ -859,8 +890,10 @@
AsConstantExpression(this.expression, this.type);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.AS;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitAs(this, context);
}
@@ -936,8 +969,10 @@
FieldConstantExpression(this.element);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.FIELD;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitField(this, context);
}
@@ -970,8 +1005,10 @@
LocalVariableConstantExpression(this.element);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.LOCAL_VARIABLE;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitLocalVariable(this, context);
}
@@ -1003,8 +1040,10 @@
FunctionConstantExpression(this.element, this.type);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.FUNCTION;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitFunction(this, context);
}
@@ -1046,8 +1085,10 @@
static bool potentialOperator(BinaryOperator operator) =>
PRECEDENCE_MAP[operator.kind] != null;
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.BINARY;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitBinary(this, context);
}
@@ -1302,11 +1343,13 @@
return new NonConstantValue();
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new BinaryConstantExpression(
left.apply(arguments), operator, right.apply(arguments));
}
+ @override
// ignore: MISSING_RETURN
InterfaceType getKnownType(CommonElements commonElements) {
DartType knownLeftType = left.getKnownType(commonElements);
@@ -1359,6 +1402,7 @@
}
}
+ @override
int get precedence => PRECEDENCE_MAP[operator.kind];
@override
@@ -1410,8 +1454,10 @@
IdenticalConstantExpression(this.left, this.right);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.IDENTICAL;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitIdentical(this, context);
}
@@ -1435,11 +1481,13 @@
return new NonConstantValue();
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new IdenticalConstantExpression(
left.apply(arguments), right.apply(arguments));
}
+ @override
int get precedence => 15;
@override
@@ -1471,8 +1519,10 @@
assert(PRECEDENCE_MAP[operator.kind] != null);
}
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.UNARY;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitUnary(this, context);
}
@@ -1533,10 +1583,12 @@
return new NonConstantValue();
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new UnaryConstantExpression(operator, expression.apply(arguments));
}
+ @override
int get precedence => PRECEDENCE_MAP[operator.kind];
@override
@@ -1572,8 +1624,10 @@
StringLengthConstantExpression(this.expression);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.STRING_LENGTH;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitStringLength(this, context);
}
@@ -1602,10 +1656,12 @@
}
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new StringLengthConstantExpression(expression.apply(arguments));
}
+ @override
int get precedence => 15;
@override
@@ -1636,8 +1692,10 @@
ConditionalConstantExpression(this.condition, this.trueExp, this.falseExp);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.CONDITIONAL;
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitConditional(this, context);
}
@@ -1653,11 +1711,13 @@
sb.write(')');
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new ConditionalConstantExpression(condition.apply(arguments),
trueExp.apply(arguments), falseExp.apply(arguments));
}
+ @override
int get precedence => 3;
@override
@@ -1720,10 +1780,12 @@
PositionalArgumentReference(this.index);
+ @override
ConstantExpressionKind get kind {
return ConstantExpressionKind.POSITIONAL_REFERENCE;
}
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitPositional(this, context);
}
@@ -1733,6 +1795,7 @@
sb.write('Positional(index=$index)');
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return arguments.getPositionalArgument(index);
}
@@ -1758,10 +1821,12 @@
NamedArgumentReference(this.name);
+ @override
ConstantExpressionKind get kind {
return ConstantExpressionKind.NAMED_REFERENCE;
}
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitNamed(this, context);
}
@@ -1771,6 +1836,7 @@
sb.write('Named(name=$name)');
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return arguments.getNamedArgument(name);
}
@@ -1838,10 +1904,12 @@
ConstantExpression name, ConstantExpression defaultValue)
: super(name, defaultValue);
+ @override
ConstantExpressionKind get kind {
return ConstantExpressionKind.BOOL_FROM_ENVIRONMENT;
}
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitBoolFromEnvironment(this, context);
}
@@ -1898,6 +1966,7 @@
return new NonConstantValue();
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new BoolFromEnvironmentConstantExpression(name.apply(arguments),
defaultValue != null ? defaultValue.apply(arguments) : null);
@@ -1915,10 +1984,12 @@
ConstantExpression name, ConstantExpression defaultValue)
: super(name, defaultValue);
+ @override
ConstantExpressionKind get kind {
return ConstantExpressionKind.INT_FROM_ENVIRONMENT;
}
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitIntFromEnvironment(this, context);
}
@@ -1977,6 +2048,7 @@
return new NonConstantValue();
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new IntFromEnvironmentConstantExpression(name.apply(arguments),
defaultValue != null ? defaultValue.apply(arguments) : null);
@@ -1994,10 +2066,12 @@
ConstantExpression name, ConstantExpression defaultValue)
: super(name, defaultValue);
+ @override
ConstantExpressionKind get kind {
return ConstantExpressionKind.STRING_FROM_ENVIRONMENT;
}
+ @override
accept(ConstantExpressionVisitor visitor, [context]) {
return visitor.visitStringFromEnvironment(this, context);
}
@@ -2052,6 +2126,7 @@
return new NonConstantValue();
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new StringFromEnvironmentConstantExpression(name.apply(arguments),
defaultValue != null ? defaultValue.apply(arguments) : null);
@@ -2133,6 +2208,7 @@
return visitor.visitAssert(this, context);
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new AssertConstantExpression(
condition.apply(arguments), message?.apply(arguments));
@@ -2145,6 +2221,7 @@
InstantiationConstantExpression(this.typeArguments, this.expression);
+ @override
ConstantExpressionKind get kind => ConstantExpressionKind.INSTANTIATION;
@override
@@ -2167,6 +2244,7 @@
return Hashing.objectHash(expression, Hashing.listHash(typeArguments));
}
+ @override
ConstantExpression apply(NormalizedArguments arguments) {
return new InstantiationConstantExpression(
typeArguments, expression.apply(arguments));
@@ -2527,5 +2605,6 @@
sb.write(')');
}
+ @override
String toString() => sb.toString();
}
diff --git a/pkg/compiler/lib/src/constants/values.dart b/pkg/compiler/lib/src/constants/values.dart
index dc26f40..98af5f5 100644
--- a/pkg/compiler/lib/src/constants/values.dart
+++ b/pkg/compiler/lib/src/constants/values.dart
@@ -113,6 +113,7 @@
ConstantValueKind get kind;
+ @override
String toString() {
assertDebugMode("Use ConstantValue.toDartText() or "
"ConstantValue.toStructuredText() "
@@ -128,23 +129,31 @@
FunctionConstantValue(this.element, this.type);
+ @override
bool get isFunction => true;
+ @override
bool operator ==(var other) {
if (other is! FunctionConstantValue) return false;
return identical(other.element, element);
}
+ @override
List<ConstantValue> getDependencies() => const <ConstantValue>[];
+ @override
FunctionType getType(CommonElements types) => type;
+ @override
int get hashCode => (17 * element.hashCode) & 0x7fffffff;
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitFunction(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.FUNCTION;
+ @override
String toDartText() {
if (element.enclosingClass != null) {
return '${element.enclosingClass.name}.${element.name}';
@@ -153,6 +162,7 @@
}
}
+ @override
String toStructuredText() {
return 'FunctionConstant(${toDartText()})';
}
@@ -161,16 +171,20 @@
abstract class PrimitiveConstantValue extends ConstantValue {
const PrimitiveConstantValue();
+ @override
bool get isPrimitive => true;
+ @override
bool operator ==(var other) {
// Making this method abstract does not give us an error.
throw new UnsupportedError('PrimitiveConstant.==');
}
+ @override
int get hashCode => throw new UnsupportedError('PrimitiveConstant.hashCode');
// Primitive constants don't have dependencies.
+ @override
List<ConstantValue> getDependencies() => const <ConstantValue>[];
}
@@ -182,27 +196,36 @@
const NullConstantValue._internal();
+ @override
bool get isNull => true;
+ @override
DartType getType(CommonElements types) => types.nullType;
+ @override
bool operator ==(other) => other is NullConstantValue;
// The magic constant has no meaning. It is just a random value.
+ @override
int get hashCode => 785965825;
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitNull(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.NULL;
+ @override
String toStructuredText() => 'NullConstant';
+ @override
String toDartText() => 'null';
}
abstract class NumConstantValue extends PrimitiveConstantValue {
double get doubleValue;
+ @override
bool get isNum => true;
const NumConstantValue();
@@ -215,6 +238,7 @@
// to create new ones every time those values are used.
static Map<BigInt, IntConstantValue> _cachedValues = {};
+ @override
double get doubleValue => intValue.toDouble();
factory IntConstantValue(BigInt value) {
@@ -230,6 +254,7 @@
const IntConstantValue._internal(this.intValue);
+ @override
bool get isInt => true;
bool isUInt31() => intValue.toUnsigned(31) == intValue;
@@ -238,12 +263,16 @@
bool isPositive() => intValue >= BigInt.zero;
+ @override
bool get isZero => intValue == BigInt.zero;
+ @override
bool get isOne => intValue == BigInt.one;
+ @override
DartType getType(CommonElements types) => types.intType;
+ @override
bool operator ==(var other) {
// Ints and doubles are treated as separate constants.
if (other is! IntConstantValue) return false;
@@ -251,18 +280,24 @@
return intValue == otherInt.intValue;
}
+ @override
int get hashCode => intValue.hashCode & Hashing.SMI_MASK;
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitInt(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.INT;
+ @override
String toStructuredText() => 'IntConstant(${toDartText()})';
+ @override
String toDartText() => intValue.toString();
}
class DoubleConstantValue extends NumConstantValue {
+ @override
final double doubleValue;
factory DoubleConstantValue(double value) {
@@ -283,23 +318,32 @@
const DoubleConstantValue._internal(this.doubleValue);
+ @override
bool get isDouble => true;
+ @override
bool get isNaN => doubleValue.isNaN;
// We need to check for the negative sign since -0.0 == 0.0.
+ @override
bool get isMinusZero => doubleValue == 0.0 && doubleValue.isNegative;
+ @override
bool get isZero => doubleValue == 0.0;
+ @override
bool get isOne => doubleValue == 1.0;
+ @override
bool get isPositiveInfinity => doubleValue == double.infinity;
+ @override
bool get isNegativeInfinity => doubleValue == -double.infinity;
+ @override
DartType getType(CommonElements types) => types.doubleType;
+ @override
bool operator ==(var other) {
if (other is! DoubleConstantValue) return false;
DoubleConstantValue otherDouble = other;
@@ -313,14 +357,19 @@
}
}
+ @override
int get hashCode => doubleValue.hashCode;
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitDouble(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.DOUBLE;
+ @override
String toStructuredText() => 'DoubleConstant(${toDartText()})';
+ @override
String toDartText() => doubleValue.toString();
}
@@ -331,18 +380,23 @@
const BoolConstantValue._internal();
+ @override
bool get isBool => true;
bool get boolValue;
+ @override
DartType getType(CommonElements types) => types.boolType;
BoolConstantValue negate();
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitBool(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.BOOL;
+ @override
String toStructuredText() => 'BoolConstant(${toDartText()})';
}
@@ -351,18 +405,24 @@
const TrueConstantValue._internal() : super._internal();
+ @override
bool get isTrue => true;
+ @override
bool get boolValue => true;
+ @override
FalseConstantValue negate() => new FalseConstantValue();
+ @override
bool operator ==(var other) => identical(this, other);
// The magic constant is just a random value. It does not have any
// significance.
+ @override
int get hashCode => 499;
+ @override
String toDartText() => boolValue.toString();
}
@@ -371,24 +431,31 @@
const FalseConstantValue._internal() : super._internal();
+ @override
bool get isFalse => true;
+ @override
bool get boolValue => false;
+ @override
TrueConstantValue negate() => new TrueConstantValue();
+ @override
bool operator ==(var other) => identical(this, other);
// The magic constant is just a random value. It does not have any
// significance.
+ @override
int get hashCode => 536555975;
+ @override
String toDartText() => boolValue.toString();
}
class StringConstantValue extends PrimitiveConstantValue {
final String stringValue;
+ @override
final int hashCode;
// TODO(floitsch): cache StringConstants.
@@ -396,10 +463,13 @@
: this.stringValue = value,
this.hashCode = value.hashCode;
+ @override
bool get isString => true;
+ @override
DartType getType(CommonElements types) => types.stringType;
+ @override
bool operator ==(var other) {
if (identical(this, other)) return true;
if (other is! StringConstantValue) return false;
@@ -412,13 +482,17 @@
int get length => stringValue.length;
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitString(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.STRING;
// TODO(johnniwinther): Ensure correct escaping.
+ @override
String toDartText() => '"${stringValue}"';
+ @override
String toStructuredText() => 'StringConstant(${toDartText()})';
}
@@ -427,8 +501,10 @@
ObjectConstantValue(this.type);
+ @override
bool get isObject => true;
+ @override
DartType getType(CommonElements types) => type;
void _unparseTypeArguments(StringBuffer sb) {
@@ -446,28 +522,37 @@
TypeConstantValue(this.representedType, InterfaceType type) : super(type);
+ @override
bool get isType => true;
+ @override
bool operator ==(other) {
return other is TypeConstantValue &&
representedType.unaliased == other.representedType.unaliased;
}
+ @override
int get hashCode => representedType.unaliased.hashCode * 13;
+ @override
List<ConstantValue> getDependencies() => const <ConstantValue>[];
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitType(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.TYPE;
+ @override
String toDartText() => '$representedType';
+ @override
String toStructuredText() => 'TypeConstant(${representedType})';
}
class ListConstantValue extends ObjectConstantValue {
final List<ConstantValue> entries;
+ @override
final int hashCode;
ListConstantValue(InterfaceType type, List<ConstantValue> entries)
@@ -475,8 +560,10 @@
hashCode = Hashing.listHash(entries, Hashing.objectHash(type)),
super(type);
+ @override
bool get isList => true;
+ @override
bool operator ==(var other) {
if (identical(this, other)) return true;
if (other is! ListConstantValue) return false;
@@ -490,14 +577,18 @@
return true;
}
+ @override
List<ConstantValue> getDependencies() => entries;
int get length => entries.length;
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitList(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.LIST;
+ @override
String toDartText() {
StringBuffer sb = new StringBuffer();
_unparseTypeArguments(sb);
@@ -510,6 +601,7 @@
return sb.toString();
}
+ @override
String toStructuredText() {
StringBuffer sb = new StringBuffer();
sb.write('ListConstant(');
@@ -526,6 +618,7 @@
abstract class SetConstantValue extends ObjectConstantValue {
final List<ConstantValue> values;
+ @override
final int hashCode;
SetConstantValue(InterfaceType type, List<ConstantValue> values)
@@ -536,6 +629,7 @@
@override
bool get isSet => true;
+ @override
bool operator ==(var other) {
if (identical(this, other)) return true;
if (other is! SetConstantValue) return false;
@@ -585,6 +679,7 @@
abstract class MapConstantValue extends ObjectConstantValue {
final List<ConstantValue> keys;
final List<ConstantValue> values;
+ @override
final int hashCode;
Map<ConstantValue, ConstantValue> _lookupMap;
@@ -598,8 +693,10 @@
assert(keys.length == values.length);
}
+ @override
bool get isMap => true;
+ @override
bool operator ==(var other) {
if (identical(this, other)) return true;
if (other is! MapConstantValue) return false;
@@ -614,6 +711,7 @@
return true;
}
+ @override
List<ConstantValue> getDependencies() {
List<ConstantValue> result = <ConstantValue>[];
result.addAll(keys);
@@ -629,10 +727,13 @@
return lookupMap[key];
}
+ @override
accept(ConstantValueVisitor visitor, arg) => visitor.visitMap(this, arg);
+ @override
ConstantValueKind get kind => ConstantValueKind.MAP;
+ @override
String toDartText() {
StringBuffer sb = new StringBuffer();
_unparseTypeArguments(sb);
@@ -647,6 +748,7 @@
return sb.toString();
}
+ @override
String toStructuredText() {
StringBuffer sb = new StringBuffer();
sb.write('MapConstant(');
@@ -670,28 +772,37 @@
InterceptorConstantValue(this.cls);
+ @override
bool get isInterceptor => true;
+ @override
bool operator ==(other) {
return other is InterceptorConstantValue && cls == other.cls;
}
+ @override
int get hashCode => cls.hashCode * 43;
+ @override
List<ConstantValue> getDependencies() => const <ConstantValue>[];
+ @override
accept(ConstantValueVisitor visitor, arg) {
return visitor.visitInterceptor(this, arg);
}
+ @override
DartType getType(CommonElements types) => types.dynamicType;
+ @override
ConstantValueKind get kind => ConstantValueKind.INTERCEPTOR;
+ @override
String toDartText() {
return 'interceptor($cls)';
}
+ @override
String toStructuredText() {
return 'InterceptorConstant(${cls.name})';
}
@@ -703,26 +814,35 @@
SyntheticConstantValue(this.valueKind, this.payload);
+ @override
bool get isDummy => true;
+ @override
bool operator ==(other) {
return other is SyntheticConstantValue && payload == other.payload;
}
+ @override
get hashCode => payload.hashCode * 17 + valueKind.hashCode;
+ @override
List<ConstantValue> getDependencies() => const <ConstantValue>[];
+ @override
accept(ConstantValueVisitor visitor, arg) {
return visitor.visitSynthetic(this, arg);
}
+ @override
DartType getType(CommonElements types) => types.dynamicType;
+ @override
ConstantValueKind get kind => ConstantValueKind.SYNTHETIC;
+ @override
String toDartText() => 'synthetic($valueKind, $payload)';
+ @override
String toStructuredText() => 'SyntheticConstant($valueKind, $payload)';
}
@@ -730,6 +850,7 @@
// TODO(johnniwinther): Make [fields] private to avoid misuse of the map
// ordering and mutability.
final Map<FieldEntity, ConstantValue> fields;
+ @override
final int hashCode;
ConstructedConstantValue(
@@ -742,8 +863,10 @@
assert(!fields.containsValue(null));
}
+ @override
bool get isConstructedObject => true;
+ @override
bool operator ==(var otherVar) {
if (identical(this, otherVar)) return true;
if (otherVar is! ConstructedConstantValue) return false;
@@ -757,18 +880,22 @@
return true;
}
+ @override
List<ConstantValue> getDependencies() => fields.values.toList();
+ @override
accept(ConstantValueVisitor visitor, arg) {
return visitor.visitConstructed(this, arg);
}
+ @override
ConstantValueKind get kind => ConstantValueKind.CONSTRUCTED;
Iterable<FieldEntity> get _fieldsSortedByName {
return fields.keys.toList()..sort((a, b) => a.name.compareTo(b.name));
}
+ @override
String toDartText() {
StringBuffer sb = new StringBuffer();
sb.write(type.element.name);
@@ -787,6 +914,7 @@
return sb.toString();
}
+ @override
String toStructuredText() {
StringBuffer sb = new StringBuffer();
sb.write('ConstructedConstant(');
@@ -812,6 +940,7 @@
InstantiationConstantValue(this.typeArguments, this.function);
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
return other is InstantiationConstantValue &&
@@ -824,21 +953,27 @@
return Hashing.objectHash(function, Hashing.listHash(typeArguments));
}
+ @override
List<ConstantValue> getDependencies() => <ConstantValue>[function];
+ @override
accept(ConstantValueVisitor visitor, arg) =>
visitor.visitInstantiation(this, arg);
+ @override
DartType getType(CommonElements types) {
FunctionType type = function.getType(types);
return type.instantiate(typeArguments);
}
+ @override
ConstantValueKind get kind => ConstantValueKind.INSTANTIATION;
+ @override
String toDartText() =>
'<${typeArguments.join(', ')}>(${function.toDartText()})';
+ @override
String toStructuredText() {
return 'InstantiationConstant($typeArguments,'
'${function.toStructuredText()})';
@@ -865,25 +1000,33 @@
bool get isReference => true;
+ @override
bool operator ==(other) {
return other is DeferredGlobalConstantValue &&
referenced == other.referenced &&
unit == other.unit;
}
+ @override
get hashCode => (referenced.hashCode * 17 + unit.hashCode) & 0x3fffffff;
+ @override
List<ConstantValue> getDependencies() => <ConstantValue>[referenced];
+ @override
accept(ConstantValueVisitor visitor, arg) =>
visitor.visitDeferredGlobal(this, arg);
+ @override
DartType getType(CommonElements types) => referenced.getType(types);
+ @override
ConstantValueKind get kind => ConstantValueKind.DEFERRED_GLOBAL;
+ @override
String toDartText() => 'deferred_global(${referenced.toDartText()})';
+ @override
String toStructuredText() {
return 'DeferredGlobalConstant(${referenced.toStructuredText()})';
}
@@ -893,6 +1036,7 @@
/// expression.
// TODO(johnniwinther): Expand this to contain the error kind.
class NonConstantValue extends ConstantValue {
+ @override
bool get isConstant => false;
@override
@@ -906,6 +1050,7 @@
@override
DartType getType(CommonElements types) => types.dynamicType;
+ @override
ConstantValueKind get kind => ConstantValueKind.NON_CONSTANT;
@override
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 3aa386e..65dc8c6 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -664,6 +664,7 @@
class AbortLeg {
final message;
AbortLeg(this.message);
+ @override
toString() => 'Aborted due to --throw-on-error: $message';
}
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index d2fd134..dbce4ff 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -51,6 +51,7 @@
OutputUnit(this.isMainOutput, this.name, this._imports);
+ @override
int compareTo(OutputUnit other) {
if (identical(this, other)) return 0;
if (isMainOutput && !other.isMainOutput) return -1;
@@ -76,6 +77,7 @@
Set<ImportEntity> get importsForTesting => _imports;
+ @override
String toString() => "OutputUnit($name, $_imports)";
}
@@ -84,6 +86,7 @@
/// shared OutputUnits.
abstract class DeferredLoadTask extends CompilerTask {
/// The name of this task.
+ @override
String get name => 'Deferred Loading';
/// The OutputUnit that will be loaded when the program starts.
@@ -1092,6 +1095,7 @@
return result;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('ImportSet(size: $length, ');
@@ -1200,6 +1204,7 @@
ClassWorkItem(this.cls, ImportSet newSet) : super(newSet);
+ @override
void update(DeferredLoadTask task, WorkQueue queue) {
queue.pendingClasses.remove(cls);
ImportSet oldSet = task._classToSet[cls];
@@ -1215,6 +1220,7 @@
MemberWorkItem(this.member, ImportSet newSet) : super(newSet);
+ @override
void update(DeferredLoadTask task, WorkQueue queue) {
queue.pendingMembers.remove(member);
ImportSet oldSet = task._memberToSet[member];
@@ -1230,6 +1236,7 @@
ConstantWorkItem(this.constant, ImportSet newSet) : super(newSet);
+ @override
void update(DeferredLoadTask task, WorkQueue queue) {
queue.pendingConstants.remove(constant);
ImportSet oldSet = task._constantToSet[constant];
diff --git a/pkg/compiler/lib/src/diagnostics/code_location.dart b/pkg/compiler/lib/src/diagnostics/code_location.dart
index 63fee22..8e923f9 100644
--- a/pkg/compiler/lib/src/diagnostics/code_location.dart
+++ b/pkg/compiler/lib/src/diagnostics/code_location.dart
@@ -40,10 +40,12 @@
SchemeLocation(this.uri);
+ @override
bool inSameLocation(Uri uri) {
return this.uri.scheme == uri.scheme;
}
+ @override
String relativize(Uri baseUri) {
return uri_extras.relativize(baseUri, uri, false);
}
@@ -58,10 +60,12 @@
PackageLocation(this.packageName);
+ @override
bool inSameLocation(Uri uri) {
return uri.scheme == 'package' && uri.path.startsWith('$packageName/');
}
+ @override
String relativize(Uri baseUri) => 'package:$packageName';
}
@@ -73,8 +77,10 @@
UriLocation(this.uri);
+ @override
bool inSameLocation(Uri uri) => this.uri == uri;
+ @override
String relativize(Uri baseUri) {
return uri_extras.relativize(baseUri, uri, false);
}
@@ -84,7 +90,9 @@
class AnyLocation implements CodeLocation {
const AnyLocation();
+ @override
bool inSameLocation(Uri uri) => true;
+ @override
String relativize(Uri baseUri) => '$baseUri';
}
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index af208b1..16aee21 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -692,6 +692,7 @@
"'case' expression of type '#{type}'."),
}); // End of TEMPLATES.
+ @override
String toString() => template;
Message message([Map arguments = const {}, bool terse = false]) {
@@ -738,15 +739,18 @@
return message;
}
+ @override
String toString() {
return computeMessage();
}
+ @override
bool operator ==(other) {
if (other is! Message) return false;
return (template == other.template) && (toString() == other.toString());
}
+ @override
int get hashCode => throw new UnsupportedError('Message.hashCode');
static String convertToString(value) {
diff --git a/pkg/compiler/lib/src/diagnostics/source_span.dart b/pkg/compiler/lib/src/diagnostics/source_span.dart
index 3fffc29..2b24c11 100644
--- a/pkg/compiler/lib/src/diagnostics/source_span.dart
+++ b/pkg/compiler/lib/src/diagnostics/source_span.dart
@@ -13,15 +13,18 @@
const SourceSpan(this.uri, this.begin, this.end);
+ @override
int get hashCode {
return 13 * uri.hashCode + 17 * begin.hashCode + 19 * end.hashCode;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! SourceSpan) return false;
return uri == other.uri && begin == other.begin && end == other.end;
}
+ @override
String toString() => 'SourceSpan($uri, $begin, $end)';
}
diff --git a/pkg/compiler/lib/src/diagnostics/spannable.dart b/pkg/compiler/lib/src/diagnostics/spannable.dart
index cdba684..356e2e4 100644
--- a/pkg/compiler/lib/src/diagnostics/spannable.dart
+++ b/pkg/compiler/lib/src/diagnostics/spannable.dart
@@ -14,6 +14,7 @@
const _SpannableSentinel(this.name);
+ @override
String toString() => name;
}
@@ -33,6 +34,7 @@
final String message;
SpannableAssertionFailure(this.node, this.message);
+ @override
String toString() => 'Assertion failure'
'${message != null ? ': $message' : ''}';
}
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index d4c2161..35be4dd 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -402,6 +402,7 @@
: useBinaryFormat = compiler.options.useDumpInfoBinaryFormat,
super(compiler.measurer);
+ @override
String get name => "Dump Info";
ElementInfoCollector infoCollector;
@@ -433,6 +434,7 @@
_programSize = programSize;
}
+ @override
void reportInlined(FunctionEntity element, MemberEntity inlinedFrom) {
inlineCount.putIfAbsent(element, () => 0);
inlineCount[element] += 1;
@@ -675,6 +677,7 @@
// TODO(sigmund): delete once we no longer emit text by default.
class _CodeData extends CodeSpan {
StringBuffer _text = new StringBuffer();
+ @override
String get text => '$_text';
int get length => end - start;
}
diff --git a/pkg/compiler/lib/src/elements/entities.dart b/pkg/compiler/lib/src/elements/entities.dart
index a3a5c4d..a621644 100644
--- a/pkg/compiler/lib/src/elements/entities.dart
+++ b/pkg/compiler/lib/src/elements/entities.dart
@@ -53,6 +53,7 @@
ImportEntity(this.isDeferred, this.name, this.uri, this.enclosingLibraryUri);
+ @override
String toString() => 'import($name:${isDeferred ? ' deferred' : ''})';
}
@@ -196,6 +197,7 @@
const AsyncMarker._(this.asyncParserState,
{this.isAsync: false, this.isYielding: false});
+ @override
String toString() {
return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}';
}
@@ -326,6 +328,7 @@
namedParameters, typeParameters);
}
+ @override
int get hashCode => Hashing.listHash(
namedParameters,
Hashing.objectHash(
@@ -333,6 +336,7 @@
Hashing.objectHash(
requiredParameters, Hashing.objectHash(typeParameters))));
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! ParameterStructure) return false;
@@ -368,6 +372,7 @@
return sb.toString();
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('ParameterStructure(');
diff --git a/pkg/compiler/lib/src/elements/indexed.dart b/pkg/compiler/lib/src/elements/indexed.dart
index 56defb0..e83b8a0 100644
--- a/pkg/compiler/lib/src/elements/indexed.dart
+++ b/pkg/compiler/lib/src/elements/indexed.dart
@@ -13,18 +13,21 @@
abstract class IndexedLibrary extends _Indexed implements LibraryEntity {
/// Library index used for fast lookup in [KernelToElementMapBase].
int get libraryIndex => _index;
+ @override
int get hashCode => 7 * _index + 2;
}
abstract class IndexedClass extends _Indexed implements ClassEntity {
/// Class index used for fast lookup in [KernelToElementMapBase].
int get classIndex => _index;
+ @override
int get hashCode => 7 * _index + 1;
}
abstract class IndexedMember extends _Indexed implements MemberEntity {
/// Member index used for fast lookup in [KernelToElementMapBase].
int get memberIndex => _index;
+ @override
int get hashCode => 7 * _index;
}
diff --git a/pkg/compiler/lib/src/elements/jumps.dart b/pkg/compiler/lib/src/elements/jumps.dart
index 05a25e7..53bf887 100644
--- a/pkg/compiler/lib/src/elements/jumps.dart
+++ b/pkg/compiler/lib/src/elements/jumps.dart
@@ -20,6 +20,7 @@
/// A jump target is the reference point of a statement or switch-case,
/// either by label or as the default target of a break or continue.
abstract class JumpTarget extends Local {
+ @override
String get name => 'target';
bool get isTarget => isBreakTarget || isContinueTarget;
diff --git a/pkg/compiler/lib/src/elements/names.dart b/pkg/compiler/lib/src/elements/names.dart
index dd60ab4..0a004de 100644
--- a/pkg/compiler/lib/src/elements/names.dart
+++ b/pkg/compiler/lib/src/elements/names.dart
@@ -61,57 +61,77 @@
}
class PublicName implements Name {
+ @override
final String text;
+ @override
final bool isSetter;
const PublicName(this.text, {this.isSetter: false});
+ @override
Name get getter => isSetter ? new PublicName(text) : this;
+ @override
Name get setter => isSetter ? this : new PublicName(text, isSetter: true);
+ @override
bool isAccessibleFrom(LibraryEntity element) => true;
+ @override
bool get isPrivate => false;
+ @override
int get hashCode => similarHashCode;
+ @override
bool operator ==(other) {
if (other is! PublicName) return false;
return isSimilarTo(other);
}
+ @override
bool isSimilarTo(Name other) =>
text == other.text && isSetter == other.isSetter;
+ @override
int get similarHashCode => text.hashCode + 11 * isSetter.hashCode;
+ @override
LibraryEntity get library => null;
+ @override
String toString() => isSetter ? '$text=' : text;
}
class PrivateName extends PublicName {
+ @override
final LibraryEntity library;
PrivateName(String text, this.library, {bool isSetter: false})
: super(text, isSetter: isSetter);
+ @override
Name get getter => isSetter ? new PrivateName(text, library) : this;
+ @override
Name get setter {
return isSetter ? this : new PrivateName(text, library, isSetter: true);
}
+ @override
bool isAccessibleFrom(LibraryEntity element) => library == element;
+ @override
bool get isPrivate => true;
+ @override
int get hashCode => super.hashCode + 13 * library.hashCode;
+ @override
bool operator ==(other) {
if (other is! PrivateName) return false;
return super == (other) && library == other.library;
}
+ @override
String toString() => '${library.name}#${super.toString()}';
}
diff --git a/pkg/compiler/lib/src/elements/operators.dart b/pkg/compiler/lib/src/elements/operators.dart
index ddc9cff3..e3fc7d9 100644
--- a/pkg/compiler/lib/src/elements/operators.dart
+++ b/pkg/compiler/lib/src/elements/operators.dart
@@ -26,6 +26,7 @@
Selector get selector => new Selector(SelectorKind.OPERATOR,
new PublicName(selectorName), CallStructure.NO_ARGS);
+ @override
String toString() => name;
/// The unary ! operator.
@@ -102,6 +103,7 @@
String get selectorName => name;
+ @override
String toString() => name;
/// The == operator.
@@ -297,8 +299,10 @@
class _NotEqualsOperator extends BinaryOperator {
const _NotEqualsOperator() : super._(BinaryOperatorKind.NOT_EQ, '!=');
+ @override
bool get isUserDefinable => false;
+ @override
String get selectorName => '==';
}
@@ -308,8 +312,10 @@
const _LogicalOperator(BinaryOperatorKind kind, String name)
: super._(kind, name);
+ @override
bool get isUserDefinable => false;
+ @override
String get selectorName => null;
}
@@ -318,7 +324,9 @@
const _IfNullOperator(BinaryOperatorKind kind, String name)
: super._(kind, name);
+ @override
bool get isUserDefinable => false;
+ @override
String get selectorName => '??';
}
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
index d42f31a..ef7c2f8 100644
--- a/pkg/compiler/lib/src/elements/types.dart
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -144,6 +144,7 @@
return _assumptionMap[a]?.contains(b) ?? false;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('_Assumptions(');
@@ -165,25 +166,31 @@
InterfaceType(this.element, this.typeArguments);
+ @override
bool get isInterfaceType => true;
+ @override
bool get isObject {
return element.name == 'Object' &&
element.library.canonicalUri == Uris.dart_core;
}
+ @override
bool get containsTypeVariables =>
typeArguments.any((type) => type.containsTypeVariables);
+ @override
void forEachTypeVariable(f(TypeVariableType variable)) {
typeArguments.forEach((type) => type.forEachTypeVariable(f));
}
+ @override
bool _containsFreeTypeVariables(List<FunctionTypeVariable> bindings) {
return typeArguments
.any((type) => type._containsFreeTypeVariables(bindings));
}
+ @override
InterfaceType subst(List<DartType> arguments, List<DartType> parameters) {
if (typeArguments.isEmpty) {
// Return fast on non-generic types.
@@ -203,6 +210,7 @@
return this;
}
+ @override
bool get treatAsRaw {
for (DartType type in typeArguments) {
if (!type.treatAsDynamic) return false;
@@ -214,6 +222,7 @@
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitInterfaceType(this, argument);
+ @override
int get hashCode {
int hash = element.hashCode;
for (DartType argument in typeArguments) {
@@ -223,12 +232,14 @@
return hash;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! InterfaceType) return false;
return _equalsInternal(other, null);
}
+ @override
bool _equals(DartType other, _Assumptions assumptions) {
if (identical(this, other)) return true;
if (other is! InterfaceType) return false;
@@ -240,6 +251,7 @@
_equalTypes(typeArguments, other.typeArguments, assumptions);
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write(element.name);
@@ -262,22 +274,28 @@
class TypedefType extends DartType {
final TypedefEntity element;
final List<DartType> typeArguments;
+ @override
final FunctionType unaliased;
TypedefType(this.element, this.typeArguments, this.unaliased);
+ @override
bool get isTypedef => true;
+ @override
bool get containsTypeVariables =>
typeArguments.any((type) => type.containsTypeVariables);
+ @override
void forEachTypeVariable(f(TypeVariableType variable)) {
typeArguments.forEach((type) => type.forEachTypeVariable(f));
}
+ @override
bool _containsFreeTypeVariables(List<FunctionTypeVariable> bindings) =>
typeArguments.any((type) => type._containsFreeTypeVariables(bindings));
+ @override
TypedefType subst(List<DartType> arguments, List<DartType> parameters) {
if (typeArguments.isEmpty) {
// Return fast on non-generic types.
@@ -299,6 +317,7 @@
return this;
}
+ @override
bool get treatAsRaw {
for (DartType type in typeArguments) {
if (!type.treatAsDynamic) return false;
@@ -310,6 +329,7 @@
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitTypedefType(this, argument);
+ @override
int get hashCode {
int hash = element.hashCode;
for (DartType argument in typeArguments) {
@@ -319,12 +339,14 @@
return hash;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! TypedefType) return false;
return _equalsInternal(other, null);
}
+ @override
bool _equals(DartType other, _Assumptions assumptions) {
if (identical(this, other)) return true;
if (other is! TypedefType) return false;
@@ -336,6 +358,7 @@
_equalTypes(typeArguments, other.typeArguments, assumptions);
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write(element.name);
@@ -360,16 +383,21 @@
TypeVariableType(this.element);
+ @override
bool get isTypeVariable => true;
+ @override
bool get containsTypeVariables => true;
+ @override
void forEachTypeVariable(f(TypeVariableType variable)) {
f(this);
}
+ @override
bool _containsFreeTypeVariables(List<FunctionTypeVariable> bindings) => true;
+ @override
DartType subst(List<DartType> arguments, List<DartType> parameters) {
assert(arguments.length == parameters.length);
if (parameters.isEmpty) {
@@ -388,8 +416,10 @@
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitTypeVariableType(this, argument);
+ @override
int get hashCode => 17 * element.hashCode;
+ @override
bool operator ==(other) {
if (other is! TypeVariableType) return false;
return identical(other.element, element);
@@ -403,6 +433,7 @@
return false;
}
+ @override
String toString() => '${element.typeDeclaration.name}.${element.name}';
}
@@ -438,12 +469,14 @@
@override
bool get isFunctionTypeVariable => true;
+ @override
bool _containsFreeTypeVariables(List<FunctionTypeVariable> bindings) {
if (bindings == null) return true;
if (bindings.indexOf(this) >= 0) return false;
return true;
}
+ @override
DartType subst(List<DartType> arguments, List<DartType> parameters) {
assert(arguments.length == parameters.length);
if (parameters.isEmpty) {
@@ -458,8 +491,10 @@
return this;
}
+ @override
int get hashCode => index.hashCode * 19;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! FunctionTypeVariable) return false;
@@ -478,14 +513,17 @@
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitFunctionTypeVariable(this, argument);
+ @override
String toString() => '#${new String.fromCharCode(0x41 + index)}';
}
class VoidType extends DartType {
const VoidType();
+ @override
bool get isVoid => true;
+ @override
DartType subst(List<DartType> arguments, List<DartType> parameters) {
// `void` cannot be substituted.
return this;
@@ -495,6 +533,7 @@
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitVoidType(this, argument);
+ @override
int get hashCode => 6007;
@override
@@ -502,6 +541,7 @@
return identical(this, other);
}
+ @override
String toString() => 'void';
}
@@ -514,6 +554,7 @@
@override
bool get treatAsDynamic => true;
+ @override
DartType subst(List<DartType> arguments, List<DartType> parameters) {
// `dynamic` cannot be substituted.
return this;
@@ -523,6 +564,7 @@
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitDynamicType(this, argument);
+ @override
int get hashCode => 91;
@override
@@ -530,6 +572,7 @@
return identical(this, other);
}
+ @override
String toString() => 'dynamic';
}
@@ -565,6 +608,7 @@
assert(!typeVariables.contains(null), "Invalid type variables in $this.");
}
+ @override
bool get containsTypeVariables {
return typeVariables.any((type) => type.bound.containsTypeVariables) ||
returnType.containsTypeVariables ||
@@ -573,6 +617,7 @@
namedParameterTypes.any((type) => type.containsTypeVariables);
}
+ @override
void forEachTypeVariable(f(TypeVariableType variable)) {
typeVariables.forEach((type) => type.bound.forEachTypeVariable(f));
returnType.forEachTypeVariable(f);
@@ -581,6 +626,7 @@
namedParameterTypes.forEach((type) => type.forEachTypeVariable(f));
}
+ @override
bool _containsFreeTypeVariables(List<FunctionTypeVariable> bindings) {
int restore;
if (typeVariables.isNotEmpty) {
@@ -604,8 +650,10 @@
return result;
}
+ @override
bool get isFunctionType => true;
+ @override
DartType subst(List<DartType> arguments, List<DartType> parameters) {
if (parameters.isEmpty) {
assert(arguments.isEmpty);
@@ -669,6 +717,7 @@
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitFunctionType(this, argument);
+ @override
int get hashCode {
int hash = 3 * returnType.hashCode;
for (DartType parameter in parameterTypes) {
@@ -686,12 +735,14 @@
return hash;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! FunctionType) return false;
return _equalsInternal(other, null);
}
+ @override
bool _equals(DartType other, _Assumptions assumptions) {
if (identical(this, other)) return true;
if (other is! FunctionType) return false;
@@ -728,6 +779,7 @@
return result;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write(returnType);
@@ -811,26 +863,33 @@
return new FutureOrType(newTypeArgument);
}
+ @override
bool get containsTypeVariables => typeArgument.containsTypeVariables;
+ @override
void forEachTypeVariable(f(TypeVariableType variable)) {
typeArgument.forEachTypeVariable(f);
}
+ @override
bool _containsFreeTypeVariables(List<FunctionTypeVariable> bindings) =>
typeArgument._containsFreeTypeVariables(bindings);
+ @override
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
visitor.visitFutureOrType(this, argument);
+ @override
int get hashCode => typeArgument.hashCode * 13;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! FutureOrType) return false;
return _equalsInternal(other, null);
}
+ @override
bool _equals(DartType other, _Assumptions assumptions) {
if (identical(this, other)) return true;
if (other is! FutureOrType) return false;
@@ -841,6 +900,7 @@
return typeArgument._equals(other.typeArgument, assumptions);
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('FutureOr');
@@ -964,10 +1024,12 @@
/// Returns the declared bound of [element].
DartType getTypeVariableBound(TypeVariableEntity element);
+ @override
bool visitType(T t, T s) {
throw 'internal error: unknown type ${t}';
}
+ @override
bool visitVoidType(VoidType t, T s) {
assert(s is! VoidType);
return false;
@@ -983,6 +1045,7 @@
bool invalidCallableType(covariant DartType callType, covariant DartType s);
+ @override
bool visitInterfaceType(InterfaceType t, covariant DartType s) {
ensureResolved(t);
@@ -1015,6 +1078,7 @@
return false;
}
+ @override
bool visitFunctionType(FunctionType t, DartType s) {
if (s == commonElements.functionType) {
return true;
@@ -1141,6 +1205,7 @@
return true;
}
+ @override
bool visitTypeVariableType(TypeVariableType t, T s) {
// Identity check is handled in [isSubtype].
DartType bound = getTypeVariableBound(t.element);
@@ -1168,6 +1233,7 @@
return true;
}
+ @override
bool visitFunctionTypeVariable(FunctionTypeVariable t, DartType s) {
if (!s.isFunctionTypeVariable) return false;
return assumptions.isAssumed(t, s);
@@ -1194,27 +1260,33 @@
return t.accept(this, s);
}
+ @override
bool invalidTypeArguments(T t, T s) {
return !isMoreSpecific(t, s);
}
+ @override
bool invalidFunctionReturnTypes(T t, T s) {
if (s.treatAsDynamic && t.isVoid) return true;
return !s.isVoid && !isMoreSpecific(t, s);
}
+ @override
bool invalidFunctionParameterTypes(T t, T s) {
return !isMoreSpecific(t, s);
}
+ @override
bool invalidTypeVariableBounds(T bound, T s) {
return !isMoreSpecific(bound, s);
}
+ @override
bool invalidCallableType(covariant DartType callType, covariant DartType s) {
return !isMoreSpecific(callType, s);
}
+ @override
bool visitFutureOrType(FutureOrType t, covariant DartType s) {
return false;
}
@@ -1244,26 +1316,32 @@
return isSubtype(t, s) || isSubtype(s, t);
}
+ @override
bool invalidTypeArguments(T t, T s) {
return !isSubtype(t, s);
}
+ @override
bool invalidFunctionReturnTypes(T t, T s) {
return !isSubtype(t, s);
}
+ @override
bool invalidFunctionParameterTypes(T t, T s) {
return !isSubtype(s, t);
}
+ @override
bool invalidTypeVariableBounds(T bound, T s) {
return !isSubtype(bound, s);
}
+ @override
bool invalidCallableType(covariant DartType callType, covariant DartType s) {
return !isSubtype(callType, s);
}
+ @override
bool visitFutureOrType(FutureOrType t, covariant DartType s) {
if (s.isFutureOr) {
FutureOrType sFutureOr = s;
@@ -1280,6 +1358,7 @@
extends SubtypeVisitor<T> {
bool _assumeInstantiations = true;
+ @override
bool isSubtype(DartType t, DartType s) {
if (t is TypeVariableType || s is TypeVariableType) {
return true;
@@ -1291,6 +1370,7 @@
return super.isSubtype(t, s);
}
+ @override
int getCommonTypeVariablesCount(FunctionType t, FunctionType s) {
if (t.typeVariables.length == s.typeVariables.length) {
return t.typeVariables.length;
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index 4defca5..d42e48c 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -39,6 +39,7 @@
CodegenEnqueuer codegenEnqueuerForTesting;
final Compiler compiler;
+ @override
String get name => 'Enqueue';
EnqueueTask(Compiler compiler)
@@ -189,12 +190,14 @@
ImpactStrategy get impactStrategy => _impactStrategy;
+ @override
void open(ImpactStrategy impactStrategy, FunctionEntity mainMethod,
Iterable<Uri> libraries) {
_impactStrategy = impactStrategy;
listener.onQueueOpen(this, mainMethod, libraries);
}
+ @override
void close() {
// TODO(johnniwinther): Set [_impactStrategy] to `null` and [queueIsClosed]
// to `true` here.
@@ -224,9 +227,11 @@
static const ImpactUseCase IMPACT_USE =
const ImpactUseCase('ResolutionEnqueuer');
+ @override
final CompilerTask task;
final String name;
final CompilerOptions _options;
+ @override
final EnqueuerListener listener;
final Set<ClassEntity> _recentClasses = new Setlet<ClassEntity>();
@@ -235,6 +240,7 @@
final WorkItemBuilder _workItemBuilder;
final DiagnosticReporter _reporter;
+ @override
bool queueIsClosed = false;
WorldImpactVisitor _impactVisitor;
@@ -251,8 +257,10 @@
_impactVisitor = new EnqueuerImplImpactVisitor(this);
}
+ @override
ResolutionWorldBuilder get worldBuilder => _worldBuilder;
+ @override
bool get queueIsEmpty => _queue.isEmpty;
@override
@@ -262,8 +270,10 @@
}
}
+ @override
Iterable<ClassEntity> get processedClasses => _worldBuilder.processedClasses;
+ @override
void applyImpact(WorldImpact worldImpact, {var impactSource}) {
if (worldImpact.isEmpty) return;
impactStrategy.visitImpact(
@@ -283,12 +293,14 @@
});
}
+ @override
bool checkNoEnqueuedInvokedInstanceMethods(
ElementEnvironment elementEnvironment) {
if (Enqueuer.skipEnqueuerCheckForTesting) return true;
return checkEnqueuerConsistency(elementEnvironment);
}
+ @override
void checkClass(ClassEntity cls) {
_worldBuilder.processClassMembers(cls,
(MemberEntity member, EnumSet<MemberUse> useSet) {
@@ -330,12 +342,14 @@
}
}
+ @override
void processDynamicUse(DynamicUse dynamicUse) {
task.measure(() {
_worldBuilder.registerDynamicUse(dynamicUse, _applyMemberUse);
});
}
+ @override
void processConstantUse(ConstantUse constantUse) {
task.measure(() {
if (_worldBuilder.registerConstantUse(constantUse)) {
@@ -346,6 +360,7 @@
});
}
+ @override
void processStaticUse(StaticUse staticUse) {
_worldBuilder.registerStaticUse(staticUse, _applyMemberUse);
// TODO(johnniwinther): Add `ResolutionWorldBuilder.registerConstructorUse`
@@ -367,6 +382,7 @@
}
}
+ @override
void processTypeUse(TypeUse typeUse) {
DartType type = typeUse.type;
switch (typeUse.kind) {
@@ -439,6 +455,7 @@
_queue.isNotEmpty || _recentClasses.isNotEmpty || _recentConstants);
}
+ @override
void forEach(void f(WorkItem work)) {
_forEach(f);
if (onEmptyForTesting != null) {
@@ -447,18 +464,23 @@
}
}
+ @override
void logSummary(void log(String message)) {
log('Resolved ${processedEntities.length} elements.');
listener.logSummary(log);
}
+ @override
String toString() => 'Enqueuer($name)';
+ @override
Iterable<MemberEntity> get processedEntities =>
_worldBuilder.processedMembers;
+ @override
ImpactUseCase get impactUse => IMPACT_USE;
+ @override
bool get isResolutionQueue => true;
/// Registers [entity] as processed by the resolution enqueuer. Used only for
diff --git a/pkg/compiler/lib/src/frontend_strategy.dart b/pkg/compiler/lib/src/frontend_strategy.dart
index 39d0872..4d0e320 100644
--- a/pkg/compiler/lib/src/frontend_strategy.dart
+++ b/pkg/compiler/lib/src/frontend_strategy.dart
@@ -117,6 +117,7 @@
new NativeBasicDataBuilderImpl();
NativeBasicData _nativeBasicData;
+ @override
NativeBasicData get nativeBasicData {
if (_nativeBasicData == null) {
_nativeBasicData = nativeBasicDataBuilder.close(elementEnvironment);
diff --git a/pkg/compiler/lib/src/helpers/debug_collection.dart b/pkg/compiler/lib/src/helpers/debug_collection.dart
index c7b9f79..1636e9e 100644
--- a/pkg/compiler/lib/src/helpers/debug_collection.dart
+++ b/pkg/compiler/lib/src/helpers/debug_collection.dart
@@ -21,15 +21,20 @@
putIfAbsentCallback = value;
}
+ @override
Map<RK, RV> cast<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
+ @override
bool containsValue(Object value) {
return sourceMap.containsValue(value);
}
+ @override
bool containsKey(Object key) => sourceMap.containsKey(key);
+ @override
V operator [](Object key) => sourceMap[key];
+ @override
void operator []=(K key, V value) {
if (indexSetCallback != null) {
indexSetCallback('[]=', key, value);
@@ -37,6 +42,7 @@
sourceMap[key] = value;
}
+ @override
V putIfAbsent(K key, V ifAbsent()) {
return sourceMap.putIfAbsent(key, () {
V v = ifAbsent();
@@ -47,8 +53,10 @@
});
}
+ @override
void addAll(Map<K, V> other) => sourceMap.addAll(other);
+ @override
V remove(Object key) {
if (removeCallback != null) {
removeCallback('remove', key, sourceMap[key]);
@@ -56,6 +64,7 @@
return sourceMap.remove(key);
}
+ @override
void clear() {
if (removeCallback != null) {
removeCallback('clear', sourceMap, null);
@@ -63,34 +72,46 @@
sourceMap.clear();
}
+ @override
void forEach(void f(K key, V value)) => sourceMap.forEach(f);
+ @override
Iterable<K> get keys => sourceMap.keys;
+ @override
Iterable<V> get values => sourceMap.values;
+ @override
Iterable<MapEntry<K, V>> get entries => sourceMap.entries;
+ @override
void addEntries(Iterable<MapEntry<K, V>> entries) {
sourceMap.addEntries(entries);
}
+ @override
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> transform(K key, V value)) =>
sourceMap.map(transform);
+ @override
int get length => sourceMap.length;
+ @override
bool get isEmpty => sourceMap.isEmpty;
+ @override
bool get isNotEmpty => sourceMap.isNotEmpty;
+ @override
V update(K key, V update(V value), {V ifAbsent()}) =>
sourceMap.update(key, update, ifAbsent: ifAbsent);
+ @override
void updateAll(V update(K key, V value)) {
sourceMap.updateAll(update);
}
+ @override
void removeWhere(bool test(K key, V value)) {
sourceMap.removeWhere(test);
}
@@ -101,74 +122,105 @@
DebugIterable(this.iterable);
+ @override
Iterator<E> get iterator => iterable.iterator;
+ @override
Iterable<R> cast<R>() => Iterable.castFrom<E, R>(this);
+ @override
Iterable<T> map<T>(T f(E element)) => iterable.map(f);
+ @override
Iterable<E> where(bool test(E element)) => iterable.where(test);
+ @override
Iterable<T> expand<T>(Iterable<T> f(E element)) => iterable.expand(f);
+ @override
bool contains(Object element) => iterable.contains(element);
+ @override
void forEach(void f(E element)) => iterable.forEach(f);
+ @override
E reduce(E combine(E value, E element)) => iterable.reduce(combine);
+ @override
T fold<T>(T initialValue, T combine(T previousValue, E element)) {
return iterable.fold(initialValue, combine);
}
+ @override
bool every(bool test(E element)) => iterable.every(test);
+ @override
String join([String separator = ""]) => iterable.join(separator);
+ @override
bool any(bool test(E element)) => iterable.any(test);
+ @override
List<E> toList({bool growable: true}) {
return iterable.toList(growable: growable);
}
+ @override
Set<E> toSet() => iterable.toSet();
+ @override
int get length => iterable.length;
+ @override
bool get isEmpty => iterable.isEmpty;
+ @override
bool get isNotEmpty => iterable.isNotEmpty;
+ @override
Iterable<E> take(int n) => iterable.take(n);
+ @override
Iterable<E> takeWhile(bool test(E value)) => iterable.takeWhile(test);
+ @override
Iterable<E> skip(int n) => iterable.skip(n);
+ @override
Iterable<E> skipWhile(bool test(E value)) => iterable.skipWhile(test);
+ @override
E get first => iterable.first;
+ @override
E get last => iterable.last;
+ @override
E get single => iterable.single;
+ @override
E firstWhere(bool test(E element), {E orElse()}) {
return iterable.firstWhere(test, orElse: orElse);
}
+ @override
E lastWhere(bool test(E element), {E orElse()}) {
return iterable.lastWhere(test, orElse: orElse);
}
+ @override
E singleWhere(bool test(E element), {E orElse()}) =>
iterable.singleWhere(test, orElse: orElse);
+ @override
E elementAt(int index) => iterable.elementAt(index);
+ @override
Iterable<E> followedBy(Iterable<E> other) => iterable.followedBy(other);
+ @override
Iterable<T> whereType<T>() => iterable.whereType<T>();
+ @override
String toString() => iterable.toString();
}
@@ -181,29 +233,38 @@
List<E> get list => iterable;
+ @override
List<R> cast<R>() => List.castFrom<E, R>(this);
+ @override
List<E> operator +(List<E> other) => list + other;
+ @override
E operator [](int index) => list[index];
+ @override
void operator []=(int index, E value) {
list[index] = value;
}
+ @override
void set first(E element) {
list.first = element;
}
+ @override
void set last(E element) {
list.last = element;
}
+ @override
int get length => list.length;
+ @override
void set length(int newLength) {
list.length = newLength;
}
+ @override
void add(E value) {
if (addCallback != null) {
addCallback('add', value, null);
@@ -211,6 +272,7 @@
list.add(value);
}
+ @override
void addAll(Iterable<E> iterable) {
if (addAllCallback != null) {
addAllCallback('addAll', iterable, null);
@@ -218,62 +280,85 @@
list.addAll(iterable);
}
+ @override
Iterable<E> get reversed => list.reversed;
+ @override
void sort([int compare(E a, E b)]) => list.sort(compare);
+ @override
void shuffle([random]) => list.shuffle(random);
+ @override
int indexOf(E element, [int start = 0]) => list.indexOf(element, start);
+ @override
int indexWhere(bool test(E element), [int start = 0]) =>
list.indexWhere(test, start);
+ @override
int lastIndexOf(E element, [int start]) => list.lastIndexOf(element, start);
+ @override
int lastIndexWhere(bool test(E element), [int start]) =>
list.lastIndexWhere(test, start);
+ @override
void clear() => list.clear();
+ @override
void insert(int index, E element) => list.insert(index, element);
+ @override
void insertAll(int index, Iterable<E> iterable) {
list.insertAll(index, iterable);
}
+ @override
void setAll(int index, Iterable<E> iterable) => list.setAll(index, iterable);
+ @override
bool remove(Object value) => list.remove(value);
+ @override
E removeAt(int index) => list.removeAt(index);
+ @override
E removeLast() => list.removeLast();
+ @override
void removeWhere(bool test(E element)) => list.removeWhere(test);
+ @override
void retainWhere(bool test(E element)) => list.retainWhere(test);
+ @override
List<E> sublist(int start, [int end]) => list.sublist(start, end);
+ @override
Iterable<E> getRange(int start, int end) => list.getRange(start, end);
+ @override
void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
list.setRange(start, end, iterable, skipCount);
}
+ @override
void removeRange(int start, int end) {
list.removeRange(start, end);
}
+ @override
void fillRange(int start, int end, [E fillValue]) {
list.fillRange(start, end, fillValue);
}
+ @override
void replaceRange(int start, int end, Iterable<E> replacement) {
list.replaceRange(start, end, replacement);
}
+ @override
Map<int, E> asMap() => list.asMap();
}
@@ -284,9 +369,12 @@
Set<E> get set => iterable;
+ @override
Set<R> cast<R>() => Set.castFrom<E, R>(this);
+ @override
bool contains(Object value) => set.contains(value);
+ @override
bool add(E value) {
if (addCallback != null) {
addCallback('add', value, null);
@@ -294,32 +382,45 @@
return set.add(value);
}
+ @override
void addAll(Iterable<E> elements) {
elements.forEach(add);
}
+ @override
bool remove(Object value) => set.remove(value);
+ @override
E lookup(Object object) => set.lookup(object);
+ @override
void removeAll(Iterable<Object> elements) => set.removeAll(elements);
+ @override
void retainAll(Iterable<Object> elements) => set.retainAll(elements);
+ @override
void removeWhere(bool test(E element)) => set.removeWhere(test);
+ @override
void retainWhere(bool test(E element)) => set.retainWhere(test);
+ @override
bool containsAll(Iterable<Object> other) => set.containsAll(other);
+ @override
Set<E> intersection(Set<Object> other) => set.intersection(other);
+ @override
Set<E> union(Set<E> other) => set.union(other);
+ @override
Set<E> difference(Set<Object> other) => set.difference(other);
+ @override
void clear() => set.clear();
+ @override
Set<E> toSet() => set.toSet();
}
diff --git a/pkg/compiler/lib/src/helpers/expensive_map.dart b/pkg/compiler/lib/src/helpers/expensive_map.dart
index ed95b22..149e811 100644
--- a/pkg/compiler/lib/src/helpers/expensive_map.dart
+++ b/pkg/compiler/lib/src/helpers/expensive_map.dart
@@ -17,28 +17,39 @@
}
}
+ @override
int get length => _maps[0].length;
+ @override
bool get isEmpty => _maps[0].isEmpty;
+ @override
bool get isNotEmpty => _maps[0].isNotEmpty;
+ @override
Iterable<K> get keys => _maps[0].keys;
+ @override
Iterable<V> get values => _maps[0].values;
+ @override
bool containsKey(Object key) => _maps[0].containsKey(key);
+ @override
bool containsValue(Object value) => _maps[0].containsValue(value);
+ @override
V operator [](Object key) => _maps[0][key];
+ @override
void forEach(void action(K key, V value)) {
_maps[0].forEach(action);
}
+ @override
void operator []=(K key, V value) {
for (int i = 0; i < _maps.length; i++) {
_maps[i][key] = value;
}
}
+ @override
V putIfAbsent(K key, V ifAbsent()) {
if (containsKey(key)) return this[key];
V value = ifAbsent();
@@ -46,12 +57,14 @@
return value;
}
+ @override
void addAll(Map<K, V> other) {
for (int i = 0; i < _maps.length; i++) {
_maps[i].addAll(other);
}
}
+ @override
V remove(Object key) {
V result = _maps[0].remove(key);
for (int i = 1; i < _maps.length; i++) {
@@ -60,24 +73,30 @@
return result;
}
+ @override
void clear() {
for (int i = 0; i < _maps.length; i++) {
_maps[i].clear();
}
}
+ @override
Map<KR, VR> cast<KR, VR>() => Map.castFrom<K, V, KR, VR>(this);
+ @override
Iterable<MapEntry<K, V>> get entries => _maps[0].entries;
+ @override
void addEntries(Iterable<MapEntry<K, V>> entries) {
for (int i = 0; i < _maps.length; i++) {
_maps[i].addEntries(entries);
}
}
+ @override
Map<KR, VR> map<KR, VR>(MapEntry<KR, VR> transform(K key, V value)) =>
_maps[0].map(transform);
+ @override
V update(K key, V update(V value), {V ifAbsent()}) {
V result;
for (int i = 0; i < _maps.length; i++) {
@@ -86,17 +105,20 @@
return result;
}
+ @override
void updateAll(V update(K key, V value)) {
for (int i = 0; i < _maps.length; i++) {
_maps[i].updateAll(update);
}
}
+ @override
void removeWhere(bool test(K key, V value)) {
for (int i = 0; i < _maps.length; i++) {
_maps[i].removeWhere(test);
}
}
+ @override
String toString() => "expensive(${_maps[0]}x${_maps.length})";
}
diff --git a/pkg/compiler/lib/src/helpers/expensive_set.dart b/pkg/compiler/lib/src/helpers/expensive_set.dart
index f4c2f4f..4c5101e 100644
--- a/pkg/compiler/lib/src/helpers/expensive_set.dart
+++ b/pkg/compiler/lib/src/helpers/expensive_set.dart
@@ -17,19 +17,27 @@
}
}
+ @override
int get length => _sets[0].length;
+ @override
bool get isEmpty => _sets[0].isEmpty;
+ @override
bool get isNotEmpty => _sets[0].isNotEmpty;
+ @override
Iterator<E> get iterator => _sets[0].iterator;
+ @override
bool contains(Object object) => _sets[0].contains(object);
+ @override
E lookup(Object object) => _sets[0].lookup(object);
+ @override
void forEach(void action(E element)) {
_sets[0].forEach(action);
}
+ @override
bool add(E element) {
bool result = _sets[0].add(element);
for (int i = 1; i < _sets.length; i++) {
@@ -38,12 +46,14 @@
return result;
}
+ @override
void addAll(Iterable<E> objects) {
for (E each in objects) {
add(each);
}
}
+ @override
bool remove(Object object) {
bool result = _sets[0].remove(object);
for (int i = 1; i < _sets.length; i++) {
@@ -52,26 +62,31 @@
return result;
}
+ @override
void clear() {
for (int i = 0; i < _sets.length; i++) {
_sets[i].clear();
}
}
+ @override
void removeAll(Iterable<Object> objectsToRemove) {
for (var each in objectsToRemove) {
remove(each);
}
}
+ @override
void removeWhere(bool test(E element)) {
removeAll(this.toList().where((e) => test(e)));
}
+ @override
void retainWhere(bool test(E element)) {
removeAll(toList().where((e) => !test(e)));
}
+ @override
bool containsAll(Iterable<Object> other) {
for (Object object in other) {
if (!this.contains(object)) return false;
@@ -81,6 +96,7 @@
Set _newSet() => new ExpensiveSet(_sets.length);
+ @override
Set<E> intersection(Set<Object> other) {
Set<E> result = _newSet();
if (other.length < this.length) {
@@ -95,10 +111,12 @@
return result;
}
+ @override
Set<E> union(Set<E> other) {
return _newSet()..addAll(this)..addAll(other);
}
+ @override
Set<E> difference(Set<Object> other) {
Set<E> result = _newSet();
for (E element in this) {
@@ -107,6 +125,7 @@
return result;
}
+ @override
void retainAll(Iterable objectsToRetain) {
Set retainSet;
if (objectsToRetain is Set) {
@@ -117,6 +136,7 @@
retainWhere(retainSet.contains);
}
+ @override
Set<E> toSet() {
var result = new ExpensiveSet<E>(_sets.length);
for (int i = 0; i < _sets.length; i++) {
@@ -125,5 +145,6 @@
return result;
}
+ @override
String toString() => "expensive(${_sets[0]}x${_sets.length})";
}
diff --git a/pkg/compiler/lib/src/helpers/helpers.dart b/pkg/compiler/lib/src/helpers/helpers.dart
index 2182fc0..bf34252 100644
--- a/pkg/compiler/lib/src/helpers/helpers.dart
+++ b/pkg/compiler/lib/src/helpers/helpers.dart
@@ -32,6 +32,7 @@
}
class _DebugIndentation extends Indentation {
+ @override
final String indentationUnit = " ";
}
diff --git a/pkg/compiler/lib/src/helpers/stats.dart b/pkg/compiler/lib/src/helpers/stats.dart
index 935ac8c..e524b54 100644
--- a/pkg/compiler/lib/src/helpers/stats.dart
+++ b/pkg/compiler/lib/src/helpers/stats.dart
@@ -212,6 +212,7 @@
class DebugOutput implements StatsOutput {
const DebugOutput();
+ @override
void println(String text) => debugPrint(text);
}
@@ -222,6 +223,7 @@
SinkOutput(this.sink);
+ @override
void println(String text) {
sink.add(text);
sink.add('\n');
@@ -272,6 +274,7 @@
/// Abstract base class for [ConsolePrinter] and [XMLPrinter].
abstract class BasePrinter extends StatsPrinter with Indentation {
+ @override
final int examples;
final StatsOutput output;
@@ -287,6 +290,7 @@
ConsolePrinter({StatsOutput output: const DebugOutput(), int examples: 10})
: super(output: output, examples: examples);
+ @override
void open(String id,
[Map<String, dynamic> data = const <String, dynamic>{}]) {
if (extraLevel > 0) return;
@@ -316,17 +320,20 @@
indentMore();
}
+ @override
void close(String id) {
if (extraLevel > 0) return;
indentLess();
}
+ @override
void beginExtra() {
if (extraLevel == 0) output.println('$indentation...');
extraLevel++;
}
+ @override
void endExtra() {
extraLevel--;
}
@@ -340,6 +347,7 @@
XMLPrinter({output: const DebugOutput(), int examples: 10})
: super(output: output, examples: examples);
+ @override
void start(String id) {
if (!opened) {
output.println('<?xml version="1.0" encoding="UTF-8"?>');
@@ -348,10 +356,12 @@
open(id);
}
+ @override
void end(String id) {
close(id);
}
+ @override
void open(String id,
[Map<String, dynamic> data = const <String, dynamic>{}]) {
StringBuffer sb = new StringBuffer();
@@ -367,15 +377,18 @@
indentMore();
}
+ @override
void close(String id) {
indentLess();
output.println('${indentation}</$id>');
}
+ @override
void beginExtra() {
open('extra');
}
+ @override
void endExtra() {
close('extra');
}
@@ -450,6 +463,7 @@
}
}
+ @override
int compareTo(_StackTraceNode other) {
// Sorts in decreasing count order.
return other.count - count;
@@ -479,6 +493,7 @@
}
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
printOn(sb, '');
@@ -493,6 +508,7 @@
_StackTraceTree(this.id, this.sampleFrequency) : super.root();
+ @override
void dumpTraces(StatsPrinter printer) {
printer.open('trace', {
'id': id,
@@ -519,10 +535,12 @@
Map<dynamic, Map<dynamic, List>> countersMap =
<dynamic, Map<dynamic, List>>{};
Map<dynamic, _StackTraceTree> traceMap = {};
+ @override
int stackTraceSampleFrequency = 1;
ActiveStats(StatsPrinter this.printer);
+ @override
void recordMap(id, key, value, {fromExisting(value)}) {
Map map = maps.putIfAbsent(id, () => {});
if (fromExisting != null && map.containsKey(key)) {
@@ -532,16 +550,19 @@
}
}
+ @override
Map getMap(key) {
return maps[key];
}
+ @override
void recordFrequency(id, value, [example]) {
Map<dynamic, List> map = frequencyMaps.putIfAbsent(id, () => {});
map.putIfAbsent(value, () => []);
map[value].add(example);
}
+ @override
void recordFrequencies(id, Map<dynamic, Iterable> frequencyMap) {
Map<dynamic, List> map = frequencyMaps.putIfAbsent(id, () => {});
frequencyMap.forEach((value, examples) {
@@ -550,6 +571,7 @@
});
}
+ @override
Iterable recordedFrequencies(id, value) {
Map<dynamic, List> map = frequencyMaps[id];
if (map == null) return const [];
@@ -558,15 +580,18 @@
return list;
}
+ @override
void recordCounter(id, [reason, example]) {
Map<dynamic, List> map = countersMap.putIfAbsent(id, () => {});
map.putIfAbsent(reason, () => []).add(example);
}
+ @override
void recordElement(key, element, {data}) {
setsMap.putIfAbsent(key, () => new Map())[element] = data;
}
+ @override
void recordTrace(key, {int sampleFrequency}) {
if (sampleFrequency == null) {
sampleFrequency = stackTraceSampleFrequency;
@@ -576,12 +601,14 @@
.sample();
}
+ @override
Iterable getList(String key) {
Map map = setsMap[key];
if (map == null) return const [];
return map.keys;
}
+ @override
void dumpStats({void beforeClose()}) {
printer.start('stats');
dumpFrequencies();
@@ -688,6 +715,7 @@
tree.dumpTraces(printer);
}
+ @override
void dumpCorrelation(keyA, Iterable a, keyB, Iterable b,
{Map dataA, Map dataB}) {
printer.child('correlations', {'title': '$keyA vs $keyB'}, () {
diff --git a/pkg/compiler/lib/src/helpers/trace.dart b/pkg/compiler/lib/src/helpers/trace.dart
index 104c227..51022cd 100644
--- a/pkg/compiler/lib/src/helpers/trace.dart
+++ b/pkg/compiler/lib/src/helpers/trace.dart
@@ -232,6 +232,7 @@
return sb.toString();
}
+ @override
String toString() {
return prettify();
}
@@ -269,6 +270,7 @@
sb.write('$fileText $lineNoText$columnNoText $method\n');
}
+ @override
int get hashCode {
return 13 * index +
17 * file.hashCode +
@@ -277,6 +279,7 @@
29 * method.hashCode;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! StackTraceLine) return false;
@@ -287,6 +290,7 @@
method == other.method;
}
+ @override
String toString() => "$method @ $file [$lineNo:$columnNo]";
}
diff --git a/pkg/compiler/lib/src/helpers/track_map.dart b/pkg/compiler/lib/src/helpers/track_map.dart
index 6cb7121..23d3ce4 100644
--- a/pkg/compiler/lib/src/helpers/track_map.dart
+++ b/pkg/compiler/lib/src/helpers/track_map.dart
@@ -48,23 +48,34 @@
});
}
+ @override
int get length => _map.length;
+ @override
bool get isEmpty => _map.isEmpty;
+ @override
bool get isNotEmpty => _map.isNotEmpty;
+ @override
Iterable<K> get keys => _map.keys;
+ @override
Iterable<V> get values => _map.values;
+ @override
bool containsKey(Object key) => _map.containsKey(key);
+ @override
bool containsValue(Object value) => _map.containsValue(value);
+ @override
V operator [](Object key) => _map[key];
+ @override
String toString() => _map.toString();
+ @override
void forEach(void action(K key, V value)) {
_map.forEach(action);
}
+ @override
void operator []=(K key, V value) {
if (!_map.containsKey(key)) {
_notifyLengthChanged(1);
@@ -72,6 +83,7 @@
}
}
+ @override
V putIfAbsent(K key, V ifAbsent()) {
if (containsKey(key)) return this[key];
V value = ifAbsent();
@@ -79,6 +91,7 @@
return value;
}
+ @override
V remove(Object key) {
if (_map.containsKey(key)) {
_notifyLengthChanged(-1);
@@ -86,32 +99,41 @@
return _map.remove(key);
}
+ @override
void addAll(Map<K, V> other) {
other.forEach((key, value) => this[key] = value);
}
+ @override
void clear() {
_notifyLengthChanged(-_map.length);
_map.clear();
}
+ @override
Map<KR, VR> cast<KR, VR>() => _map.cast<KR, VR>();
+ @override
Iterable<MapEntry<K, V>> get entries => _map.entries;
+ @override
void addEntries(Iterable<MapEntry<K, V>> entries) {
for (var entry in entries) this[entry.key] = entry.value;
}
+ @override
Map<KR, VR> map<KR, VR>(MapEntry<KR, VR> transform(K key, V value)) =>
_map.map(transform);
+ @override
V update(K key, V update(V value), {V ifAbsent()}) =>
_map.update(key, update, ifAbsent: ifAbsent);
+ @override
void updateAll(V update(K key, V value)) {
_map.updateAll(update);
}
+ @override
void removeWhere(bool test(K key, V value)) {
int before = _map.length;
_map.removeWhere(test);
diff --git a/pkg/compiler/lib/src/inferrer/abstract_value_domain.dart b/pkg/compiler/lib/src/inferrer/abstract_value_domain.dart
index 1352562..1503b1d 100644
--- a/pkg/compiler/lib/src/inferrer/abstract_value_domain.dart
+++ b/pkg/compiler/lib/src/inferrer/abstract_value_domain.dart
@@ -45,6 +45,7 @@
static AbstractBool maybeOrFalse(bool value) => value ? Maybe : False;
+ @override
String toString() =>
'AbstractBool.${_value == null ? 'Maybe' : (_value ? 'True' : 'False')}';
}
diff --git a/pkg/compiler/lib/src/inferrer/builder_kernel.dart b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
index b88d849..dd872ab 100644
--- a/pkg/compiler/lib/src/inferrer/builder_kernel.dart
+++ b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
@@ -1973,6 +1973,7 @@
sb.write('\n]');
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('LocalState(');
diff --git a/pkg/compiler/lib/src/inferrer/closure_tracer.dart b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
index e7ecf72..7558fcc 100644
--- a/pkg/compiler/lib/src/inferrer/closure_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
@@ -28,6 +28,7 @@
"${tracedElements.where((f) => f.isAbstract)}");
}
+ @override
ApplyableTypeInformation get tracedType => super.tracedType;
void run() {
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
index 9692c59..801da74 100644
--- a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
@@ -252,6 +252,7 @@
final Map<Local, TypeInformation> defaultTypeOfParameter =
new Map<Local, TypeInformation>();
final WorkQueue workQueue = new WorkQueue();
+ @override
final FunctionEntity mainElement;
final Set<MemberEntity> analyzedElements = new Set<MemberEntity>();
@@ -263,16 +264,22 @@
int overallRefineCount = 0;
int addedInGraph = 0;
+ @override
final CompilerOptions options;
final Progress progress;
+ @override
final DiagnosticReporter reporter;
final CompilerOutput _compilerOutput;
/// The [JClosedWorld] on which inference reasoning is based.
+ @override
final JsClosedWorld closedWorld;
+ @override
final InferredDataBuilder inferredDataBuilder;
+ @override
final TypeSystem types;
+ @override
final Map<ir.Node, TypeInformation> concreteTypes =
new Map<ir.Node, TypeInformation>();
@@ -300,6 +307,7 @@
ElementEnvironment get _elementEnvironment => closedWorld.elementEnvironment;
+ @override
void forEachElementMatching(
Selector selector, AbstractValue mask, bool f(MemberEntity element)) {
Iterable<MemberEntity> elements = closedWorld.locateMembers(selector, mask);
@@ -309,6 +317,7 @@
}
// TODO(johnniwinther): Make this private again.
+ @override
GlobalTypeInferenceElementData dataOfMember(MemberEntity element) =>
_memberData[element] ??= new KernelGlobalTypeInferenceElementData();
@@ -342,6 +351,7 @@
}
}
+ @override
TypeInformation typeOfNativeBehavior(NativeBehavior nativeBehavior) {
if (nativeBehavior == null) return types.dynamicType;
List typesReturned = nativeBehavior.typesReturned;
@@ -382,6 +392,7 @@
return returnType;
}
+ @override
void updateSelectorInMember(MemberEntity owner, CallType callType,
ir.Node node, Selector selector, AbstractValue mask) {
KernelGlobalTypeInferenceElementData data = dataOfMember(owner);
@@ -403,26 +414,31 @@
}
}
+ @override
bool checkIfExposesThis(ConstructorEntity element) {
return generativeConstructorsExposingThis.contains(element);
}
+ @override
void recordExposesThis(ConstructorEntity element, bool exposesThis) {
if (exposesThis) {
generativeConstructorsExposingThis.add(element);
}
}
+ @override
bool returnsListElementType(Selector selector, AbstractValue mask) {
return mask != null &&
abstractValueDomain.isContainer(mask) &&
returnsListElementTypeSet.contains(selector);
}
+ @override
bool returnsMapValueType(Selector selector, AbstractValue mask) {
return mask != null && abstractValueDomain.isMap(mask) && selector.isIndex;
}
+ @override
void analyzeListAndEnqueue(ListTypeInformation info) {
if (info.analyzed) return;
info.analyzed = true;
@@ -443,6 +459,7 @@
workQueue.add(info.elementType);
}
+ @override
void analyzeSetAndEnqueue(SetTypeInformation info) {
if (info.analyzed) return;
info.analyzed = true;
@@ -460,6 +477,7 @@
workQueue.add(info.elementType);
}
+ @override
void analyzeMapAndEnqueue(MapTypeInformation info) {
if (info.analyzed) return;
info.analyzed = true;
@@ -485,6 +503,7 @@
workQueue.add(info);
}
+ @override
void runOverAllElements() {
analyzeAllElements();
TypeGraphDump dump =
@@ -733,6 +752,7 @@
return function;
}
+ @override
void analyze(MemberEntity element) {
if (analyzedElements.contains(element)) return;
analyzedElements.add(element);
@@ -906,6 +926,7 @@
workQueue.addAll(types.allocatedCalls);
}
+ @override
void updateParameterAssignments(TypeInformation caller, MemberEntity callee,
ArgumentsTypes arguments, Selector selector, AbstractValue mask,
{bool remove, bool addToQueue: true}) {
@@ -970,6 +991,7 @@
}
}
+ @override
void setDefaultTypeOfParameter(Local parameter, TypeInformation type,
{bool isInstanceMember}) {
assert(
@@ -997,6 +1019,7 @@
}
}
+ @override
TypeInformation getDefaultTypeOfParameter(Local parameter) {
return defaultTypeOfParameter.putIfAbsent(parameter, () {
return new PlaceholderTypeInformation(
@@ -1004,29 +1027,35 @@
});
}
+ @override
bool hasAlreadyComputedTypeOfParameterDefault(Local parameter) {
TypeInformation seen = defaultTypeOfParameter[parameter];
return (seen != null && seen is! PlaceholderTypeInformation);
}
+ @override
TypeInformation typeOfParameter(Local element) {
return types.getInferredTypeOfParameter(element);
}
+ @override
TypeInformation typeOfMember(MemberEntity element) {
if (element is FunctionEntity) return types.functionType;
return types.getInferredTypeOfMember(element);
}
+ @override
TypeInformation returnTypeOfMember(MemberEntity element) {
if (element is! FunctionEntity) return types.dynamicType;
return types.getInferredTypeOfMember(element);
}
+ @override
void recordTypeOfField(FieldEntity element, TypeInformation type) {
types.getInferredTypeOfMember(element).addAssignment(type);
}
+ @override
void recordReturnType(FunctionEntity element, TypeInformation type) {
TypeInformation info = types.getInferredTypeOfMember(element);
if (element.name == '==') {
@@ -1039,6 +1068,7 @@
if (info.assignments.isEmpty) info.addAssignment(type);
}
+ @override
TypeInformation addReturnTypeForMethod(
FunctionEntity element, TypeInformation unused, TypeInformation newType) {
TypeInformation type = types.getInferredTypeOfMember(element);
@@ -1051,6 +1081,7 @@
return type;
}
+ @override
TypeInformation registerCalledMember(
Object node,
Selector selector,
@@ -1090,6 +1121,7 @@
return info;
}
+ @override
TypeInformation registerCalledSelector(
CallType callType,
ir.Node node,
@@ -1132,6 +1164,7 @@
return info;
}
+ @override
TypeInformation registerAwait(ir.Node node, TypeInformation argument) {
AwaitTypeInformation info = new AwaitTypeInformation(
abstractValueDomain, types.currentMember, node);
@@ -1140,6 +1173,7 @@
return info;
}
+ @override
TypeInformation registerYield(ir.Node node, TypeInformation argument) {
YieldTypeInformation info = new YieldTypeInformation(
abstractValueDomain, types.currentMember, node);
@@ -1148,6 +1182,7 @@
return info;
}
+ @override
TypeInformation registerCalledClosure(
ir.Node node,
Selector selector,
@@ -1173,6 +1208,7 @@
return info;
}
+ @override
void close() {
for (MemberTypeInformation typeInformation
in types.memberTypeInformations.values) {
@@ -1180,6 +1216,7 @@
}
}
+ @override
void clear() {
if (retainDataForTesting) return;
@@ -1213,11 +1250,13 @@
_memberData.clear();
}
+ @override
Iterable<MemberEntity> getCallersOfForTesting(MemberEntity element) {
MemberTypeInformation info = types.getInferredTypeOfMember(element);
return info.callersForTesting;
}
+ @override
TypeInformation typeOfMemberWithSelector(
MemberEntity element, Selector selector) {
if (element.name == Identifiers.noSuchMethod_ &&
@@ -1252,6 +1291,7 @@
///
/// One category of elements that do not apply is runtime helpers that the
/// backend calls, but the optimizations don't see those calls.
+ @override
bool canFieldBeUsedForGlobalOptimizations(FieldEntity element) {
if (closedWorld.backendUsage.isFieldUsedByBackend(element)) {
return false;
@@ -1267,6 +1307,7 @@
///
/// One category of elements that do not apply is runtime helpers that the
/// backend calls, but the optimizations don't see those calls.
+ @override
bool canFunctionParametersBeUsedForGlobalOptimizations(
FunctionEntity function) {
return !closedWorld.backendUsage.isFunctionUsedByBackend(function);
@@ -1427,6 +1468,7 @@
}
/// Serializes this [GlobalTypeInferenceElementData] to [sink].
+ @override
void writeToDataSink(DataSink sink, AbstractValueDomain abstractValueDomain) {
sink.begin(tag);
sink.writeTreeNodeMap(
diff --git a/pkg/compiler/lib/src/inferrer/list_tracer.dart b/pkg/compiler/lib/src/inferrer/list_tracer.dart
index dfe10a0..0f7aa07 100644
--- a/pkg/compiler/lib/src/inferrer/list_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/list_tracer.dart
@@ -154,10 +154,12 @@
}
}
+ @override
visitClosureCallSiteTypeInformation(ClosureCallSiteTypeInformation info) {
bailout('Passed to a closure');
}
+ @override
visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
super.visitStaticCallSiteTypeInformation(info);
MemberEntity called = info.calledElement;
@@ -167,6 +169,7 @@
}
}
+ @override
visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) {
super.visitDynamicCallSiteTypeInformation(info);
Selector selector = info.selector;
diff --git a/pkg/compiler/lib/src/inferrer/locals_handler.dart b/pkg/compiler/lib/src/inferrer/locals_handler.dart
index aff2896..a94ddbd 100644
--- a/pkg/compiler/lib/src/inferrer/locals_handler.dart
+++ b/pkg/compiler/lib/src/inferrer/locals_handler.dart
@@ -170,6 +170,7 @@
sb.write(']');
}
+ @override
String toString() {
String rest = parent == null ? "null" : parent.toString();
return '{$variables} $rest';
@@ -253,12 +254,16 @@
: positional = const [],
named = const {};
+ @override
int get length => positional.length + named.length;
+ @override
Iterator<TypeInformation> get iterator => new ArgumentsTypesIterator(this);
+ @override
String toString() => "{ positional = $positional, named = $named }";
+ @override
bool operator ==(other) {
if (positional.length != other.positional.length) return false;
if (named.length != other.named.length) return false;
@@ -272,19 +277,23 @@
return result;
}
+ @override
int get hashCode => throw new UnsupportedError('ArgumentsTypes.hashCode');
bool hasNoArguments() => positional.isEmpty && named.isEmpty;
+ @override
void forEach(void f(TypeInformation type)) {
positional.forEach(f);
named.values.forEach(f);
}
+ @override
bool every(bool f(TypeInformation type)) {
return positional.every(f) && named.values.every(f);
}
+ @override
bool contains(Object type) {
return positional.contains(type) || named.containsValue(type);
}
@@ -302,8 +311,10 @@
Iterator<TypeInformation> get _currentIterator =>
_iteratePositional ? positional : named;
+ @override
TypeInformation get current => _currentIterator.current;
+ @override
bool moveNext() {
if (_iteratePositional && positional.moveNext()) {
return true;
@@ -587,6 +598,7 @@
sb.write('\n]');
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('LocalsHandler(');
diff --git a/pkg/compiler/lib/src/inferrer/map_tracer.dart b/pkg/compiler/lib/src/inferrer/map_tracer.dart
index e9da06a..4925dfc 100644
--- a/pkg/compiler/lib/src/inferrer/map_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/map_tracer.dart
@@ -58,10 +58,12 @@
return false;
}
+ @override
visitClosureCallSiteTypeInformation(ClosureCallSiteTypeInformation info) {
bailout('Passed to a closure');
}
+ @override
visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
super.visitStaticCallSiteTypeInformation(info);
MemberEntity called = info.calledElement;
@@ -71,6 +73,7 @@
}
}
+ @override
visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) {
super.visitDynamicCallSiteTypeInformation(info);
Selector selector = info.selector;
diff --git a/pkg/compiler/lib/src/inferrer/node_tracer.dart b/pkg/compiler/lib/src/inferrer/node_tracer.dart
index 5dc00dc..987cb11 100644
--- a/pkg/compiler/lib/src/inferrer/node_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/node_tracer.dart
@@ -184,10 +184,12 @@
continueAnalyzing = false;
}
+ @override
void visitAwaitTypeInformation(AwaitTypeInformation info) {
bailout("Passed through await");
}
+ @override
void visitYieldTypeInformation(YieldTypeInformation info) {
// TODO(29344): The enclosing sync*/async/async* method could have a
// tracable TypeInformation for the Iterable / Future / Stream with an
@@ -196,55 +198,70 @@
bailout("Passed through yield");
}
+ @override
void visitNarrowTypeInformation(NarrowTypeInformation info) {
addNewEscapeInformation(info);
}
+ @override
void visitPhiElementTypeInformation(PhiElementTypeInformation info) {
addNewEscapeInformation(info);
}
+ @override
void visitElementInContainerTypeInformation(
ElementInContainerTypeInformation info) {
addNewEscapeInformation(info);
}
+ @override
void visitElementInSetTypeInformation(ElementInSetTypeInformation info) {
addNewEscapeInformation(info);
}
+ @override
void visitKeyInMapTypeInformation(KeyInMapTypeInformation info) {
// We do not track the use of keys from a map, so we have to bail.
bailout('Used as key in Map');
}
+ @override
void visitValueInMapTypeInformation(ValueInMapTypeInformation info) {
addNewEscapeInformation(info);
}
+ @override
void visitListTypeInformation(ListTypeInformation info) {
listsToAnalyze.add(info);
}
+ @override
void visitSetTypeInformation(SetTypeInformation info) {
setsToAnalyze.add(info);
}
+ @override
void visitMapTypeInformation(MapTypeInformation info) {
mapsToAnalyze.add(info);
}
+ @override
void visitConcreteTypeInformation(ConcreteTypeInformation info) {}
+ @override
void visitStringLiteralTypeInformation(StringLiteralTypeInformation info) {}
+ @override
void visitBoolLiteralTypeInformation(BoolLiteralTypeInformation info) {}
+ @override
void visitClosureTypeInformation(ClosureTypeInformation info) {}
+ @override
void visitClosureCallSiteTypeInformation(
ClosureCallSiteTypeInformation info) {}
+ @override
visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
MemberEntity called = info.calledElement;
TypeInformation inferred = inferrer.types.getInferredTypeOfMember(called);
@@ -362,6 +379,7 @@
}
}
+ @override
void visitDynamicCallSiteTypeInformation(
DynamicCallSiteTypeInformation info) {
void addsToContainer(AbstractValue mask) {
@@ -497,6 +515,7 @@
return cls != null && cls.isClosure;
}
+ @override
void visitMemberTypeInformation(MemberTypeInformation info) {
if (info.isClosurized) {
bailout('Returned from a closurized method');
@@ -511,6 +530,7 @@
addNewEscapeInformation(info);
}
+ @override
void visitParameterTypeInformation(ParameterTypeInformation info) {
if (inferrer.closedWorld.nativeData.isNativeMember(info.method)) {
bailout('Passed to a native method');
diff --git a/pkg/compiler/lib/src/inferrer/trivial.dart b/pkg/compiler/lib/src/inferrer/trivial.dart
index dcd5e97..9d4d5ef 100644
--- a/pkg/compiler/lib/src/inferrer/trivial.dart
+++ b/pkg/compiler/lib/src/inferrer/trivial.dart
@@ -16,6 +16,7 @@
class TrivialAbstractValue implements AbstractValue {
const TrivialAbstractValue();
+ @override
String toString() => '?';
}
@@ -472,5 +473,6 @@
@override
bool canHit(MemberEntity element, Name name, World world) => true;
+ @override
String toString() => 'TrivialUniverseSelectorConstraints:$hashCode';
}
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
index d9ddd4d..70d3fa0 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
@@ -317,6 +317,7 @@
}
}
+ @override
void visitNarrowTypeInformation(NarrowTypeInformation info) {
// Omit unused Narrows.
if (!PRINT_GRAPH_ALL_NODES && info.users.isEmpty) return;
@@ -324,50 +325,61 @@
color: narrowColor);
}
+ @override
void visitPhiElementTypeInformation(PhiElementTypeInformation info) {
// Omit unused Phis.
if (!PRINT_GRAPH_ALL_NODES && info.users.isEmpty) return;
addNode(info, 'Phi ${info.variable?.name ?? ''}', color: phiColor);
}
+ @override
void visitElementInContainerTypeInformation(
ElementInContainerTypeInformation info) {
addNode(info, 'ElementInContainer');
}
+ @override
void visitElementInSetTypeInformation(ElementInSetTypeInformation info) {
addNode(info, 'ElementInSet');
}
+ @override
void visitKeyInMapTypeInformation(KeyInMapTypeInformation info) {
addNode(info, 'KeyInMap');
}
+ @override
void visitValueInMapTypeInformation(ValueInMapTypeInformation info) {
addNode(info, 'ValueInMap');
}
+ @override
void visitListTypeInformation(ListTypeInformation info) {
addNode(info, 'List');
}
+ @override
void visitSetTypeInformation(SetTypeInformation info) {
addNode(info, 'Set');
}
+ @override
void visitMapTypeInformation(MapTypeInformation info) {
addNode(info, 'Map');
}
+ @override
void visitConcreteTypeInformation(ConcreteTypeInformation info) {
addNode(info, 'Concrete');
}
+ @override
void visitStringLiteralTypeInformation(StringLiteralTypeInformation info) {
String text = shorten(info.value).replaceAll('\n', '\\n');
addNode(info, 'StringLiteral\n"$text"');
}
+ @override
void visitBoolLiteralTypeInformation(BoolLiteralTypeInformation info) {
addNode(info, 'BoolLiteral\n${info.value}');
}
@@ -387,38 +399,46 @@
addNode(info, text, color: callColor, inputs: inputs);
}
+ @override
void visitClosureCallSiteTypeInformation(
ClosureCallSiteTypeInformation info) {
handleCall(info, 'ClosureCallSite', {});
}
+ @override
void visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
handleCall(info, 'StaticCallSite', {});
}
+ @override
void visitDynamicCallSiteTypeInformation(
DynamicCallSiteTypeInformation info) {
handleCall(info, 'DynamicCallSite', {'obj': info.receiver});
}
+ @override
void visitMemberTypeInformation(MemberTypeInformation info) {
addNode(info, 'Member\n${info.debugName}');
}
+ @override
void visitParameterTypeInformation(ParameterTypeInformation info) {
addNode(info, 'Parameter ${info.debugName}');
}
+ @override
void visitClosureTypeInformation(ClosureTypeInformation info) {
String text = shorten('${info.debugName}');
addNode(info, 'Closure\n$text');
}
+ @override
void visitAwaitTypeInformation(AwaitTypeInformation info) {
String text = shorten('${info.debugName}');
addNode(info, 'Await\n$text');
}
+ @override
void visitYieldTypeInformation(YieldTypeInformation info) {
String text = shorten('${info.debugName}');
addNode(info, 'Yield\n$text');
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
index d9f69ca..d1b919c 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
@@ -62,6 +62,7 @@
AbstractValueDomain get abstractValueDomain =>
closedWorld.abstractValueDomain;
+ @override
GlobalTypeInferenceResults analyzeMain(FunctionEntity main) {
inferrer = createInferrerEngineFor(main);
inferrer.runOverAllElements();
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index 467890a..b8d5dcc 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -79,6 +79,7 @@
// TypeInformations are unique. Store an arbitrary identity hash code.
static int _staticHashCode = 0;
+ @override
final int hashCode = _staticHashCode = (_staticHashCode + 1).toUnsigned(30);
bool get isConcrete => false;
@@ -248,14 +249,17 @@
AbstractValueDomain abstractValueDomain, MemberTypeInformation context)
: super(abstractValueDomain.emptyType, context);
+ @override
void accept(TypeInformationVisitor visitor) {
throw new UnsupportedError("Cannot visit placeholder");
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
throw new UnsupportedError("Cannot refine placeholder");
}
+ @override
toString() => "Placeholder [$hashCode]";
}
@@ -296,11 +300,15 @@
}
}
+ @override
Iterator<TypeInformation> get iterator => assignments.keys.iterator;
+ @override
Iterable<TypeInformation> where(Function f) => assignments.keys.where(f);
+ @override
bool contains(Object info) => assignments.containsKey(info);
+ @override
String toString() => assignments.keys.toList().toString();
}
@@ -386,6 +394,7 @@
MemberEntity get member => _member;
+ @override
String get debugName => '$member';
void addCall(MemberEntity caller, Object node) {
@@ -438,6 +447,7 @@
// [users] is accurate. The inference stops tracking users for stable types.
// Note that we only override the getter, the setter will still modify the
// state of the [isStable] field inherited from [TypeInformation].
+ @override
bool get isStable => super.isStable && !isClosurized;
AbstractValue handleSpecialCases(InferrerEngine inferrer);
@@ -469,6 +479,7 @@
AbstractValue _potentiallyNarrowType(
AbstractValue mask, InferrerEngine inferrer);
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
AbstractValue special = handleSpecialCases(inferrer);
if (special != null) return potentiallyNarrowType(special, inferrer);
@@ -476,16 +487,20 @@
inferrer.types.computeTypeMask(assignments), inferrer);
}
+ @override
AbstractValue safeType(InferrerEngine inferrer) {
return potentiallyNarrowType(super.safeType(inferrer), inferrer);
}
+ @override
String toString() => 'Member $_member $type';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitMemberTypeInformation(this);
}
+ @override
void cleanup() {
_callers = null;
super.cleanup();
@@ -505,6 +520,7 @@
AbstractValueDomain abstractValueDomain, FieldEntity element, this._type)
: super._internal(abstractValueDomain, element);
+ @override
AbstractValue handleSpecialCases(InferrerEngine inferrer) {
if (!inferrer.canFieldBeUsedForGlobalOptimizations(_field) ||
inferrer.assumeDynamic(_field)) {
@@ -527,11 +543,13 @@
return null;
}
+ @override
AbstractValue _potentiallyNarrowType(
AbstractValue mask, InferrerEngine inferrer) {
return _narrowType(inferrer.closedWorld, mask, _type);
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
// The number of assignments of non-final fields is
// not stable. Therefore such a field cannot be stable.
@@ -550,10 +568,12 @@
FunctionEntity element, this._type)
: super._internal(abstractValueDomain, element);
+ @override
AbstractValue handleSpecialCases(InferrerEngine inferrer) {
return _handleFunctionCase(_getter, inferrer);
}
+ @override
AbstractValue _potentiallyNarrowType(
AbstractValue mask, InferrerEngine inferrer) {
return _narrowType(inferrer.closedWorld, mask, _type.returnType);
@@ -567,10 +587,12 @@
AbstractValueDomain abstractValueDomain, FunctionEntity element)
: super._internal(abstractValueDomain, element);
+ @override
AbstractValue handleSpecialCases(InferrerEngine inferrer) {
return _handleFunctionCase(_setter, inferrer);
}
+ @override
AbstractValue _potentiallyNarrowType(
AbstractValue mask, InferrerEngine inferrer) {
return mask;
@@ -585,15 +607,18 @@
FunctionEntity element, this._type)
: super._internal(abstractValueDomain, element);
+ @override
AbstractValue handleSpecialCases(InferrerEngine inferrer) {
return _handleFunctionCase(_method, inferrer);
}
+ @override
AbstractValue _potentiallyNarrowType(
AbstractValue mask, InferrerEngine inferrer) {
return _narrowType(inferrer.closedWorld, mask, _type.returnType);
}
+ @override
bool hasStableType(InferrerEngine inferrer) => false;
}
@@ -605,6 +630,7 @@
ConstructorEntity element, this._type)
: super._internal(abstractValueDomain, element);
+ @override
AbstractValue handleSpecialCases(InferrerEngine inferrer) {
AbstractValueDomain abstractValueDomain = inferrer.abstractValueDomain;
if (_constructor.isFromEnvironmentConstructor) {
@@ -624,11 +650,13 @@
return _handleFunctionCase(_constructor, inferrer);
}
+ @override
AbstractValue _potentiallyNarrowType(
AbstractValue mask, InferrerEngine inferrer) {
return _narrowType(inferrer.closedWorld, mask, _type.returnType);
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
return super.hasStableType(inferrer);
}
@@ -641,15 +669,18 @@
AbstractValueDomain abstractValueDomain, ConstructorEntity element)
: super._internal(abstractValueDomain, element);
+ @override
AbstractValue handleSpecialCases(InferrerEngine inferrer) {
return _handleFunctionCase(_constructor, inferrer);
}
+ @override
AbstractValue _potentiallyNarrowType(
AbstractValue mask, InferrerEngine inferrer) {
return mask;
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
return super.hasStableType(inferrer);
}
@@ -708,6 +739,7 @@
bool get isRegularParameter => !_isInitializingFormal;
+ @override
String get debugName => '$parameter';
void tagAsTearOffClosureParameter(InferrerEngine inferrer) {
@@ -805,6 +837,7 @@
return mask;
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
AbstractValue special = handleSpecialCases(inferrer);
if (special != null) return special;
@@ -812,10 +845,12 @@
inferrer.types.computeTypeMask(assignments), inferrer);
}
+ @override
AbstractValue safeType(InferrerEngine inferrer) {
return potentiallyNarrowType(super.safeType(inferrer), inferrer);
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
// The number of assignments of parameters of instance methods is
// not stable. Therefore such a parameter cannot be stable.
@@ -825,10 +860,12 @@
return super.hasStableType(inferrer);
}
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitParameterTypeInformation(this);
}
+ @override
String toString() => 'Parameter $_parameter $type';
@override
@@ -882,6 +919,7 @@
assert(_call is ir.Node);
}
+ @override
String toString() => 'Call site $debugName $type';
/// Add [this] to the graph being computed by [engine].
@@ -913,6 +951,7 @@
return inferrer.types.getInferredTypeOfMember(calledElement);
}
+ @override
void addToGraph(InferrerEngine inferrer) {
MemberTypeInformation callee = _getCalledTypeInfo(inferrer);
callee.addCall(caller, _call);
@@ -937,6 +976,7 @@
return inferrer.typeOfMemberWithSelector(calledElement, selector);
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
if (isSynthesized) {
assert(arguments != null);
@@ -946,12 +986,15 @@
}
}
+ @override
Iterable<MemberEntity> get callees => [calledElement];
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitStaticCallSiteTypeInformation(this);
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
bool isStable = _getCalledTypeInfo(inferrer).isStable;
return isStable &&
@@ -959,6 +1002,7 @@
super.hasStableType(inferrer);
}
+ @override
void removeAndClearReferences(InferrerEngine inferrer) {
ElementTypeInformation callee = _getCalledTypeInfo(inferrer);
callee.removeUser(this);
@@ -995,6 +1039,7 @@
assert(validCallType(_callType, _call));
}
+ @override
void addToGraph(InferrerEngine inferrer) {
assert(receiver != null);
AbstractValue typeMask = computeTypedSelector(inferrer);
@@ -1024,6 +1069,7 @@
/// methods on closures.
Iterable<MemberEntity> get concreteTargets => _concreteTargets;
+ @override
Iterable<MemberEntity> get callees => _concreteTargets;
AbstractValue computeTypedSelector(InferrerEngine inferrer) {
@@ -1151,6 +1197,7 @@
}
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
JClosedWorld closedWorld = inferrer.closedWorld;
AbstractValueDomain abstractValueDomain = closedWorld.abstractValueDomain;
@@ -1248,6 +1295,7 @@
return result;
}
+ @override
void giveUp(InferrerEngine inferrer, {bool clearAssignments: true}) {
if (!abandonInferencing) {
inferrer.updateSelectorInMember(caller, _callType, _call, selector, mask);
@@ -1269,6 +1317,7 @@
super.giveUp(inferrer, clearAssignments: clearAssignments);
}
+ @override
void removeAndClearReferences(InferrerEngine inferrer) {
for (MemberEntity element in _concreteTargets) {
MemberTypeInformation callee =
@@ -1281,12 +1330,15 @@
super.removeAndClearReferences(inferrer);
}
+ @override
String toString() => 'Call site $debugName on ${receiver.type} $type';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitDynamicCallSiteTypeInformation(this);
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
return receiver.isStable &&
_concreteTargets.every((MemberEntity element) =>
@@ -1312,23 +1364,29 @@
: super(abstractValueDomain, context, call, enclosing, selector, mask,
arguments, inLoop);
+ @override
void addToGraph(InferrerEngine inferrer) {
arguments.forEach((info) => info.addUser(this));
closure.addUser(this);
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) => safeType(inferrer);
+ @override
Iterable<MemberEntity> get callees {
throw new UnsupportedError("Cannot compute callees of a closure call.");
}
+ @override
String toString() => 'Closure call $debugName on $closure';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitClosureCallSiteTypeInformation(this);
}
+ @override
void removeAndClearReferences(InferrerEngine inferrer) {
// This method is a placeholder for the following comment:
// We should maintain the information that the closure is a user
@@ -1353,40 +1411,51 @@
this.isStable = true;
}
+ @override
bool get isConcrete => true;
+ @override
void addUser(TypeInformation user) {
// Nothing to do, a concrete type does not get updated so never
// needs to notify its users.
}
+ @override
void addUsersOf(TypeInformation other) {
// Nothing to do, a concrete type does not get updated so never
// needs to notify its users.
}
+ @override
void removeUser(TypeInformation user) {}
+ @override
void addAssignment(TypeInformation assignment) {
throw "Not supported";
}
+ @override
void removeAssignment(TypeInformation assignment) {
throw "Not supported";
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) => type;
+ @override
bool reset(InferrerEngine inferrer) {
throw "Not supported";
}
+ @override
String toString() => 'Type $type';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitConcreteTypeInformation(this);
}
+ @override
bool hasStableType(InferrerEngine inferrer) => true;
}
@@ -1399,8 +1468,10 @@
mask, new StringConstantValue(value)));
String asString() => value;
+ @override
String toString() => 'Type $type value ${value}';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitStringLiteralTypeInformation(this);
}
@@ -1414,8 +1485,10 @@
: super(abstractValueDomain.createPrimitiveValue(
mask, value ? new TrueConstantValue() : new FalseConstantValue()));
+ @override
String toString() => 'Type $type value ${value}';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitBoolLiteralTypeInformation(this);
}
@@ -1447,11 +1520,13 @@
addAssignment(narrowedType);
}
+ @override
addAssignment(TypeInformation info) {
super.addAssignment(info);
assert(assignments.length == 1);
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
AbstractValueDomain abstractValueDomain = inferrer.abstractValueDomain;
AbstractValue input = assignments.first.type;
@@ -1469,10 +1544,12 @@
return intersection;
}
+ @override
String toString() {
return 'Narrow to $typeAnnotation $type';
}
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitNarrowTypeInformation(this);
}
@@ -1492,11 +1569,13 @@
if (parentType != null) addAssignment(parentType);
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
if (!inferred) return safeType(inferrer);
return inferrer.types.computeTypeMask(assignments);
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
return inferred && super.hasStableType(inferrer);
}
@@ -1531,16 +1610,20 @@
elementType.addUser(this);
}
+ @override
String toString() => 'List type $type';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitListTypeInformation(this);
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
return elementType.isStable && super.hasStableType(inferrer);
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
AbstractValueDomain abstractValueDomain = inferrer.abstractValueDomain;
AbstractValue mask = type;
@@ -1557,8 +1640,10 @@
return mask;
}
+ @override
AbstractValue safeType(InferrerEngine inferrer) => originalType;
+ @override
void cleanup() {
super.cleanup();
elementType.cleanup();
@@ -1573,8 +1658,10 @@
MemberTypeInformation context, elementType)
: super(abstractValueDomain, context, elementType);
+ @override
String toString() => 'Element in container $type';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitElementInContainerTypeInformation(this);
}
@@ -1592,12 +1679,15 @@
elementType.addUser(this);
}
+ @override
String toString() => 'Set type $type';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitSetTypeInformation(this);
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
AbstractValueDomain abstractValueDomain = inferrer.abstractValueDomain;
AbstractValue mask = type;
@@ -1612,12 +1702,15 @@
return mask;
}
+ @override
AbstractValue safeType(InferrerEngine inferrer) => originalType;
+ @override
bool hasStableType(InferrerEngine inferrer) {
return elementType.isStable && super.hasStableType(inferrer);
}
+ @override
void cleanup() {
super.cleanup();
elementType.cleanup();
@@ -1632,8 +1725,10 @@
MemberTypeInformation context, elementType)
: super(abstractValueDomain, context, elementType);
+ @override
String toString() => 'Element in set $type';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitElementInSetTypeInformation(this);
}
@@ -1713,10 +1808,12 @@
typeInfoMap.values.forEach((v) => v.inferred = true);
}
+ @override
addAssignment(TypeInformation other) {
throw "not supported";
}
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitMapTypeInformation(this);
}
@@ -1745,6 +1842,7 @@
}
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
AbstractValueDomain abstractValueDomain = inferrer.abstractValueDomain;
if (abstractValueDomain.isDictionary(type) != inDictionaryMode) {
@@ -1775,14 +1873,17 @@
return type;
}
+ @override
AbstractValue safeType(InferrerEngine inferrer) => originalType;
+ @override
bool hasStableType(InferrerEngine inferrer) {
return keyType.isStable &&
valueType.isStable &&
super.hasStableType(inferrer);
}
+ @override
void cleanup() {
super.cleanup();
keyType.cleanup();
@@ -1793,6 +1894,7 @@
_flowsInto = null;
}
+ @override
String toString() {
return 'Map $type (K:$keyType, V:$valueType) contents $typeInfoMap';
}
@@ -1805,10 +1907,12 @@
MemberTypeInformation context, TypeInformation keyType)
: super(abstractValueDomain, context, keyType);
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitKeyInMapTypeInformation(this);
}
+ @override
String toString() => 'Key in Map $type';
}
@@ -1825,16 +1929,19 @@
[this.nonNull = false])
: super(abstractValueDomain, context, valueType);
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitValueInMapTypeInformation(this);
}
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
return nonNull
? super.computeType(inferrer)
: inferrer.abstractValueDomain.includeNull(super.computeType(inferrer));
}
+ @override
String toString() => 'Value in Map $type';
}
@@ -1850,12 +1957,15 @@
{this.isTry})
: super(abstractValueDomain.emptyType, context);
+ @override
AbstractValue computeType(InferrerEngine inferrer) {
return inferrer.types.computeTypeMask(assignments);
}
+ @override
String toString() => 'Phi($hashCode) $variable $type';
+ @override
void _toStructuredText(
StringBuffer sb, String indent, Set<TypeInformation> seen) {
if (seen.add(this)) {
@@ -1870,6 +1980,7 @@
}
}
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitPhiElementTypeInformation(this);
}
@@ -1885,20 +1996,25 @@
FunctionEntity get closure => _element;
+ @override
AbstractValue computeType(InferrerEngine inferrer) => safeType(inferrer);
+ @override
AbstractValue safeType(InferrerEngine inferrer) {
return inferrer.types.functionType.type;
}
String get debugName => '$closure';
+ @override
String toString() => 'Closure $_element';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitClosureTypeInformation(this);
}
+ @override
bool hasStableType(InferrerEngine inferrer) {
return false;
}
@@ -1945,12 +2061,15 @@
: super(abstractValueDomain.emptyType, context);
// TODO(22894): Compute a better type here.
+ @override
AbstractValue computeType(InferrerEngine inferrer) => safeType(inferrer);
String get debugName => '$_node';
+ @override
String toString() => 'Await';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitAwaitTypeInformation(this);
}
@@ -1963,12 +2082,15 @@
MemberTypeInformation context, this._node)
: super(abstractValueDomain.emptyType, context);
+ @override
AbstractValue computeType(InferrerEngine inferrer) => safeType(inferrer);
String get debugName => '$_node';
+ @override
String toString() => 'Yield';
+ @override
accept(TypeInformationVisitor visitor) {
return visitor.visitYieldTypeInformation(this);
}
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/container_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/container_type_mask.dart
index 4b27265..e920091 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/container_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/container_type_mask.dart
@@ -12,12 +12,15 @@
/// debugging data stream.
static const String tag = 'container-type-mask';
+ @override
final TypeMask forwardTo;
// The [Node] where this type mask was created.
+ @override
final ir.TreeNode allocationNode;
// The [Entity] where this type mask was created.
+ @override
final MemberEntity allocationElement;
// The element type of this container.
@@ -44,6 +47,7 @@
}
/// Serializes this [ContainerTypeMask] to [sink].
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(TypeMaskKind.container);
sink.begin(tag);
@@ -55,6 +59,7 @@
sink.end(tag);
}
+ @override
TypeMask nullable() {
return isNullable
? this
@@ -62,6 +67,7 @@
allocationElement, elementType, length);
}
+ @override
TypeMask nonNullable() {
return isNullable
? new ContainerTypeMask(forwardTo.nonNullable(), allocationNode,
@@ -69,9 +75,12 @@
: this;
}
+ @override
bool get isContainer => true;
+ @override
bool get isExact => true;
+ @override
bool equalsDisregardNull(other) {
if (other is! ContainerTypeMask) return false;
return super.equalsDisregardNull(other) &&
@@ -80,12 +89,14 @@
length == other.length;
}
+ @override
TypeMask intersection(TypeMask other, JClosedWorld closedWorld) {
TypeMask forwardIntersection = forwardTo.intersection(other, closedWorld);
if (forwardIntersection.isEmptyOrNull) return forwardIntersection;
return forwardIntersection.isNullable ? nullable() : nonNullable();
}
+ @override
TypeMask union(dynamic other, JClosedWorld closedWorld) {
if (this == other) {
return this;
@@ -113,13 +124,16 @@
}
}
+ @override
bool operator ==(other) => super == other;
+ @override
int get hashCode {
return computeHashCode(
allocationNode, isNullable, elementType, length, forwardTo);
}
+ @override
String toString() {
return 'Container($forwardTo, element: $elementType, length: $length)';
}
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/dictionary_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/dictionary_type_mask.dart
index 8463350..827840c 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/dictionary_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/dictionary_type_mask.dart
@@ -44,6 +44,7 @@
}
/// Serializes this [DictionaryTypeMask] to [sink].
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(TypeMaskKind.dictionary);
sink.begin(tag);
@@ -59,6 +60,7 @@
sink.end(tag);
}
+ @override
TypeMask nullable() {
return isNullable
? this
@@ -66,6 +68,7 @@
allocationElement, keyType, valueType, _typeMap);
}
+ @override
TypeMask nonNullable() {
return isNullable
? new DictionaryTypeMask(forwardTo.nonNullable(), allocationNode,
@@ -73,13 +76,16 @@
: this;
}
+ @override
bool get isDictionary => true;
+ @override
bool get isExact => true;
bool containsKey(String key) => _typeMap.containsKey(key);
TypeMask getValueForKey(String key) => _typeMap[key];
+ @override
bool equalsDisregardNull(other) {
if (other is! DictionaryTypeMask) return false;
return allocationNode == other.allocationNode &&
@@ -90,12 +96,14 @@
(k) => _typeMap.containsKey(k) && _typeMap[k] == other._typeMap[k]);
}
+ @override
TypeMask intersection(TypeMask other, JClosedWorld closedWorld) {
TypeMask forwardIntersection = forwardTo.intersection(other, closedWorld);
if (forwardIntersection.isEmptyOrNull) return forwardIntersection;
return forwardIntersection.isNullable ? nullable() : nonNullable();
}
+ @override
TypeMask union(dynamic other, JClosedWorld closedWorld) {
if (this == other) {
return this;
@@ -135,12 +143,15 @@
}
}
+ @override
bool operator ==(other) => super == other;
+ @override
int get hashCode {
return computeHashCode(allocationNode, isNullable, _typeMap, forwardTo);
}
+ @override
String toString() {
return 'Dictionary($forwardTo, key: $keyType, '
'value: $valueType, map: $_typeMap)';
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/flat_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/flat_type_mask.dart
index 8478b0f..d8ddc8a 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/flat_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/flat_type_mask.dart
@@ -78,6 +78,7 @@
}
/// Serializes this [FlatTypeMask] to [sink].
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(TypeMaskKind.flat);
sink.begin(tag);
@@ -90,18 +91,30 @@
? ClassQuery.EXACT
: (isSubclass ? ClassQuery.SUBCLASS : ClassQuery.SUBTYPE);
+ @override
bool get isEmpty => isEmptyOrNull && !isNullable;
+ @override
bool get isNull => isEmptyOrNull && isNullable;
+ @override
bool get isEmptyOrNull => (flags >> 1) == EMPTY;
+ @override
bool get isExact => (flags >> 1) == EXACT;
+ @override
bool get isNullable => (flags & 1) != 0;
+ @override
bool get isUnion => false;
+ @override
bool get isContainer => false;
+ @override
bool get isSet => false;
+ @override
bool get isMap => false;
+ @override
bool get isDictionary => false;
+ @override
bool get isForwarding => false;
+ @override
bool get isValue => false;
// TODO(kasperl): Get rid of these. They should not be a visible
@@ -110,14 +123,17 @@
bool get isSubclass => (flags >> 1) == SUBCLASS;
bool get isSubtype => (flags >> 1) == SUBTYPE;
+ @override
TypeMask nullable() {
return isNullable ? this : new FlatTypeMask.internal(base, flags | 1);
}
+ @override
TypeMask nonNullable() {
return isNullable ? new FlatTypeMask.internal(base, flags & ~1) : this;
}
+ @override
bool contains(ClassEntity other, JClosedWorld closedWorld) {
if (isEmptyOrNull) {
return false;
@@ -162,6 +178,7 @@
return false;
}
+ @override
bool isInMask(TypeMask other, JClosedWorld closedWorld) {
if (isEmptyOrNull) return isNullable ? other.isNullable : true;
// The empty type contains no classes.
@@ -195,10 +212,12 @@
return satisfies(otherBase, closedWorld);
}
+ @override
bool containsMask(TypeMask other, JClosedWorld closedWorld) {
return other.isInMask(this, closedWorld);
}
+ @override
bool containsOnlyInt(JClosedWorld closedWorld) {
CommonElements commonElements = closedWorld.commonElements;
return base == closedWorld.commonElements.intClass ||
@@ -208,11 +227,13 @@
base == commonElements.jsUInt32Class;
}
+ @override
bool containsOnlyDouble(JClosedWorld closedWorld) {
return base == closedWorld.commonElements.doubleClass ||
base == closedWorld.commonElements.jsDoubleClass;
}
+ @override
bool containsOnlyNum(JClosedWorld closedWorld) {
return containsOnlyInt(closedWorld) ||
containsOnlyDouble(closedWorld) ||
@@ -220,20 +241,24 @@
base == closedWorld.commonElements.jsNumberClass;
}
+ @override
bool containsOnlyBool(JClosedWorld closedWorld) {
return base == closedWorld.commonElements.boolClass ||
base == closedWorld.commonElements.jsBoolClass;
}
+ @override
bool containsOnlyString(JClosedWorld closedWorld) {
return base == closedWorld.commonElements.stringClass ||
base == closedWorld.commonElements.jsStringClass;
}
+ @override
bool containsOnly(ClassEntity cls) {
return base == cls;
}
+ @override
bool satisfies(ClassEntity cls, JClosedWorld closedWorld) {
if (isEmptyOrNull) return false;
if (closedWorld.classHierarchy.isSubtypeOf(base, cls)) return true;
@@ -242,6 +267,7 @@
/// Returns the [Entity] if this type represents a single class, otherwise
/// returns `null`. This method is conservative.
+ @override
ClassEntity singleClass(JClosedWorld closedWorld) {
if (isEmptyOrNull) return null;
if (isNullable) return null; // It is Null and some other class.
@@ -258,11 +284,13 @@
}
/// Returns whether or not this type mask contains all types.
+ @override
bool containsAll(JClosedWorld closedWorld) {
if (isEmptyOrNull || isExact) return false;
return identical(base, closedWorld.commonElements.objectClass);
}
+ @override
TypeMask union(TypeMask other, JClosedWorld closedWorld) {
assert(other != null);
assert(TypeMask.assertIsNormalized(this, closedWorld));
@@ -352,6 +380,7 @@
: this;
}
+ @override
TypeMask intersection(TypeMask other, JClosedWorld closedWorld) {
assert(other != null);
if (other is! FlatTypeMask) return other.intersection(this, closedWorld);
@@ -425,6 +454,7 @@
}
}
+ @override
bool isDisjoint(TypeMask other, JClosedWorld closedWorld) {
if (other is! FlatTypeMask) return other.isDisjoint(this, closedWorld);
FlatTypeMask flatOther = other;
@@ -517,6 +547,7 @@
/// Returns whether [element] is a potential target when being
/// invoked on this type mask. [selector] is used to ensure library
/// privacy is taken into account.
+ @override
bool canHit(MemberEntity element, Name name, JClosedWorld closedWorld) {
CommonElements commonElements = closedWorld.commonElements;
assert(element.name == name.text);
@@ -552,6 +583,7 @@
}
}
+ @override
bool needsNoSuchMethodHandling(
Selector selector, covariant JClosedWorld closedWorld) {
// A call on an empty type mask is either dead code, or a call on
@@ -566,6 +598,7 @@
return closedWorld.needsNoSuchMethod(base, selector, _classQuery);
}
+ @override
MemberEntity locateSingleMember(Selector selector, JClosedWorld closedWorld) {
if (isEmptyOrNull) return null;
if (closedWorld.includesClosureCall(selector, this)) return null;
@@ -593,6 +626,7 @@
return null;
}
+ @override
bool operator ==(var other) {
if (identical(this, other)) return true;
if (other is! FlatTypeMask) return false;
@@ -600,10 +634,12 @@
return (flags == otherMask.flags) && (base == otherMask.base);
}
+ @override
int get hashCode {
return (base == null ? 0 : base.hashCode) + 31 * flags.hashCode;
}
+ @override
String toString() {
if (isEmptyOrNull) return isNullable ? '[null]' : '[empty]';
StringBuffer buffer = new StringBuffer();
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/forwarding_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/forwarding_type_mask.dart
index 6021460..39f850c 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/forwarding_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/forwarding_type_mask.dart
@@ -11,68 +11,93 @@
ForwardingTypeMask();
+ @override
bool get isEmptyOrNull => forwardTo.isEmptyOrNull;
+ @override
bool get isEmpty => forwardTo.isEmpty;
+ @override
bool get isNullable => forwardTo.isNullable;
+ @override
bool get isNull => forwardTo.isNull;
+ @override
bool get isExact => forwardTo.isExact;
+ @override
bool get isUnion => false;
+ @override
bool get isContainer => false;
+ @override
bool get isSet => false;
+ @override
bool get isMap => false;
+ @override
bool get isDictionary => false;
+ @override
bool get isValue => false;
+ @override
bool get isForwarding => true;
+ @override
bool isInMask(TypeMask other, JClosedWorld closedWorld) {
return forwardTo.isInMask(other, closedWorld);
}
+ @override
bool containsMask(TypeMask other, JClosedWorld closedWorld) {
return forwardTo.containsMask(other, closedWorld);
}
+ @override
bool containsOnlyInt(JClosedWorld closedWorld) {
return forwardTo.containsOnlyInt(closedWorld);
}
+ @override
bool containsOnlyDouble(JClosedWorld closedWorld) {
return forwardTo.containsOnlyDouble(closedWorld);
}
+ @override
bool containsOnlyNum(JClosedWorld closedWorld) {
return forwardTo.containsOnlyNum(closedWorld);
}
+ @override
bool containsOnlyBool(JClosedWorld closedWorld) {
return forwardTo.containsOnlyBool(closedWorld);
}
+ @override
bool containsOnlyString(JClosedWorld closedWorld) {
return forwardTo.containsOnlyString(closedWorld);
}
+ @override
bool containsOnly(ClassEntity cls) {
return forwardTo.containsOnly(cls);
}
+ @override
bool satisfies(ClassEntity cls, JClosedWorld closedWorld) {
return forwardTo.satisfies(cls, closedWorld);
}
+ @override
bool contains(ClassEntity cls, JClosedWorld closedWorld) {
return forwardTo.contains(cls, closedWorld);
}
+ @override
bool containsAll(JClosedWorld closedWorld) {
return forwardTo.containsAll(closedWorld);
}
+ @override
ClassEntity singleClass(JClosedWorld closedWorld) {
return forwardTo.singleClass(closedWorld);
}
+ @override
TypeMask union(other, JClosedWorld closedWorld) {
if (this == other) {
return this;
@@ -84,23 +109,28 @@
return forwardTo.union(other, closedWorld);
}
+ @override
bool isDisjoint(TypeMask other, JClosedWorld closedWorld) {
return forwardTo.isDisjoint(other, closedWorld);
}
+ @override
TypeMask intersection(TypeMask other, JClosedWorld closedWorld) {
return forwardTo.intersection(other, closedWorld);
}
+ @override
bool needsNoSuchMethodHandling(
Selector selector, covariant JClosedWorld closedWorld) {
return forwardTo.needsNoSuchMethodHandling(selector, closedWorld);
}
+ @override
bool canHit(MemberEntity element, Name name, JClosedWorld closedWorld) {
return forwardTo.canHit(element, name, closedWorld);
}
+ @override
MemberEntity locateSingleMember(Selector selector, JClosedWorld closedWorld) {
return forwardTo.locateSingleMember(selector, closedWorld);
}
@@ -114,10 +144,12 @@
}
}
+ @override
bool operator ==(other) {
return equalsDisregardNull(other) && isNullable == other.isNullable;
}
+ @override
int get hashCode => throw "Subclass should implement hashCode getter";
}
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/map_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/map_type_mask.dart
index 2486256..7ba33af 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/map_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/map_type_mask.dart
@@ -12,12 +12,15 @@
/// debugging data stream.
static const String tag = 'map-type-mask';
+ @override
final TypeMask forwardTo;
// The [Node] where this type mask was created.
+ @override
final ir.TreeNode allocationNode;
// The [MemberEntity] where this type mask was created.
+ @override
final MemberEntity allocationElement;
// The value type of this map.
@@ -44,6 +47,7 @@
}
/// Serializes this [MapTypeMask] to [sink].
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(TypeMaskKind.map);
sink.begin(tag);
@@ -55,6 +59,7 @@
sink.end(tag);
}
+ @override
TypeMask nullable() {
return isNullable
? this
@@ -62,6 +67,7 @@
allocationElement, keyType, valueType);
}
+ @override
TypeMask nonNullable() {
return isNullable
? new MapTypeMask(forwardTo.nonNullable(), allocationNode,
@@ -69,10 +75,14 @@
: this;
}
+ @override
bool get isContainer => false;
+ @override
bool get isMap => true;
+ @override
bool get isExact => true;
+ @override
bool equalsDisregardNull(other) {
if (other is! MapTypeMask) return false;
return super.equalsDisregardNull(other) &&
@@ -81,12 +91,14 @@
valueType == other.valueType;
}
+ @override
TypeMask intersection(TypeMask other, JClosedWorld closedWorld) {
TypeMask forwardIntersection = forwardTo.intersection(other, closedWorld);
if (forwardIntersection.isEmptyOrNull) return forwardIntersection;
return forwardIntersection.isNullable ? nullable() : nonNullable();
}
+ @override
TypeMask union(dynamic other, JClosedWorld closedWorld) {
if (this == other) {
return this;
@@ -128,13 +140,16 @@
}
}
+ @override
bool operator ==(other) => super == other;
+ @override
int get hashCode {
return computeHashCode(
allocationNode, isNullable, keyType, valueType, forwardTo);
}
+ @override
String toString() {
return 'Map($forwardTo, key: $keyType, value: $valueType)';
}
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/set_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/set_type_mask.dart
index fb0a7e2..966cbdf 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/set_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/set_type_mask.dart
@@ -12,12 +12,15 @@
/// data stream.
static const String tag = 'set-type-mask';
+ @override
final TypeMask forwardTo;
// The [Node] where this type mask was created.
+ @override
final ir.TreeNode allocationNode;
// The [Entity] where this type mask was created.
+ @override
final MemberEntity allocationElement;
// The element type of this set.
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart
index cb54ce7..cf6099d 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart
@@ -48,6 +48,7 @@
return _masks.add(mask);
}
+ @override
String toString() {
if (isAll) {
return '<all>';
@@ -361,6 +362,7 @@
///
/// Note: This may differ from semantic equality in the set containment sense.
/// Use [containsMask] and [isInMask] for that, instead.
+ @override
bool operator ==(other);
/// If this returns `true`, [other] is guaranteed to be a supertype of this
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart
index 98a5a87..1c3b7ec 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart
@@ -34,6 +34,7 @@
}
/// Serializes this [UnionTypeMask] to [sink].
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(TypeMaskKind.union);
sink.begin(tag);
@@ -161,6 +162,7 @@
return new TypeMask(bestElement, bestKind, isNullable, closedWorld);
}
+ @override
TypeMask union(dynamic other, JClosedWorld closedWorld) {
other = TypeMask.nonForwardingMask(other);
if (!other.isUnion && disjointMasks.contains(other)) return this;
@@ -175,6 +177,7 @@
return new TypeMask.unionOf(newList, closedWorld);
}
+ @override
TypeMask intersection(dynamic other, JClosedWorld closedWorld) {
other = TypeMask.nonForwardingMask(other);
if (!other.isUnion && disjointMasks.contains(other)) return other;
@@ -197,6 +200,7 @@
return new TypeMask.unionOf(intersections, closedWorld);
}
+ @override
bool isDisjoint(TypeMask other, JClosedWorld closedWorld) {
for (var current in disjointMasks) {
if (!current.isDisjoint(other, closedWorld)) return false;
@@ -204,6 +208,7 @@
return true;
}
+ @override
TypeMask nullable() {
if (isNullable) return this;
List<FlatTypeMask> newList = new List<FlatTypeMask>.from(disjointMasks);
@@ -211,6 +216,7 @@
return new UnionTypeMask._internal(newList);
}
+ @override
TypeMask nonNullable() {
if (!isNullable) return this;
Iterable<FlatTypeMask> newIterable = disjointMasks.map((e) {
@@ -220,17 +226,29 @@
return new UnionTypeMask._internal(newIterable);
}
+ @override
bool get isEmptyOrNull => false;
+ @override
bool get isEmpty => false;
+ @override
bool get isNull => false;
+ @override
bool get isNullable => disjointMasks.any((e) => e.isNullable);
+ @override
bool get isExact => false;
+ @override
bool get isUnion => true;
+ @override
bool get isContainer => false;
+ @override
bool get isSet => false;
+ @override
bool get isMap => false;
+ @override
bool get isDictionary => false;
+ @override
bool get isForwarding => false;
+ @override
bool get isValue => false;
/// Checks whether [other] is contained in this union.
@@ -268,6 +286,7 @@
return members.every((ClassEntity cls) => this.contains(cls, closedWorld));
}
+ @override
bool isInMask(TypeMask other, JClosedWorld closedWorld) {
other = TypeMask.nonForwardingMask(other);
if (isNullable && !other.isNullable) return false;
@@ -296,6 +315,7 @@
return disjointMasks.every((mask) => mask.isInMask(other, closedWorld));
}
+ @override
bool containsMask(TypeMask other, JClosedWorld closedWorld) {
other = TypeMask.nonForwardingMask(other);
if (other.isNullable && !isNullable) return false;
@@ -311,55 +331,68 @@
return contained;
}
+ @override
bool containsOnlyInt(JClosedWorld closedWorld) {
return disjointMasks.every((mask) => mask.containsOnlyInt(closedWorld));
}
+ @override
bool containsOnlyDouble(JClosedWorld closedWorld) {
return disjointMasks.every((mask) => mask.containsOnlyDouble(closedWorld));
}
+ @override
bool containsOnlyNum(JClosedWorld closedWorld) {
return disjointMasks.every((mask) {
return mask.containsOnlyNum(closedWorld);
});
}
+ @override
bool containsOnlyBool(JClosedWorld closedWorld) {
return disjointMasks.every((mask) => mask.containsOnlyBool(closedWorld));
}
+ @override
bool containsOnlyString(JClosedWorld closedWorld) {
return disjointMasks.every((mask) => mask.containsOnlyString(closedWorld));
}
+ @override
bool containsOnly(ClassEntity element) {
return disjointMasks.every((mask) => mask.containsOnly(element));
}
+ @override
bool satisfies(ClassEntity cls, JClosedWorld closedWorld) {
return disjointMasks.every((mask) => mask.satisfies(cls, closedWorld));
}
+ @override
bool contains(ClassEntity cls, JClosedWorld closedWorld) {
return disjointMasks.any((e) => e.contains(cls, closedWorld));
}
+ @override
bool containsAll(JClosedWorld closedWorld) {
return disjointMasks.any((mask) => mask.containsAll(closedWorld));
}
+ @override
ClassEntity singleClass(JClosedWorld closedWorld) => null;
+ @override
bool needsNoSuchMethodHandling(Selector selector, JClosedWorld closedWorld) {
return disjointMasks
.any((e) => e.needsNoSuchMethodHandling(selector, closedWorld));
}
+ @override
bool canHit(MemberEntity element, Name name, JClosedWorld closedWorld) {
return disjointMasks.any((e) => e.canHit(element, name, closedWorld));
}
+ @override
MemberEntity locateSingleMember(Selector selector, JClosedWorld closedWorld) {
MemberEntity candidate;
for (FlatTypeMask mask in disjointMasks) {
@@ -375,6 +408,7 @@
return candidate;
}
+ @override
String toString() {
String masksString =
(disjointMasks.map((TypeMask mask) => mask.toString()).toList()..sort())
@@ -382,6 +416,7 @@
return 'Union($masksString)';
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
@@ -398,6 +433,7 @@
containsAll();
}
+ @override
int get hashCode {
int hashCode = isNullable ? 86 : 43;
// The order of the masks in [disjointMasks] must not affect the
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/value_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/value_type_mask.dart
index 45c1300..1c965dc 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/value_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/value_type_mask.dart
@@ -9,6 +9,7 @@
/// debugging data stream.
static const String tag = 'value-type-mask';
+ @override
final TypeMask forwardTo;
final PrimitiveConstantValue value;
@@ -25,6 +26,7 @@
}
/// Serializes this [ValueTypeMask] to [sink].
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(TypeMaskKind.value);
sink.begin(tag);
@@ -33,35 +35,43 @@
sink.end(tag);
}
+ @override
TypeMask nullable() {
return isNullable ? this : new ValueTypeMask(forwardTo.nullable(), value);
}
+ @override
TypeMask nonNullable() {
return isNullable
? new ValueTypeMask(forwardTo.nonNullable(), value)
: this;
}
+ @override
bool get isValue => true;
+ @override
bool equalsDisregardNull(other) {
if (other is! ValueTypeMask) return false;
return super.equalsDisregardNull(other) && value == other.value;
}
+ @override
TypeMask intersection(TypeMask other, JClosedWorld closedWorld) {
TypeMask forwardIntersection = forwardTo.intersection(other, closedWorld);
if (forwardIntersection.isEmptyOrNull) return forwardIntersection;
return forwardIntersection.isNullable ? nullable() : nonNullable();
}
+ @override
bool operator ==(other) => super == other;
+ @override
int get hashCode {
return computeHashCode(value, isNullable, forwardTo);
}
+ @override
String toString() {
return 'Value($forwardTo, value: ${value.toDartText()})';
}
diff --git a/pkg/compiler/lib/src/inferrer/types.dart b/pkg/compiler/lib/src/inferrer/types.dart
index 6a1017b..265d76d 100644
--- a/pkg/compiler/lib/src/inferrer/types.dart
+++ b/pkg/compiler/lib/src/inferrer/types.dart
@@ -147,6 +147,7 @@
/// Global analysis that infers concrete types.
class GlobalTypeInferenceTask extends CompilerTask {
// TODO(sigmund): rename at the same time as our benchmarking tools.
+ @override
final String name = 'Type inference';
final Compiler compiler;
@@ -187,7 +188,9 @@
/// in a debugging data stream.
static const String tag = 'global-type-inference-results';
+ @override
final JClosedWorld closedWorld;
+ @override
final InferredData inferredData;
final GlobalTypeInferenceMemberResult _deadFieldResult;
final GlobalTypeInferenceMemberResult _deadMethodResult;
@@ -240,6 +243,7 @@
allocatedLists);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeBool(false); // Is _not_ trivial.
sink.begin(tag);
@@ -365,8 +369,10 @@
bool isFixedArrayCheckedForGrowable(ir.Node ctorCall) =>
checkedForGrowableLists.contains(ctorCall);
+ @override
AbstractValue typeOfNewList(ir.Node node) => _allocatedLists[node];
+ @override
AbstractValue typeOfListLiteral(ir.Node node) => _allocatedLists[node];
}
@@ -377,9 +383,13 @@
static const String tag = 'global-type-inference-member-result';
final GlobalTypeInferenceElementData _data;
+ @override
final AbstractValue returnType;
+ @override
final AbstractValue type;
+ @override
final bool throwsAlways;
+ @override
final bool isCalledOnce;
GlobalTypeInferenceMemberResultImpl(this._data, this.returnType, this.type,
@@ -403,6 +413,7 @@
throwsAlways: throwsAlways, isCalledOnce: isCalledOnce);
}
+ @override
void writeToDataSink(DataSink sink, AbstractValueDomain abstractValueDomain) {
sink.begin(tag);
sink.writeValueOrNull(_data, (GlobalTypeInferenceElementData data) {
@@ -415,19 +426,26 @@
sink.end(tag);
}
+ @override
AbstractValue typeOfSend(ir.Node node) => _data?.typeOfSend(node);
+ @override
AbstractValue typeOfGetter(ir.Node node) => _data?.typeOfGetter(node);
+ @override
AbstractValue typeOfIterator(ir.Node node) => _data?.typeOfIterator(node);
+ @override
AbstractValue typeOfIteratorMoveNext(ir.Node node) =>
_data?.typeOfIteratorMoveNext(node);
+ @override
AbstractValue typeOfIteratorCurrent(ir.Node node) =>
_data?.typeOfIteratorCurrent(node);
}
class TrivialGlobalTypeInferenceResults implements GlobalTypeInferenceResults {
+ @override
final JClosedWorld closedWorld;
final TrivialGlobalTypeInferenceMemberResult _trivialMemberResult;
final AbstractValue _trivialParameterResult;
+ @override
final InferredData inferredData = new TrivialInferredData();
TrivialGlobalTypeInferenceResults(this.closedWorld)
@@ -435,6 +453,7 @@
closedWorld.abstractValueDomain.dynamicType),
_trivialParameterResult = closedWorld.abstractValueDomain.dynamicType;
+ @override
void writeToDataSink(DataSink sink) {
sink.writeBool(true); // Is trivial.
}
@@ -497,6 +516,7 @@
@override
bool get isCalledOnce => false;
+ @override
void writeToDataSink(DataSink sink, AbstractValueDomain abstractValueDomain) {
throw new UnsupportedError(
"TrivialGlobalTypeInferenceMemberResult.writeToDataSink");
@@ -539,6 +559,7 @@
@override
bool get isCalledOnce => false;
+ @override
void writeToDataSink(DataSink sink, AbstractValueDomain abstractValueDomain) {
throw new UnsupportedError(
"DeadFieldGlobalTypeInferenceResult.writeToDataSink");
@@ -581,6 +602,7 @@
@override
bool get isCalledOnce => false;
+ @override
void writeToDataSink(DataSink sink, AbstractValueDomain abstractValueDomain) {
throw new UnsupportedError(
"DeadFieldGlobalTypeInferenceResult.writeToDataSink");
diff --git a/pkg/compiler/lib/src/io/code_output.dart b/pkg/compiler/lib/src/io/code_output.dart
index 9ccc4b3..d7342ef 100644
--- a/pkg/compiler/lib/src/io/code_output.dart
+++ b/pkg/compiler/lib/src/io/code_output.dart
@@ -50,9 +50,11 @@
}
class _SourceLocationsImpl implements SourceLocations {
+ @override
final String name;
final AbstractCodeOutput codeOutput;
Map<int, List<SourceLocation>> markers = <int, List<SourceLocation>>{};
+ @override
Map<int, List<FrameEntry>> frameMarkers = <int, List<FrameEntry>>{};
_SourceLocationsImpl(this.name, this.codeOutput);
@@ -143,6 +145,7 @@
abstract class AbstractCodeOutput extends CodeOutput {
Map<String, _SourceLocationsImpl> sourceLocationsMap =
<String, _SourceLocationsImpl>{};
+ @override
bool isClosed = false;
void _addInternal(String text);
@@ -199,10 +202,12 @@
@override
int get length => buffer.length;
+ @override
String getText() {
return buffer.toString();
}
+ @override
String toString() {
throw "Don't use CodeBuffer.toString() since it drops sourcemap data.";
}
@@ -210,6 +215,7 @@
/// [CodeOutput] using a [CompilationOutput] as backend.
class StreamCodeOutput extends AbstractCodeOutput {
+ @override
int length = 0;
final OutputSink output;
final List<CodeOutputListener> _listeners;
@@ -225,6 +231,7 @@
}
}
+ @override
void close() {
output.close();
super.close();
diff --git a/pkg/compiler/lib/src/io/kernel_source_information.dart b/pkg/compiler/lib/src/io/kernel_source_information.dart
index af69c56..520fbb40 100644
--- a/pkg/compiler/lib/src/io/kernel_source_information.dart
+++ b/pkg/compiler/lib/src/io/kernel_source_information.dart
@@ -485,8 +485,11 @@
}
class KernelSourceLocation extends AbstractSourceLocation {
+ @override
final int offset;
+ @override
final String sourceName;
+ @override
final Uri sourceUri;
KernelSourceLocation(ir.Location location, this.offset, this.sourceName)
diff --git a/pkg/compiler/lib/src/io/location_provider.dart b/pkg/compiler/lib/src/io/location_provider.dart
index a015bab..3455e31 100644
--- a/pkg/compiler/lib/src/io/location_provider.dart
+++ b/pkg/compiler/lib/src/io/location_provider.dart
@@ -49,6 +49,7 @@
this.length = length;
}
+ @override
String toString() {
return 'lineStarts=$lineStarts,length=$length';
}
diff --git a/pkg/compiler/lib/src/io/position_information.dart b/pkg/compiler/lib/src/io/position_information.dart
index 0d3b387..732b841 100644
--- a/pkg/compiler/lib/src/io/position_information.dart
+++ b/pkg/compiler/lib/src/io/position_information.dart
@@ -23,6 +23,7 @@
@override
final SourceLocation innerPosition;
+ @override
final List<FrameContext> inliningContext;
PositionSourceInformation(
@@ -49,11 +50,13 @@
return new SourceSpan(uri, offset, offset);
}
+ @override
int get hashCode {
return 0x7FFFFFFF &
(startPosition.hashCode * 17 + innerPosition.hashCode * 19);
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! PositionSourceInformation) return false;
@@ -78,6 +81,7 @@
return sb.toString();
}
+ @override
String get shortText {
if (startPosition != null) {
return _computeText(startPosition.sourceUri.pathSegments.last);
@@ -86,6 +90,7 @@
}
}
+ @override
String toString() {
if (startPosition != null) {
return _computeText('${startPosition.sourceUri}');
@@ -152,6 +157,7 @@
}
}
+ @override
String toString() {
return 'CodePosition(start=$startPosition,'
'end=$endPosition,closing=$closingPosition)';
@@ -178,6 +184,7 @@
_codePositionMap[node] = codePosition;
}
+ @override
CodePosition operator [](js.Node node) => _codePositionMap[node];
}
@@ -295,6 +302,7 @@
}
}
+ @override
void process(js.Node node, BufferedCodeOutput code) {
new JavaScriptTracer(codePositionMap, reader, traceListeners).apply(node);
inliningListener?.finish();
@@ -379,6 +387,7 @@
class InliningTraceListener extends TraceListener
with NodeToSourceInformationMixin {
final SourceMapper sourceMapper;
+ @override
final SourceInformationReader reader;
final Map<int, List<FrameContext>> _frames = {};
@@ -459,6 +468,7 @@
class PositionTraceListener extends TraceListener
with NodeToSourceInformationMixin {
final SourceMapper sourceMapper;
+ @override
final SourceInformationReader reader;
PositionTraceListener(this.sourceMapper, this.reader);
@@ -752,6 +762,7 @@
int get value => subexpressionOffset;
+ @override
String toString() {
return 'Offset[statementOffset=$statementOffset,'
'leftToRightOffset=$leftToRightOffset,'
@@ -1369,12 +1380,14 @@
return sb.toString();
}
+ @override
String toString() => getCoverageReport();
}
/// [TraceListener] that registers [onStep] callbacks with [coverage].
class CoverageListener extends TraceListener with NodeToSourceInformationMixin {
final Coverage coverage;
+ @override
final SourceInformationReader reader;
CoverageListener(this.coverage, this.reader);
diff --git a/pkg/compiler/lib/src/io/source_file.dart b/pkg/compiler/lib/src/io/source_file.dart
index ff227ae..ffdb8d0 100644
--- a/pkg/compiler/lib/src/io/source_file.dart
+++ b/pkg/compiler/lib/src/io/source_file.dart
@@ -17,8 +17,10 @@
/// a UTF-8 encoded [List<int>] of bytes.
abstract class SourceFile<T> implements Input<T>, LocationProvider {
/// The absolute URI of the source file.
+ @override
Uri get uri;
+ @override
InputKind get inputKind => InputKind.UTF8;
kernel.Source cachedKernelSource;
@@ -83,6 +85,7 @@
return starts;
}
+ @override
kernel.Location getLocation(int offset) {
return kernelSource.getLocation(null, offset);
}
@@ -172,6 +175,7 @@
}
class Utf8BytesSourceFile extends SourceFile<List<int>> {
+ @override
final Uri uri;
/// The UTF-8 encoded content of the source file.
@@ -184,22 +188,27 @@
Utf8BytesSourceFile(this.uri, List<int> content)
: this.zeroTerminatedContent = _zeroTerminateIfNecessary(content);
+ @override
List<int> get data => zeroTerminatedContent;
+ @override
String slowText() {
// Don't convert the trailing zero byte.
return utf8.decoder
.convert(zeroTerminatedContent, 0, zeroTerminatedContent.length - 1);
}
+ @override
List<int> slowUtf8ZeroTerminatedBytes() => zeroTerminatedContent;
+ @override
String slowSubstring(int start, int end) {
// TODO(lry): to make this faster, the scanner could record the UTF-8 slack
// for all positions of the source text. We could use [:content.sublist:].
return slowText().substring(start, end);
}
+ @override
int get length {
if (lengthCache == -1) {
// During scanning the length is not yet assigned, so we use a slow path.
@@ -208,17 +217,20 @@
return lengthCache;
}
+ @override
set length(int v) => lengthCache = v;
int lengthCache = -1;
}
class CachingUtf8BytesSourceFile extends Utf8BytesSourceFile {
String cachedText;
+ @override
final String filename;
CachingUtf8BytesSourceFile(Uri uri, this.filename, List<int> content)
: super(uri, content);
+ @override
String slowText() {
if (cachedText == null) {
cachedText = super.slowText();
@@ -228,7 +240,9 @@
}
class StringSourceFile extends SourceFile<List<int>> {
+ @override
final Uri uri;
+ @override
final String filename;
final String text;
@@ -240,26 +254,35 @@
StringSourceFile.fromName(String filename, String text)
: this(new Uri(path: filename), filename, text);
+ @override
List<int> get data => utf8.encode(text);
+ @override
int get length => text.length;
+ @override
set length(int v) {}
+ @override
String slowText() => text;
+ @override
List<int> slowUtf8ZeroTerminatedBytes() {
return _zeroTerminateIfNecessary(utf8.encode(text));
}
+ @override
String slowSubstring(int start, int end) => text.substring(start, end);
}
/// Binary input data.
class Binary implements Input<List<int>> {
+ @override
final Uri uri;
+ @override
final List<int> data;
Binary(this.uri, this.data);
+ @override
InputKind get inputKind => InputKind.binary;
}
diff --git a/pkg/compiler/lib/src/io/source_information.dart b/pkg/compiler/lib/src/io/source_information.dart
index 756340b..7709884 100644
--- a/pkg/compiler/lib/src/io/source_information.dart
+++ b/pkg/compiler/lib/src/io/source_information.dart
@@ -53,6 +53,7 @@
FrameContext(this.callInformation, this.inlinedMethodName);
+ @override
String toString() => "(FrameContext: $callInformation, $inlinedMethodName)";
}
@@ -225,12 +226,14 @@
/// `true` if the offset within the length of the source file.
bool get isValid;
+ @override
int get hashCode {
return sourceUri.hashCode * 17 +
offset.hashCode * 19 +
sourceName.hashCode * 23;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! SourceLocation) return false;
@@ -241,6 +244,7 @@
String get shortText => '${sourceUri?.pathSegments?.last}:[$line,$column]';
+ @override
String toString() => '${sourceUri}:[${line},${column}]';
}
@@ -264,37 +268,49 @@
: this.fromLocation(location._location);
/// The absolute URI of the source file of this source location.
+ @override
Uri get sourceUri => _sourceFile.uri;
/// The character offset of the this source location into the source file.
+ @override
int get offset;
/// The 1-based line number of the [offset].
+ @override
int get line => (_location ??= _sourceFile.getLocation(offset)).line;
/// The 1-based column number of the [offset] with its line.
+ @override
int get column => (_location ??= _sourceFile.getLocation(offset)).column;
/// The name associated with this source location, if any.
+ @override
String get sourceName;
/// `true` if the offset within the length of the source file.
+ @override
bool get isValid => offset < _sourceFile.length;
+ @override
String get shortText => '${sourceUri.pathSegments.last}:[$line,$column]';
+ @override
String toString() => '${sourceUri}:[$line,$column]';
}
class OffsetSourceLocation extends AbstractSourceLocation {
+ @override
final int offset;
+ @override
final String sourceName;
OffsetSourceLocation(SourceFile sourceFile, this.offset, this.sourceName)
: super(sourceFile);
+ @override
String get shortText => '${super.shortText}:$sourceName';
+ @override
String toString() => '${super.toString()}:$sourceName';
}
@@ -365,6 +381,7 @@
String get shortName => '<no-location>';
+ @override
String toString() => '<no-location>';
}
diff --git a/pkg/compiler/lib/src/ir/annotations.dart b/pkg/compiler/lib/src/ir/annotations.dart
index 3222787..3119c2c 100644
--- a/pkg/compiler/lib/src/ir/annotations.dart
+++ b/pkg/compiler/lib/src/ir/annotations.dart
@@ -195,6 +195,7 @@
String get name => 'dart2js:$suffix';
+ @override
String toString() => 'PragmaAnnotationData($name)';
}
diff --git a/pkg/compiler/lib/src/ir/cached_static_type.dart b/pkg/compiler/lib/src/ir/cached_static_type.dart
index 5daea39..6067b5e 100644
--- a/pkg/compiler/lib/src/ir/cached_static_type.dart
+++ b/pkg/compiler/lib/src/ir/cached_static_type.dart
@@ -14,6 +14,7 @@
/// and a precomputed cache for complex expression type.
class CachedStaticType extends StaticTypeBase implements StaticTypeProvider {
final Map<ir.Expression, ir.DartType> _cache;
+ @override
final ThisInterfaceType thisType;
CachedStaticType(
diff --git a/pkg/compiler/lib/src/ir/closure.dart b/pkg/compiler/lib/src/ir/closure.dart
index 2bc573f..d237f3f 100644
--- a/pkg/compiler/lib/src/ir/closure.dart
+++ b/pkg/compiler/lib/src/ir/closure.dart
@@ -17,6 +17,7 @@
Map<ir.TreeNode, KernelScopeInfo> closuresToGenerate =
<ir.TreeNode, KernelScopeInfo>{};
+ @override
String toString() {
return '$scopeInfo\n$capturedScopesMap\n$closuresToGenerate';
}
@@ -76,6 +77,7 @@
this.thisUsedAsFreeVariableIfNeedsRti,
this.hasThisLocal);
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('KernelScopeInfo(this=$hasThisLocal,');
@@ -319,6 +321,7 @@
static const VariableUse fieldType =
const VariableUse._simple(VariableUseKind.fieldType);
+ @override
int get hashCode =>
kind.hashCode * 11 +
member.hashCode * 13 +
@@ -326,6 +329,7 @@
invocation.hashCode * 19 +
instantiation.hashCode * 23;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! VariableUse) return false;
@@ -336,6 +340,7 @@
instantiation == other.instantiation;
}
+ @override
String toString() => 'VariableUse(kind=$kind,member=$member,'
'localFunction=$localFunction,invocation=$invocation,'
'instantiation=$instantiation)';
@@ -398,21 +403,26 @@
TypeVariableTypeWithContext.internal(
this.type, this.context, this.kind, this.typeDeclaration);
+ @override
accept(ir.Visitor v) {
throw new UnsupportedError('TypeVariableTypeWithContext.accept');
}
+ @override
visitChildren(ir.Visitor v) {
throw new UnsupportedError('TypeVariableTypeWithContext.visitChildren');
}
+ @override
int get hashCode => type.hashCode;
+ @override
bool operator ==(other) {
if (other is! TypeVariableTypeWithContext) return false;
return type == other.type && context == other.context;
}
+ @override
String toString() =>
'TypeVariableTypeWithContext(type=$type,context=$context,'
'kind=$kind,typeDeclaration=$typeDeclaration)';
diff --git a/pkg/compiler/lib/src/ir/debug.dart b/pkg/compiler/lib/src/ir/debug.dart
index a61a77a..27fad8e 100644
--- a/pkg/compiler/lib/src/ir/debug.dart
+++ b/pkg/compiler/lib/src/ir/debug.dart
@@ -12,6 +12,7 @@
import '../util/util.dart' show Indentation, Tagging;
class DebugPrinter extends Visitor with Indentation, Tagging<Node> {
+ @override
StringBuffer sb = new StringBuffer();
void visitNodeWithChildren(Node node, String type, [Map params]) {
diff --git a/pkg/compiler/lib/src/ir/impact.dart b/pkg/compiler/lib/src/ir/impact.dart
index 937966a..c548eae 100644
--- a/pkg/compiler/lib/src/ir/impact.dart
+++ b/pkg/compiler/lib/src/ir/impact.dart
@@ -188,6 +188,7 @@
abstract class ImpactBuilderBase extends StaticTypeVisitor
implements ImpactRegistry {
+ @override
final VariableScopeModel variableScopeModel;
ImpactBuilderBase(ir.TypeEnvironment typeEnvironment,
@@ -406,6 +407,7 @@
registerLoadLibrary();
}
+ @override
void handleRedirectingInitializer(
ir.RedirectingInitializer node, ArgumentTypes argumentTypes) {
registerRedirectingInitializer(
@@ -643,6 +645,7 @@
return super.visitSwitchStatement(node);
}
+ @override
void handleRuntimeTypeUse(ir.PropertyGet node, RuntimeTypeUseKind kind,
ir.DartType receiverType, ir.DartType argumentType) {
registerRuntimeTypeUse(node, kind, receiverType, argumentType);
@@ -656,8 +659,10 @@
/// Visitor that builds an [ImpactData] object for the world impact.
class ImpactBuilder extends ImpactBuilderBase with ImpactRegistryMixin {
+ @override
final bool useAsserts;
+ @override
final inferEffectivelyFinalVariableTypes;
ImpactBuilder(ir.TypeEnvironment typeEnvironment,
diff --git a/pkg/compiler/lib/src/ir/runtime_type_analysis.dart b/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
index cde8217..d7e1d75 100644
--- a/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
+++ b/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
@@ -63,6 +63,7 @@
throw new UnsupportedError("Unexpected RuntimeTypeUseKind $kind.");
}
+ @override
String toString() {
return "RuntimeTypeUseData(kind=$kind,"
"receiverGet=$leftRuntimeTypeExpression,receiver=$receiver,"
diff --git a/pkg/compiler/lib/src/ir/scope.dart b/pkg/compiler/lib/src/ir/scope.dart
index 074d261..1d2a300 100644
--- a/pkg/compiler/lib/src/ir/scope.dart
+++ b/pkg/compiler/lib/src/ir/scope.dart
@@ -72,6 +72,7 @@
class VariableScopeImpl implements VariableScope {
List<VariableScope> _subScopes;
Set<ir.VariableDeclaration> _assignedVariables;
+ @override
bool hasContinueSwitch = false;
void addSubScope(VariableScope scope) {
@@ -84,6 +85,7 @@
_assignedVariables.add(variable);
}
+ @override
Iterable<ir.VariableDeclaration> get assignedVariables sync* {
if (_assignedVariables != null) {
yield* _assignedVariables;
diff --git a/pkg/compiler/lib/src/ir/scope_visitor.dart b/pkg/compiler/lib/src/ir/scope_visitor.dart
index 016d4dc..7fcac8a 100644
--- a/pkg/compiler/lib/src/ir/scope_visitor.dart
+++ b/pkg/compiler/lib/src/ir/scope_visitor.dart
@@ -370,6 +370,7 @@
return const InitializerComplexity.lazy();
}
+ @override
InitializerComplexity visitWhileStatement(ir.WhileStatement node) {
enterNewScope(node, () {
visitInVariableScope(node, () {
@@ -380,6 +381,7 @@
return const InitializerComplexity.lazy();
}
+ @override
InitializerComplexity visitDoStatement(ir.DoStatement node) {
enterNewScope(node, () {
visitInVariableScope(node, () {
@@ -444,6 +446,7 @@
return const InitializerComplexity.lazy();
}
+ @override
InitializerComplexity visitSuperMethodInvocation(
ir.SuperMethodInvocation node) {
if (_hasThisLocal) {
@@ -458,6 +461,7 @@
return const InitializerComplexity.lazy();
}
+ @override
InitializerComplexity visitSuperPropertySet(ir.SuperPropertySet node) {
if (_hasThisLocal) {
_registerNeedsThis(VariableUse.explicit);
@@ -466,6 +470,7 @@
return const InitializerComplexity.lazy();
}
+ @override
InitializerComplexity visitSuperPropertyGet(ir.SuperPropertyGet node) {
if (_hasThisLocal) {
_registerNeedsThis(VariableUse.explicit);
@@ -1198,5 +1203,6 @@
return sb.toString();
}
+ @override
String toString() => 'InitializerComplexity($shortText)';
}
diff --git a/pkg/compiler/lib/src/ir/static_type.dart b/pkg/compiler/lib/src/ir/static_type.dart
index 33ef11e..1300bd8 100644
--- a/pkg/compiler/lib/src/ir/static_type.dart
+++ b/pkg/compiler/lib/src/ir/static_type.dart
@@ -58,6 +58,7 @@
VariableScopeModel get variableScopeModel;
+ @override
ThisInterfaceType get thisType {
assert(_thisType != null);
return _thisType;
@@ -951,6 +952,7 @@
return type;
}
+ @override
ir.DartType visitExpressionStatement(ir.ExpressionStatement node) {
visitNode(node.expression);
return null;
@@ -1427,6 +1429,7 @@
return candidate;
}
+ @override
int get hashCode {
if (_hashCode == null) {
_hashCode = Hashing.setHash(falseTypes,
@@ -1435,6 +1438,7 @@
return _hashCode;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
return other is TypeHolder &&
@@ -1460,6 +1464,7 @@
sb.write('}');
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('TypeHolder(');
@@ -1697,6 +1702,7 @@
sb.write(']');
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('TargetInfo(');
@@ -1841,6 +1847,7 @@
return sb.toString();
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('TypeMap(');
diff --git a/pkg/compiler/lib/src/ir/static_type_base.dart b/pkg/compiler/lib/src/ir/static_type_base.dart
index 2ed1a24..272689a 100644
--- a/pkg/compiler/lib/src/ir/static_type_base.dart
+++ b/pkg/compiler/lib/src/ir/static_type_base.dart
@@ -14,6 +14,7 @@
class DoesNotCompleteType extends ir.BottomType {
const DoesNotCompleteType();
+ @override
String toString() => 'DoesNotCompleteType()';
}
@@ -27,6 +28,7 @@
? new ThisInterfaceType(type.classNode, type.typeArguments)
: null;
+ @override
String toString() => 'this:${super.toString()}';
}
@@ -40,6 +42,7 @@
? new ExactInterfaceType(type.classNode, type.typeArguments)
: null;
+ @override
String toString() => 'exact:${super.toString()}';
}
@@ -79,6 +82,7 @@
}
}
+ @override
ir.DartType defaultExpression(ir.Expression node) {
throw fail('Unhandled node $node (${node.runtimeType})');
}
diff --git a/pkg/compiler/lib/src/ir/types.dart b/pkg/compiler/lib/src/ir/types.dart
index 6d0f40d..ec95dff 100644
--- a/pkg/compiler/lib/src/ir/types.dart
+++ b/pkg/compiler/lib/src/ir/types.dart
@@ -99,18 +99,22 @@
KernelOrderedTypeSetBuilder(this.elementMap, ClassEntity cls) : super(cls);
+ @override
InterfaceType getThisType(ClassEntity cls) {
return elementMap.getThisType(cls);
}
+ @override
InterfaceType substByContext(InterfaceType type, InterfaceType context) {
return elementMap.substByContext(type, context);
}
+ @override
int getHierarchyDepth(ClassEntity cls) {
return elementMap.getHierarchyDepth(cls);
}
+ @override
OrderedTypeSet getOrderedTypeSet(ClassEntity cls) {
return elementMap.getOrderedTypeSet(cls);
}
@@ -141,6 +145,7 @@
class KernelSubtypeVisitor extends SubtypeVisitor<DartType>
with AbstractTypeRelationMixin {
+ @override
final IrToElementMap elementMap;
KernelSubtypeVisitor(this.elementMap);
@@ -148,6 +153,7 @@
class _KernelPotentialSubtypeVisitor extends PotentialSubtypeVisitor<DartType>
with AbstractTypeRelationMixin {
+ @override
final IrToElementMap elementMap;
_KernelPotentialSubtypeVisitor(this.elementMap);
diff --git a/pkg/compiler/lib/src/ir/util.dart b/pkg/compiler/lib/src/ir/util.dart
index 0a749db..2ce8d7d 100644
--- a/pkg/compiler/lib/src/ir/util.dart
+++ b/pkg/compiler/lib/src/ir/util.dart
@@ -91,6 +91,7 @@
ir.Let get let => syntheticVariable.parent;
+ @override
String toString() => let.toString();
}
diff --git a/pkg/compiler/lib/src/ir/visitors.dart b/pkg/compiler/lib/src/ir/visitors.dart
index fabd55d..0b7e8e4 100644
--- a/pkg/compiler/lib/src/ir/visitors.dart
+++ b/pkg/compiler/lib/src/ir/visitors.dart
@@ -63,6 +63,7 @@
return constant;
}
+ @override
ConstantExpression defaultExpression(ir.Expression node) {
if (requireConstant) {
failNode ??= node;
diff --git a/pkg/compiler/lib/src/js/js.dart b/pkg/compiler/lib/src/js/js.dart
index 523cd66..c62d6f3 100644
--- a/pkg/compiler/lib/src/js/js.dart
+++ b/pkg/compiler/lib/src/js/js.dart
@@ -134,6 +134,7 @@
final bool _protectForEval;
LiteralString _cachedLiteral;
+ @override
Iterable<Node> get containedNodes => [tree];
/// A [js.Literal] that represents the string result of unparsing [ast].
diff --git a/pkg/compiler/lib/src/js/js_debug.dart b/pkg/compiler/lib/src/js/js_debug.dart
index d191491..9eaca9f 100644
--- a/pkg/compiler/lib/src/js/js_debug.dart
+++ b/pkg/compiler/lib/src/js/js_debug.dart
@@ -24,6 +24,7 @@
/// Visitor that creates an XML-like representation of the structure of a
/// JavaScript [Node].
class DebugPrinter extends BaseVisitor with Indentation, Tagging<Node> {
+ @override
StringBuffer sb = new StringBuffer();
void visitNodeWithChildren(Node node, String type, [Map params]) {
diff --git a/pkg/compiler/lib/src/js/js_source_mapping.dart b/pkg/compiler/lib/src/js/js_source_mapping.dart
index 13735ca..ff8a155 100644
--- a/pkg/compiler/lib/src/js/js_source_mapping.dart
+++ b/pkg/compiler/lib/src/js/js_source_mapping.dart
@@ -63,6 +63,7 @@
SourceMapperProviderImpl(this.provider);
+ @override
SourceMapper createSourceMapper(String name) {
return new SourceLocationsMapper(provider.createSourceLocations(name));
}
diff --git a/pkg/compiler/lib/src/js/placeholder_safety.dart b/pkg/compiler/lib/src/js/placeholder_safety.dart
index 48b71cc..72d1e8d 100644
--- a/pkg/compiler/lib/src/js/placeholder_safety.dart
+++ b/pkg/compiler/lib/src/js/placeholder_safety.dart
@@ -60,16 +60,19 @@
return node.accept(this);
}
+ @override
int visitNode(js.Node node) {
safe = false;
super.visitNode(node);
return UNKNOWN_VALUE;
}
+ @override
int visitLiteralNull(js.LiteralNull node) {
return UNKNOWN_VALUE;
}
+ @override
int visitLiteral(js.Literal node) {
return NONNULL_VALUE;
}
@@ -81,26 +84,32 @@
return position;
}
+ @override
int visitInterpolatedExpression(js.InterpolatedExpression node) {
return handleInterpolatedNode(node);
}
+ @override
int visitInterpolatedLiteral(js.InterpolatedLiteral node) {
return handleInterpolatedNode(node);
}
+ @override
int visitInterpolatedSelector(js.InterpolatedSelector node) {
return handleInterpolatedNode(node);
}
+ @override
int visitInterpolatedStatement(js.InterpolatedStatement node) {
return handleInterpolatedNode(node);
}
+ @override
int visitInterpolatedDeclaration(js.InterpolatedDeclaration node) {
return handleInterpolatedNode(node);
}
+ @override
int visitObjectInitializer(js.ObjectInitializer node) {
for (js.Property property in node.properties) {
visit(property);
@@ -108,21 +117,25 @@
return NONNULL_VALUE;
}
+ @override
int visitProperty(js.Property node) {
visit(node.name);
visit(node.value);
return UNKNOWN_VALUE;
}
+ @override
int visitArrayInitializer(js.ArrayInitializer node) {
node.elements.forEach(visit);
return NONNULL_VALUE;
}
+ @override
int visitArrayHole(js.ArrayHole node) {
return UNKNOWN_VALUE;
}
+ @override
int visitAccess(js.PropertyAccess node) {
int first = visit(node.receiver);
visit(node.selector);
@@ -131,6 +144,7 @@
return UNKNOWN_VALUE;
}
+ @override
int visitAssignment(js.Assignment node) {
js.Expression left = node.leftHandSide;
js.Expression right = node.value;
@@ -172,6 +186,7 @@
return leftToRight();
}
+ @override
int visitCall(js.Call node) {
// TODO(sra): Recognize JavaScript built-ins like
// 'Object.prototype.hasOwnProperty.call'.
@@ -180,12 +195,14 @@
return unsafe(UNKNOWN_VALUE);
}
+ @override
int visitNew(js.New node) {
visit(node.target);
node.arguments.forEach(visit);
return unsafe(NONNULL_VALUE);
}
+ @override
int visitBinary(js.Binary node) {
switch (node.op) {
// We make the non-conservative assumption that these operations are not
@@ -238,6 +255,7 @@
}
}
+ @override
int visitConditional(js.Conditional node) {
visit(node.condition);
// TODO(sra): Might be safe, e.g. "# ? 1 : 2".
@@ -247,11 +265,13 @@
return UNKNOWN_VALUE;
}
+ @override
int visitThrow(js.Throw node) {
visit(node.expression);
return unsafe(UNKNOWN_VALUE);
}
+ @override
int visitPrefix(js.Prefix node) {
if (node.op == 'typeof') {
// "typeof a" first evaluates to a Reference. If the Reference is to a
@@ -287,12 +307,14 @@
}
}
+ @override
int visitPostfix(js.Postfix node) {
assert(node.op == '--' || node.op == '++');
visit(node.argument);
return NONNULL_VALUE; // Always a number, even for "(a=null, a++)".
}
+ @override
int visitVariableUse(js.VariableUse node) {
// We could get a ReferenceError unless the variable is in scope. For JS
// fragments, the only use of VariableUse outside a `function(){...}` should
@@ -315,6 +337,7 @@
}
}
+ @override
int visitFun(js.Fun node) {
bool oldSafe = safe;
int oldNextPosition = nextPosition;
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart
index 68fffe8..b3768c4 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -1510,6 +1510,7 @@
}
/// See the comments of [rewriteFunction] for more explanation.
+ @override
void visitTry(js.Try node) {
if (!shouldTransform(node)) {
js.Block body = translateToBlock(node.body);
@@ -1721,6 +1722,7 @@
}
class AsyncRewriter extends AsyncRewriterBase {
+ @override
bool get isAsync => true;
/// The Completer that will finish an async function.
@@ -1787,6 +1789,7 @@
reporter.internalError(spannable, "Yield in non-generating async function");
}
+ @override
void addErrorExit(SourceInformation sourceInformation) {
if (!hasHandlerLabels) return; // rethrow handled in method boilerplate.
beginLabel(rethrowLabel);
@@ -1803,6 +1806,7 @@
/// Returning from an async method calls [asyncStarHelper] with the result.
/// (the result might have been stored in [returnValue] by some finally
/// block).
+ @override
void addSuccessExit(SourceInformation sourceInformation) {
if (analysis.hasExplicitReturns) {
beginLabel(exitLabel);
@@ -1929,6 +1933,7 @@
}
class SyncStarRewriter extends AsyncRewriterBase {
+ @override
bool get isSyncStar => true;
/// Constructor creating the Iterable for a sync* method. Called with
@@ -2068,6 +2073,7 @@
}).withSourceInformation(functionSourceInformation);
}
+ @override
void addErrorExit(SourceInformation sourceInformation) {
hasHandlerLabels = true; // TODO(sra): Add short form error handler.
beginLabel(rethrowLabel);
@@ -2080,6 +2086,7 @@
}
/// Returning from a sync* function returns an [endOfIteration] marker.
+ @override
void addSuccessExit(SourceInformation sourceInformation) {
if (analysis.hasExplicitReturns) {
beginLabel(exitLabel);
@@ -2114,6 +2121,7 @@
}
class AsyncStarRewriter extends AsyncRewriterBase {
+ @override
bool get isAsyncStar => true;
/// The stack of labels of finally blocks to assign to [next] if the
diff --git a/pkg/compiler/lib/src/js_backend/annotations.dart b/pkg/compiler/lib/src/js_backend/annotations.dart
index 5ee5778..1464c0b 100644
--- a/pkg/compiler/lib/src/js_backend/annotations.dart
+++ b/pkg/compiler/lib/src/js_backend/annotations.dart
@@ -273,6 +273,7 @@
return new AnnotationsDataImpl(pragmaAnnotations);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
sink.writeMemberMap(pragmaAnnotations, (EnumSet<PragmaAnnotation> set) {
@@ -286,27 +287,35 @@
return set != null && set.contains(annotation);
}
+ @override
bool hasAssumeDynamic(MemberEntity member) =>
_hasPragma(member, PragmaAnnotation.assumeDynamic);
+ @override
bool hasNoInline(MemberEntity member) =>
_hasPragma(member, PragmaAnnotation.noInline);
+ @override
bool hasTryInline(MemberEntity member) =>
_hasPragma(member, PragmaAnnotation.tryInline);
+ @override
bool hasDisableFinal(MemberEntity member) =>
_hasPragma(member, PragmaAnnotation.disableFinal);
+ @override
bool hasNoElision(MemberEntity member) =>
_hasPragma(member, PragmaAnnotation.noElision);
+ @override
bool hasNoThrows(MemberEntity member) =>
_hasPragma(member, PragmaAnnotation.noThrows);
+ @override
bool hasNoSideEffects(MemberEntity member) =>
_hasPragma(member, PragmaAnnotation.noSideEffects);
+ @override
void forEachNoInline(void f(FunctionEntity function)) {
pragmaAnnotations
.forEach((MemberEntity member, EnumSet<PragmaAnnotation> set) {
@@ -316,6 +325,7 @@
});
}
+ @override
void forEachTryInline(void f(FunctionEntity function)) {
pragmaAnnotations
.forEach((MemberEntity member, EnumSet<PragmaAnnotation> set) {
@@ -325,6 +335,7 @@
});
}
+ @override
void forEachNoThrows(void f(FunctionEntity function)) {
pragmaAnnotations
.forEach((MemberEntity member, EnumSet<PragmaAnnotation> set) {
@@ -334,6 +345,7 @@
});
}
+ @override
void forEachNoSideEffects(void f(FunctionEntity function)) {
pragmaAnnotations
.forEach((MemberEntity member, EnumSet<PragmaAnnotation> set) {
diff --git a/pkg/compiler/lib/src/js_backend/backend_usage.dart b/pkg/compiler/lib/src/js_backend/backend_usage.dart
index ed86add..1dc5108 100644
--- a/pkg/compiler/lib/src/js_backend/backend_usage.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_usage.dart
@@ -114,12 +114,14 @@
bool requiresPreamble = false;
/// `true` if `Function.apply` is used.
+ @override
bool isFunctionApplyUsed = false;
/// `true` if 'dart:mirrors' features are used.
bool isMirrorsUsed = false;
/// `true` if `noSuchMethod` is used.
+ @override
bool isNoSuchMethodUsed = false;
BackendUsageBuilderImpl(this._frontendStrategy);
@@ -190,6 +192,7 @@
}
}
+ @override
void processBackendImpact(BackendImpact backendImpact) {
for (FunctionEntity staticUse in backendImpact.staticUses) {
assert(staticUse != null);
@@ -223,6 +226,7 @@
}
}
+ @override
void registerUsedMember(MemberEntity member) {
if (member == _commonElements.getIsolateAffinityTagMarker) {
_needToInitializeIsolateAffinityTag = true;
@@ -235,6 +239,7 @@
}
}
+ @override
void registerGlobalFunctionDependency(FunctionEntity element) {
assert(element != null);
if (_globalFunctionDependencies == null) {
@@ -243,6 +248,7 @@
_globalFunctionDependencies.add(element);
}
+ @override
void registerGlobalClassDependency(ClassEntity element) {
assert(element != null);
if (_globalClassDependencies == null) {
@@ -256,6 +262,7 @@
_runtimeTypeUses.add(runtimeTypeUse);
}
+ @override
BackendUsage close() {
return new BackendUsageImpl(
globalFunctionDependencies: _globalFunctionDependencies,
@@ -289,19 +296,25 @@
final Set<RuntimeTypeUse> _runtimeTypeUses;
+ @override
bool needToInitializeIsolateAffinityTag;
+ @override
bool needToInitializeDispatchProperty;
/// `true` if a core-library function requires the preamble file to function.
+ @override
final bool requiresPreamble;
/// `true` if `Function.apply` is used.
+ @override
final bool isFunctionApplyUsed;
/// `true` if 'dart:mirrors' features are used.
+ @override
final bool isMirrorsUsed;
/// `true` if `noSuchMethod` is used.
+ @override
final bool isNoSuchMethodUsed;
BackendUsageImpl(
@@ -357,6 +370,7 @@
isNoSuchMethodUsed: isNoSuchMethodUsed);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
sink.writeMembers(_globalFunctionDependencies);
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 71bb262..9682f5b 100644
--- a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
@@ -37,8 +37,10 @@
class PropertyCheckedModeHelper extends CheckedModeHelper {
const PropertyCheckedModeHelper(String name) : super(name);
+ @override
CallStructure get callStructure => CallStructure.TWO_ARGS;
+ @override
void generateAdditionalArguments(SsaCodeGenerator codegen, Namer namer,
HTypeConversion node, List<jsAst.Expression> arguments) {
DartType type = node.typeExpression;
@@ -50,8 +52,10 @@
class TypeVariableCheckedModeHelper extends CheckedModeHelper {
const TypeVariableCheckedModeHelper(String name) : super(name);
+ @override
CallStructure get callStructure => CallStructure.TWO_ARGS;
+ @override
void generateAdditionalArguments(SsaCodeGenerator codegen, Namer namer,
HTypeConversion node, List<jsAst.Expression> arguments) {
assert(node.typeExpression.isTypeVariable);
@@ -63,8 +67,10 @@
class FunctionTypeRepresentationCheckedModeHelper extends CheckedModeHelper {
const FunctionTypeRepresentationCheckedModeHelper(String name) : super(name);
+ @override
CallStructure get callStructure => CallStructure.TWO_ARGS;
+ @override
void generateAdditionalArguments(SsaCodeGenerator codegen, Namer namer,
HTypeConversion node, List<jsAst.Expression> arguments) {
assert(node.typeExpression.isFunctionType);
@@ -76,8 +82,10 @@
class FutureOrRepresentationCheckedModeHelper extends CheckedModeHelper {
const FutureOrRepresentationCheckedModeHelper(String name) : super(name);
+ @override
CallStructure get callStructure => CallStructure.TWO_ARGS;
+ @override
void generateAdditionalArguments(SsaCodeGenerator codegen, Namer namer,
HTypeConversion node, List<jsAst.Expression> arguments) {
assert(node.typeExpression.isFutureOr);
@@ -89,8 +97,10 @@
class SubtypeCheckedModeHelper extends CheckedModeHelper {
const SubtypeCheckedModeHelper(String name) : super(name);
+ @override
CallStructure get callStructure => const CallStructure.unnamed(4);
+ @override
void generateAdditionalArguments(SsaCodeGenerator codegen, Namer namer,
HTypeConversion node, List<jsAst.Expression> arguments) {
// TODO(sra): Move these calls into the SSA graph so that the arguments can
diff --git a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
index 1335b2e..2b65955 100644
--- a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
@@ -20,6 +20,7 @@
: this.jsConstantCompiler = new JavaScriptConstantCompiler(),
super(compiler.measurer);
+ @override
String get name => 'ConstantHandler';
}
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 a3c61f7..16be5f2 100644
--- a/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
@@ -81,6 +81,7 @@
}
class CustomElementsResolutionAnalysis extends CustomElementsAnalysisBase {
+ @override
final CustomElementsAnalysisJoin join;
CustomElementsResolutionAnalysis(
@@ -117,6 +118,7 @@
}
class CustomElementsCodegenAnalysis extends CustomElementsAnalysisBase {
+ @override
final CustomElementsAnalysisJoin join;
CustomElementsCodegenAnalysis(CommonElements commonElements,
diff --git a/pkg/compiler/lib/src/js_backend/enqueuer.dart b/pkg/compiler/lib/src/js_backend/enqueuer.dart
index 72910ae..a0c3009 100644
--- a/pkg/compiler/lib/src/js_backend/enqueuer.dart
+++ b/pkg/compiler/lib/src/js_backend/enqueuer.dart
@@ -37,8 +37,11 @@
final CodegenWorldBuilderImpl _worldBuilder;
final WorkItemBuilder _workItemBuilder;
+ @override
bool queueIsClosed = false;
+ @override
final CompilerTask task;
+ @override
final EnqueuerListener listener;
final CompilerOptions _options;
@@ -62,8 +65,10 @@
_impactVisitor = new EnqueuerImplImpactVisitor(this);
}
+ @override
CodegenWorldBuilder get worldBuilder => _worldBuilder;
+ @override
bool get queueIsEmpty => _queue.isEmpty;
@override
@@ -74,6 +79,7 @@
}
/// Returns [:true:] if this enqueuer is the resolution enqueuer.
+ @override
bool get isResolutionQueue => false;
/// Create a [WorkItem] for [entity] and add it to the work list if it has not
@@ -92,6 +98,7 @@
_queue.add(workItem);
}
+ @override
void applyImpact(WorldImpact worldImpact, {var impactSource}) {
if (worldImpact.isEmpty) return;
impactStrategy.visitImpact(
@@ -106,11 +113,13 @@
});
}
+ @override
bool checkNoEnqueuedInvokedInstanceMethods(
ElementEnvironment elementEnvironment) {
return checkEnqueuerConsistency(elementEnvironment);
}
+ @override
void checkClass(ClassEntity cls) {
_worldBuilder.processClassMembers(cls, (MemberEntity member, useSet) {
if (useSet.isNotEmpty) {
@@ -148,12 +157,14 @@
}
}
+ @override
void processDynamicUse(DynamicUse dynamicUse) {
task.measure(() {
_worldBuilder.registerDynamicUse(dynamicUse, _applyMemberUse);
});
}
+ @override
void processStaticUse(StaticUse staticUse) {
_worldBuilder.registerStaticUse(staticUse, _applyMemberUse);
switch (staticUse.kind) {
@@ -171,6 +182,7 @@
}
}
+ @override
void processTypeUse(TypeUse typeUse) {
DartType type = typeUse.type;
switch (typeUse.kind) {
@@ -213,6 +225,7 @@
}
}
+ @override
void processConstantUse(ConstantUse constantUse) {
task.measure(() {
if (_worldBuilder.registerConstantUse(constantUse)) {
@@ -252,6 +265,7 @@
_queue.isNotEmpty || _recentClasses.isNotEmpty || _recentConstants);
}
+ @override
void forEach(void f(WorkItem work)) {
_forEach(f);
if (onEmptyForTesting != null) {
@@ -276,8 +290,10 @@
listener.logSummary(log);
}
+ @override
String toString() => 'Enqueuer($name)';
+ @override
ImpactUseCase get impactUse => IMPACT_USE;
@override
diff --git a/pkg/compiler/lib/src/js_backend/field_analysis.dart b/pkg/compiler/lib/src/js_backend/field_analysis.dart
index 5217327..915dd48 100644
--- a/pkg/compiler/lib/src/js_backend/field_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/field_analysis.dart
@@ -211,6 +211,7 @@
throw new UnsupportedError('Unexpected kind $kind');
}
+ @override
String toString() => shortText;
}
@@ -612,6 +613,7 @@
ConstantValue get constantValue => isEffectivelyFinal ? initialValue : null;
+ @override
String toString() =>
'FieldAnalysisData(initialValue=${initialValue?.toStructuredText()},'
'isInitializedInAllocator=$isInitializedInAllocator,'
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 828dd25..a0fb0b3 100644
--- a/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart
+++ b/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart
@@ -189,7 +189,9 @@
/// as a separator between method names and argument counts and does not appear
/// in generated names themselves.
class _MixinFieldNamingScope extends _FieldNamingScope {
+ @override
int get _localFieldNameCounter => registry.globalCount;
+ @override
void set _localFieldNameCounter(int val) {
registry.globalCount = val;
}
@@ -204,6 +206,7 @@
_FieldNamingScope superScope, _FieldNamingRegistry registry)
: super.inherit(container, superScope, registry);
+ @override
jsAst.Name _nextName() {
jsAst.Name proposed = super._nextName();
return new CompoundName([proposed, Namer._literalDollar]);
@@ -221,6 +224,7 @@
@override
bool containsField(_) => true;
+ @override
jsAst.Name operator [](Entity field) {
if (!names.containsKey(field)) add(field);
return names[field];
diff --git a/pkg/compiler/lib/src/js_backend/frequency_namer.dart b/pkg/compiler/lib/src/js_backend/frequency_namer.dart
index 781d1ef..36ff852 100644
--- a/pkg/compiler/lib/src/js_backend/frequency_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/frequency_namer.dart
@@ -7,6 +7,7 @@
class FrequencyBasedNamer extends Namer
with _MinifiedFieldNamer, _MinifiedOneShotInterceptorNamer
implements jsAst.TokenFinalizer {
+ @override
_FieldNamingRegistry fieldRegistry;
List<TokenName> tokens = new List<TokenName>();
@@ -14,21 +15,35 @@
new Maplet<NamingScope, TokenScope>();
// Some basic settings for smaller names
+ @override
String get isolateName => 'I';
+ @override
String get isolatePropertiesName => 'p';
+ @override
bool get shouldMinify => true;
+ @override
final String getterPrefix = 'g';
+ @override
final String setterPrefix = 's';
+ @override
final String callPrefix = ''; // this will create function names $<n>
+ @override
String get operatorIsPrefix => r'$i';
+ @override
String get operatorAsPrefix => r'$a';
+ @override
String get callCatchAllName => r'$C';
+ @override
String get requiredParameterField => r'$R';
+ @override
String get defaultValuesField => r'$D';
+ @override
String get operatorSignature => r'$S';
+ @override
String get genericInstantiationPrefix => r'$I';
+ @override
jsAst.Name get staticsPropertyName =>
_staticsPropertyName ??= getFreshName(instanceScope, 'static');
diff --git a/pkg/compiler/lib/src/js_backend/inferred_data.dart b/pkg/compiler/lib/src/js_backend/inferred_data.dart
index ad5be30..be9b3dc 100644
--- a/pkg/compiler/lib/src/js_backend/inferred_data.dart
+++ b/pkg/compiler/lib/src/js_backend/inferred_data.dart
@@ -121,6 +121,7 @@
functionsThatMightBePassedToApply);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeBool(false); // Is _not_ trivial.
sink.begin(tag);
@@ -235,6 +236,7 @@
}
/// Compute [SideEffects] for all registered [SideEffectBuilder]s.
+ @override
InferredData close(JClosedWorld closedWorld) {
assert(_sideEffectsBuilders != null,
"Inferred data has already been computed.");
diff --git a/pkg/compiler/lib/src/js_backend/interceptor_data.dart b/pkg/compiler/lib/src/js_backend/interceptor_data.dart
index 06c66ae..0a206a5 100644
--- a/pkg/compiler/lib/src/js_backend/interceptor_data.dart
+++ b/pkg/compiler/lib/src/js_backend/interceptor_data.dart
@@ -72,6 +72,7 @@
final Map<String, Set<MemberEntity>> interceptedMembers;
/// Set of classes whose methods are intercepted.
+ @override
final Set<ClassEntity> interceptedClasses;
/// Set of classes used as mixins on intercepted (native and primitive)
@@ -125,6 +126,7 @@
classesMixedIntoInterceptedClasses);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
sink.writeInt(interceptedMembers.length);
@@ -137,6 +139,7 @@
sink.end(tag);
}
+ @override
bool isInterceptedMethod(MemberEntity element) {
if (!element.isInstanceMember) return false;
// TODO(johnniwinther): Avoid this hack.
@@ -146,18 +149,22 @@
return interceptedMembers[element.name] != null;
}
+ @override
bool fieldHasInterceptedGetter(FieldEntity element) {
return interceptedMembers[element.name] != null;
}
+ @override
bool fieldHasInterceptedSetter(FieldEntity element) {
return interceptedMembers[element.name] != null;
}
+ @override
bool isInterceptedName(String name) {
return interceptedMembers[name] != null;
}
+ @override
bool isInterceptedSelector(Selector selector) {
return interceptedMembers[selector.name] != null;
}
@@ -165,6 +172,7 @@
/// Returns `true` iff [selector] matches an element defined in a class mixed
/// into an intercepted class. These selectors are not eligible for the
/// 'dummy explicit receiver' optimization.
+ @override
bool isInterceptedMixinSelector(
Selector selector, AbstractValue mask, JClosedWorld closedWorld) {
Set<MemberEntity> elements =
@@ -203,6 +211,7 @@
/// Returns a set of interceptor classes that contain a member named [name]
///
/// Returns an empty set if there is no class. Do not modify the returned set.
+ @override
Set<ClassEntity> getInterceptedClassesOn(
String name, JClosedWorld closedWorld) {
Set<MemberEntity> intercepted = interceptedMembers[name];
@@ -244,6 +253,7 @@
return result;
}
+ @override
bool isInterceptedClass(ClassEntity element) {
if (element == null) return false;
if (_nativeData.isNativeOrExtendsNative(element)) return true;
@@ -252,9 +262,11 @@
return false;
}
+ @override
bool isMixedIntoInterceptedClass(ClassEntity element) =>
classesMixedIntoInterceptedClasses.contains(element);
+ @override
bool mayGenerateInstanceofCheck(DartType type, JClosedWorld closedWorld) {
// We can use an instanceof check for raw types that have no subclass that
// is mixed-in or in an implements clause.
@@ -291,6 +303,7 @@
InterceptorDataBuilderImpl(
this._nativeData, this._elementEnvironment, this._commonElements);
+ @override
InterceptorData close() {
return new InterceptorDataImpl(
_nativeData,
@@ -300,6 +313,7 @@
_classesMixedIntoInterceptedClasses);
}
+ @override
void addInterceptorsForNativeClassMembers(ClassEntity cls) {
_elementEnvironment.forEachClassMember(cls,
(ClassEntity cls, MemberEntity member) {
@@ -317,6 +331,7 @@
});
}
+ @override
void addInterceptors(ClassEntity cls) {
if (_interceptedClasses.add(cls)) {
_elementEnvironment.forEachClassMember(cls,
diff --git a/pkg/compiler/lib/src/js_backend/minify_namer.dart b/pkg/compiler/lib/src/js_backend/minify_namer.dart
index 2d772ff..3179a2f 100644
--- a/pkg/compiler/lib/src/js_backend/minify_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/minify_namer.dart
@@ -16,21 +16,35 @@
fieldRegistry = new _FieldNamingRegistry(this);
}
+ @override
_FieldNamingRegistry fieldRegistry;
+ @override
String get isolateName => 'I';
+ @override
String get isolatePropertiesName => 'p';
+ @override
bool get shouldMinify => true;
+ @override
final String getterPrefix = 'g';
+ @override
final String setterPrefix = 's';
+ @override
final String callPrefix = ''; // this will create function names $<n>
+ @override
String get operatorIsPrefix => r'$i';
+ @override
String get operatorAsPrefix => r'$a';
+ @override
String get callCatchAllName => r'$C';
+ @override
String get requiredParameterField => r'$R';
+ @override
String get defaultValuesField => r'$D';
+ @override
String get operatorSignature => r'$S';
+ @override
String get genericInstantiationPrefix => r'$I';
final ALPHABET_CHARACTERS = 52; // a-zA-Z.
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 3222b70..0648b9c 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -2291,24 +2291,30 @@
return sb.toString();
}
+ @override
visit(DartType type, [_]) {
type.accept(this, null);
}
+ @override
visitType(DartType type, _) {}
+ @override
visitInterfaceType(InterfaceType type, _) {
sb.write(type.element.name);
}
+ @override
visitTypedefType(TypedefType type, _) {
sb.write(type.element.name);
}
+ @override
visitTypeVariableType(TypeVariableType type, _) {
sb.write(type.element.name);
}
+ @override
visitFunctionType(FunctionType type, _) {
if (rtiEncoder.isSimpleFunctionType(type)) {
sb.write('args${type.parameterTypes.length}');
diff --git a/pkg/compiler/lib/src/js_backend/namer_names.dart b/pkg/compiler/lib/src/js_backend/namer_names.dart
index 9f351e3..db0819d 100644
--- a/pkg/compiler/lib/src/js_backend/namer_names.dart
+++ b/pkg/compiler/lib/src/js_backend/namer_names.dart
@@ -9,6 +9,7 @@
int get _kind;
_NamerName get _target => this;
+ @override
String toString() {
if (DEBUG_MODE) {
return 'Name($key)';
@@ -21,21 +22,27 @@
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class StringBackedName extends _NamerName {
+ @override
final String name;
+ @override
int get _kind => _NamerNameKinds.StringBacked.index;
StringBackedName(this.name);
+ @override
String get key => name;
+ @override
operator ==(other) {
if (other is _NameReference) other = other._target;
if (identical(this, other)) return true;
return (other is StringBackedName) && other.name == name;
}
+ @override
int get hashCode => name.hashCode;
+ @override
int compareTo(covariant _NamerName other) {
other = other._target;
if (other._kind != _kind) return other._kind - _kind;
@@ -47,16 +54,21 @@
abstract class _PrefixedName extends _NamerName implements jsAst.AstContainer {
final jsAst.Name prefix;
final jsAst.Name base;
+ @override
int get _kind;
+ @override
Iterable<jsAst.Node> get containedNodes => [prefix, base];
_PrefixedName(this.prefix, this.base);
+ @override
String get name => prefix.name + base.name;
+ @override
String get key => prefix.key + base.key;
+ @override
bool operator ==(other) {
if (other is _NameReference) other = other._target;
if (identical(this, other)) return true;
@@ -64,8 +76,10 @@
return other.base == base && other.prefix == prefix;
}
+ @override
int get hashCode => base.hashCode * 13 + prefix.hashCode;
+ @override
int compareTo(covariant _NamerName other) {
other = other._target;
if (other._kind != _kind) return other._kind - _kind;
@@ -83,6 +97,7 @@
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class GetterName extends _PrefixedName {
+ @override
int get _kind => _NamerNameKinds.Getter.index;
GetterName(jsAst.Name prefix, jsAst.Name base) : super(prefix, base);
@@ -90,6 +105,7 @@
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class SetterName extends _PrefixedName {
+ @override
int get _kind => _NamerNameKinds.Setter.index;
SetterName(jsAst.Name prefix, jsAst.Name base) : super(prefix, base);
@@ -97,6 +113,7 @@
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class _AsyncName extends _PrefixedName {
+ @override
int get _kind => _NamerNameKinds.Async.index;
_AsyncName(jsAst.Name prefix, jsAst.Name base) : super(prefix, base);
@@ -108,14 +125,17 @@
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class CompoundName extends _NamerName implements jsAst.AstContainer {
final List<_NamerName> _parts;
+ @override
int get _kind => _NamerNameKinds.Compound.index;
String _cachedName;
int _cachedHashCode = -1;
+ @override
Iterable<jsAst.Node> get containedNodes => _parts;
CompoundName(this._parts);
+ @override
String get name {
if (_cachedName == null) {
_cachedName = _parts.map((jsAst.Name name) => name.name).join();
@@ -123,8 +143,10 @@
return _cachedName;
}
+ @override
String get key => _parts.map((_NamerName name) => name.key).join();
+ @override
bool operator ==(other) {
if (other is _NameReference) other = other._target;
if (identical(this, other)) return true;
@@ -136,6 +158,7 @@
return true;
}
+ @override
int get hashCode {
if (_cachedHashCode < 0) {
_cachedHashCode = 0;
@@ -146,6 +169,7 @@
return _cachedHashCode;
}
+ @override
int compareTo(covariant _NamerName other) {
other = other._target;
if (other._kind != _kind) return other._kind - _kind;
@@ -163,8 +187,10 @@
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class TokenName extends _NamerName implements jsAst.ReferenceCountedAstNode {
+ @override
int get _kind => _NamerNameKinds.Token.index;
String _name;
+ @override
final String key;
final TokenScope _scope;
int _rc = 0;
@@ -173,6 +199,7 @@
bool get isFinalized => _name != null;
+ @override
String get name {
assert(isFinalized);
return _name;
@@ -186,6 +213,7 @@
return key.compareTo(otherToken.key);
}
+ @override
markSeen(jsAst.TokenCounter counter) => _rc++;
@override
@@ -209,15 +237,20 @@
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class _NameReference extends _NamerName implements jsAst.AstContainer {
+ @override
_NamerName _target;
+ @override
int get _kind => _target._kind;
+ @override
String get key => _target.key;
+ @override
Iterable<jsAst.Node> get containedNodes => [_target];
_NameReference(this._target);
+ @override
String get name => _target.name;
@override
diff --git a/pkg/compiler/lib/src/js_backend/native_data.dart b/pkg/compiler/lib/src/js_backend/native_data.dart
index 1c72d9c..7b31ddc 100644
--- a/pkg/compiler/lib/src/js_backend/native_data.dart
+++ b/pkg/compiler/lib/src/js_backend/native_data.dart
@@ -63,6 +63,7 @@
NativeDataImpl.readFromDataSource;
/// Serializes this [NativeData] to [sink].
+ @override
void writeToDataSink(DataSink sink);
/// Returns `true` if [element] corresponds to a native JavaScript member.
@@ -97,6 +98,7 @@
String getFixedBackendMethodPath(FunctionEntity element);
/// Returns `true` if [element] is a JsInterop method.
+ @override
bool isJsInteropMember(MemberEntity element);
/// Returns the explicit js interop name for library [element].
@@ -191,6 +193,7 @@
/// The tag info string contains comma-separated 'words' which are either
/// dispatch tags (having JavaScript identifier syntax) and directives that
/// begin with `!`.
+ @override
void setNativeClassTagInfo(ClassEntity cls, String tagText) {
assert(
!_closed,
@@ -251,6 +254,7 @@
jsInteropMembers[element] = name;
}
+ @override
NativeBasicData close(ElementEnvironment environment) {
_closed = true;
return new NativeBasicDataImpl(
@@ -324,6 +328,7 @@
jsInteropMembers);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
sink.writeClassMap(nativeClassTagInfo, (NativeClassTag tag) {
@@ -426,6 +431,7 @@
/// Sets the native [name] for the member [element]. This name is used for
/// [element] in the generated JavaScript.
+ @override
void setNativeMemberName(MemberEntity element, String name) {
// TODO(johnniwinther): Avoid setting this more than once. The enqueuer
// might enqueue [element] several times (before processing it) and computes
@@ -441,16 +447,19 @@
}
/// Registers the [behavior] for calling the native [method].
+ @override
void setNativeMethodBehavior(FunctionEntity method, NativeBehavior behavior) {
nativeMethodBehavior[method] = behavior;
}
/// Registers the [behavior] for reading from the native [field].
+ @override
void setNativeFieldLoadBehavior(FieldEntity field, NativeBehavior behavior) {
nativeFieldLoadBehavior[field] = behavior;
}
/// Registers the [behavior] for writing to the native [field].
+ @override
void setNativeFieldStoreBehavior(FieldEntity field, NativeBehavior behavior) {
nativeFieldStoreBehavior[field] = behavior;
}
@@ -514,6 +523,7 @@
nativeFieldStoreBehavior);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
_nativeBasicData.writeToDataSink(sink);
@@ -536,20 +546,24 @@
/// The JavaScript names for libraries implemented via typed JavaScript
/// interop.
+ @override
Map<LibraryEntity, String> get jsInteropLibraries =>
_nativeBasicData.jsInteropLibraries;
/// JavaScript interop classes annotated with `@anonymous`
+ @override
Set<ClassEntity> get anonymousJsInteropClasses =>
_nativeBasicData.anonymousJsInteropClasses;
/// The JavaScript names for classes implemented via typed JavaScript
/// interop.
+ @override
Map<ClassEntity, String> get jsInteropClasses =>
_nativeBasicData.jsInteropClasses;
/// The JavaScript names for members implemented via typed JavaScript
/// interop.
+ @override
Map<MemberEntity, String> get jsInteropMembers =>
_nativeBasicData.jsInteropMembers;
@@ -559,52 +573,64 @@
}
/// Returns `true` if [cls] is a native class.
+ @override
bool isNativeClass(ClassEntity element) =>
_nativeBasicData.isNativeClass(element);
/// Returns the list of non-directive native tag words for [cls].
+ @override
List<String> getNativeTagsOfClass(ClassEntity cls) =>
_nativeBasicData.getNativeTagsOfClass(cls);
/// Returns `true` if [cls] has a `!nonleaf` tag word.
+ @override
bool hasNativeTagsForcedNonLeaf(ClassEntity cls) =>
_nativeBasicData.hasNativeTagsForcedNonLeaf(cls);
+ @override
bool get isJsInteropUsed => _nativeBasicData.isJsInteropUsed;
/// Returns `true` if [element] is a JsInterop library.
+ @override
bool isJsInteropLibrary(LibraryEntity element) =>
_nativeBasicData.isJsInteropLibrary(element);
/// Returns `true` if [element] is a JsInterop class.
+ @override
bool isJsInteropClass(ClassEntity element) =>
_nativeBasicData.isJsInteropClass(element);
/// Returns `true` if [element] or any of its superclasses is native.
+ @override
bool isNativeOrExtendsNative(ClassEntity element) =>
_nativeBasicData.isNativeOrExtendsNative(element);
/// Returns the explicit js interop name for library [element].
+ @override
String getJsInteropLibraryName(LibraryEntity element) {
return jsInteropLibraries[element];
}
/// Returns the explicit js interop name for class [element].
+ @override
String getJsInteropClassName(ClassEntity element) {
return jsInteropClasses[element];
}
/// Returns the explicit js interop name for member [element].
+ @override
String getJsInteropMemberName(MemberEntity element) {
return jsInteropMembers[element];
}
/// Returns `true` if [element] is explicitly marked as part of JsInterop.
+ @override
bool _isJsInteropMember(MemberEntity element) {
return jsInteropMembers.containsKey(element);
}
/// Returns `true` if [element] is a JsInterop method.
+ @override
bool isJsInteropMember(MemberEntity element) {
if (element.isFunction ||
element.isConstructor ||
@@ -628,12 +654,14 @@
/// Returns `true` if the name of [element] is fixed for the generated
/// JavaScript.
+ @override
bool hasFixedBackendName(MemberEntity element) {
return isJsInteropMember(element) || nativeMemberName.containsKey(element);
}
/// Computes the name for [element] to use in the generated JavaScript. This
/// is either given through a native annotation or a js interop annotation.
+ @override
String getFixedBackendName(MemberEntity element) {
String name = nativeMemberName[element];
if (name == null && isJsInteropMember(element)) {
@@ -679,6 +707,7 @@
/// For example: fixedBackendPath for the static method createMap in the
/// Map class of the goog.map JavaScript library would have path
/// "goog.maps.Map".
+ @override
String getFixedBackendMethodPath(FunctionEntity element) {
if (!isJsInteropMember(element)) return null;
if (element.isInstanceMember) return 'this';
@@ -699,12 +728,14 @@
}
/// Returns `true` if [element] is a native member of a native class.
+ @override
bool isNativeMember(MemberEntity element) {
if (isJsInteropMember(element)) return true;
return nativeMemberName.containsKey(element);
}
/// Returns the [NativeBehavior] for calling the native [method].
+ @override
NativeBehavior getNativeMethodBehavior(FunctionEntity method) {
assert(
nativeMethodBehavior.containsKey(method),
@@ -714,6 +745,7 @@
}
/// Returns the [NativeBehavior] for reading from the native [field].
+ @override
NativeBehavior getNativeFieldLoadBehavior(FieldEntity field) {
assert(
nativeFieldLoadBehavior.containsKey(field),
@@ -725,6 +757,7 @@
}
/// Returns the [NativeBehavior] for writing to the native [field].
+ @override
NativeBehavior getNativeFieldStoreBehavior(FieldEntity field) {
assert(
nativeFieldStoreBehavior.containsKey(field),
@@ -735,6 +768,7 @@
/// Apply JS$ escaping scheme to convert possible escaped Dart names into
/// JS names.
+ @override
String computeUnescapedJSInteropName(String name) {
return name.startsWith(_jsInteropEscapePrefix)
? name.substring(_jsInteropEscapePrefix.length)
@@ -774,13 +808,16 @@
return sb.toString();
}
+ @override
int get hashCode => Hashing.listHash(names, isNonLeaf.hashCode);
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! NativeClassTag) return false;
return equalElements(names, other.names) && isNonLeaf == other.isNonLeaf;
}
+ @override
String toString() => text;
}
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 3dc3075..b579c07 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
@@ -94,13 +94,17 @@
NoSuchMethodResolver get internalResolverForTesting => _resolver;
+ @override
bool get hasThrowingNoSuchMethod => throwingImpls.isNotEmpty;
+ @override
bool get hasComplexNoSuchMethod => otherImpls.isNotEmpty;
+ @override
void registerNoSuchMethod(FunctionEntity noSuchMethodElement) {
_uncategorizedImpls.add(noSuchMethodElement);
}
+ @override
void onQueueEmpty() {
_uncategorizedImpls.forEach(_categorizeImpl);
_uncategorizedImpls.clear();
@@ -161,6 +165,7 @@
}
}
+ @override
NoSuchMethodData close() {
return new NoSuchMethodDataImpl(
throwingImpls, otherImpls, forwardingSyntaxImpls);
@@ -234,6 +239,7 @@
..complexReturningImpls.addAll(complexReturningImpls);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
sink.writeMembers(throwingImpls);
@@ -247,6 +253,7 @@
/// Now that type inference is complete, split category D into two
/// subcategories: D1, those that have no return type, and D2, those
/// that have a return type.
+ @override
void categorizeComplexImplementations(GlobalTypeInferenceResults results) {
otherImpls.forEach((FunctionEntity element) {
if (results.resultOfMember(element).throwsAlways) {
@@ -258,6 +265,7 @@
}
/// Emits a diagnostic
+ @override
void emitDiagnostic(DiagnosticReporter reporter) {
throwingImpls.forEach((e) {
if (!forwardingSyntaxImpls.contains(e)) {
@@ -279,6 +287,7 @@
/// Returns [true] if the given element is a complex [noSuchMethod]
/// implementation. An implementation is complex if it falls into
/// category D, as described above.
+ @override
bool isComplex(FunctionEntity element) {
assert(element.name == Identifiers.noSuchMethod_);
return otherImpls.contains(element);
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 382475a..7af5856 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -124,6 +124,7 @@
class TrivialRuntimeTypesNeed implements RuntimeTypesNeed {
const TrivialRuntimeTypesNeed();
+ @override
void writeToDataSink(DataSink sink) {
sink.writeBool(true); // Is trivial.
}
@@ -244,6 +245,7 @@
class TrivialRuntimeTypesChecksBuilder implements RuntimeTypesChecksBuilder {
final JClosedWorld _closedWorld;
final TrivialRuntimeTypesSubstitutions _substitutions;
+ @override
bool rtiChecksBuilderClosed = false;
TrivialRuntimeTypesChecksBuilder(this._closedWorld, this._substitutions);
@@ -299,6 +301,7 @@
ClassCollector(this._elementEnvironment);
+ @override
void addClass(ClassEntity cls) {
if (classes.add(cls)) {
_elementEnvironment.forEachSupertype(cls, (InterfaceType type) {
@@ -633,7 +636,9 @@
}
class TrivialRuntimeTypesSubstitutions extends RuntimeTypesSubstitutionsMixin {
+ @override
final JClosedWorld _closedWorld;
+ @override
TypeChecks _requiredChecks;
TrivialRuntimeTypesSubstitutions(this._closedWorld);
@@ -786,6 +791,7 @@
instantiationsNeedingTypeArguments);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeBool(false); // Is _not_ trivial.
sink.begin(tag);
@@ -802,16 +808,19 @@
bool checkClass(covariant ClassEntity cls) => true;
+ @override
bool classNeedsTypeArguments(ClassEntity cls) {
assert(checkClass(cls));
if (!_elementEnvironment.isGenericClass(cls)) return false;
return classesNeedingTypeArguments.contains(cls);
}
+ @override
bool methodNeedsSignature(FunctionEntity function) {
return methodsNeedingSignature.contains(function);
}
+ @override
bool methodNeedsTypeArguments(FunctionEntity function) {
return methodsNeedingTypeArguments.contains(function);
}
@@ -1398,6 +1407,7 @@
String get kind;
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write(kind);
@@ -1412,8 +1422,10 @@
ClassNode(this.cls);
+ @override
Entity get entity => cls;
+ @override
String get kind => 'class';
}
@@ -1427,6 +1439,7 @@
MethodNode(this.function, this.parameterStructure,
{this.isCallTarget, this.instanceName, this.isNoSuchMethod: false});
+ @override
Entity get entity => function;
bool selectorApplies(Selector selector) {
@@ -1436,8 +1449,10 @@
selector.callStructure.signatureApplies(parameterStructure);
}
+ @override
String get kind => 'method';
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('MethodNode(');
@@ -1892,6 +1907,7 @@
class _RuntimeTypesChecks implements RuntimeTypesChecks {
final RuntimeTypesSubstitutions _substitutions;
+ @override
final TypeChecks requiredChecks;
final Iterable<ClassEntity> _typeLiterals;
final Iterable<ClassEntity> _typeArguments;
@@ -1920,6 +1936,7 @@
class RuntimeTypesImpl extends _RuntimeTypesBase
with RuntimeTypesSubstitutionsMixin
implements RuntimeTypesChecksBuilder {
+ @override
final JClosedWorld _closedWorld;
// The set of type arguments tested against type variable bounds.
@@ -1929,13 +1946,16 @@
TypeChecks cachedRequiredChecks;
+ @override
bool rtiChecksBuilderClosed = false;
RuntimeTypesImpl(this._closedWorld) : super(_closedWorld.dartTypes);
JCommonElements get _commonElements => _closedWorld.commonElements;
+ @override
JElementEnvironment get _elementEnvironment =>
_closedWorld.elementEnvironment;
+ @override
RuntimeTypesNeed get _rtiNeed => _closedWorld.rtiNeed;
@override
@@ -1958,6 +1978,7 @@
_genericInstantiations.add(instantiation);
}
+ @override
RuntimeTypesChecks computeRequiredChecks(
CodegenWorldBuilder codegenWorldBuilder, CompilerOptions options) {
TypeVariableTests typeVariableTests = new TypeVariableTests(
@@ -2412,6 +2433,7 @@
jsAst.Expression visit(DartType type, Emitter emitter) =>
type.accept(this, emitter);
+ @override
jsAst.Expression visitTypeVariableType(
TypeVariableType type, Emitter emitter) {
if (typedefBindings != null) {
@@ -2421,6 +2443,7 @@
return onVariable(type);
}
+ @override
jsAst.Expression visitFunctionTypeVariable(
FunctionTypeVariable type, Emitter emitter) {
int position = functionTypeVariables.indexOf(type);
@@ -2428,6 +2451,7 @@
return js.number(functionTypeVariables.length - position - 1);
}
+ @override
jsAst.Expression visitDynamicType(DynamicType type, Emitter emitter) {
return getDynamicValue();
}
@@ -2444,6 +2468,7 @@
return new jsAst.ArrayInitializer(elements);
}
+ @override
jsAst.Expression visitInterfaceType(InterfaceType type, Emitter emitter) {
jsAst.Expression name = getJavaScriptClassName(type.element, emitter);
jsAst.Expression result;
@@ -2508,6 +2533,7 @@
return jsAst.js.expressionTemplateFor("# === -2");
}
+ @override
jsAst.Expression visitFunctionType(FunctionType type, Emitter emitter) {
List<jsAst.Property> properties = <jsAst.Property>[];
@@ -2566,10 +2592,12 @@
return new jsAst.ObjectInitializer(properties);
}
+ @override
jsAst.Expression visitVoidType(VoidType type, Emitter emitter) {
return getVoidValue();
}
+ @override
jsAst.Expression visitTypedefType(TypedefType type, Emitter emitter) {
bool shouldEncode = shouldEncodeTypedef(type);
DartType unaliasedType = type.unaliased;
@@ -2646,6 +2674,7 @@
class TypeCheckMapping implements TypeChecks {
final Map<ClassEntity, ClassChecks> map = new Map<ClassEntity, ClassChecks>();
+ @override
ClassChecks operator [](ClassEntity element) {
ClassChecks result = map[element];
return result != null ? result : const ClassChecks.empty();
@@ -2655,8 +2684,10 @@
map[element] = checks;
}
+ @override
Iterable<ClassEntity> get classes => map.keys;
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
for (ClassEntity holder in classes) {
@@ -2687,15 +2718,18 @@
}
}
+ @override
visitTypedefType(TypedefType type, bool isTypeArgument) {
collect(type.unaliased, isTypeArgument: isTypeArgument);
}
+ @override
visitInterfaceType(InterfaceType type, bool isTypeArgument) {
if (isTypeArgument) addClass(type.element);
collectAll(type.typeArguments, isTypeArgument: true);
}
+ @override
visitFunctionType(FunctionType type, _) {
collect(type.returnType, isTypeArgument: true);
collectAll(type.parameterTypes, isTypeArgument: true);
@@ -2719,10 +2753,12 @@
}
}
+ @override
visitTypedefType(TypedefType type, bool inFunctionType) {
collect(type.unaliased, inFunctionType: inFunctionType);
}
+ @override
visitInterfaceType(InterfaceType type, bool inFunctionType) {
if (inFunctionType) {
classes.add(type.element);
@@ -2730,6 +2766,7 @@
collectAll(type.typeArguments, inFunctionType: inFunctionType);
}
+ @override
visitFunctionType(FunctionType type, _) {
collect(type.returnType, inFunctionType: true);
collectAll(type.parameterTypes, inFunctionType: true);
@@ -2780,6 +2817,7 @@
bool get isJsInterop => length != null;
+ @override
String toString() => 'Substitution(isTrivial=$isTrivial,'
'isFunction=$isFunction,isJsInterop=$isJsInterop,arguments=$arguments,'
'parameters=$parameters,length=$length)';
@@ -2791,11 +2829,13 @@
final ClassEntity cls;
final bool needsIs;
final Substitution substitution;
+ @override
final int hashCode = _nextHash = (_nextHash + 100003).toUnsigned(30);
static int _nextHash = 0;
TypeCheck(this.cls, this.substitution, {this.needsIs: true});
+ @override
String toString() =>
'TypeCheck(cls=$cls,needsIs=$needsIs,substitution=$substitution)';
}
@@ -2891,6 +2931,7 @@
Iterable<TypeCheck> get checks => _map.values;
+ @override
String toString() {
return 'ClassChecks($checks)';
}
@@ -2985,6 +3026,7 @@
/// type arguments.
bool get isLive => directInstance || typeArgument;
+ @override
String toString() {
List<String> properties = <String>[];
if (instance) {
diff --git a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
index 987d957..0320701 100644
--- a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
+++ b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
@@ -67,6 +67,7 @@
return _emitter;
}
+ @override
String get name => 'Code emitter';
/// Returns true, if the emitter supports reflection.
@@ -268,6 +269,7 @@
}
abstract class EmitterBase implements Emitter {
+ @override
Program programForTesting;
Namer get namer;
diff --git a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
index 9b4aed2..9306361 100644
--- a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
+++ b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
@@ -27,6 +27,7 @@
_dartTypeOrdering = new _DartTypeOrdering(this);
}
+ @override
int compare(ConstantValue a, ConstantValue b) => compareValues(a, b);
int compareValues(ConstantValue a, ConstantValue b) {
@@ -75,38 +76,46 @@
return _dartTypeOrdering.compare(a, b);
}
+ @override
int visitFunction(FunctionConstantValue a, FunctionConstantValue b) {
return compareMembers(a.element, b.element);
}
+ @override
int visitNull(NullConstantValue a, NullConstantValue b) {
return 0;
}
+ @override
int visitNonConstant(NonConstantValue a, NonConstantValue b) {
return 0;
}
+ @override
int visitInt(IntConstantValue a, IntConstantValue b) {
return a.intValue.compareTo(b.intValue);
}
+ @override
int visitDouble(DoubleConstantValue a, DoubleConstantValue b) {
return a.doubleValue.compareTo(b.doubleValue);
}
+ @override
int visitBool(BoolConstantValue a, BoolConstantValue b) {
int aInt = a.boolValue ? 1 : 0;
int bInt = b.boolValue ? 1 : 0;
return aInt.compareTo(bInt);
}
+ @override
int visitString(StringConstantValue a, StringConstantValue b) {
String aString = a.stringValue;
String bString = b.stringValue;
return aString.compareTo(bString);
}
+ @override
int visitList(ListConstantValue a, ListConstantValue b) {
int r = compareLists(compareValues, a.entries, b.entries);
if (r != 0) return r;
@@ -120,6 +129,7 @@
return compareDartTypes(a.type, b.type);
}
+ @override
int visitMap(MapConstantValue a, MapConstantValue b) {
int r = compareLists(compareValues, a.keys, b.keys);
if (r != 0) return r;
@@ -128,6 +138,7 @@
return compareDartTypes(a.type, b.type);
}
+ @override
int visitConstructed(ConstructedConstantValue a, ConstructedConstantValue b) {
int r = compareDartTypes(a.type, b.type);
if (r != 0) return r;
@@ -145,16 +156,19 @@
aFields.map((field) => b.fields[field]).toList());
}
+ @override
int visitType(TypeConstantValue a, TypeConstantValue b) {
int r = compareDartTypes(a.representedType, b.representedType);
if (r != 0) return r;
return compareDartTypes(a.type, b.type);
}
+ @override
int visitInterceptor(InterceptorConstantValue a, InterceptorConstantValue b) {
return compareClasses(a.cls, b.cls);
}
+ @override
int visitSynthetic(SyntheticConstantValue a, SyntheticConstantValue b) {
// [SyntheticConstantValue]s have abstract fields that are set only by
// convention. Lucky for us, they do not occur as top level constant, only
@@ -183,6 +197,7 @@
}
}
+ @override
int visitDeferredGlobal(
DeferredGlobalConstantValue a, DeferredGlobalConstantValue b) {
int r = compareValues(a.referenced, b.referenced);
@@ -190,6 +205,7 @@
return a.unit.compareTo(b.unit);
}
+ @override
int visitInstantiation(
InstantiationConstantValue a, InstantiationConstantValue b) {
int r = compareValues(a.function, b.function);
@@ -221,21 +237,37 @@
static int kind(ConstantValue constant) =>
constant.accept(const _KindVisitor(), null);
+ @override
int visitFunction(FunctionConstantValue a, _) => FUNCTION;
+ @override
int visitNull(NullConstantValue a, _) => NULL;
+ @override
int visitNonConstant(NonConstantValue a, _) => NONCONSTANT;
+ @override
int visitInt(IntConstantValue a, _) => INT;
+ @override
int visitDouble(DoubleConstantValue a, _) => DOUBLE;
+ @override
int visitBool(BoolConstantValue a, _) => BOOL;
+ @override
int visitString(StringConstantValue a, _) => STRING;
+ @override
int visitList(ListConstantValue a, _) => LIST;
+ @override
int visitSet(SetConstantValue a, _) => SET;
+ @override
int visitMap(MapConstantValue a, _) => MAP;
+ @override
int visitConstructed(ConstructedConstantValue a, _) => CONSTRUCTED;
+ @override
int visitType(TypeConstantValue a, _) => TYPE;
+ @override
int visitInterceptor(InterceptorConstantValue a, _) => INTERCEPTOR;
+ @override
int visitSynthetic(SyntheticConstantValue a, _) => SYNTHETIC;
+ @override
int visitDeferredGlobal(DeferredGlobalConstantValue a, _) => DEFERRED_GLOBAL;
+ @override
int visitInstantiation(InstantiationConstantValue a, _) => INSTANTIATION;
}
@@ -247,11 +279,17 @@
return type.accept(const _DartTypeKindVisitor(), null);
}
+ @override
int visitVoidType(covariant VoidType type, _) => 6;
+ @override
int visitTypeVariableType(covariant TypeVariableType type, _) => 3;
+ @override
int visitFunctionType(covariant FunctionType type, _) => 0;
+ @override
int visitInterfaceType(covariant InterfaceType type, _) => 1;
+ @override
int visitTypedefType(covariant TypedefType type, _) => 2;
+ @override
int visitDynamicType(covariant DynamicType type, _) => 5;
}
@@ -271,16 +309,19 @@
return r;
}
+ @override
int visitVoidType(covariant VoidType type, covariant VoidType other) {
throw new UnsupportedError('Unreachable');
}
+ @override
int visitTypeVariableType(
covariant TypeVariableType type, covariant TypeVariableType other) {
throw new UnsupportedError(
"Type variables are not expected in constants: '$type' in '$_root'");
}
+ @override
int visitFunctionType(
covariant FunctionType type, covariant FunctionType other) {
int r = _compareTypeArguments(type.parameterTypes, other.parameterTypes);
@@ -297,6 +338,7 @@
return compare(type.returnType, other.returnType);
}
+ @override
int visitInterfaceType(
covariant InterfaceType type, covariant InterfaceType other) {
int r = _constantOrdering.compareClasses(type.element, other.element);
@@ -304,6 +346,7 @@
return _compareTypeArguments(type.typeArguments, other.typeArguments);
}
+ @override
int visitTypedefType(
covariant TypedefType type, covariant TypedefType other) {
int r = _constantOrdering.compareTypedefs(type.element, other.element);
@@ -311,6 +354,7 @@
return _compareTypeArguments(type.typeArguments, other.typeArguments);
}
+ @override
int visitDynamicType(
covariant DynamicType type, covariant DynamicType other) {
throw new UnsupportedError('Unreachable');
diff --git a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
index db2d3c0..39b2574 100644
--- a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
+++ b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
@@ -29,18 +29,22 @@
abstract class _MetadataEntry extends jsAst.DeferredNumber
implements Comparable, jsAst.ReferenceCountedAstNode {
jsAst.Expression get entry;
+ @override
int get value;
int get _rc;
// Mark this entry as seen. On the first time this is seen, the visitor
// will be applied to the [entry] to also mark potential [_MetadataEntry]
// instances in the [entry] as seen.
+ @override
markSeen(jsAst.TokenCounter visitor);
}
class _BoundMetadataEntry extends _MetadataEntry {
int _value = -1;
+ @override
int _rc = 0;
+ @override
final jsAst.Expression entry;
_BoundMetadataEntry(this.entry);
@@ -52,6 +56,7 @@
_value = value;
}
+ @override
int get value {
assert(isFinalized);
return _value;
@@ -59,13 +64,16 @@
bool get isUsed => _rc > 0;
+ @override
markSeen(jsAst.BaseVisitor visitor) {
_rc++;
if (_rc == 1) entry.accept(visitor);
}
+ @override
int compareTo(covariant _MetadataEntry other) => other._rc - this._rc;
+ @override
String toString() => '_BoundMetadataEntry($hashCode,rc=$_rc,_value=$_value)';
}
@@ -78,11 +86,13 @@
_value = value;
}
+ @override
jsAst.Expression get value {
assert(_value != null);
return _value;
}
+ @override
int get precedenceLevel => js_precedence.PRIMARY;
}
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index e12153b..247a1ef 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -83,6 +83,7 @@
Holder(this.name, this.index,
{this.isStaticStateHolder: false, this.isConstantsHolder: false});
+ @override
String toString() {
return 'Holder(name=${name})';
}
@@ -136,8 +137,10 @@
: super(outputUnit, outputFileName, libraries, staticNonFinalFields,
staticLazilyInitializedFields, constants);
+ @override
bool get isMainFragment => true;
+ @override
String toString() {
return 'MainFragment()';
}
@@ -158,8 +161,10 @@
: super(outputUnit, outputFileName, libraries, staticNonFinalFields,
staticLazilyInitializedFields, constants);
+ @override
bool get isMainFragment => false;
+ @override
String toString() {
return 'DeferredFragment(name=${name})';
}
@@ -172,6 +177,7 @@
Constant(this.name, this.holder, this.value);
+ @override
String toString() {
return 'Constant(name=${name.key},value=${value.toStructuredText()})';
}
@@ -190,11 +196,13 @@
final List<StaticMethod> statics;
final List<Class> classes;
+ @override
final List<Field> staticFieldsForReflection;
Library(this.element, this.uri, this.statics, this.classes,
this.staticFieldsForReflection);
+ @override
String toString() {
return 'Library(uri=${uri},element=${element})';
}
@@ -218,6 +226,7 @@
StaticField(this.element, this.name, this.getterName, this.holder, this.code,
{this.isFinal, this.isLazy, this.isInitializedByConstant: false});
+ @override
String toString() {
return 'StaticField(name=${name.key},element=${element})';
}
@@ -242,6 +251,7 @@
/// noSuchMethod stubs in the special case that the class is Object.
final List<StubMethod> noSuchMethodStubs;
+ @override
final List<Field> staticFieldsForReflection;
final bool hasRtiField; // Per-instance runtime type information pseudo-field.
final bool onlyForRti;
@@ -316,6 +326,7 @@
int get superclassHolderIndex =>
(superclass == null) ? 0 : superclass.holder.index;
+ @override
String toString() => 'Class(name=${name.key},element=$element)';
}
@@ -352,8 +363,10 @@
isClosureBaseClass: false,
isSuperMixinApplication: false);
+ @override
bool get isSimpleMixinApplication => true;
+ @override
String toString() => 'Mixin(name=${name.key},element=$element)';
}
@@ -413,6 +426,7 @@
bool get needsInterceptedGetterOnThis => getterFlags == 3;
bool get needsInterceptedSetterOnThis => setterFlags == 3;
+ @override
String toString() {
return 'Field(name=${name.key},element=${element})';
}
@@ -520,8 +534,10 @@
assert(isClosureCallMethod != null);
}
+ @override
bool get isStatic => false;
+ @override
String toString() {
return 'InstanceMethod(name=${name.key},element=${element}'
',code=${js.nodeToString(code)})';
@@ -535,6 +551,7 @@
StubMethod(js.Name name, js.Expression code, {MemberEntity element})
: super(element, name, code);
+ @override
String toString() {
return 'StubMethod(name=${name.key},element=${element}'
',code=${js.nodeToString(code)})';
@@ -562,6 +579,7 @@
{MemberEntity element})
: super(name, code, element: element);
+ @override
String toString() {
return 'ParameterStubMethod(name=${name.key}, callName=${callName?.key}'
', element=${element}'
@@ -574,6 +592,7 @@
}
class StaticDartMethod extends DartMethod implements StaticMethod {
+ @override
final Holder holder;
StaticDartMethod(
@@ -599,8 +618,10 @@
functionType: functionType,
applyIndex: applyIndex);
+ @override
bool get isStatic => true;
+ @override
String toString() {
return 'StaticDartMethod(name=${name.key},element=${element}'
',code=${js.nodeToString(code)})';
@@ -608,10 +629,12 @@
}
class StaticStubMethod extends StubMethod implements StaticMethod {
+ @override
Holder holder;
StaticStubMethod(js.Name name, this.holder, js.Expression code)
: super(name, code);
+ @override
String toString() {
return 'StaticStubMethod(name=${name.key},element=${element}}'
',code=${js.nodeToString(code)})';
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
index f6be1c1..75acab7 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
@@ -41,6 +41,7 @@
class Emitter extends emitterTask.EmitterBase {
final Compiler _compiler;
final JClosedWorld _closedWorld;
+ @override
final Namer namer;
final ModelEmitter _emitter;
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index 29c8051..a1ba755 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -1994,10 +1994,12 @@
_value = value;
}
+ @override
js.Expression get value {
assert(_value != null);
return _value;
}
+ @override
int get precedenceLevel => js_precedence.PRIMARY;
}
diff --git a/pkg/compiler/lib/src/js_model/closure.dart b/pkg/compiler/lib/src/js_model/closure.dart
index 5582d45..d3295fe 100644
--- a/pkg/compiler/lib/src/js_model/closure.dart
+++ b/pkg/compiler/lib/src/js_model/closure.dart
@@ -64,6 +64,7 @@
}
/// Serializes this [ClosureData] to [sink].
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
sink.writeMemberMap(
@@ -430,6 +431,7 @@
static const String tag = 'scope-info';
final Iterable<Local> localsUsedInTryOrSync;
+ @override
final Local thisLocal;
final Map<Local, JRecordField> boxedVariables;
@@ -455,15 +457,18 @@
}
}
+ @override
void forEachBoxedVariable(f(Local local, FieldEntity field)) {
boxedVariables.forEach((Local l, JRecordField box) {
f(l, box);
});
}
+ @override
bool localIsUsedInTryOrSync(Local variable) =>
localsUsedInTryOrSync.contains(variable);
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('this=$thisLocal,');
@@ -471,6 +476,7 @@
return sb.toString();
}
+ @override
bool isBoxedVariable(Local variable) => boxedVariables.containsKey(variable);
factory JsScopeInfo.readFromDataSource(DataSource source) {
@@ -502,6 +508,7 @@
/// debugging data stream.
static const String tag = 'captured-scope';
+ @override
final Local context;
JsCapturedScope.internal(
@@ -522,6 +529,7 @@
boxedVariables.isNotEmpty ? boxedVariables.values.first.box : null,
super.from(boxedVariables, capturedScope, localsMap, elementMap);
+ @override
bool get requiresContextBox => boxedVariables.isNotEmpty;
factory JsCapturedScope.readFromDataSource(DataSource source) {
@@ -555,6 +563,7 @@
/// debugging data stream.
static const String tag = 'captured-loop-scope';
+ @override
final List<Local> boxedLoopVariables;
JsCapturedLoopScope.internal(
@@ -577,6 +586,7 @@
.toList(),
super.from(boxedVariables, capturedScope, localsMap, elementMap);
+ @override
bool get hasBoxedLoopVariables => boxedLoopVariables.isNotEmpty;
factory JsCapturedLoopScope.readFromDataSource(DataSource source) {
@@ -615,10 +625,14 @@
/// debugging data stream.
static const String tag = 'closure-representation-info';
+ @override
JFunction callMethod;
JSignatureMethod signatureMethod;
+ @override
final Local closureEntity;
+ @override
final Local thisLocal;
+ @override
final JClass closureClassEntity;
final Map<Local, JField> localToFieldMap;
@@ -674,6 +688,7 @@
localToFieldMap);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(ScopeInfoKind.closureRepresentationInfo);
sink.begin(tag);
@@ -689,6 +704,7 @@
sink.end(tag);
}
+ @override
List<Local> get createdFieldEntities => localToFieldMap.keys.toList();
@override
@@ -702,13 +718,16 @@
return null;
}
+ @override
FieldEntity get thisFieldEntity => localToFieldMap[thisLocal];
+ @override
void forEachFreeVariable(f(Local variable, JField field)) {
localToFieldMap.forEach(f);
boxedVariables.forEach(f);
}
+ @override
bool get isClosure => true;
}
@@ -728,6 +747,7 @@
return new JClosureClass(library, name);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JClassKind.closure);
sink.begin(tag);
@@ -739,6 +759,7 @@
@override
bool get isClosure => true;
+ @override
String toString() => '${jsElementPrefix}closure_class($name)';
}
@@ -747,16 +768,20 @@
AnonymousClosureLocal(this.closureClass);
+ @override
String get name => '';
+ @override
int get hashCode => closureClass.hashCode * 13;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! AnonymousClosureLocal) return false;
return closureClass == other.closureClass;
}
+ @override
String toString() =>
'${jsElementPrefix}anonymous_closure_local(${closureClass.name})';
}
@@ -766,6 +791,7 @@
/// debugging data stream.
static const String tag = 'closure-field';
+ @override
final String declaredName;
JClosureField(
@@ -894,6 +920,7 @@
return new JRecord(library, name);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JClassKind.record);
sink.begin(tag);
@@ -902,8 +929,10 @@
sink.end(tag);
}
+ @override
bool get isClosure => false;
+ @override
String toString() => '${jsElementPrefix}record_container($name)';
}
@@ -991,6 +1020,7 @@
/// debugging data stream.
static const String tag = 'closure-class-definition';
+ @override
final SourceSpan location;
ClosureClassDefinition(this.location);
@@ -1010,20 +1040,25 @@
sink.end(tag);
}
+ @override
ClassKind get kind => ClassKind.closure;
+ @override
ir.Node get node =>
throw new UnsupportedError('ClosureClassDefinition.node for $location');
+ @override
String toString() => 'ClosureClassDefinition(kind:$kind,location:$location)';
}
abstract class ClosureMemberData implements JMemberData {
+ @override
final MemberDefinition definition;
final InterfaceType memberThisType;
ClosureMemberData(this.definition, this.memberThisType);
+ @override
Map<ir.Expression, ir.DartType> get staticTypes {
// The cached types are stored in the data for enclosing member.
throw new UnsupportedError("ClosureMemberData.staticTypes");
@@ -1043,7 +1078,9 @@
static const String tag = 'closure-function-data';
final FunctionType functionType;
+ @override
final ir.FunctionNode functionNode;
+ @override
final ClassTypeVariableAccess classTypeVariableAccess;
ClosureFunctionData(
@@ -1068,6 +1105,7 @@
functionNode, classTypeVariableAccess);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberDataKind.closureFunction);
sink.begin(tag);
@@ -1104,6 +1142,7 @@
return new ClosureFieldData(definition, memberThisType);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberDataKind.closureField);
sink.begin(tag);
@@ -1157,8 +1196,11 @@
/// debugging data stream.
static const String tag = 'closure-member-definition';
+ @override
final SourceSpan location;
+ @override
final MemberKind kind;
+ @override
final ir.TreeNode node;
ClosureMemberDefinition(this.location, this.kind, this.node)
@@ -1174,6 +1216,7 @@
return new ClosureMemberDefinition(location, kind, node);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(kind);
sink.begin(tag);
@@ -1182,6 +1225,7 @@
sink.end(tag);
}
+ @override
String toString() => 'ClosureMemberDefinition(kind:$kind,location:$location)';
}
@@ -1190,6 +1234,7 @@
/// a debugging data stream.
static const String tag = 'record-definition';
+ @override
final SourceSpan location;
RecordContainerDefinition(this.location);
@@ -1209,11 +1254,14 @@
sink.end(tag);
}
+ @override
ClassKind get kind => ClassKind.record;
+ @override
ir.Node get node => throw new UnsupportedError(
'RecordContainerDefinition.node for $location');
+ @override
String toString() =>
'RecordContainerDefinition(kind:$kind,location:$location)';
}
diff --git a/pkg/compiler/lib/src/js_model/element_map.dart b/pkg/compiler/lib/src/js_model/element_map.dart
index 9371d5c..2afbce4 100644
--- a/pkg/compiler/lib/src/js_model/element_map.dart
+++ b/pkg/compiler/lib/src/js_model/element_map.dart
@@ -384,6 +384,7 @@
/// debugging data stream.
static const String tag = 'regular-member-definition';
+ @override
final ir.Member node;
RegularMemberDefinition(this.node);
@@ -403,10 +404,13 @@
sink.end(tag);
}
+ @override
SourceSpan get location => computeSourceSpanFromTreeNode(node);
+ @override
MemberKind get kind => MemberKind.regular;
+ @override
String toString() => 'RegularMemberDefinition(kind:$kind,'
'node:$node,location:$location)';
}
@@ -417,7 +421,9 @@
/// debugging data stream.
static const String tag = 'special-member-definition';
+ @override
final ir.TreeNode node;
+ @override
final MemberKind kind;
SpecialMemberDefinition(this.node, this.kind);
@@ -438,8 +444,10 @@
sink.end(tag);
}
+ @override
SourceSpan get location => computeSourceSpanFromTreeNode(node);
+ @override
String toString() => 'SpecialMemberDefinition(kind:$kind,'
'node:$node,location:$location)';
}
@@ -480,6 +488,7 @@
/// debugging data stream.
static const String tag = 'regular-class-definition';
+ @override
final ir.Class node;
RegularClassDefinition(this.node);
@@ -491,6 +500,7 @@
return new RegularClassDefinition(node);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(kind);
sink.begin(tag);
@@ -498,10 +508,13 @@
sink.end(tag);
}
+ @override
SourceSpan get location => computeSourceSpanFromTreeNode(node);
+ @override
ClassKind get kind => ClassKind.regular;
+ @override
String toString() => 'RegularClassDefinition(kind:$kind,'
'node:$node,location:$location)';
}
diff --git a/pkg/compiler/lib/src/js_model/element_map_impl.dart b/pkg/compiler/lib/src/js_model/element_map_impl.dart
index 31e729e..10db057 100644
--- a/pkg/compiler/lib/src/js_model/element_map_impl.dart
+++ b/pkg/compiler/lib/src/js_model/element_map_impl.dart
@@ -88,6 +88,7 @@
static const String nestedClosuresTag = 'nested-closures';
final CompilerOptions options;
+ @override
final DiagnosticReporter reporter;
CommonElementsImpl _commonElements;
JsElementEnvironment _elementEnvironment;
@@ -483,8 +484,10 @@
sink.end(tag);
}
+ @override
DartTypes get types => _types;
+ @override
JsElementEnvironment get elementEnvironment => _elementEnvironment;
@override
@@ -597,11 +600,13 @@
return new InterfaceType(getClass(cls), getDartTypes(typeArguments));
}
+ @override
LibraryEntity getLibrary(ir.Library node) => getLibraryInternal(node);
@override
ClassEntity getClass(ir.Class node) => getClassInternal(node);
+ @override
InterfaceType getSuperType(IndexedClass cls) {
assert(checkFamily(cls));
JClassData data = classes.getData(cls);
@@ -632,6 +637,7 @@
}
}
+ @override
TypeVariableEntity getTypeVariable(ir.TypeParameter node) =>
getTypeVariableInternal(node);
@@ -732,6 +738,7 @@
throw new UnsupportedError("Unexpected member: $node");
}
+ @override
MemberEntity getSuperMember(MemberEntity context, ir.Name name,
{bool setter: false}) {
// We can no longer trust the interface target of the super access since it
@@ -788,9 +795,11 @@
@override
DartType getDartType(ir.DartType type) => _typeConverter.convert(type);
+ @override
TypeVariableType getTypeVariableType(ir.TypeParameterType type) =>
getDartType(type);
+ @override
List<DartType> getDartTypes(List<ir.DartType> types) {
List<DartType> list = <DartType>[];
types.forEach((ir.DartType type) {
@@ -799,6 +808,7 @@
return list;
}
+ @override
InterfaceType getInterfaceType(ir.InterfaceType type) =>
_typeConverter.convert(type);
@@ -876,6 +886,7 @@
constantRequired: requireConstant);
}
+ @override
DartType substByContext(DartType type, InterfaceType context) {
return type.subst(
context.typeArguments, getThisType(context.element).typeArguments);
@@ -886,6 +897,7 @@
/// If [type] doesn't have a `call` member `null` is returned. If [type] has
/// an invalid `call` member (non-method or a synthesized method with both
/// optional and named parameters) a [DynamicType] is returned.
+ @override
DartType getCallType(InterfaceType type) {
IndexedClass cls = type.element;
assert(checkFamily(cls));
@@ -896,6 +908,7 @@
return null;
}
+ @override
InterfaceType getThisType(IndexedClass cls) {
assert(checkFamily(cls));
JClassData data = classes.getData(cls);
@@ -928,6 +941,7 @@
return data.getFieldType(this);
}
+ @override
DartType getTypeVariableBound(IndexedTypeVariable typeVariable) {
assert(checkFamily(typeVariable));
JTypeVariableData data = typeVariables.getData(typeVariable);
@@ -1013,6 +1027,7 @@
return data.getFieldConstantExpression(this);
}
+ @override
InterfaceType asInstanceOf(InterfaceType type, ClassEntity cls) {
assert(checkFamily(cls));
OrderedTypeSet orderedTypeSet = getOrderedTypeSet(type.element);
@@ -1024,6 +1039,7 @@
return supertype;
}
+ @override
OrderedTypeSet getOrderedTypeSet(IndexedClass cls) {
assert(checkFamily(cls));
JClassData data = classes.getData(cls);
@@ -1031,6 +1047,7 @@
return data.orderedTypeSet;
}
+ @override
int getHierarchyDepth(IndexedClass cls) {
assert(checkFamily(cls));
JClassData data = classes.getData(cls);
@@ -1038,6 +1055,7 @@
return data.orderedTypeSet.maxDepth;
}
+ @override
Iterable<InterfaceType> getInterfaces(IndexedClass cls) {
assert(checkFamily(cls));
JClassData data = classes.getData(cls);
@@ -1055,6 +1073,7 @@
return classes.getData(cls).definition;
}
+ @override
ImportEntity getImport(ir.LibraryDependency node) {
ir.Library library = node.parent;
JLibraryData data = libraries.getData(getLibraryInternal(library));
@@ -1076,6 +1095,7 @@
return _classHierarchy;
}
+ @override
StaticTypeProvider getStaticTypeProvider(MemberEntity member) {
MemberDefinition memberDefinition = members.getData(member).definition;
Map<ir.Expression, ir.DartType> cachedStaticTypes;
@@ -1112,11 +1132,13 @@
new ThisInterfaceType.from(thisType));
}
+ @override
Name getName(ir.Name name) {
return new Name(
name.name, name.isPrivate ? getLibrary(name.library) : null);
}
+ @override
CallStructure getCallStructure(ir.Arguments arguments) {
int argumentCount = arguments.positional.length + arguments.named.length;
List<String> namedArguments = arguments.named.map((e) => e.name).toList();
@@ -1124,6 +1146,7 @@
argumentCount, namedArguments, arguments.types.length);
}
+ @override
Selector getSelector(ir.Expression node) {
// TODO(efortuna): This is screaming for a common interface between
// PropertyGet and SuperPropertyGet (and same for *Get). Talk to kernel
@@ -1258,6 +1281,7 @@
/// Computes the [native.NativeBehavior] for a call to the [JS] function.
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 2 ||
node.arguments.named.isNotEmpty) {
@@ -1291,6 +1315,7 @@
/// Computes the [NativeBehavior] for a call to the [JS_BUILTIN]
/// function.
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForJsBuiltinCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
reporter.internalError(
@@ -1319,6 +1344,7 @@
/// Computes the [NativeBehavior] for a call to the
/// [JS_EMBEDDED_GLOBAL] function.
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
@@ -1351,6 +1377,7 @@
commonElements);
}
+ @override
js.Name getNameForJsGetName(ConstantValue constant, Namer namer) {
int index = extractEnumIndexFromConstantValue(
constant, commonElements.jsGetNameEnum);
@@ -1373,6 +1400,7 @@
return null;
}
+ @override
ConstantValue getConstantValue(ir.Expression node,
{bool requireConstant: true, bool implicitNull: false}) {
if (node is ir.ConstantExpression) {
@@ -1416,6 +1444,7 @@
return metadata;
}
+ @override
FunctionEntity getSuperNoSuchMethod(ClassEntity cls) {
while (cls != null) {
cls = elementEnvironment.getSuperClass(cls);
@@ -2454,9 +2483,13 @@
/// [BehaviorBuilder] for kernel based elements.
class JsBehaviorBuilder extends BehaviorBuilder {
+ @override
final ElementEnvironment elementEnvironment;
+ @override
final CommonElements commonElements;
+ @override
final DiagnosticReporter reporter;
+ @override
final NativeBasicData nativeBasicData;
final CompilerOptions _options;
diff --git a/pkg/compiler/lib/src/js_model/elements.dart b/pkg/compiler/lib/src/js_model/elements.dart
index 4afe45a..2818e69 100644
--- a/pkg/compiler/lib/src/js_model/elements.dart
+++ b/pkg/compiler/lib/src/js_model/elements.dart
@@ -20,7 +20,9 @@
/// debugging data stream.
static const String tag = 'library';
+ @override
final String name;
+ @override
final Uri canonicalUri;
JLibrary(this.name, this.canonicalUri);
@@ -42,6 +44,7 @@
sink.end(tag);
}
+ @override
String toString() => '${jsElementPrefix}library($name)';
}
@@ -53,9 +56,12 @@
/// debugging data stream.
static const String tag = 'class';
+ @override
final JLibrary library;
+ @override
final String name;
+ @override
final bool isAbstract;
JClass(this.library, this.name, {this.isAbstract});
@@ -92,6 +98,7 @@
@override
bool get isClosure => false;
+ @override
String toString() => '${jsElementPrefix}class($name)';
}
@@ -100,8 +107,10 @@
/// debugging data stream.
static const String tag = 'typedef';
+ @override
final JLibrary library;
+ @override
final String name;
JTypedef(this.library, this.name);
@@ -123,6 +132,7 @@
sink.end(tag);
}
+ @override
String toString() => '${jsElementPrefix}typedef($name)';
}
@@ -143,7 +153,9 @@
}
abstract class JMember extends IndexedMember {
+ @override
final JLibrary library;
+ @override
final JClass enclosingClass;
final Name _name;
final bool _isStatic;
@@ -186,8 +198,10 @@
/// Serializes this [JMember] to [sink].
void writeToDataSink(DataSink sink);
+ @override
String get name => _name.text;
+ @override
Name get memberName => _name;
@override
@@ -225,14 +239,18 @@
String get _kind;
+ @override
String toString() => '${jsElementPrefix}$_kind'
'(${enclosingClass != null ? '${enclosingClass.name}.' : ''}$name)';
}
abstract class JFunction extends JMember
implements FunctionEntity, IndexedFunction {
+ @override
final ParameterStructure parameterStructure;
+ @override
final bool isExternal;
+ @override
final AsyncMarker asyncMarker;
JFunction(JLibrary library, JClass enclosingClass, Name name,
@@ -243,6 +261,7 @@
abstract class JConstructor extends JFunction
implements ConstructorEntity, IndexedConstructor {
+ @override
final bool isConst;
JConstructor(
@@ -267,6 +286,7 @@
@override
bool get isFromEnvironmentConstructor => false;
+ @override
String get _kind => 'constructor';
}
@@ -370,6 +390,7 @@
/// debugging data stream.
static const String tag = 'constructor-body';
+ @override
final JConstructor constructor;
JConstructorBody(this.constructor, ParameterStructure parameterStructure)
@@ -395,6 +416,7 @@
sink.end(tag);
}
+ @override
String get _kind => 'constructor_body';
}
@@ -403,6 +425,7 @@
/// debugging data stream.
static const String tag = 'method';
+ @override
final bool isAbstract;
JMethod(JLibrary library, JClass enclosingClass, Name name,
@@ -461,6 +484,7 @@
@override
bool get isFunction => true;
+ @override
String get _kind => 'method';
}
@@ -471,6 +495,7 @@
final JFunction function;
final DartType elementType;
+ @override
final int hashCode;
JGeneratorBody(this.function, this.elementType)
@@ -496,6 +521,7 @@
sink.end(tag);
}
+ @override
String get _kind => 'generator_body';
}
@@ -504,6 +530,7 @@
/// debugging data stream.
static const String tag = 'getter';
+ @override
final bool isAbstract;
JGetter(JLibrary library, JClass enclosingClass, Name name,
@@ -560,6 +587,7 @@
@override
bool get isGetter => true;
+ @override
String get _kind => 'getter';
}
@@ -568,6 +596,7 @@
/// debugging data stream.
static const String tag = 'setter';
+ @override
final bool isAbstract;
JSetter(JLibrary library, JClass enclosingClass, Name name,
@@ -624,6 +653,7 @@
@override
bool get isSetter => true;
+ @override
String get _kind => 'setter';
}
@@ -632,7 +662,9 @@
/// debugging data stream.
static const String tag = 'field';
+ @override
final bool isAssignable;
+ @override
final bool isConst;
JField(JLibrary library, JClass enclosingClass, Name name,
@@ -683,6 +715,7 @@
@override
bool get isField => true;
+ @override
String get _kind => 'field';
}
@@ -718,6 +751,7 @@
sink.end(tag);
}
+ @override
String get _kind => 'closure_call';
}
@@ -740,6 +774,7 @@
return new JSignatureMethod(cls);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberKind.signatureMethod);
sink.begin(tag);
@@ -747,6 +782,7 @@
sink.end(tag);
}
+ @override
String get _kind => 'signature';
}
@@ -758,8 +794,11 @@
/// debugging data stream.
static const String tag = 'type-variable';
+ @override
final Entity typeDeclaration;
+ @override
final String name;
+ @override
final int index;
JTypeVariable(this.typeDeclaration, this.name, this.index);
@@ -818,6 +857,7 @@
sink.end(tag);
}
+ @override
String toString() =>
'${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)';
}
diff --git a/pkg/compiler/lib/src/js_model/env.dart b/pkg/compiler/lib/src/js_model/env.dart
index 1e72ff3..9fb97dc 100644
--- a/pkg/compiler/lib/src/js_model/env.dart
+++ b/pkg/compiler/lib/src/js_model/env.dart
@@ -230,11 +230,13 @@
/// debugging data stream.
static const String tag = 'class-env';
+ @override
final ir.Class cls;
final Map<String, ir.Member> _constructorMap;
final Map<String, ir.Member> _memberMap;
final Map<String, ir.Member> _setterMap;
final List<ir.Member> _members; // in declaration order.
+ @override
final bool isSuperMixinApplication;
/// Constructor bodies created for this class.
@@ -272,11 +274,13 @@
sink.end(tag);
}
+ @override
bool get isUnnamedMixinApplication => cls.isAnonymousMixin;
/// Return the [MemberEntity] for the member [name] in [cls]. If [setter] is
/// `true`, the setter or assignable field corresponding to [name] is
/// returned.
+ @override
MemberEntity lookupMember(IrToElementMap elementMap, String name,
{bool setter: false}) {
ir.Member member = setter ? _setterMap[name] : _memberMap[name];
@@ -284,6 +288,7 @@
}
/// Calls [f] for each member of [cls].
+ @override
void forEachMember(IrToElementMap elementMap, void f(MemberEntity member)) {
_members.forEach((ir.Member member) {
f(elementMap.getMember(member));
@@ -291,12 +296,14 @@
}
/// Return the [ConstructorEntity] for the constructor [name] in [cls].
+ @override
ConstructorEntity lookupConstructor(IrToElementMap elementMap, String name) {
ir.Member constructor = _constructorMap[name];
return constructor != null ? elementMap.getConstructor(constructor) : null;
}
/// Calls [f] for each constructor of [cls].
+ @override
void forEachConstructor(
IrToElementMap elementMap, void f(ConstructorEntity constructor)) {
_constructorMap.values.forEach((ir.Member constructor) {
@@ -309,6 +316,7 @@
_constructorBodyList.add(constructorBody);
}
+ @override
void forEachConstructorBody(void f(ConstructorBodyEntity constructor)) {
_constructorBodyList?.forEach(f);
}
@@ -454,15 +462,23 @@
static const String tag = 'class-data';
final ir.Class cls;
+ @override
final ClassDefinition definition;
+ @override
bool isMixinApplication;
bool isCallTypeComputed = false;
+ @override
InterfaceType thisType;
+ @override
InterfaceType rawType;
+ @override
InterfaceType supertype;
+ @override
InterfaceType mixedInType;
+ @override
List<InterfaceType> interfaces;
+ @override
OrderedTypeSet orderedTypeSet;
JClassDataImpl(this.cls, this.definition);
@@ -484,8 +500,10 @@
sink.end(tag);
}
+ @override
bool get isEnumClass => cls != null && cls.isEnum;
+ @override
DartType get callType => null;
}
@@ -543,12 +561,15 @@
abstract class JMemberDataImpl implements JMemberData {
final ir.Member node;
+ @override
final MemberDefinition definition;
+ @override
final Map<ir.Expression, ir.DartType> staticTypes;
JMemberDataImpl(this.node, this.definition, this.staticTypes);
+ @override
InterfaceType getMemberThisType(JsToElementMap elementMap) {
MemberEntity member = elementMap.getMember(node);
ClassEntity cls = member.enclosingClass;
@@ -575,6 +596,7 @@
ir.FunctionNode get functionNode;
List<TypeVariableType> _typeVariables;
+ @override
List<TypeVariableType> getFunctionTypeVariables(
covariant JsKernelToElementMap elementMap) {
if (_typeVariables == null) {
@@ -602,6 +624,7 @@
abstract class FunctionDataForEachParameterMixin implements FunctionData {
ir.FunctionNode get functionNode;
+ @override
void forEachParameter(
JsToElementMap elementMap,
ParameterStructure parameterStructure,
@@ -637,6 +660,7 @@
/// debugging data stream.
static const String tag = 'function-data';
+ @override
final ir.FunctionNode functionNode;
FunctionType _type;
@@ -664,6 +688,7 @@
return new FunctionDataImpl(node, functionNode, definition, staticTypes);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberDataKind.function);
sink.begin(tag);
@@ -673,6 +698,7 @@
sink.end(tag);
}
+ @override
FunctionType getFunctionType(covariant JsKernelToElementMap elementMap) {
return _type ??= elementMap.getFunctionType(functionNode);
}
@@ -689,8 +715,10 @@
/// debugging data stream.
static const String tag = 'signature-function-data';
+ @override
final MemberDefinition definition;
final InterfaceType memberThisType;
+ @override
final ClassTypeVariableAccess classTypeVariableAccess;
final List<ir.TypeParameter> typeParameters;
@@ -710,6 +738,7 @@
definition, memberThisType, typeParameters, classTypeVariableAccess);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberDataKind.signature);
sink.begin(tag);
@@ -723,10 +752,12 @@
@override
Map<ir.Expression, ir.DartType> get staticTypes => const {};
+ @override
FunctionType getFunctionType(covariant JsKernelToElementMap elementMap) {
throw new UnsupportedError("SignatureFunctionData.getFunctionType");
}
+ @override
List<TypeVariableType> getFunctionTypeVariables(IrToElementMap elementMap) {
return typeParameters
.map<TypeVariableType>((ir.TypeParameter typeParameter) {
@@ -734,6 +765,7 @@
}).toList();
}
+ @override
void forEachParameter(
JsToElementMap elementMap,
ParameterStructure parameterStructure,
@@ -742,6 +774,7 @@
throw new UnimplementedError('SignatureData.forEachParameter');
}
+ @override
InterfaceType getMemberThisType(JsToElementMap elementMap) {
return memberThisType;
}
@@ -752,14 +785,17 @@
DelegatedFunctionData(this.baseData);
+ @override
FunctionType getFunctionType(covariant JsKernelToElementMap elementMap) {
return baseData.getFunctionType(elementMap);
}
+ @override
List<TypeVariableType> getFunctionTypeVariables(IrToElementMap elementMap) {
return baseData.getFunctionTypeVariables(elementMap);
}
+ @override
void forEachParameter(
JsToElementMap elementMap,
ParameterStructure parameterStructure,
@@ -769,10 +805,12 @@
isNative: isNative);
}
+ @override
InterfaceType getMemberThisType(JsToElementMap elementMap) {
return baseData.getMemberThisType(elementMap);
}
+ @override
ClassTypeVariableAccess get classTypeVariableAccess =>
baseData.classTypeVariableAccess;
}
@@ -782,6 +820,7 @@
/// a debugging data stream.
static const String tag = 'generator-body-data';
+ @override
final MemberDefinition definition;
GeneratorBodyFunctionData(FunctionData baseData, this.definition)
@@ -797,6 +836,7 @@
return new GeneratorBodyFunctionData(baseData, definition);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberDataKind.generatorBody);
sink.begin(tag);
@@ -848,6 +888,7 @@
node, functionNode, definition, staticTypes);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberDataKind.constructor);
sink.begin(tag);
@@ -858,6 +899,7 @@
sink.end(tag);
}
+ @override
ConstantConstructor getConstructorConstant(
JsKernelToElementMap elementMap, ConstructorEntity constructor) {
if (_constantConstructor == null) {
@@ -909,6 +951,7 @@
node, functionNode, definition, staticTypes);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberDataKind.constructorBody);
sink.begin(tag);
@@ -955,6 +998,7 @@
return new JFieldDataImpl(node, definition, staticTypes);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.writeEnum(JMemberDataKind.field);
sink.begin(tag);
@@ -964,12 +1008,15 @@
sink.end(tag);
}
+ @override
ir.Field get node => super.node;
+ @override
DartType getFieldType(covariant JsKernelToElementMap elementMap) {
return _type ??= elementMap.getDartType(node.type);
}
+ @override
ConstantExpression getFieldConstantExpression(
JsKernelToElementMap elementMap) {
if (_constantExpression == null) {
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 3f13c78..2090143 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -148,7 +148,9 @@
class KernelCodegenWorkItem extends CodegenWorkItem {
final JavaScriptBackend _backend;
final JClosedWorld _closedWorld;
+ @override
final MemberEntity element;
+ @override
final CodegenRegistry registry;
final GlobalTypeInferenceResults _globalInferenceResults;
@@ -207,73 +209,88 @@
_globalInferenceResults
.resultOfMember(e is ConstructorBodyEntity ? e.constructor : e);
+ @override
AbstractValue getReturnTypeOf(FunctionEntity function) {
return AbstractValueFactory.inferredReturnTypeForElement(
function, _globalInferenceResults);
}
+ @override
AbstractValue receiverTypeOfInvocation(
ir.MethodInvocation node, AbstractValueDomain abstractValueDomain) {
return _targetResults.typeOfSend(node);
}
+ @override
AbstractValue receiverTypeOfGet(ir.PropertyGet node) {
return _targetResults.typeOfSend(node);
}
+ @override
AbstractValue receiverTypeOfDirectGet(ir.DirectPropertyGet node) {
return _targetResults.typeOfSend(node);
}
+ @override
AbstractValue receiverTypeOfSet(
ir.PropertySet node, AbstractValueDomain abstractValueDomain) {
return _targetResults.typeOfSend(node);
}
+ @override
AbstractValue typeOfListLiteral(
ir.ListLiteral listLiteral, AbstractValueDomain abstractValueDomain) {
return _globalInferenceResults.typeOfListLiteral(listLiteral) ??
abstractValueDomain.dynamicType;
}
+ @override
AbstractValue typeOfIterator(ir.ForInStatement node) {
return _targetResults.typeOfIterator(node);
}
+ @override
AbstractValue typeOfIteratorCurrent(ir.ForInStatement node) {
return _targetResults.typeOfIteratorCurrent(node);
}
+ @override
AbstractValue typeOfIteratorMoveNext(ir.ForInStatement node) {
return _targetResults.typeOfIteratorMoveNext(node);
}
+ @override
bool isJsIndexableIterator(
ir.ForInStatement node, AbstractValueDomain abstractValueDomain) {
AbstractValue mask = typeOfIterator(node);
return abstractValueDomain.isJsIndexableAndIterable(mask).isDefinitelyTrue;
}
+ @override
AbstractValue inferredIndexType(ir.ForInStatement node) {
return AbstractValueFactory.inferredTypeForSelector(
new Selector.index(), typeOfIterator(node), _globalInferenceResults);
}
+ @override
AbstractValue getInferredTypeOf(MemberEntity member) {
return AbstractValueFactory.inferredTypeForMember(
member, _globalInferenceResults);
}
+ @override
AbstractValue getInferredTypeOfParameter(Local parameter) {
return AbstractValueFactory.inferredTypeForParameter(
parameter, _globalInferenceResults);
}
+ @override
AbstractValue selectorTypeOf(Selector selector, AbstractValue mask) {
return AbstractValueFactory.inferredTypeForSelector(
selector, mask, _globalInferenceResults);
}
+ @override
AbstractValue typeFromNativeBehavior(
NativeBehavior nativeBehavior, JClosedWorld closedWorld) {
return AbstractValueFactory.fromNativeBehavior(nativeBehavior, closedWorld);
diff --git a/pkg/compiler/lib/src/js_model/js_world.dart b/pkg/compiler/lib/src/js_model/js_world.dart
index 024408f..fdf9a69 100644
--- a/pkg/compiler/lib/src/js_model/js_world.dart
+++ b/pkg/compiler/lib/src/js_model/js_world.dart
@@ -41,9 +41,13 @@
class JsClosedWorld implements JClosedWorld {
static const String tag = 'closed-world';
+ @override
final NativeData nativeData;
+ @override
final InterceptorData interceptorData;
+ @override
final BackendUsage backendUsage;
+ @override
final NoSuchMethodData noSuchMethodData;
FunctionSet _allFunctions;
@@ -64,19 +68,28 @@
/// Members that are written either directly or through a setter selector.
final Set<MemberEntity> assignedInstanceMembers;
+ @override
final Set<ClassEntity> liveNativeClasses;
+ @override
final Set<MemberEntity> processedMembers;
+ @override
final ClassHierarchy classHierarchy;
final JsKernelToElementMap elementMap;
+ @override
final RuntimeTypesNeed rtiNeed;
AbstractValueDomain _abstractValueDomain;
+ @override
final JFieldAnalysis fieldAnalysis;
+ @override
final AnnotationsData annotationsData;
+ @override
final GlobalLocalsMap globalLocalsMap;
+ @override
final ClosureData closureDataLookup;
+ @override
final OutputUnitData outputUnitData;
Sorter _sorter;
@@ -207,13 +220,17 @@
sink.end(tag);
}
+ @override
JElementEnvironment get elementEnvironment => elementMap.elementEnvironment;
+ @override
JCommonElements get commonElements => elementMap.commonElements;
+ @override
DartTypes get dartTypes => elementMap.types;
/// Returns `true` if [cls] is implemented by an instantiated class.
+ @override
bool isImplemented(ClassEntity cls) {
return implementedClasses.contains(cls);
}
@@ -239,11 +256,13 @@
}
/// Returns `true` if [cls] is mixed into a live class.
+ @override
bool isUsedAsMixin(ClassEntity cls) {
return !mixinUsesOf(cls).isEmpty;
}
/// Returns `true` if any live class that mixes in [cls] implements [type].
+ @override
bool hasAnySubclassOfMixinUseThatImplements(
ClassEntity cls, ClassEntity type) {
return mixinUsesOf(cls)
@@ -252,6 +271,7 @@
/// Returns `true` if every subtype of [x] is a subclass of [y] or a subclass
/// of a mixin application of [y].
+ @override
bool everySubtypeIsSubclassOfOrMixinUseOf(ClassEntity x, ClassEntity y) {
Map<ClassEntity, bool> secondMap =
_subtypeCoveredByCache[x] ??= <ClassEntity, bool>{};
@@ -262,6 +282,7 @@
}
/// Returns `true` if any subclass of [superclass] implements [type].
+ @override
bool hasAnySubclassThatImplements(ClassEntity superclass, ClassEntity type) {
Set<ClassEntity> subclasses = typesImplementedBySubclasses[superclass];
if (subclasses == null) return false;
@@ -320,6 +341,7 @@
}
/// Returns an iterable over the common supertypes of the [classes].
+ @override
Iterable<ClassEntity> commonSupertypesOf(Iterable<ClassEntity> classes) {
Iterator<ClassEntity> iterator = classes.iterator;
if (!iterator.moveNext()) return const <ClassEntity>[];
@@ -360,6 +382,7 @@
}
/// Returns an iterable over the live mixin applications that mixin [cls].
+ @override
Iterable<ClassEntity> mixinUsesOf(ClassEntity cls) {
if (_liveMixinUses == null) {
_liveMixinUses = new Map<ClassEntity, List<ClassEntity>>();
@@ -389,6 +412,7 @@
/// Returns `true` if any live class that mixes in [mixin] is also a subclass
/// of [superclass].
+ @override
bool hasAnySubclassThatMixes(ClassEntity superclass, ClassEntity mixin) {
return mixinUsesOf(mixin).any((ClassEntity each) {
return classHierarchy.isSubclassOf(each, superclass);
@@ -396,6 +420,7 @@
}
/// Returns `true` if [cls] or any superclass mixes in [mixin].
+ @override
bool isSubclassOfMixinUseOf(ClassEntity cls, ClassEntity mixin) {
if (isUsedAsMixin(mixin)) {
ClassEntity current = cls;
@@ -422,6 +447,7 @@
/// Every implementation of `Closure` has a 'call' method with its own
/// signature so it cannot be modelled by a [FunctionEntity]. Also,
/// call-methods for tear-off are not part of the element model.
+ @override
bool includesClosureCall(Selector selector, AbstractValue receiver) {
return selector.name == Identifiers.call &&
(receiver == null ||
@@ -431,6 +457,7 @@
.isPotentiallyTrue);
}
+ @override
AbstractValue computeReceiverType(Selector selector, AbstractValue receiver) {
_ensureFunctionSet();
if (includesClosureCall(selector, receiver)) {
@@ -439,6 +466,7 @@
return _allFunctions.receiverType(selector, receiver, abstractValueDomain);
}
+ @override
Iterable<MemberEntity> locateMembers(
Selector selector, AbstractValue receiver) {
_ensureFunctionSet();
@@ -452,6 +480,7 @@
.any((each) => each.isGetter);
}
+ @override
MemberEntity locateSingleMember(Selector selector, AbstractValue receiver) {
if (includesClosureCall(selector, receiver)) {
return null;
@@ -460,6 +489,7 @@
return abstractValueDomain.locateSingleMember(receiver, selector);
}
+ @override
bool fieldNeverChanges(MemberEntity element) {
if (!element.isField) return false;
if (nativeData.isNativeMember(element)) {
diff --git a/pkg/compiler/lib/src/js_model/js_world_builder.dart b/pkg/compiler/lib/src/js_model/js_world_builder.dart
index 3e33991..c8210a9 100644
--- a/pkg/compiler/lib/src/js_model/js_world_builder.dart
+++ b/pkg/compiler/lib/src/js_model/js_world_builder.dart
@@ -660,6 +660,7 @@
JsToFrontendMapImpl(this._backend);
+ @override
DartType toBackendType(DartType type, {bool allowFreeVariables: false}) =>
type == null
? null
@@ -677,14 +678,17 @@
return toBackendLibrary(entity);
}
+ @override
LibraryEntity toBackendLibrary(covariant IndexedLibrary library) {
return _backend.libraries.getEntity(library.libraryIndex);
}
+ @override
ClassEntity toBackendClass(covariant IndexedClass cls) {
return _backend.classes.getEntity(cls.classIndex);
}
+ @override
MemberEntity toBackendMember(covariant IndexedMember member) {
return _backend.members.getEntity(member.memberIndex);
}
@@ -703,6 +707,7 @@
.getEntity(indexedTypeVariable.typeVariableIndex);
}
+ @override
ConstantValue toBackendConstant(ConstantValue constant,
{bool allowNull: false}) {
if (constant == null) {
@@ -822,19 +827,28 @@
_ConstantConverter(this.toBackendEntity)
: typeConverter = new _TypeConverter();
+ @override
ConstantValue visitNull(NullConstantValue constant, _) => constant;
+ @override
ConstantValue visitInt(IntConstantValue constant, _) => constant;
+ @override
ConstantValue visitDouble(DoubleConstantValue constant, _) => constant;
+ @override
ConstantValue visitBool(BoolConstantValue constant, _) => constant;
+ @override
ConstantValue visitString(StringConstantValue constant, _) => constant;
+ @override
ConstantValue visitSynthetic(SyntheticConstantValue constant, _) => constant;
+ @override
ConstantValue visitNonConstant(NonConstantValue constant, _) => constant;
+ @override
ConstantValue visitFunction(FunctionConstantValue constant, _) {
return new FunctionConstantValue(toBackendEntity(constant.element),
typeConverter.visit(constant.type, toBackendEntity));
}
+ @override
ConstantValue visitList(ListConstantValue constant, _) {
DartType type = typeConverter.visit(constant.type, toBackendEntity);
List<ConstantValue> entries = _handleValues(constant.entries);
@@ -855,6 +869,7 @@
return new constant_system.JavaScriptSetConstant(type, entries);
}
+ @override
ConstantValue visitMap(
covariant constant_system.JavaScriptMapConstant constant, _) {
DartType type = typeConverter.visit(constant.type, toBackendEntity);
@@ -871,6 +886,7 @@
type, keys, values, protoValue, constant.onlyStringKeys);
}
+ @override
ConstantValue visitConstructed(ConstructedConstantValue constant, _) {
DartType type = typeConverter.visit(constant.type, toBackendEntity);
Map<FieldEntity, ConstantValue> fields = {};
@@ -882,6 +898,7 @@
return new ConstructedConstantValue(type, fields);
}
+ @override
ConstantValue visitType(TypeConstantValue constant, _) {
DartType type = typeConverter.visit(constant.type, toBackendEntity);
DartType representedType =
@@ -892,18 +909,21 @@
return new TypeConstantValue(representedType, type);
}
+ @override
ConstantValue visitInterceptor(InterceptorConstantValue constant, _) {
// Interceptor constants are only created in the SSA graph builder.
throw new UnsupportedError(
"Unexpected visitInterceptor ${constant.toStructuredText()}");
}
+ @override
ConstantValue visitDeferredGlobal(DeferredGlobalConstantValue constant, _) {
// Deferred global constants are only created in the SSA graph builder.
throw new UnsupportedError(
"Unexpected DeferredGlobalConstantValue ${constant.toStructuredText()}");
}
+ @override
ConstantValue visitInstantiation(InstantiationConstantValue constant, _) {
ConstantValue function = constant.function.accept(this, null);
List<DartType> typeArguments =
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index 2281cd9..d6666c0 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -138,6 +138,7 @@
}
/// Serializes this [KernelToLocalsMapImpl] to [sink].
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
sink.writeMember(currentMember);
@@ -187,6 +188,7 @@
}
}
+ @override
MemberEntity get currentMember => _currentMember;
Local getLocalByIndex(int index) {
@@ -451,11 +453,16 @@
static const String tag = 'jump-target';
final MemberEntity memberContext;
+ @override
final int nestingLevel;
List<LabelDefinition> _labels;
+ @override
final bool isSwitch;
+ @override
final bool isSwitchCase;
+ @override
bool isBreakTarget;
+ @override
bool isContinueTarget;
JJumpTarget(this.memberContext, this.nestingLevel,
@@ -527,6 +534,7 @@
return _labels ?? const <LabelDefinition>[];
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('JJumpTarget(');
@@ -548,9 +556,13 @@
}
class JLabelDefinition extends LabelDefinition {
+ @override
final JumpTarget target;
+ @override
final String labelName;
+ @override
bool isBreakTarget;
+ @override
bool isContinueTarget;
JLabelDefinition(this.target, this.labelName,
@@ -558,6 +570,7 @@
@override
String get name => labelName;
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('JLabelDefinition(');
@@ -573,6 +586,7 @@
}
class JLocal extends IndexedLocal {
+ @override
final String name;
final MemberEntity memberContext;
@@ -585,6 +599,7 @@
String get _kind => 'local';
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('$_kind(');
diff --git a/pkg/compiler/lib/src/kernel/dart2js_target.dart b/pkg/compiler/lib/src/kernel/dart2js_target.dart
index 38c496d..cc810d1 100644
--- a/pkg/compiler/lib/src/kernel/dart2js_target.dart
+++ b/pkg/compiler/lib/src/kernel/dart2js_target.dart
@@ -45,14 +45,18 @@
/// A kernel [Target] to configure the Dart Front End for dart2js.
class Dart2jsTarget extends Target {
final TargetFlags flags;
+ @override
final String name;
Dart2jsTarget(this.name, this.flags);
+ @override
bool get legacyMode => flags.legacyMode;
+ @override
bool get enableNoSuchMethodForwarders => !flags.legacyMode;
+ @override
List<String> get extraRequiredLibraries => _requiredLibraries[name];
@override
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 74411dc..b289b50 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -65,6 +65,7 @@
/// impact computation.
class KernelToElementMapImpl implements KernelToElementMap, IrToElementMap {
final CompilerOptions options;
+ @override
final DiagnosticReporter reporter;
CommonElementsImpl _commonElements;
KernelElementEnvironment _elementEnvironment;
@@ -123,8 +124,10 @@
_types = new KernelDartTypes(this);
}
+ @override
DartTypes get types => _types;
+ @override
KernelElementEnvironment get elementEnvironment => _elementEnvironment;
@override
@@ -246,6 +249,7 @@
@override
ClassEntity getClass(ir.Class node) => getClassInternal(node);
+ @override
InterfaceType getSuperType(IndexedClass cls) {
assert(checkFamily(cls));
KClassData data = classes.getData(cls);
@@ -276,6 +280,7 @@
}
}
+ @override
TypeVariableEntity getTypeVariable(ir.TypeParameter node) =>
getTypeVariableInternal(node);
@@ -376,6 +381,7 @@
throw new UnsupportedError("Unexpected member: $node");
}
+ @override
MemberEntity getSuperMember(MemberEntity context, ir.Name name,
{bool setter: false}) {
// We can no longer trust the interface target of the super access since it
@@ -405,6 +411,7 @@
ConstructorEntity getConstructor(ir.Member node) =>
getConstructorInternal(node);
+ @override
ConstructorEntity getSuperConstructor(
ir.Constructor sourceNode, ir.Member targetNode) {
ConstructorEntity source = getConstructor(sourceNode);
@@ -435,6 +442,7 @@
@override
DartType getDartType(ir.DartType type) => _typeConverter.convert(type);
+ @override
TypeVariableType getTypeVariableType(ir.TypeParameterType type) =>
getDartType(type);
@@ -446,6 +454,7 @@
return list;
}
+ @override
InterfaceType getInterfaceType(ir.InterfaceType type) =>
_typeConverter.convert(type);
@@ -523,6 +532,7 @@
constantRequired: requireConstant, checkCasts: checkCasts);
}
+ @override
DartType substByContext(DartType type, InterfaceType context) {
return type.subst(
context.typeArguments, getThisType(context.element).typeArguments);
@@ -533,6 +543,7 @@
/// If [type] doesn't have a `call` member `null` is returned. If [type] has
/// an invalid `call` member (non-method or a synthesized method with both
/// optional and named parameters) a [DynamicType] is returned.
+ @override
DartType getCallType(InterfaceType type) {
IndexedClass cls = type.element;
assert(checkFamily(cls));
@@ -543,6 +554,7 @@
return null;
}
+ @override
InterfaceType getThisType(IndexedClass cls) {
assert(checkFamily(cls));
KClassData data = classes.getData(cls);
@@ -575,6 +587,7 @@
return data.getFunctionTypeVariables(this);
}
+ @override
DartType getTypeVariableBound(IndexedTypeVariable typeVariable) {
assert(checkFamily(typeVariable));
KTypeVariableData data = typeVariables.getData(typeVariable);
@@ -667,6 +680,7 @@
return data.getFieldConstantExpression(this);
}
+ @override
InterfaceType asInstanceOf(InterfaceType type, ClassEntity cls) {
assert(checkFamily(cls));
OrderedTypeSet orderedTypeSet = getOrderedTypeSet(type.element);
@@ -678,6 +692,7 @@
return supertype;
}
+ @override
OrderedTypeSet getOrderedTypeSet(IndexedClass cls) {
assert(checkFamily(cls));
KClassData data = classes.getData(cls);
@@ -685,6 +700,7 @@
return data.orderedTypeSet;
}
+ @override
int getHierarchyDepth(IndexedClass cls) {
assert(checkFamily(cls));
KClassData data = classes.getData(cls);
@@ -692,6 +708,7 @@
return data.orderedTypeSet.maxDepth;
}
+ @override
Iterable<InterfaceType> getInterfaces(IndexedClass cls) {
assert(checkFamily(cls));
KClassData data = classes.getData(cls);
@@ -699,11 +716,13 @@
return data.interfaces;
}
+ @override
ir.Member getMemberNode(covariant IndexedMember member) {
assert(checkFamily(member));
return members.getData(member).node;
}
+ @override
ir.Class getClassNode(covariant IndexedClass cls) {
assert(checkFamily(cls));
return classes.getData(cls).node;
@@ -713,6 +732,7 @@
return typedefs.getData(typedef).node;
}
+ @override
ImportEntity getImport(ir.LibraryDependency node) {
if (node == null) return null;
ir.Library library = node.parent;
@@ -720,6 +740,7 @@
return data.imports[node];
}
+ @override
ir.TypeEnvironment get typeEnvironment {
if (_typeEnvironment == null) {
_typeEnvironment ??= new ir.TypeEnvironment(
@@ -728,6 +749,7 @@
return _typeEnvironment;
}
+ @override
ir.ClassHierarchy get classHierarchy {
if (_classHierarchy == null) {
_classHierarchy ??= new ir.ClassHierarchy(env.mainComponent);
@@ -735,11 +757,13 @@
return _classHierarchy;
}
+ @override
Name getName(ir.Name name) {
return new Name(
name.name, name.isPrivate ? getLibrary(name.library) : null);
}
+ @override
CallStructure getCallStructure(ir.Arguments arguments) {
int argumentCount = arguments.positional.length + arguments.named.length;
List<String> namedArguments = arguments.named.map((e) => e.name).toList();
@@ -761,6 +785,7 @@
namedParameters, includeTypeParameters ? typeParameters : 0);
}
+ @override
Selector getInvocationSelector(ir.Name irName, int positionalArguments,
List<String> namedArguments, int typeArguments) {
Name name = getName(irName);
@@ -871,6 +896,7 @@
/// Computes the [NativeBehavior] for a call to the [JS] function.
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 2 ||
node.arguments.named.isNotEmpty) {
@@ -904,6 +930,7 @@
/// Computes the [NativeBehavior] for a call to the [JS_BUILTIN]
/// function.
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForJsBuiltinCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
reporter.internalError(
@@ -932,6 +959,7 @@
/// Computes the [NativeBehavior] for a call to the
/// [JS_EMBEDDED_GLOBAL] function.
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
@@ -964,6 +992,7 @@
commonElements);
}
+ @override
js.Name getNameForJsGetName(ConstantValue constant, Namer namer) {
int index = extractEnumIndexFromConstantValue(
constant, commonElements.jsGetNameEnum);
@@ -986,6 +1015,7 @@
return null;
}
+ @override
ConstantValue getConstantValue(ir.Expression node,
{bool requireConstant: true,
bool implicitNull: false,
@@ -1033,6 +1063,7 @@
return metadata;
}
+ @override
FunctionEntity getSuperNoSuchMethod(ClassEntity cls) {
while (cls != null) {
cls = elementEnvironment.getSuperClass(cls);
@@ -1303,12 +1334,14 @@
}
/// NativeBasicData is need for computation of the default super class.
+ @override
NativeBasicData get nativeBasicData => _frontendStrategy.nativeBasicData;
/// Adds libraries in [component] to the set of libraries.
///
/// The main method of the first component is used as the main method for the
/// compilation.
+ @override
void addComponent(ir.Component component) {
env.addComponent(component);
}
@@ -1441,6 +1474,7 @@
/// Returns `true` is [node] has a `@Native(...)` annotation.
// TODO(johnniwinther): Cache this for later use.
+ @override
bool isNativeClass(ir.Class node) {
for (ir.Expression annotation in node.annotations) {
if (annotation is ir.ConstructorInvocation) {
@@ -1454,6 +1488,7 @@
}
/// Compute the kind of foreign helper function called by [node], if any.
+ @override
ForeignKind getForeignKind(ir.StaticInvocation node) {
if (commonElements.isForeignHelper(getMember(node.target))) {
switch (node.target.name.name) {
@@ -1472,6 +1507,7 @@
/// Computes the [InterfaceType] referenced by a call to the
/// [JS_INTERCEPTOR_CONSTANT] function, if any.
+ @override
InterfaceType getInterfaceTypeForJsInterceptorCall(ir.StaticInvocation node) {
if (node.arguments.positional.length != 1 ||
node.arguments.named.isNotEmpty) {
@@ -1487,6 +1523,7 @@
/// Computes the native behavior for reading the native [field].
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field,
{bool isJsInterop}) {
DartType type = getDartType(field.type);
@@ -1501,6 +1538,7 @@
/// Computes the native behavior for writing to the native [field].
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForFieldStore(ir.Field field) {
DartType type = getDartType(field.type);
return nativeBehaviorBuilder.buildFieldStoreBehavior(type);
@@ -1508,6 +1546,7 @@
/// Computes the native behavior for calling [member].
// TODO(johnniwinther): Cache this for later use.
+ @override
NativeBehavior getNativeBehaviorForMethod(ir.Member member,
{bool isJsInterop}) {
DartType type;
@@ -1841,9 +1880,13 @@
/// [BehaviorBuilder] for kernel based elements.
class KernelBehaviorBuilder extends BehaviorBuilder {
+ @override
final ElementEnvironment elementEnvironment;
+ @override
final CommonElements commonElements;
+ @override
final DiagnosticReporter reporter;
+ @override
final NativeBasicData nativeBasicData;
final CompilerOptions _options;
@@ -1882,6 +1925,7 @@
class KernelEvaluationEnvironment extends EvaluationEnvironmentBase {
final KernelToElementMapImpl _elementMap;
final Environment _environment;
+ @override
final bool checkCasts;
KernelEvaluationEnvironment(
diff --git a/pkg/compiler/lib/src/kernel/env.dart b/pkg/compiler/lib/src/kernel/env.dart
index a721968..b7c9246 100644
--- a/pkg/compiler/lib/src/kernel/env.dart
+++ b/pkg/compiler/lib/src/kernel/env.dart
@@ -285,6 +285,7 @@
/// Environment for fast lookup of class members.
class KClassEnvImpl implements KClassEnv {
+ @override
final ir.Class cls;
Map<String, ir.Member> _constructorMap;
@@ -301,8 +302,10 @@
KClassEnvImpl.internal(this.cls, this._constructorMap, this._memberMap,
this._setterMap, this._members, this._isSuperMixinApplication);
+ @override
bool get isUnnamedMixinApplication => cls.isAnonymousMixin;
+ @override
bool get isSuperMixinApplication {
assert(_isSuperMixinApplication != null);
return _isSuperMixinApplication;
@@ -354,6 +357,7 @@
initializers: <ir.Initializer>[superInitializer]);
}
+ @override
void ensureMembers(KernelToElementMapImpl elementMap) {
_ensureMaps(elementMap);
}
@@ -505,6 +509,7 @@
/// Return the [MemberEntity] for the member [name] in [cls]. If [setter] is
/// `true`, the setter or assignable field corresponding to [name] is
/// returned.
+ @override
MemberEntity lookupMember(IrToElementMap elementMap, String name,
{bool setter: false}) {
_ensureMaps(elementMap);
@@ -513,6 +518,7 @@
}
/// Calls [f] for each member of [cls].
+ @override
void forEachMember(IrToElementMap elementMap, void f(MemberEntity member)) {
_ensureMaps(elementMap);
_members.forEach((ir.Member member) {
@@ -521,6 +527,7 @@
}
/// Return the [ConstructorEntity] for the constructor [name] in [cls].
+ @override
ConstructorEntity lookupConstructor(IrToElementMap elementMap, String name) {
_ensureMaps(elementMap);
ir.Member constructor = _constructorMap[name];
@@ -528,6 +535,7 @@
}
/// Calls [f] for each constructor of [cls].
+ @override
void forEachConstructor(
IrToElementMap elementMap, void f(ConstructorEntity constructor)) {
_ensureMaps(elementMap);
@@ -541,10 +549,12 @@
_constructorBodyList.add(constructorBody);
}
+ @override
void forEachConstructorBody(void f(ConstructorBodyEntity constructor)) {
_constructorBodyList?.forEach(f);
}
+ @override
JClassEnv convert(IrToElementMap elementMap,
Map<MemberEntity, MemberUsage> liveMemberUsage) {
Map<String, ir.Member> constructorMap;
@@ -621,30 +631,42 @@
}
class KClassDataImpl implements KClassData {
+ @override
final ir.Class node;
+ @override
bool isMixinApplication;
bool isCallTypeComputed = false;
+ @override
InterfaceType thisType;
+ @override
InterfaceType rawType;
+ @override
InterfaceType supertype;
+ @override
InterfaceType mixedInType;
+ @override
List<InterfaceType> interfaces;
+ @override
OrderedTypeSet orderedTypeSet;
Iterable<ConstantValue> _metadata;
KClassDataImpl(this.node);
+ @override
bool get isEnumClass => node.isEnum;
+ @override
DartType get callType => null;
+ @override
Iterable<ConstantValue> getMetadata(
covariant KernelToElementMapImpl elementMap) {
return _metadata ??= elementMap.getMetadata(node.annotations);
}
+ @override
JClassData convert() {
return new JClassDataImpl(node, new RegularClassDefinition(node));
}
@@ -666,19 +688,23 @@
}
abstract class KMemberDataImpl implements KMemberData {
+ @override
final ir.Member node;
Iterable<ConstantValue> _metadata;
+ @override
Map<ir.Expression, ir.DartType> staticTypes;
KMemberDataImpl(this.node);
+ @override
Iterable<ConstantValue> getMetadata(
covariant KernelToElementMapImpl elementMap) {
return _metadata ??= elementMap.getMetadata(node.annotations);
}
+ @override
InterfaceType getMemberThisType(JsToElementMap elementMap) {
MemberEntity member = elementMap.getMember(node);
ClassEntity cls = member.enclosingClass;
@@ -702,6 +728,7 @@
ir.FunctionNode get functionNode;
List<TypeVariableType> _typeVariables;
+ @override
List<TypeVariableType> getFunctionTypeVariables(
covariant KernelToElementMapImpl elementMap) {
if (_typeVariables == null) {
@@ -729,15 +756,18 @@
class KFunctionDataImpl extends KMemberDataImpl
with KFunctionDataMixin
implements KFunctionData {
+ @override
final ir.FunctionNode functionNode;
FunctionType _type;
KFunctionDataImpl(ir.Member node, this.functionNode) : super(node);
+ @override
FunctionType getFunctionType(covariant KernelToElementMapImpl elementMap) {
return _type ??= elementMap.getFunctionType(functionNode);
}
+ @override
void forEachParameter(JsToElementMap elementMap,
void f(DartType type, String name, ConstantValue defaultValue)) {
void handleParameter(ir.VariableDeclaration node, {bool isOptional: true}) {
@@ -789,6 +819,7 @@
KConstructorDataImpl(ir.Member node, ir.FunctionNode functionNode)
: super(node, functionNode);
+ @override
ConstantConstructor getConstructorConstant(
KernelToElementMapImpl elementMap, ConstructorEntity constructor) {
if (_constantConstructor == null) {
@@ -835,12 +866,15 @@
KFieldDataImpl(ir.Field node) : super(node);
+ @override
ir.Field get node => super.node;
+ @override
DartType getFieldType(covariant KernelToElementMapImpl elementMap) {
return _type ??= elementMap.getDartType(node.type);
}
+ @override
ConstantExpression getFieldConstantExpression(
KernelToElementMapImpl elementMap) {
if (_constantExpression == null) {
diff --git a/pkg/compiler/lib/src/kernel/front_end_adapter.dart b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
index 169237d..571f11f 100644
--- a/pkg/compiler/lib/src/kernel/front_end_adapter.dart
+++ b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
@@ -32,6 +32,7 @@
}
class _CompilerFileSystemEntity implements fe.FileSystemEntity {
+ @override
final Uri uri;
final CompilerFileSystem fs;
diff --git a/pkg/compiler/lib/src/kernel/kelements.dart b/pkg/compiler/lib/src/kernel/kelements.dart
index 2f1a8f5..1ac70af 100644
--- a/pkg/compiler/lib/src/kernel/kelements.dart
+++ b/pkg/compiler/lib/src/kernel/kelements.dart
@@ -13,18 +13,24 @@
const String kElementPrefix = 'k:';
class KLibrary extends IndexedLibrary {
+ @override
final String name;
+ @override
final Uri canonicalUri;
KLibrary(this.name, this.canonicalUri);
+ @override
String toString() => '${kElementPrefix}library($name)';
}
class KClass extends IndexedClass {
+ @override
final KLibrary library;
+ @override
final String name;
+ @override
final bool isAbstract;
KClass(this.library, this.name, {this.isAbstract});
@@ -32,21 +38,27 @@
@override
bool get isClosure => false;
+ @override
String toString() => '${kElementPrefix}class($name)';
}
class KTypedef extends IndexedTypedef {
+ @override
final KLibrary library;
+ @override
final String name;
KTypedef(this.library, this.name);
+ @override
String toString() => '${kElementPrefix}typedef($name)';
}
abstract class KMember extends IndexedMember {
+ @override
final KLibrary library;
+ @override
final KClass enclosingClass;
final Name _name;
final bool _isStatic;
@@ -54,8 +66,10 @@
KMember(this.library, this.enclosingClass, this._name, {bool isStatic: false})
: _isStatic = isStatic;
+ @override
String get name => _name.text;
+ @override
Name get memberName => _name;
@override
@@ -93,14 +107,18 @@
String get _kind;
+ @override
String toString() => '${kElementPrefix}$_kind'
'(${enclosingClass != null ? '${enclosingClass.name}.' : ''}$name)';
}
abstract class KFunction extends KMember
implements FunctionEntity, IndexedFunction {
+ @override
final ParameterStructure parameterStructure;
+ @override
final bool isExternal;
+ @override
final AsyncMarker asyncMarker;
KFunction(KLibrary library, KClass enclosingClass, Name name,
@@ -111,6 +129,7 @@
abstract class KConstructor extends KFunction
implements ConstructorEntity, IndexedConstructor {
+ @override
final bool isConst;
KConstructor(
@@ -135,6 +154,7 @@
@override
bool get isFromEnvironmentConstructor => false;
+ @override
String get _kind => 'constructor';
}
@@ -170,6 +190,7 @@
}
class KMethod extends KFunction {
+ @override
final bool isAbstract;
KMethod(KLibrary library, KClass enclosingClass, Name name,
@@ -181,10 +202,12 @@
@override
bool get isFunction => true;
+ @override
String get _kind => 'method';
}
class KGetter extends KFunction {
+ @override
final bool isAbstract;
KGetter(KLibrary library, KClass enclosingClass, Name name,
@@ -197,10 +220,12 @@
@override
bool get isGetter => true;
+ @override
String get _kind => 'getter';
}
class KSetter extends KFunction {
+ @override
final bool isAbstract;
KSetter(KLibrary library, KClass enclosingClass, Name name,
@@ -215,11 +240,14 @@
@override
bool get isSetter => true;
+ @override
String get _kind => 'setter';
}
class KField extends KMember implements FieldEntity, IndexedField {
+ @override
final bool isAssignable;
+ @override
final bool isConst;
KField(KLibrary library, KClass enclosingClass, Name name,
@@ -229,21 +257,27 @@
@override
bool get isField => true;
+ @override
String get _kind => 'field';
}
class KTypeVariable extends IndexedTypeVariable {
+ @override
final Entity typeDeclaration;
+ @override
final String name;
+ @override
final int index;
KTypeVariable(this.typeDeclaration, this.name, this.index);
+ @override
String toString() =>
'${kElementPrefix}type_variable(${typeDeclaration.name}.$name)';
}
class KLocalFunction implements Local {
+ @override
final String name;
final MemberEntity memberContext;
final Entity executableContext;
@@ -253,19 +287,24 @@
KLocalFunction(
this.name, this.memberContext, this.executableContext, this.node);
+ @override
String toString() => '${kElementPrefix}local_function'
'(${memberContext.name}.${name ?? '<anonymous>'})';
}
class KLocalTypeVariable implements TypeVariableEntity {
+ @override
final Entity typeDeclaration;
+ @override
final String name;
+ @override
final int index;
DartType bound;
DartType defaultType;
KLocalTypeVariable(this.typeDeclaration, this.name, this.index);
+ @override
String toString() =>
'${kElementPrefix}local_type_variable(${typeDeclaration.name}.$name)';
}
diff --git a/pkg/compiler/lib/src/kernel/kernel_impact.dart b/pkg/compiler/lib/src/kernel/kernel_impact.dart
index f65c5d6..f32c305 100644
--- a/pkg/compiler/lib/src/kernel/kernel_impact.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_impact.dart
@@ -33,10 +33,15 @@
/// Visitor that computes the world impact of a member.
class KernelImpactBuilder extends ImpactBuilderBase
with KernelImpactRegistryMixin {
+ @override
final ResolutionWorldImpactBuilder impactBuilder;
+ @override
final KernelToElementMap elementMap;
+ @override
final DiagnosticReporter reporter;
+ @override
final CompilerOptions _options;
+ @override
final MemberEntity currentMember;
final Set<PragmaAnnotation> _annotations;
@@ -47,12 +52,16 @@
super(elementMap.typeEnvironment, elementMap.classHierarchy,
variableScopeModel);
+ @override
CommonElements get commonElements => elementMap.commonElements;
+ @override
NativeBasicData get _nativeBasicData => elementMap.nativeBasicData;
+ @override
bool get useAsserts => _options.enableUserAssertions;
+ @override
bool get inferEffectivelyFinalVariableTypes =>
!_annotations.contains(PragmaAnnotation.disableFinal);
}
@@ -60,10 +69,15 @@
/// Converts a [ImpactData] object based on kernel to the corresponding
/// [ResolutionImpact] based on the K model.
class KernelImpactConverter extends KernelImpactRegistryMixin {
+ @override
final ResolutionWorldImpactBuilder impactBuilder;
+ @override
final KernelToElementMap elementMap;
+ @override
final DiagnosticReporter reporter;
+ @override
final CompilerOptions _options;
+ @override
final MemberEntity currentMember;
KernelImpactConverter(
@@ -71,10 +85,13 @@
: this.impactBuilder =
new ResolutionWorldImpactBuilder('${currentMember}');
+ @override
ir.TypeEnvironment get typeEnvironment => elementMap.typeEnvironment;
+ @override
CommonElements get commonElements => elementMap.commonElements;
+ @override
NativeBasicData get _nativeBasicData => elementMap.nativeBasicData;
/// Converts a [ImpactData] object based on kernel to the corresponding
@@ -284,6 +301,7 @@
}
}
+ @override
void registerConstConstructorInvocationNode(ir.ConstructorInvocation node) {
assert(node.isConst);
ConstructorEntity constructor = elementMap.getConstructor(node.target);
@@ -669,6 +687,7 @@
impactBuilder.registerFeature(Feature.THROW_EXPRESSION);
}
+ @override
void registerSyncForIn(ir.DartType iterableType) {
// TODO(johnniwinther): Use receiver constraints for the dynamic uses in
// strong mode.
@@ -678,6 +697,7 @@
impactBuilder.registerDynamicUse(new DynamicUse(Selectors.moveNext));
}
+ @override
void registerAsyncForIn(ir.DartType iterableType) {
// TODO(johnniwinther): Use receiver constraints for the dynamic uses in
// strong mode.
@@ -687,14 +707,17 @@
impactBuilder.registerDynamicUse(new DynamicUse(Selectors.moveNext));
}
+ @override
void registerCatch() {
impactBuilder.registerFeature(Feature.CATCH_STATEMENT);
}
+ @override
void registerStackTrace() {
impactBuilder.registerFeature(Feature.STACK_TRACE_IN_CATCH);
}
+ @override
void registerCatchType(ir.DartType type) {
impactBuilder
.registerTypeUse(new TypeUse.catchType(elementMap.getDartType(type)));
diff --git a/pkg/compiler/lib/src/kernel/kernel_strategy.dart b/pkg/compiler/lib/src/kernel/kernel_strategy.dart
index 442a6c6..1f265d9 100644
--- a/pkg/compiler/lib/src/kernel/kernel_strategy.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_strategy.dart
@@ -83,6 +83,7 @@
@override
CommonElements get commonElements => _elementMap.commonElements;
+ @override
DartTypes get dartTypes => _elementMap.types;
KernelToElementMap get elementMap => _elementMap;
@@ -104,16 +105,19 @@
_elementMap.elementEnvironment, nativeBasicData);
}
+ @override
NoSuchMethodResolver createNoSuchMethodResolver() {
return new KernelNoSuchMethodResolver(elementMap);
}
/// Computes the main function from [mainLibrary] adding additional world
/// impact to [impactBuilder].
+ @override
FunctionEntity computeMain(WorldImpactBuilder impactBuilder) {
return elementEnvironment.mainFunction;
}
+ @override
RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder() {
return _runtimeTypesNeedBuilder ??= _options.disableRtiOptimization
? const TrivialRuntimeTypesNeedBuilder()
@@ -121,9 +125,11 @@
elementEnvironment, _elementMap.types);
}
+ @override
RuntimeTypesNeedBuilder get runtimeTypesNeedBuilderForTesting =>
_runtimeTypesNeedBuilder;
+ @override
ResolutionWorldBuilder createResolutionWorldBuilder(
NativeBasicData nativeBasicData,
NativeDataBuilder nativeDataBuilder,
@@ -179,6 +185,7 @@
_irAnnotationData);
}
+ @override
ClassQueries createClassQueries() {
return new KernelClassQueries(elementMap);
}
@@ -239,6 +246,7 @@
final ImpactTransformer _impactTransformer;
final NativeMemberResolver _nativeMemberResolver;
final AnnotationsDataBuilder _annotationsDataBuilder;
+ @override
final MemberEntity element;
final Map<MemberEntity, ClosureScopeModel> _closureModels;
final Map<Entity, WorldImpact> _impactCache;
diff --git a/pkg/compiler/lib/src/kernel/kernel_world.dart b/pkg/compiler/lib/src/kernel/kernel_world.dart
index 673ba75..053c528 100644
--- a/pkg/compiler/lib/src/kernel/kernel_world.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_world.dart
@@ -24,33 +24,49 @@
class KClosedWorldImpl implements KClosedWorld {
final KernelToElementMapImpl elementMap;
+ @override
final KElementEnvironment elementEnvironment;
+ @override
final DartTypes dartTypes;
+ @override
final KCommonElements commonElements;
+ @override
final NativeData nativeData;
+ @override
final InterceptorData interceptorData;
+ @override
final BackendUsage backendUsage;
+ @override
final NoSuchMethodData noSuchMethodData;
+ @override
final Map<ClassEntity, Set<ClassEntity>> mixinUses;
+ @override
final Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses;
// TODO(johnniwinther): Can this be derived from [ClassSet]s?
final Set<ClassEntity> _implementedClasses;
+ @override
final Iterable<MemberEntity> liveInstanceMembers;
/// Members that are written either directly or through a setter selector.
+ @override
final Iterable<MemberEntity> assignedInstanceMembers;
+ @override
final KFieldAnalysis fieldAnalysis;
+ @override
final Iterable<ClassEntity> liveNativeClasses;
+ @override
final Map<MemberEntity, MemberUsage> liveMemberUsage;
+ @override
final ClassHierarchy classHierarchy;
+ @override
final AnnotationsData annotationsData;
RuntimeTypesNeed _rtiNeed;
@@ -81,9 +97,11 @@
resolutionWorldBuilder, this, options);
}
+ @override
RuntimeTypesNeed get rtiNeed => _rtiNeed;
/// Returns `true` if [cls] is implemented by an instantiated class.
+ @override
bool isImplemented(ClassEntity cls) {
return _implementedClasses.contains(cls);
}
diff --git a/pkg/compiler/lib/src/kernel/loader.dart b/pkg/compiler/lib/src/kernel/loader.dart
index 7b56f28..b972976 100644
--- a/pkg/compiler/lib/src/kernel/loader.dart
+++ b/pkg/compiler/lib/src/kernel/loader.dart
@@ -51,6 +51,7 @@
: initializedCompilerState = _options.kernelInitializedCompilerState,
super(measurer);
+ @override
String get name => 'kernel loader';
/// Loads an entire Kernel [Component] from a file on disk.
@@ -157,5 +158,6 @@
assert(rootLibraryUri != null);
}
+ @override
String toString() => 'root=$rootLibraryUri,libraries=${libraries}';
}
diff --git a/pkg/compiler/lib/src/kernel/native_basic_data.dart b/pkg/compiler/lib/src/kernel/native_basic_data.dart
index 8bcc052..7aeda4d 100644
--- a/pkg/compiler/lib/src/kernel/native_basic_data.dart
+++ b/pkg/compiler/lib/src/kernel/native_basic_data.dart
@@ -13,6 +13,7 @@
KernelAnnotationProcessor(
this.elementMap, this._nativeBasicDataBuilder, this.annotationData);
+ @override
void extractNativeAnnotations(LibraryEntity library) {
KElementEnvironment elementEnvironment = elementMap.elementEnvironment;
KCommonElements commonElements = elementMap.commonElements;
@@ -66,6 +67,7 @@
}
}
+ @override
void extractJsInteropAnnotations(LibraryEntity library) {
DiagnosticReporter reporter = elementMap.reporter;
KElementEnvironment elementEnvironment = elementMap.elementEnvironment;
diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart
index 138fc5e..5bb7e12 100644
--- a/pkg/compiler/lib/src/native/behavior.dart
+++ b/pkg/compiler/lib/src/native/behavior.dart
@@ -24,8 +24,10 @@
/// The type Object, but no subtypes:
static const JsObject = const SpecialType._('=Object');
+ @override
int get hashCode => name.hashCode;
+ @override
String toString() => name;
static SpecialType fromName(String name) {
@@ -68,6 +70,7 @@
return this;
}
+ @override
String toString() {
if (this == NEVER) return 'never';
if (this == MAY) return 'may';
@@ -258,6 +261,7 @@
sink.end(tag);
}
+ @override
String toString() {
return 'NativeBehavior('
'returns: ${typesReturned}'
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index dfd4b8f..4552d00 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -40,6 +40,7 @@
final Set<ClassEntity> _registeredClasses = new Set<ClassEntity>();
final Set<ClassEntity> _unusedClasses = new Set<ClassEntity>();
+ @override
bool get hasInstantiatedNativeClasses => !_registeredClasses.isEmpty;
/// Log message reported if all native types are used.
@@ -56,6 +57,7 @@
bool get enableLiveTypeAnalysis => _options.enableNativeLiveTypeAnalysis;
+ @override
void onInstantiatedType(InterfaceType type) {
if (_unusedClasses.remove(type.element)) {
_registeredClasses.add(type.element);
@@ -77,6 +79,7 @@
}
}
+ @override
void registerNativeBehavior(
WorldImpactBuilder impactBuilder, NativeBehavior nativeBehavior, cause) {
_processNativeBehavior(impactBuilder, nativeBehavior, cause);
@@ -161,6 +164,7 @@
});
}
+ @override
void logSummary(void log(String message)) {
if (_allUsedMessage != null) {
log(_allUsedMessage);
@@ -189,6 +193,7 @@
Iterable<ClassEntity> get liveNativeClasses => _registeredClasses;
+ @override
WorldImpact processNativeClasses(Iterable<Uri> libraries) {
WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
Iterable<ClassEntity> nativeClasses =
@@ -201,6 +206,7 @@
return impactBuilder;
}
+ @override
void logSummary(void log(String message)) {
super.logSummary(log);
log('Resolved ${_registeredClasses.length} native elements used, '
@@ -225,6 +231,7 @@
this._nativeData)
: super(options, elementEnvironment, commonElements, dartTypes);
+ @override
WorldImpact processNativeClasses(Iterable<Uri> libraries) {
WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
_unusedClasses.addAll(_nativeClasses);
@@ -247,6 +254,7 @@
return impactBuilder;
}
+ @override
void _registerTypeUses(
WorldImpactBuilder impactBuilder, Set<ClassEntity> classes, cause) {
super._registerTypeUses(impactBuilder, classes, cause);
@@ -288,6 +296,7 @@
directSubtypes.add(cls);
}
+ @override
void logSummary(void log(String message)) {
super.logSummary(log);
log('Compiled ${_registeredClasses.length} native classes, '
diff --git a/pkg/compiler/lib/src/native/js.dart b/pkg/compiler/lib/src/native/js.dart
index 0c83197..bbc8bd0 100644
--- a/pkg/compiler/lib/src/native/js.dart
+++ b/pkg/compiler/lib/src/native/js.dart
@@ -41,18 +41,21 @@
node.accept(this);
}
+ @override
void visitLiteralExpression(js.LiteralExpression node) {
sideEffects.setAllSideEffects();
sideEffects.setDependsOnSomething();
node.visitChildren(this);
}
+ @override
void visitLiteralStatement(js.LiteralStatement node) {
sideEffects.setAllSideEffects();
sideEffects.setDependsOnSomething();
node.visitChildren(this);
}
+ @override
void visitAssignment(js.Assignment node) {
sideEffects.setChangesStaticProperty();
sideEffects.setChangesInstanceProperty();
@@ -60,32 +63,38 @@
node.visitChildren(this);
}
+ @override
void visitVariableInitialization(js.VariableInitialization node) {
node.visitChildren(this);
}
+ @override
void visitCall(js.Call node) {
sideEffects.setAllSideEffects();
sideEffects.setDependsOnSomething();
node.visitChildren(this);
}
+ @override
void visitBinary(js.Binary node) {
node.visitChildren(this);
}
+ @override
void visitThrow(js.Throw node) {
// TODO(ngeoffray): Incorporate a mayThrow flag in the
// [SideEffects] class.
sideEffects.setAllSideEffects();
}
+ @override
void visitNew(js.New node) {
sideEffects.setAllSideEffects();
sideEffects.setDependsOnSomething();
node.visitChildren(this);
}
+ @override
void visitPrefix(js.Prefix node) {
if (node.op == 'delete') {
sideEffects.setChangesStaticProperty();
@@ -95,14 +104,17 @@
node.visitChildren(this);
}
+ @override
void visitVariableUse(js.VariableUse node) {
sideEffects.setDependsOnStaticPropertyStore();
}
+ @override
void visitPostfix(js.Postfix node) {
node.visitChildren(this);
}
+ @override
void visitAccess(js.PropertyAccess node) {
sideEffects.setDependsOnIndexStore();
sideEffects.setDependsOnInstancePropertyStore();
@@ -149,43 +161,53 @@
return node.accept(this);
}
+ @override
NativeThrowBehavior visitNode(js.Node node) {
return NativeThrowBehavior.MAY;
}
+ @override
NativeThrowBehavior visitLiteral(js.Literal node) {
return NativeThrowBehavior.NEVER;
}
+ @override
NativeThrowBehavior visitInterpolatedExpression(js.InterpolatedNode node) {
return NativeThrowBehavior.NEVER;
}
+ @override
NativeThrowBehavior visitInterpolatedSelector(js.InterpolatedNode node) {
return NativeThrowBehavior.NEVER;
}
+ @override
NativeThrowBehavior visitArrayInitializer(js.ArrayInitializer node) {
return node.elements.map(visit).fold(NativeThrowBehavior.NEVER, sequence);
}
+ @override
NativeThrowBehavior visitArrayHole(js.ArrayHole node) {
return NativeThrowBehavior.NEVER;
}
+ @override
NativeThrowBehavior visitObjectInitializer(js.ObjectInitializer node) {
return node.properties.map(visit).fold(NativeThrowBehavior.NEVER, sequence);
}
+ @override
NativeThrowBehavior visitProperty(js.Property node) {
return sequence(visit(node.name), visit(node.value));
}
+ @override
NativeThrowBehavior visitAssignment(js.Assignment node) {
// TODO(sra): Can we make "#.p = #" be null(1)?
return NativeThrowBehavior.MAY;
}
+ @override
NativeThrowBehavior visitCall(js.Call node) {
js.Expression target = node.target;
if (target is js.PropertyAccess && _isFirstInterpolatedProperty(target)) {
@@ -201,11 +223,13 @@
return NativeThrowBehavior.MAY;
}
+ @override
NativeThrowBehavior visitNew(js.New node) {
// TODO(sra): `new Array(x)` where `x` is a small number.
return NativeThrowBehavior.MAY;
}
+ @override
NativeThrowBehavior visitBinary(js.Binary node) {
NativeThrowBehavior left = visit(node.left);
NativeThrowBehavior right = visit(node.right);
@@ -248,10 +272,12 @@
}
}
+ @override
NativeThrowBehavior visitThrow(js.Throw node) {
return sequence(visit(node.expression), NativeThrowBehavior.MAY);
}
+ @override
NativeThrowBehavior visitPrefix(js.Prefix node) {
if (node.op == 'typeof' && node.argument is js.VariableUse)
return NativeThrowBehavior.NEVER;
@@ -269,6 +295,7 @@
}
}
+ @override
NativeThrowBehavior visitVariableUse(js.VariableUse node) {
// We could get a ReferenceError unless the variable is in scope. The AST
// could distinguish in-scope and out-of scope references. For JS fragments,
@@ -284,6 +311,7 @@
}
}
+ @override
NativeThrowBehavior visitAccess(js.PropertyAccess node) {
js.Node receiver = node.receiver;
NativeThrowBehavior first = visit(receiver);
diff --git a/pkg/compiler/lib/src/native/resolver.dart b/pkg/compiler/lib/src/native/resolver.dart
index 49b45d8..8a9ed11 100644
--- a/pkg/compiler/lib/src/native/resolver.dart
+++ b/pkg/compiler/lib/src/native/resolver.dart
@@ -30,6 +30,7 @@
BaseNativeClassFinder(this._elementEnvironment, this._nativeBasicData);
+ @override
Iterable<ClassEntity> computeNativeClasses(Iterable<Uri> libraries) {
Set<ClassEntity> nativeClasses = new Set<ClassEntity>();
libraries.forEach((uri) => _processNativeClassesInLibrary(
diff --git a/pkg/compiler/lib/src/null_compiler_output.dart b/pkg/compiler/lib/src/null_compiler_output.dart
index 95206bb..b01e544 100644
--- a/pkg/compiler/lib/src/null_compiler_output.dart
+++ b/pkg/compiler/lib/src/null_compiler_output.dart
@@ -29,10 +29,13 @@
NullSink(this.name);
+ @override
void add(String value) {}
+ @override
void close() {}
+ @override
String toString() => name;
/// Convenience method for getting an [api.CompilerOutputProvider].
@@ -53,5 +56,6 @@
@override
void close() {}
+ @override
String toString() => 'NullBinarySink($uri)';
}
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index c9c8862..9ee2539 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -136,15 +136,19 @@
bool disableProgramSplit = false;
/// Diagnostic option: If `true`, warnings cause the compilation to fail.
+ @override
bool fatalWarnings = false;
/// Diagnostic option: Emit terse diagnostics without howToFix.
+ @override
bool terseDiagnostics = false;
/// Diagnostic option: If `true`, warnings are not reported.
+ @override
bool suppressWarnings = false;
/// Diagnostic option: If `true`, hints are not reported.
+ @override
bool suppressHints = false;
/// Diagnostic option: List of packages for which warnings and hints are
@@ -449,14 +453,17 @@
}
/// Returns `true` if warnings and hints are shown for all packages.
+ @override
bool get showAllPackageWarnings {
return shownPackageWarnings != null && shownPackageWarnings.isEmpty;
}
/// Returns `true` if warnings and hints are hidden for all packages.
+ @override
bool get hidePackageWarnings => shownPackageWarnings == null;
/// Returns `true` if warnings should be should for [uri].
+ @override
bool showPackageWarningsFor(Uri uri) {
if (showAllPackageWarnings) {
return true;
@@ -485,6 +492,7 @@
static const trusted = const CheckPolicy(isTrusted: true);
static const checked = const CheckPolicy(isEmitted: true);
+ @override
String toString() => 'CheckPolicy(isTrusted=$isTrusted,'
'isEmitted=$isEmitted)';
}
diff --git a/pkg/compiler/lib/src/ordered_typeset.dart b/pkg/compiler/lib/src/ordered_typeset.dart
index efec511..ce4ff17 100644
--- a/pkg/compiler/lib/src/ordered_typeset.dart
+++ b/pkg/compiler/lib/src/ordered_typeset.dart
@@ -175,6 +175,7 @@
return null;
}
+ @override
String toString() => types.toString();
}
@@ -213,6 +214,7 @@
int getHierarchyDepth(covariant ClassEntity cls);
OrderedTypeSet getOrderedTypeSet(covariant ClassEntity cls);
+ @override
OrderedTypeSet createOrderedTypeSet(
InterfaceType supertype, Link<DartType> interfaces) {
// TODO(15296): Collapse these iterations to one when the order is not
@@ -305,6 +307,7 @@
return new OrderedTypeSet.internal(levels, levels.last);
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
for (int depth = 0; depth <= maxDepth; depth++) {
diff --git a/pkg/compiler/lib/src/resolution/registry.dart b/pkg/compiler/lib/src/resolution/registry.dart
index 853beb3..9fdb9bb 100644
--- a/pkg/compiler/lib/src/resolution/registry.dart
+++ b/pkg/compiler/lib/src/resolution/registry.dart
@@ -103,6 +103,7 @@
_constantLiterals.add(constant);
}
+ @override
Iterable<ConstantExpression> get constantLiterals {
return _constantLiterals != null
? _constantLiterals
@@ -140,6 +141,7 @@
return _genericInstantiations ?? const <GenericInstantiation>[];
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('ResolutionWorldImpactBuilder($name)');
diff --git a/pkg/compiler/lib/src/serialization/abstract_sink.dart b/pkg/compiler/lib/src/serialization/abstract_sink.dart
index 0c95e75..737c314 100644
--- a/pkg/compiler/lib/src/serialization/abstract_sink.dart
+++ b/pkg/compiler/lib/src/serialization/abstract_sink.dart
@@ -43,6 +43,7 @@
_importIndex = new IndexedSink<ImportEntity>(this);
}
+ @override
void begin(String tag) {
if (useDataKinds) {
_tags ??= <String>[];
@@ -51,6 +52,7 @@
}
}
+ @override
void end(Object tag) {
if (useDataKinds) {
_end(tag);
@@ -207,6 +209,7 @@
_writeIntInternal(value);
}
+ @override
void writeTreeNode(ir.TreeNode value) {
_writeDataKind(DataKind.treeNode);
_writeTreeNode(value);
@@ -294,22 +297,27 @@
if (useDataKinds) _writeEnumInternal(kind);
}
+ @override
void writeLibrary(IndexedLibrary value) {
writeInt(value.libraryIndex);
}
+ @override
void writeClass(IndexedClass value) {
writeInt(value.classIndex);
}
+ @override
void writeTypedef(IndexedTypedef value) {
writeInt(value.typedefIndex);
}
+ @override
void writeMember(IndexedMember value) {
writeInt(value.memberIndex);
}
+ @override
void writeLocal(Local local) {
if (local is JLocal) {
writeEnum(LocalKind.jLocal);
diff --git a/pkg/compiler/lib/src/serialization/abstract_source.dart b/pkg/compiler/lib/src/serialization/abstract_source.dart
index a78fbea..b9660bd 100644
--- a/pkg/compiler/lib/src/serialization/abstract_source.dart
+++ b/pkg/compiler/lib/src/serialization/abstract_source.dart
@@ -27,14 +27,17 @@
_importIndex = new IndexedSource<ImportEntity>(this);
}
+ @override
void begin(String tag) {
if (useDataKinds) _begin(tag);
}
+ @override
void end(String tag) {
if (useDataKinds) _end(tag);
}
+ @override
void registerComponentLookup(ComponentLookup componentLookup) {
assert(_componentLookup == null);
_componentLookup = componentLookup;
@@ -45,6 +48,7 @@
return _componentLookup;
}
+ @override
void registerEntityLookup(EntityLookup entityLookup) {
assert(_entityLookup == null);
_entityLookup = entityLookup;
@@ -55,6 +59,7 @@
return _entityLookup;
}
+ @override
void registerLocalLookup(LocalLookup localLookup) {
assert(_localLookup == null);
_localLookup = localLookup;
@@ -71,18 +76,22 @@
return source.read(f);
}
+ @override
IndexedLibrary readLibrary() {
return getIndexedLibrary(readInt());
}
+ @override
IndexedClass readClass() {
return getIndexedClass(readInt());
}
+ @override
IndexedTypedef readTypedef() {
return getIndexedTypedef(readInt());
}
+ @override
IndexedMember readMember() {
return getIndexedMember(readInt());
}
@@ -409,6 +418,7 @@
return _readConstant();
}
+ @override
double readDoubleValue() {
_checkDataKind(DataKind.double);
return _readDoubleValue();
@@ -423,6 +433,7 @@
return data.getFloat64(0);
}
+ @override
int readIntegerValue() {
_checkDataKind(DataKind.int);
return _readBigInt().toInt();
diff --git a/pkg/compiler/lib/src/serialization/binary_sink.dart b/pkg/compiler/lib/src/serialization/binary_sink.dart
index ae11f9b..3f771b4 100644
--- a/pkg/compiler/lib/src/serialization/binary_sink.dart
+++ b/pkg/compiler/lib/src/serialization/binary_sink.dart
@@ -16,9 +16,11 @@
: _bufferedSink = new BufferedSink(sink),
super(useDataKinds: useDataKinds);
+ @override
void _begin(String tag) {
// TODO(johnniwinther): Support tags in binary serialization?
}
+ @override
void _end(String tag) {
// TODO(johnniwinther): Support tags in binary serialization?
}
@@ -57,6 +59,7 @@
_writeIntInternal(value.index);
}
+ @override
void close() {
_bufferedSink.flushAndDestroy();
_bufferedSink = null;
@@ -64,5 +67,6 @@
}
/// Returns the number of bytes written to this data sink.
+ @override
int get length => _length;
}
diff --git a/pkg/compiler/lib/src/serialization/binary_source.dart b/pkg/compiler/lib/src/serialization/binary_source.dart
index c68e4c9..11132b9 100644
--- a/pkg/compiler/lib/src/serialization/binary_source.dart
+++ b/pkg/compiler/lib/src/serialization/binary_source.dart
@@ -14,7 +14,9 @@
BinarySourceImpl(this._bytes, {bool useDataKinds: false})
: super(useDataKinds: useDataKinds);
+ @override
void _begin(String tag) {}
+ @override
void _end(String tag) {}
int _readByte() => _bytes[_byteOffset++];
diff --git a/pkg/compiler/lib/src/serialization/helpers.dart b/pkg/compiler/lib/src/serialization/helpers.dart
index d6db5f2..4bb57a4 100644
--- a/pkg/compiler/lib/src/serialization/helpers.dart
+++ b/pkg/compiler/lib/src/serialization/helpers.dart
@@ -71,14 +71,17 @@
Tag(this.value);
+ @override
int get hashCode => value.hashCode * 13;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! Tag) return false;
return value == other.value;
}
+ @override
String toString() => 'Tag($value)';
}
@@ -102,6 +105,7 @@
DartTypeWriter(this._sink);
+ @override
void visit(covariant DartType type,
List<FunctionTypeVariable> functionTypeVariables) =>
type.accept(this, functionTypeVariables);
@@ -114,11 +118,13 @@
}
}
+ @override
void visitVoidType(covariant VoidType type,
List<FunctionTypeVariable> functionTypeVariables) {
_sink.writeEnum(DartTypeKind.voidType);
}
+ @override
void visitTypeVariableType(covariant TypeVariableType type,
List<FunctionTypeVariable> functionTypeVariables) {
_sink.writeEnum(DartTypeKind.typeVariable);
@@ -126,6 +132,7 @@
_sink.writeInt(typeVariable.typeVariableIndex);
}
+ @override
void visitFunctionTypeVariable(covariant FunctionTypeVariable type,
List<FunctionTypeVariable> functionTypeVariables) {
int index = functionTypeVariables.indexOf(type);
@@ -138,6 +145,7 @@
}
}
+ @override
void visitFunctionType(covariant FunctionType type,
List<FunctionTypeVariable> functionTypeVariables) {
_sink.writeEnum(DartTypeKind.functionType);
@@ -157,6 +165,7 @@
}
}
+ @override
void visitInterfaceType(covariant InterfaceType type,
List<FunctionTypeVariable> functionTypeVariables) {
_sink.writeEnum(DartTypeKind.interfaceType);
@@ -164,6 +173,7 @@
visitTypes(type.typeArguments, functionTypeVariables);
}
+ @override
void visitTypedefType(covariant TypedefType type,
List<FunctionTypeVariable> functionTypeVariables) {
_sink.writeEnum(DartTypeKind.typedef);
@@ -172,11 +182,13 @@
_sink._writeDartType(type.unaliased, functionTypeVariables);
}
+ @override
void visitDynamicType(covariant DynamicType type,
List<FunctionTypeVariable> functionTypeVariables) {
_sink.writeEnum(DartTypeKind.dynamicType);
}
+ @override
void visitFutureOrType(covariant FutureOrType type,
List<FunctionTypeVariable> functionTypeVariables) {
_sink.writeEnum(DartTypeKind.futureOr);
@@ -217,27 +229,32 @@
}
}
+ @override
void defaultDartType(
ir.DartType node, List<ir.TypeParameter> functionTypeVariables) {
throw new UnsupportedError(
"Unexpected ir.DartType $node (${node.runtimeType}).");
}
+ @override
void visitInvalidType(
ir.InvalidType node, List<ir.TypeParameter> functionTypeVariables) {
_sink.writeEnum(DartTypeNodeKind.invalidType);
}
+ @override
void visitDynamicType(
ir.DynamicType node, List<ir.TypeParameter> functionTypeVariables) {
_sink.writeEnum(DartTypeNodeKind.dynamicType);
}
+ @override
void visitVoidType(
ir.VoidType node, List<ir.TypeParameter> functionTypeVariables) {
_sink.writeEnum(DartTypeNodeKind.voidType);
}
+ @override
void visitBottomType(
ir.BottomType node, List<ir.TypeParameter> functionTypeVariables) {
if (node == const DoesNotCompleteType()) {
@@ -247,6 +264,7 @@
}
}
+ @override
void visitInterfaceType(
ir.InterfaceType node, List<ir.TypeParameter> functionTypeVariables) {
if (node is ThisInterfaceType) {
@@ -260,6 +278,7 @@
visitTypes(node.typeArguments, functionTypeVariables);
}
+ @override
void visitFunctionType(
ir.FunctionType node, List<ir.TypeParameter> functionTypeVariables) {
_sink.writeEnum(DartTypeNodeKind.functionType);
@@ -286,6 +305,7 @@
_sink.end(functionTypeNodeTag);
}
+ @override
void visitTypeParameterType(
ir.TypeParameterType node, List<ir.TypeParameter> functionTypeVariables) {
int index = functionTypeVariables.indexOf(node.parameter);
@@ -302,6 +322,7 @@
}
}
+ @override
void visitTypedefType(
ir.TypedefType node, List<ir.TypeParameter> functionTypeVariables) {
_sink.writeEnum(DartTypeNodeKind.typedef);
diff --git a/pkg/compiler/lib/src/serialization/member_data.dart b/pkg/compiler/lib/src/serialization/member_data.dart
index b4aeee12..f088210 100644
--- a/pkg/compiler/lib/src/serialization/member_data.dart
+++ b/pkg/compiler/lib/src/serialization/member_data.dart
@@ -108,6 +108,7 @@
return _members[name];
}
+ @override
String toString() => '_LibraryData($node(${identityHashCode(node)}))';
}
@@ -137,6 +138,7 @@
return _members[name];
}
+ @override
String toString() => '_ClassData($node(${identityHashCode(node)}))';
}
@@ -180,5 +182,6 @@
return index;
}
+ @override
String toString() => '_MemberData($node(${identityHashCode(node)}))';
}
diff --git a/pkg/compiler/lib/src/serialization/object_sink.dart b/pkg/compiler/lib/src/serialization/object_sink.dart
index 3246b9f..31376e3 100644
--- a/pkg/compiler/lib/src/serialization/object_sink.dart
+++ b/pkg/compiler/lib/src/serialization/object_sink.dart
@@ -14,10 +14,12 @@
ObjectSink(this._data, {bool useDataKinds})
: super(useDataKinds: useDataKinds);
+ @override
void _begin(String tag) {
_data.add(new Tag('begin:$tag'));
}
+ @override
void _end(String tag) {
_data.add(new Tag('end:$tag'));
}
diff --git a/pkg/compiler/lib/src/serialization/object_source.dart b/pkg/compiler/lib/src/serialization/object_source.dart
index 4ce571e..54207a2 100644
--- a/pkg/compiler/lib/src/serialization/object_source.dart
+++ b/pkg/compiler/lib/src/serialization/object_source.dart
@@ -21,6 +21,7 @@
return value;
}
+ @override
void _begin(String tag) {
Tag expectedTag = new Tag('begin:$tag');
Tag actualTag = _read();
@@ -30,6 +31,7 @@
"Expected $expectedTag, found $actualTag.$_errorContext");
}
+ @override
void _end(String tag) {
Tag expectedTag = new Tag('end:$tag');
Tag actualTag = _read();
diff --git a/pkg/compiler/lib/src/serialization/task.dart b/pkg/compiler/lib/src/serialization/task.dart
index 3aac9f3..56ab4bd 100644
--- a/pkg/compiler/lib/src/serialization/task.dart
+++ b/pkg/compiler/lib/src/serialization/task.dart
@@ -49,6 +49,7 @@
SerializationTask(this.compiler, Measurer measurer) : super(measurer);
+ @override
String get name => 'Serialization';
void serialize(GlobalTypeInferenceResults results) {
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index f6551af..3a6f81a 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -176,6 +176,7 @@
class CompilerSourceFileProvider extends SourceFileProvider {
// TODO(johnniwinther): Remove this when no longer needed for the old compiler
// API.
+ @override
Future<List<int>> call(Uri resourceUri) =>
readFromUri(resourceUri).then((input) => input.data);
@@ -372,6 +373,7 @@
return uri;
}
+ @override
OutputSink createOutputSink(String name, String extension, OutputType type) {
Uri uri = createUri(name, extension, type);
bool isPrimaryOutput = uri == out;
@@ -474,8 +476,10 @@
_OutputSinkWrapper(this.onAdd, this.onClose);
+ @override
void add(String data) => onAdd(data);
+ @override
void close() => onClose();
}
@@ -485,9 +489,11 @@
_BinaryOutputSinkWrapper(this.onWrite, this.onClose);
+ @override
void write(List<int> data, [int start = 0, int end]) =>
onWrite(data, start, end);
+ @override
void close() => onClose();
}
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index bbb9618..242fd7a 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -83,11 +83,14 @@
class KernelSsaGraphBuilder extends ir.Visitor
with GraphBuilder, SsaBuilderFieldMixin {
+ @override
final MemberEntity targetElement;
final MemberEntity initialTargetElement;
+ @override
final JClosedWorld closedWorld;
final CodegenWorldBuilder _worldBuilder;
+ @override
final CodegenRegistry registry;
final ClosureData closureDataLookup;
@@ -105,6 +108,7 @@
HInstruction rethrowableException;
+ @override
final Compiler compiler;
@override
@@ -112,8 +116,10 @@
final SourceInformationStrategy _sourceInformationStrategy;
final JsToElementMap _elementMap;
+ @override
final GlobalTypeInferenceResults globalInferenceResults;
LoopHandler loopHandler;
+ @override
TypeBuilder typeBuilder;
final NativeEmitter nativeEmitter;
@@ -1957,6 +1963,7 @@
..cleanUp();
}
+ @override
HInstruction callSetRuntimeTypeInfo(HInstruction typeInfo,
HInstruction newObject, SourceInformation sourceInformation) {
// Set the runtime type information on the object.
@@ -5056,6 +5063,7 @@
}
}
+ @override
void visitYieldStatement(ir.YieldStatement node) {
node.expression.accept(this);
add(new HYield(abstractValueDomain, pop(), node.isYieldStar,
@@ -6611,8 +6619,10 @@
KernelTypeBuilder(KernelSsaGraphBuilder builder, this._elementMap)
: super(builder);
+ @override
KernelSsaGraphBuilder get builder => super.builder;
+ @override
ClassTypeVariableAccess computeTypeVariableAccess(MemberEntity member) {
return _elementMap.getClassTypeVariableAccessForMember(member);
}
@@ -6625,17 +6635,22 @@
static bool check(ir.Initializer initializer) =>
initializer.accept(new _ErroneousInitializerVisitor());
+ @override
bool defaultInitializer(ir.Node node) => false;
+ @override
bool visitInvalidInitializer(ir.InvalidInitializer node) => true;
+ @override
bool visitLocalInitializer(ir.LocalInitializer node) {
return node.variable.initializer?.accept(this) ?? false;
}
// Expressions: Does the expression always throw?
+ @override
bool defaultExpression(ir.Expression node) => false;
+ @override
bool visitThrow(ir.Throw node) => true;
// TODO(sra): We might need to match other expressions that always throw but
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index ffccada..6c5852a 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -54,6 +54,7 @@
: this.backend = backend,
super(backend.compiler.measurer);
+ @override
String get name => 'SSA code generator';
js.Fun buildJavaScriptFunction(bool needsAsyncRewrite, FunctionEntity element,
@@ -772,8 +773,10 @@
}
// The regular [visitIf] method implements the needed logic.
+ @override
bool visitIfInfo(HIfBlockInformation info) => false;
+ @override
bool visitSwitchInfo(HSwitchBlockInformation info) {
bool isExpression = isJSExpression(info.expression);
if (!isExpression) {
@@ -845,23 +848,28 @@
return true;
}
+ @override
bool visitSequenceInfo(HStatementSequenceInformation info) {
return false;
}
+ @override
bool visitSubGraphInfo(HSubGraphBlockInformation info) {
visitSubGraph(info.subGraph);
return true;
}
+ @override
bool visitSubExpressionInfo(HSubExpressionBlockInformation info) {
return false;
}
+ @override
bool visitAndOrInfo(HAndOrBlockInformation info) {
return false;
}
+ @override
bool visitTryInfo(HTryBlockInformation info) {
js.Block body = generateStatementsInNewBlock(info.body);
js.Catch catchPart = null;
@@ -902,6 +910,7 @@
}
}
+ @override
bool visitLoopInfo(HLoopBlockInformation info) {
HExpressionInformation condition = info.condition;
bool isConditionExpression = isJSCondition(condition);
@@ -1122,6 +1131,7 @@
return true;
}
+ @override
bool visitLabeledBlockInfo(HLabeledBlockInformation labeledBlockInfo) {
Link<Entity> continueOverrides = const Link<Entity>();
@@ -1408,6 +1418,7 @@
.withSourceInformation(sourceInformation));
}
+ @override
visitLateValue(HLateValue node) {
use(node.target);
}
@@ -1476,21 +1487,33 @@
}
}
+ @override
visitIdentity(HIdentity node) {
emitIdentityComparison(node, node.sourceInformation, inverse: false);
}
+ @override
visitAdd(HAdd node) => visitInvokeBinary(node, '+');
+ @override
visitDivide(HDivide node) => visitInvokeBinary(node, '/');
+ @override
visitMultiply(HMultiply node) => visitInvokeBinary(node, '*');
+ @override
visitSubtract(HSubtract node) => visitInvokeBinary(node, '-');
+ @override
visitBitAnd(HBitAnd node) => visitBitInvokeBinary(node, '&');
+ @override
visitBitNot(HBitNot node) => visitBitInvokeUnary(node, '~');
+ @override
visitBitOr(HBitOr node) => visitBitInvokeBinary(node, '|');
+ @override
visitBitXor(HBitXor node) => visitBitInvokeBinary(node, '^');
+ @override
visitShiftLeft(HShiftLeft node) => visitBitInvokeBinary(node, '<<');
+ @override
visitShiftRight(HShiftRight node) => visitBitInvokeBinary(node, '>>>');
+ @override
visitTruncatingDivide(HTruncatingDivide node) {
assert(node.isUInt31(_abstractValueDomain).isDefinitelyTrue);
// TODO(karlklose): Enable this assertion again when type propagation is
@@ -1506,12 +1529,15 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
visitRemainder(HRemainder node) {
return visitInvokeBinary(node, '%');
}
+ @override
visitNegate(HNegate node) => visitInvokeUnary(node, '-');
+ @override
visitAbs(HAbs node) {
use(node.operand);
push(js
@@ -1519,11 +1545,16 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
visitLess(HLess node) => visitRelational(node, '<');
+ @override
visitLessEqual(HLessEqual node) => visitRelational(node, '<=');
+ @override
visitGreater(HGreater node) => visitRelational(node, '>');
+ @override
visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>=');
+ @override
visitBoolify(HBoolify node) {
assert(node.inputs.length == 1);
use(node.inputs[0]);
@@ -1532,10 +1563,12 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
visitExit(HExit node) {
// Don't do anything.
}
+ @override
visitGoto(HGoto node) {
HBasicBlock block = node.block;
assert(block.successors.length == 1);
@@ -1556,6 +1589,7 @@
continueSubGraph(dominated.first);
}
+ @override
visitLoopBranch(HLoopBranch node) {
assert(node.block == subGraph.end);
// We are generating code for a loop condition.
@@ -1568,6 +1602,7 @@
}
}
+ @override
visitBreak(HBreak node) {
assert(node.block.successors.length == 1);
if (node.label != null) {
@@ -1594,6 +1629,7 @@
}
}
+ @override
visitContinue(HContinue node) {
assert(node.block.successors.length == 1);
if (node.label != null) {
@@ -1622,6 +1658,7 @@
}
}
+ @override
visitExitTry(HExitTry node) {
// An [HExitTry] is used to represent the control flow graph of a
// try/catch block, ie the try body is always a predecessor
@@ -1631,6 +1668,7 @@
continueSubGraph(node.bodyTrySuccessor);
}
+ @override
visitTry(HTry node) {
// We should never get here. Try/catch/finally is always handled using block
// information in [visitTryInfo].
@@ -1729,6 +1767,7 @@
return js.If(test, thenPart, elsePart);
}
+ @override
visitIf(HIf node) {
if (tryControlFlowOperation(node)) return;
@@ -1764,6 +1803,7 @@
}
}
+ @override
void visitInterceptor(HInterceptor node) {
if (node.isConditionalConstantInterceptor) {
assert(node.inputs.length == 2);
@@ -1787,6 +1827,7 @@
}
}
+ @override
visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
use(node.receiver);
js.Expression object = pop();
@@ -1829,6 +1870,7 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
void visitInvokeConstructorBody(HInvokeConstructorBody node) {
use(node.inputs[0]);
js.Expression object = pop();
@@ -1841,6 +1883,7 @@
node.element, new CallStructure.unnamed(arguments.length)));
}
+ @override
void visitInvokeGeneratorBody(HInvokeGeneratorBody node) {
JGeneratorBody element = node.element;
if (element.isInstanceMember) {
@@ -1862,6 +1905,7 @@
.registerStaticUse(new StaticUse.generatorBodyInvoke(node.element));
}
+ @override
void visitOneShotInterceptor(HOneShotInterceptor node) {
List<js.Expression> arguments = visitArguments(node.inputs);
var isolate = new js.VariableUse(
@@ -1976,6 +2020,7 @@
}
}
+ @override
visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
use(node.receiver);
js.Name name = _namer.invocationName(node.selector);
@@ -1985,6 +2030,7 @@
registerSetter(node, needsCheck: node.needsCheck);
}
+ @override
visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
use(node.receiver);
js.Name name = _namer.invocationName(node.selector);
@@ -1994,6 +2040,7 @@
registerGetter(node);
}
+ @override
visitInvokeClosure(HInvokeClosure node) {
Selector call = new Selector.callClosureFrom(node.selector);
use(node.receiver);
@@ -2008,6 +2055,7 @@
new ConstrainedDynamicUse(call, null, node.typeArguments));
}
+ @override
visitInvokeStatic(HInvokeStatic node) {
MemberEntity element = node.element;
node.instantiatedTypes?.forEach(_registry.registerInstantiation);
@@ -2056,6 +2104,7 @@
}
}
+ @override
visitInvokeSuper(HInvokeSuper node) {
MemberEntity superElement = node.element;
ClassEntity superClass = superElement.enclosingClass;
@@ -2116,6 +2165,7 @@
}
}
+ @override
visitFieldGet(HFieldGet node) {
use(node.receiver);
if (node.isNullCheck) {
@@ -2133,6 +2183,7 @@
}
}
+ @override
visitFieldSet(HFieldSet node) {
FieldEntity element = node.element;
_registry.registerStaticUse(new StaticUse.fieldSet(element));
@@ -2147,12 +2198,14 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
visitGetLength(HGetLength node) {
use(node.receiver);
push(new js.PropertyAccess.field(pop(), 'length')
.withSourceInformation(node.sourceInformation));
}
+ @override
visitReadModifyWrite(HReadModifyWrite node) {
FieldEntity element = node.element;
_registry.registerStaticUse(new StaticUse.fieldGet(element));
@@ -2173,10 +2226,12 @@
}
}
+ @override
visitLocalGet(HLocalGet node) {
use(node.receiver);
}
+ @override
visitLocalSet(HLocalSet node) {
use(node.value);
assignVariable(
@@ -2190,6 +2245,7 @@
_registry.worldImpact, nativeBehavior, node);
}
+ @override
visitForeignCode(HForeignCode node) {
List<HInstruction> inputs = node.inputs;
if (node.isJsStatement()) {
@@ -2221,6 +2277,7 @@
}
}
+ @override
visitCreate(HCreate node) {
js.Expression jsClassReference = _emitter.constructorAccess(node.element);
List<js.Expression> arguments = visitArguments(node.inputs, start: 0);
@@ -2242,6 +2299,7 @@
}
}
+ @override
visitCreateBox(HCreateBox node) {
push(new js.ObjectInitializer(<js.Property>[]));
}
@@ -2267,6 +2325,7 @@
push(expression);
}
+ @override
visitConstant(HConstant node) {
assert(isGenerateAtUseSite(node));
generateConstant(node.constant, node.sourceInformation);
@@ -2279,6 +2338,7 @@
}
}
+ @override
visitNot(HNot node) {
assert(node.inputs.length == 1);
generateNot(node.inputs[0], node.sourceInformation);
@@ -2348,6 +2408,7 @@
}
}
+ @override
visitParameterValue(HParameterValue node) {
assert(!isGenerateAtUseSite(node));
String name = variableNames.getName(node);
@@ -2355,12 +2416,14 @@
declaredLocals.add(name);
}
+ @override
visitLocalValue(HLocalValue node) {
assert(!isGenerateAtUseSite(node));
String name = variableNames.getName(node);
collectedVariableDeclarations.add(name);
}
+ @override
visitPhi(HPhi node) {
// This method is only called for phis that are generated at use
// site. A phi can be generated at use site only if it is the
@@ -2392,6 +2455,7 @@
}
}
+ @override
visitReturn(HReturn node) {
assert(node.inputs.length == 1);
HInstruction input = node.inputs[0];
@@ -2405,10 +2469,12 @@
}
}
+ @override
visitThis(HThis node) {
push(new js.This());
}
+ @override
visitThrow(HThrow node) {
if (node.isRethrow) {
use(node.inputs[0]);
@@ -2421,23 +2487,27 @@
}
}
+ @override
visitAwait(HAwait node) {
use(node.inputs[0]);
push(new js.Await(pop()).withSourceInformation(node.sourceInformation));
}
+ @override
visitYield(HYield node) {
use(node.inputs[0]);
pushStatement(new js.DartYield(pop(), node.hasStar)
.withSourceInformation(node.sourceInformation));
}
+ @override
visitRangeConversion(HRangeConversion node) {
// Range conversion instructions are removed by the value range
// analyzer.
assert(false);
}
+ @override
visitBoundsCheck(HBoundsCheck node) {
// TODO(ngeoffray): Separate the two checks of the bounds check, so,
// e.g., the zero checks can be shared if possible.
@@ -2518,6 +2588,7 @@
}
}
+ @override
visitThrowExpression(HThrowExpression node) {
HInstruction argument = node.inputs[0];
use(argument);
@@ -2532,10 +2603,12 @@
push(value);
}
+ @override
void visitSwitch(HSwitch node) {
// Switches are handled using [visitSwitchInfo].
}
+ @override
void visitStatic(HStatic node) {
MemberEntity element = node.element;
assert(element.isFunction || element.isField);
@@ -2552,6 +2625,7 @@
}
}
+ @override
void visitLazyStatic(HLazyStatic node) {
FieldEntity element = node.element;
_registry.registerStaticUse(new StaticUse.staticInit(element));
@@ -2561,6 +2635,7 @@
push(call);
}
+ @override
void visitStaticStore(HStaticStore node) {
_registry.registerStaticUse(new StaticUse.staticSet(node.element));
js.Node variable = _emitter.staticFieldAccess(node.element);
@@ -2569,6 +2644,7 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
void visitStringConcat(HStringConcat node) {
use(node.left);
js.Expression jsLeft = pop();
@@ -2577,6 +2653,7 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
void visitStringify(HStringify node) {
HInstruction input = node.inputs.first;
if (input.isString(_abstractValueDomain).isDefinitelyTrue) {
@@ -2607,6 +2684,7 @@
}
}
+ @override
void visitLiteralList(HLiteralList node) {
_registry
// ignore:deprecated_member_use_from_same_package
@@ -2623,6 +2701,7 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
void visitIndex(HIndex node) {
use(node.receiver);
js.Expression receiver = pop();
@@ -2631,6 +2710,7 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
void visitIndexAssign(HIndexAssign node) {
use(node.receiver);
js.Expression receiver = pop();
@@ -2902,10 +2982,12 @@
.withSourceInformation(sourceInformation));
}
+ @override
void visitIs(HIs node) {
emitIs(node, "===", node.sourceInformation);
}
+ @override
void visitIsViaInterceptor(HIsViaInterceptor node) {
emitIsViaInterceptor(node, node.sourceInformation, negative: false);
}
@@ -3019,6 +3101,7 @@
throw failedAt(input, 'Unexpected check: $type.');
}
+ @override
void visitTypeConversion(HTypeConversion node) {
if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) {
js.Expression test = generateReceiverOrArgumentTypeTest(node);
@@ -3078,17 +3161,20 @@
.withSourceInformation(node.sourceInformation));
}
+ @override
void visitTypeKnown(HTypeKnown node) {
// [HTypeKnown] instructions are removed before generating code.
assert(false);
}
+ @override
void visitTypeInfoReadRaw(HTypeInfoReadRaw node) {
use(node.inputs[0]);
js.Expression receiver = pop();
push(js.js(r'#.#', [receiver, _namer.rtiFieldJsName]));
}
+ @override
void visitTypeInfoReadVariable(HTypeInfoReadVariable node) {
TypeVariableEntity element = node.variable.element;
int index = element.index;
@@ -3143,6 +3229,7 @@
}
}
+ @override
void visitTypeInfoExpression(HTypeInfoExpression node) {
DartType type = node.dartType;
if (node.isTypeVariableReplacement) {
diff --git a/pkg/compiler/lib/src/ssa/codegen_helpers.dart b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
index 6c28b79..4ad0571 100644
--- a/pkg/compiler/lib/src/ssa/codegen_helpers.dart
+++ b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
@@ -27,11 +27,13 @@
AbstractValueDomain get _abstractValueDomain =>
_closedWorld.abstractValueDomain;
+ @override
void visitGraph(HGraph graph) {
this.graph = graph;
visitDominatorTree(graph);
}
+ @override
visitBasicBlock(HBasicBlock block) {
HInstruction instruction = block.first;
while (instruction != null) {
@@ -63,10 +65,12 @@
}
}
+ @override
HInstruction visitInstruction(HInstruction node) {
return node;
}
+ @override
HInstruction visitIs(HIs node) {
if (node.kind == HIs.RAW_CHECK) {
HInstruction interceptor = node.interceptor;
@@ -78,6 +82,7 @@
return node;
}
+ @override
HInstruction visitIdentity(HIdentity node) {
node.singleComparisonOp = simpleOp(node.left, node.right);
return node;
@@ -128,6 +133,7 @@
.isInterceptor(_abstractValueDomain.excludeNull(type))
.isPotentiallyTrue;
+ @override
HInstruction visitInvokeDynamic(HInvokeDynamic node) {
if (node.isInterceptedCall) {
tryReplaceInterceptorWithDummy(node, node.selector, node.mask);
@@ -135,6 +141,7 @@
return node;
}
+ @override
HInstruction visitInvokeSuper(HInvokeSuper node) {
if (node.isInterceptedCall) {
AbstractValue mask = node.getDartReceiver(_closedWorld).instructionType;
@@ -143,6 +150,7 @@
return node;
}
+ @override
HInstruction visitOneShotInterceptor(HOneShotInterceptor node) {
// The receiver parameter should never be replaced with a dummy constant.
return node;
@@ -195,6 +203,7 @@
return false;
}
+ @override
HInstruction visitFieldSet(HFieldSet setter) {
// Pattern match
// t1 = x.f; t2 = t1 + 1; x.f = t2; use(t2) --> ++x.f
@@ -305,6 +314,7 @@
return noMatchingRead();
}
+ @override
visitIf(HIf node) {
if (!_options.experimentToBoolean) return node;
HInstruction condition = node.inputs.single;
@@ -343,10 +353,12 @@
/// Remove [HTypeKnown] instructions from the graph, to make codegen
/// analysis easier.
class SsaTypeKnownRemover extends HBaseVisitor with CodegenPhase {
+ @override
void visitGraph(HGraph graph) {
visitDominatorTree(graph);
}
+ @override
void visitBasicBlock(HBasicBlock block) {
HInstruction instruction = block.first;
while (instruction != null) {
@@ -356,6 +368,7 @@
}
}
+ @override
void visitTypeKnown(HTypeKnown instruction) {
for (HInstruction user in instruction.usedBy) {
if (user is HTypeConversion) {
@@ -374,11 +387,13 @@
SsaTrustedCheckRemover(this._options);
+ @override
void visitGraph(HGraph graph) {
if (!_options.trustPrimitives) return;
visitDominatorTree(graph);
}
+ @override
void visitBasicBlock(HBasicBlock block) {
HInstruction instruction = block.first;
while (instruction != null) {
@@ -388,6 +403,7 @@
}
}
+ @override
void visitTypeConversion(HTypeConversion instruction) {
if (instruction.isReceiverTypeCheck || instruction.isArgumentTypeCheck) {
instruction.block.rewrite(instruction, instruction.checkedInput);
@@ -413,11 +429,13 @@
AbstractValueDomain get _abstractValueDomain =>
_closedWorld.abstractValueDomain;
+ @override
void visitGraph(HGraph graph) {
//this.graph = graph;
visitDominatorTree(graph);
}
+ @override
void visitBasicBlock(HBasicBlock block) {
HInstruction instruction = block.first;
while (instruction != null) {
@@ -426,14 +444,17 @@
}
/// Returns the next instruction.
+ @override
HInstruction visitInstruction(HInstruction node) {
return node.next;
}
+ @override
HInstruction visitFieldSet(HFieldSet setter) {
return tryChainAssignment(setter, setter.value);
}
+ @override
HInstruction visitStaticStore(HStaticStore store) {
return tryChainAssignment(store, store.inputs.single);
}
@@ -589,6 +610,7 @@
SsaInstructionMerger(
this._abstractValueDomain, this.generateAtUseSite, this._superMemberData);
+ @override
void visitGraph(HGraph graph) {
visitDominatorTree(graph);
}
@@ -651,12 +673,14 @@
.isNotEmpty;
}
+ @override
void visitInstruction(HInstruction instruction) {
// A code motion invariant instruction is dealt before visiting it.
assert(!instruction.isCodeMotionInvariant());
analyzeInputs(instruction, 0);
}
+ @override
void visitInvokeSuper(HInvokeSuper instruction) {
MemberEntity superMethod = instruction.element;
Selector selector = instruction.selector;
@@ -677,6 +701,7 @@
}
}
+ @override
void visitIs(HIs instruction) {
// In the general case the input might be used multple multiple times, so it
// must not be set generate at use site.
@@ -695,6 +720,7 @@
// A bounds check method must not have its first input generated at use site,
// because it's using it twice.
+ @override
void visitBoundsCheck(HBoundsCheck instruction) {
analyzeInputs(instruction, 1);
}
@@ -702,6 +728,7 @@
// An identity operation must only have its inputs generated at use site if
// does not require an expression with multiple uses (because of null /
// undefined).
+ @override
void visitIdentity(HIdentity instruction) {
if (instruction.singleComparisonOp != null) {
super.visitIdentity(instruction);
@@ -709,6 +736,7 @@
// Do nothing.
}
+ @override
void visitTypeConversion(HTypeConversion instruction) {
if (!instruction.isArgumentTypeCheck && !instruction.isReceiverTypeCheck) {
assert(instruction.isCheckedModeCheck || instruction.isCastTypeCheck);
@@ -719,6 +747,7 @@
}
}
+ @override
void visitTypeKnown(HTypeKnown instruction) {
// [HTypeKnown] instructions are removed before code generation.
assert(false);
@@ -734,6 +763,7 @@
block.successors[0].predecessors.length == 1;
}
+ @override
void visitBasicBlock(HBasicBlock block) {
// Compensate from not merging blocks: if the block is the
// single predecessor of its single successor, let the successor
@@ -878,6 +908,7 @@
SsaConditionMerger(this.generateAtUseSite, this.controlFlowOperators);
+ @override
void visitGraph(HGraph graph) {
visitPostDominatorTree(graph);
}
@@ -927,6 +958,7 @@
return user.hasSameLoopHeaderAs(input);
}
+ @override
void visitBasicBlock(HBasicBlock block) {
if (block.last is! HIf) return;
HIf startIf = block.last;
@@ -1046,6 +1078,7 @@
SsaShareRegionConstants(this._options);
+ @override
visitGraph(HGraph graph) {
// We need the async rewrite to be smarter about hoisting region constants
// before it is worth-while.
@@ -1056,6 +1089,7 @@
visitBasicBlock(graph.entry);
}
+ @override
visitBasicBlock(HBasicBlock block) {
HInstruction instruction = block.first;
while (instruction != null) {
@@ -1089,6 +1123,7 @@
}
}
+ @override
void visitThis(HThis node) {
int size = 4;
// Compare the size of the unchanged minified with the size of the minified
@@ -1110,6 +1145,7 @@
_cache(node, (_) => true, '_this');
}
+ @override
void visitConstant(HConstant node) {
if (node.usedBy.length <= 1) return;
ConstantValue constant = node.constant;
@@ -1218,6 +1254,7 @@
/// A simple Entity to give intermediate values nice names when not generating
/// minified code.
class _ExpressionName implements Entity {
+ @override
final String name;
_ExpressionName(this.name);
}
diff --git a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
index 3f5d89b..098809b 100644
--- a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
+++ b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
@@ -32,6 +32,7 @@
///
class SsaSimplifyInterceptors extends HBaseVisitor
implements OptimizationPhase {
+ @override
final String name = "SsaSimplifyInterceptors";
final JClosedWorld _closedWorld;
final ClassEntity _enclosingClass;
@@ -46,11 +47,13 @@
AbstractValueDomain get _abstractValueDomain =>
_closedWorld.abstractValueDomain;
+ @override
void visitGraph(HGraph graph) {
this._graph = graph;
visitDominatorTree(graph);
}
+ @override
void visitBasicBlock(HBasicBlock node) {
currentBlock = node;
@@ -65,8 +68,10 @@
}
}
+ @override
bool visitInstruction(HInstruction instruction) => false;
+ @override
bool visitInvoke(HInvoke invoke) {
if (!invoke.isInterceptedCall) return false;
dynamic interceptor = invoke.inputs[0];
@@ -187,6 +192,7 @@
static int useCount(HInstruction user, HInstruction used) =>
user.inputs.where((input) => input == used).length;
+ @override
bool visitInterceptor(HInterceptor node) {
if (node.receiver.nonCheck() == _graph.explicitReceiverParameter) {
// If `explicitReceiverParameter` is set it means the current method is an
@@ -431,6 +437,7 @@
}
}
+ @override
bool visitOneShotInterceptor(HOneShotInterceptor node) {
// 'Undo' the one-shot transformation if the receiver has a constant
// interceptor.
diff --git a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
index 7e6e84c..42e3113 100644
--- a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
+++ b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
@@ -116,6 +116,7 @@
class IndexAssignSpecializer extends InvokeDynamicSpecializer {
const IndexAssignSpecializer();
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -187,6 +188,7 @@
class IndexSpecializer extends InvokeDynamicSpecializer {
const IndexSpecializer();
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -221,10 +223,12 @@
class BitNotSpecializer extends InvokeDynamicSpecializer {
const BitNotSpecializer();
+ @override
constant_system.UnaryOperation operation() {
return constant_system.bitNot;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -241,6 +245,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -266,10 +271,12 @@
class UnaryNegateSpecializer extends InvokeDynamicSpecializer {
const UnaryNegateSpecializer();
+ @override
constant_system.UnaryOperation operation() {
return constant_system.negate;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -297,6 +304,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -322,10 +330,12 @@
class AbsSpecializer extends InvokeDynamicSpecializer {
const AbsSpecializer();
+ @override
constant_system.UnaryOperation operation() {
return constant_system.abs;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -341,6 +351,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -369,6 +380,7 @@
abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
const BinaryArithmeticSpecializer();
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -408,6 +420,7 @@
.isDefinitelyTrue;
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -465,6 +478,7 @@
class AddSpecializer extends BinaryArithmeticSpecializer {
const AddSpecializer();
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -480,10 +494,12 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
constant_system.BinaryOperation operation() {
return constant_system.add;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -506,10 +522,12 @@
class DivideSpecializer extends BinaryArithmeticSpecializer {
const DivideSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.divide;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInstruction instruction,
GlobalTypeInferenceResults results,
@@ -523,6 +541,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -542,6 +561,7 @@
class ModuloSpecializer extends BinaryArithmeticSpecializer {
const ModuloSpecializer();
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -554,10 +574,12 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
constant_system.BinaryOperation operation() {
return constant_system.modulo;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -634,6 +656,7 @@
class RemainderSpecializer extends BinaryArithmeticSpecializer {
const RemainderSpecializer();
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -646,10 +669,12 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
constant_system.BinaryOperation operation() {
return constant_system.remainder;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -672,10 +697,12 @@
class MultiplySpecializer extends BinaryArithmeticSpecializer {
const MultiplySpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.multiply;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -688,6 +715,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -710,10 +738,12 @@
class SubtractSpecializer extends BinaryArithmeticSpecializer {
const SubtractSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.subtract;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -736,10 +766,12 @@
class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
const TruncatingDivideSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.truncatingDivide;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -789,6 +821,7 @@
return false;
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -824,6 +857,7 @@
return null;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -846,6 +880,7 @@
abstract class BinaryBitOpSpecializer extends BinaryArithmeticSpecializer {
const BinaryBitOpSpecializer();
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -895,10 +930,12 @@
class ShiftLeftSpecializer extends BinaryBitOpSpecializer {
const ShiftLeftSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.shiftLeft;
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -933,6 +970,7 @@
return null;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -955,6 +993,7 @@
class ShiftRightSpecializer extends BinaryBitOpSpecializer {
const ShiftRightSpecializer();
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -968,6 +1007,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -1015,6 +1055,7 @@
return null;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -1027,6 +1068,7 @@
computeTypeFromInputTypes(instruction, results, options, closedWorld));
}
+ @override
constant_system.BinaryOperation operation() {
return constant_system.shiftRight;
}
@@ -1041,10 +1083,12 @@
class BitOrSpecializer extends BinaryBitOpSpecializer {
const BitOrSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.bitOr;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -1060,6 +1104,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -1072,6 +1117,7 @@
computeTypeFromInputTypes(instruction, results, options, closedWorld));
}
+ @override
void registerOptimization(
OptimizationTestLog log, HInstruction original, HInstruction converted) {
log.registerBitOr(original, converted);
@@ -1081,10 +1127,12 @@
class BitAndSpecializer extends BinaryBitOpSpecializer {
const BitAndSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.bitAnd;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -1103,6 +1151,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -1115,6 +1164,7 @@
computeTypeFromInputTypes(instruction, results, options, closedWorld));
}
+ @override
void registerOptimization(
OptimizationTestLog log, HInstruction original, HInstruction converted) {
log.registerBitAnd(original, converted);
@@ -1124,10 +1174,12 @@
class BitXorSpecializer extends BinaryBitOpSpecializer {
const BitXorSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.bitXor;
}
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -1143,6 +1195,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -1155,6 +1208,7 @@
computeTypeFromInputTypes(instruction, results, options, closedWorld));
}
+ @override
void registerOptimization(
OptimizationTestLog log, HInstruction original, HInstruction converted) {
log.registerBitXor(original, converted);
@@ -1164,6 +1218,7 @@
abstract class RelationalSpecializer extends InvokeDynamicSpecializer {
const RelationalSpecializer();
+ @override
AbstractValue computeTypeFromInputTypes(
HInvokeDynamic instruction,
GlobalTypeInferenceResults results,
@@ -1178,6 +1233,7 @@
.computeTypeFromInputTypes(instruction, results, options, closedWorld);
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -1209,6 +1265,7 @@
class EqualsSpecializer extends RelationalSpecializer {
const EqualsSpecializer();
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -1250,10 +1307,12 @@
return null;
}
+ @override
constant_system.BinaryOperation operation() {
return constant_system.equal;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
return new HIdentity(instruction.inputs[1], instruction.inputs[2],
@@ -1270,10 +1329,12 @@
class LessSpecializer extends RelationalSpecializer {
const LessSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.less;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
return new HLess(instruction.inputs[1], instruction.inputs[2],
@@ -1290,10 +1351,12 @@
class GreaterSpecializer extends RelationalSpecializer {
const GreaterSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.greater;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
return new HGreater(instruction.inputs[1], instruction.inputs[2],
@@ -1310,10 +1373,12 @@
class GreaterEqualSpecializer extends RelationalSpecializer {
const GreaterEqualSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.greaterEqual;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
return new HGreaterEqual(instruction.inputs[1], instruction.inputs[2],
@@ -1330,10 +1395,12 @@
class LessEqualSpecializer extends RelationalSpecializer {
const LessEqualSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.lessEqual;
}
+ @override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
return new HLessEqual(instruction.inputs[1], instruction.inputs[2],
@@ -1350,10 +1417,12 @@
class CodeUnitAtSpecializer extends InvokeDynamicSpecializer {
const CodeUnitAtSpecializer();
+ @override
constant_system.BinaryOperation operation() {
return constant_system.codeUnitAt;
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -1387,6 +1456,7 @@
class CompareToSpecializer extends InvokeDynamicSpecializer {
const CompareToSpecializer();
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -1436,6 +1506,7 @@
extends InvokeDynamicSpecializer {
const IdempotentStringOperationSpecializer();
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -1482,6 +1553,7 @@
class PatternMatchSpecializer extends InvokeDynamicSpecializer {
const PatternMatchSpecializer();
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
@@ -1510,10 +1582,12 @@
class RoundSpecializer extends InvokeDynamicSpecializer {
const RoundSpecializer();
+ @override
constant_system.UnaryOperation operation() {
return constant_system.round;
}
+ @override
HInstruction tryConvertToBuiltin(
HInvokeDynamic instruction,
HGraph graph,
diff --git a/pkg/compiler/lib/src/ssa/jump_handler.dart b/pkg/compiler/lib/src/ssa/jump_handler.dart
index 20d604b0..df6a83e 100644
--- a/pkg/compiler/lib/src/ssa/jump_handler.dart
+++ b/pkg/compiler/lib/src/ssa/jump_handler.dart
@@ -45,25 +45,34 @@
NullJumpHandler(this.reporter);
+ @override
void generateBreak(SourceInformation sourceInformation,
[LabelDefinition label]) {
reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
'NullJumpHandler.generateBreak should not be called.');
}
+ @override
void generateContinue(SourceInformation sourceInformation,
[LabelDefinition label]) {
reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
'NullJumpHandler.generateContinue should not be called.');
}
+ @override
void forEachBreak(Function ignored) {}
+ @override
void forEachContinue(Function ignored) {}
+ @override
void close() {}
+ @override
bool hasAnyContinue() => false;
+ @override
bool hasAnyBreak() => false;
+ @override
List<LabelDefinition> get labels => const <LabelDefinition>[];
+ @override
JumpTarget get target => null;
}
@@ -73,6 +82,7 @@
/// breaks of the body. Continues in switches is currently not handled.
class TargetJumpHandler implements JumpHandler {
final GraphBuilder builder;
+ @override
final JumpTarget target;
final List<_JumpHandlerEntry> jumps;
@@ -83,6 +93,7 @@
builder.jumpTargets[target] = this;
}
+ @override
void generateBreak(SourceInformation sourceInformation,
[LabelDefinition label]) {
HInstruction breakInstruction;
@@ -98,6 +109,7 @@
jumps.add(new _JumpHandlerEntry(breakInstruction, locals));
}
+ @override
void generateContinue(SourceInformation sourceInformation,
[LabelDefinition label]) {
HInstruction continueInstruction;
@@ -116,18 +128,21 @@
jumps.add(new _JumpHandlerEntry(continueInstruction, locals));
}
+ @override
void forEachBreak(Function action) {
for (_JumpHandlerEntry entry in jumps) {
if (entry.isBreak()) action(entry.jumpInstruction, entry.locals);
}
}
+ @override
void forEachContinue(Function action) {
for (_JumpHandlerEntry entry in jumps) {
if (entry.isContinue()) action(entry.jumpInstruction, entry.locals);
}
}
+ @override
bool hasAnyContinue() {
for (_JumpHandlerEntry entry in jumps) {
if (entry.isContinue()) return true;
@@ -135,6 +150,7 @@
return false;
}
+ @override
bool hasAnyBreak() {
for (_JumpHandlerEntry entry in jumps) {
if (entry.isBreak()) return true;
@@ -142,11 +158,13 @@
return false;
}
+ @override
void close() {
// The mapping from TargetElement to JumpHandler is no longer needed.
builder.jumpTargets.remove(target);
}
+ @override
List<LabelDefinition> get labels {
List<LabelDefinition> result = null;
for (LabelDefinition element in target.labels) {
@@ -167,6 +185,7 @@
SwitchCaseJumpHandler(GraphBuilder builder, JumpTarget target)
: super(builder, target);
+ @override
void generateBreak(SourceInformation sourceInformation,
[LabelDefinition label]) {
if (label == null) {
@@ -189,6 +208,7 @@
return label != null && targetIndexMap.containsKey(label.target);
}
+ @override
void generateContinue(SourceInformation sourceInformation,
[LabelDefinition label]) {
if (isContinueToSwitchCase(label)) {
@@ -212,6 +232,7 @@
}
}
+ @override
void close() {
// The mapping from TargetElement to JumpHandler is no longer needed.
for (JumpTarget target in targetIndexMap.keys) {
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart
index b74bb8c..9c08d57 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -692,15 +692,18 @@
/// For instance used for holding return value of function or the exception of a
/// try-catch statement.
class SyntheticLocal extends Local {
+ @override
final String name;
final Entity executableContext;
final MemberEntity memberContext;
// Avoid slow Object.hashCode.
+ @override
final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30);
static int _nextHashCode = 0;
SyntheticLocal(this.name, this.executableContext, this.memberContext);
+ @override
toString() => 'SyntheticLocal($name)';
}
diff --git a/pkg/compiler/lib/src/ssa/logging.dart b/pkg/compiler/lib/src/ssa/logging.dart
index cdaef90..0a99d31 100644
--- a/pkg/compiler/lib/src/ssa/logging.dart
+++ b/pkg/compiler/lib/src/ssa/logging.dart
@@ -244,6 +244,7 @@
return entries.join(',\n');
}
+ @override
String toString() => 'OptimizationLog(${getText()})';
}
@@ -257,5 +258,6 @@
OptimizationLogEntry(this.tag, this.features);
+ @override
String toString() => '$tag(${features.getText()})';
}
diff --git a/pkg/compiler/lib/src/ssa/loop_handler.dart b/pkg/compiler/lib/src/ssa/loop_handler.dart
index be4fb554..f9fda03 100644
--- a/pkg/compiler/lib/src/ssa/loop_handler.dart
+++ b/pkg/compiler/lib/src/ssa/loop_handler.dart
@@ -313,6 +313,7 @@
// TODO(het): Since kernel simplifies loop breaks and continues, we should
// rewrite the loop handler from scratch to account for the simplified structure
class KernelLoopHandler extends LoopHandler {
+ @override
final KernelSsaGraphBuilder builder;
KernelLoopHandler(KernelSsaGraphBuilder builder)
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index 3b46935..0ec907d 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -188,6 +188,7 @@
visitInstruction(HInstruction node);
+ @override
visitBasicBlock(HBasicBlock node) {
void visitInstructionList(HInstructionList list) {
HInstruction instruction = list.first;
@@ -398,12 +399,14 @@
return validator.isValid;
}
+ @override
toString() => 'HGraph($element)';
}
class HBaseVisitor extends HGraphVisitor implements HVisitor {
HBasicBlock currentBlock;
+ @override
visitBasicBlock(HBasicBlock node) {
currentBlock = node;
@@ -428,93 +431,171 @@
visitFieldAccess(HFieldAccess node) => visitInstruction(node);
visitRelational(HRelational node) => visitInvokeBinary(node);
+ @override
visitAbs(HAbs node) => visitInvokeUnary(node);
+ @override
visitAdd(HAdd node) => visitBinaryArithmetic(node);
+ @override
visitBitAnd(HBitAnd node) => visitBinaryBitOp(node);
+ @override
visitBitNot(HBitNot node) => visitInvokeUnary(node);
+ @override
visitBitOr(HBitOr node) => visitBinaryBitOp(node);
+ @override
visitBitXor(HBitXor node) => visitBinaryBitOp(node);
+ @override
visitBoolify(HBoolify node) => visitInstruction(node);
+ @override
visitBoundsCheck(HBoundsCheck node) => visitCheck(node);
+ @override
visitBreak(HBreak node) => visitJump(node);
+ @override
visitContinue(HContinue node) => visitJump(node);
visitCheck(HCheck node) => visitInstruction(node);
+ @override
visitConstant(HConstant node) => visitInstruction(node);
+ @override
visitCreate(HCreate node) => visitInstruction(node);
+ @override
visitCreateBox(HCreateBox node) => visitInstruction(node);
+ @override
visitDivide(HDivide node) => visitBinaryArithmetic(node);
+ @override
visitExit(HExit node) => visitControlFlow(node);
+ @override
visitExitTry(HExitTry node) => visitControlFlow(node);
+ @override
visitFieldGet(HFieldGet node) => visitFieldAccess(node);
+ @override
visitFieldSet(HFieldSet node) => visitFieldAccess(node);
+ @override
visitForeignCode(HForeignCode node) => visitInstruction(node);
+ @override
visitGetLength(HGetLength node) => visitInstruction(node);
+ @override
visitGoto(HGoto node) => visitControlFlow(node);
+ @override
visitGreater(HGreater node) => visitRelational(node);
+ @override
visitGreaterEqual(HGreaterEqual node) => visitRelational(node);
+ @override
visitIdentity(HIdentity node) => visitRelational(node);
+ @override
visitIf(HIf node) => visitConditionalBranch(node);
+ @override
visitIndex(HIndex node) => visitInstruction(node);
+ @override
visitIndexAssign(HIndexAssign node) => visitInstruction(node);
+ @override
visitInterceptor(HInterceptor node) => visitInstruction(node);
+ @override
visitInvokeClosure(HInvokeClosure node) => visitInvokeDynamic(node);
+ @override
visitInvokeConstructorBody(HInvokeConstructorBody node) =>
visitInvokeStatic(node);
+ @override
visitInvokeGeneratorBody(HInvokeGeneratorBody node) =>
visitInvokeStatic(node);
+ @override
visitInvokeDynamicMethod(HInvokeDynamicMethod node) =>
visitInvokeDynamic(node);
+ @override
visitInvokeDynamicGetter(HInvokeDynamicGetter node) =>
visitInvokeDynamicField(node);
+ @override
visitInvokeDynamicSetter(HInvokeDynamicSetter node) =>
visitInvokeDynamicField(node);
+ @override
visitInvokeStatic(HInvokeStatic node) => visitInvoke(node);
+ @override
visitInvokeSuper(HInvokeSuper node) => visitInvokeStatic(node);
visitJump(HJump node) => visitControlFlow(node);
+ @override
visitLazyStatic(HLazyStatic node) => visitInstruction(node);
+ @override
visitLess(HLess node) => visitRelational(node);
+ @override
visitLessEqual(HLessEqual node) => visitRelational(node);
+ @override
visitLiteralList(HLiteralList node) => visitInstruction(node);
visitLocalAccess(HLocalAccess node) => visitInstruction(node);
+ @override
visitLocalGet(HLocalGet node) => visitLocalAccess(node);
+ @override
visitLocalSet(HLocalSet node) => visitLocalAccess(node);
+ @override
visitLocalValue(HLocalValue node) => visitInstruction(node);
+ @override
visitLoopBranch(HLoopBranch node) => visitConditionalBranch(node);
+ @override
visitNegate(HNegate node) => visitInvokeUnary(node);
+ @override
visitNot(HNot node) => visitInstruction(node);
+ @override
visitOneShotInterceptor(HOneShotInterceptor node) => visitInvokeDynamic(node);
+ @override
visitPhi(HPhi node) => visitInstruction(node);
+ @override
visitMultiply(HMultiply node) => visitBinaryArithmetic(node);
+ @override
visitParameterValue(HParameterValue node) => visitLocalValue(node);
+ @override
visitRangeConversion(HRangeConversion node) => visitCheck(node);
+ @override
visitReadModifyWrite(HReadModifyWrite node) => visitInstruction(node);
+ @override
visitRef(HRef node) => node.value.accept(this);
+ @override
visitRemainder(HRemainder node) => visitBinaryArithmetic(node);
+ @override
visitReturn(HReturn node) => visitControlFlow(node);
+ @override
visitShiftLeft(HShiftLeft node) => visitBinaryBitOp(node);
+ @override
visitShiftRight(HShiftRight node) => visitBinaryBitOp(node);
+ @override
visitSubtract(HSubtract node) => visitBinaryArithmetic(node);
+ @override
visitSwitch(HSwitch node) => visitControlFlow(node);
+ @override
visitStatic(HStatic node) => visitInstruction(node);
+ @override
visitStaticStore(HStaticStore node) => visitInstruction(node);
+ @override
visitStringConcat(HStringConcat node) => visitInstruction(node);
+ @override
visitStringify(HStringify node) => visitInstruction(node);
+ @override
visitThis(HThis node) => visitParameterValue(node);
+ @override
visitThrow(HThrow node) => visitControlFlow(node);
+ @override
visitThrowExpression(HThrowExpression node) => visitInstruction(node);
+ @override
visitTruncatingDivide(HTruncatingDivide node) => visitBinaryArithmetic(node);
+ @override
visitTry(HTry node) => visitControlFlow(node);
+ @override
visitIs(HIs node) => visitInstruction(node);
+ @override
visitLateValue(HLateValue node) => visitInstruction(node);
+ @override
visitIsViaInterceptor(HIsViaInterceptor node) => visitInstruction(node);
+ @override
visitTypeConversion(HTypeConversion node) => visitCheck(node);
+ @override
visitTypeKnown(HTypeKnown node) => visitCheck(node);
+ @override
visitAwait(HAwait node) => visitInstruction(node);
+ @override
visitYield(HYield node) => visitInstruction(node);
+ @override
visitTypeInfoReadRaw(HTypeInfoReadRaw node) => visitInstruction(node);
+ @override
visitTypeInfoReadVariable(HTypeInfoReadVariable node) =>
visitInstruction(node);
+ @override
visitTypeInfoExpression(HTypeInfoExpression node) => visitInstruction(node);
}
@@ -669,6 +750,7 @@
successors = const <HBasicBlock>[],
dominatedBlocks = <HBasicBlock>[];
+ @override
int get hashCode => id;
bool isNew() => status == STATUS_NEW;
@@ -762,6 +844,7 @@
instruction.notifyAddedToBlock(this);
}
+ @override
void remove(HInstruction instruction) {
assert(isOpen() || isClosed());
assert(instruction is! HPhi);
@@ -924,6 +1007,7 @@
other.dominatorDfsOut <= this.dominatorDfsOut;
}
+ @override
toString() => 'HBasicBlock($id)';
}
@@ -996,6 +1080,7 @@
assert(inputs.every((e) => e != null), "inputs: $inputs");
}
+ @override
int get hashCode => id;
bool useGvn() => _useGvn;
@@ -1473,6 +1558,7 @@
@override
accept(HVisitor visitor) => visitor.visitRef(this);
+ @override
String toString() => 'HRef(${value})';
}
@@ -1490,9 +1576,13 @@
sourceInformation = value.sourceInformation;
}
+ @override
accept(HVisitor visitor) => visitor.visitBoolify(this);
+ @override
int typeCode() => HInstruction.BOOLIFY_TYPECODE;
+ @override
bool typeEquals(other) => other is HBoolify;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -1506,9 +1596,12 @@
setUseGvn();
}
HInstruction get checkedInput => inputs[0];
+ @override
bool isJsStatement() => true;
+ @override
bool canThrow(AbstractValueDomain domain) => true;
+ @override
HInstruction nonCheck() => checkedInput.nonCheck();
}
@@ -1532,11 +1625,16 @@
// There can be an additional fourth input which is the index to report to
// [ioore]. This is used by the expansion of [JSArray.removeLast].
HInstruction get reportedIndex => inputs.length > 3 ? inputs[3] : index;
+ @override
bool isControlFlow() => true;
+ @override
accept(HVisitor visitor) => visitor.visitBoundsCheck(this);
+ @override
int typeCode() => HInstruction.BOUNDS_CHECK_TYPECODE;
+ @override
bool typeEquals(other) => other is HBoundsCheck;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -1554,7 +1652,9 @@
// have an `instructionType`, or statement-like [HInstruction]s should
// have a throwing getter.
: super(inputs, domain.emptyType);
+ @override
bool isControlFlow() => true;
+ @override
bool isJsStatement() => true;
}
@@ -1582,6 +1682,7 @@
this.sourceInformation = sourceInformation;
}
+ @override
bool isAllocation(AbstractValueDomain domain) => true;
HInstruction get rtiInput {
@@ -1589,8 +1690,10 @@
return inputs.last;
}
+ @override
accept(HVisitor visitor) => visitor.visitCreate(this);
+ @override
String toString() => 'HCreate($element, ${instantiatedTypes})';
}
@@ -1598,10 +1701,13 @@
class HCreateBox extends HInstruction {
HCreateBox(AbstractValue type) : super(<HInstruction>[], type);
+ @override
bool isAllocation(AbstractValueDomain domain) => true;
+ @override
accept(HVisitor visitor) => visitor.visitCreateBox(this);
+ @override
String toString() => 'HCreateBox()';
}
@@ -1617,7 +1723,9 @@
sideEffects.setDependsOnSomething();
}
static const int ARGUMENTS_OFFSET = 1;
+ @override
bool canThrow(AbstractValueDomain domain) => true;
+ @override
bool isAllocation(AbstractValueDomain domain) => _isAllocation;
void setAllocation(bool value) {
_isAllocation = value;
@@ -1626,6 +1734,7 @@
abstract class HInvokeDynamic extends HInvoke {
final InvokeDynamicSpecializer specializer;
+ @override
Selector selector;
AbstractValue mask;
MemberEntity element;
@@ -1640,8 +1749,10 @@
assert(isIntercepted != null);
isInterceptedCall = isIntercepted;
}
+ @override
toString() => 'invoke dynamic: selector=$selector, mask=$mask';
HInstruction get receiver => inputs[0];
+ @override
HInstruction getDartReceiver(JClosedWorld closedWorld) {
return isCallOnInterceptor(closedWorld) ? inputs[1] : inputs[0];
}
@@ -1654,8 +1765,11 @@
return isInterceptedCall && receiver.isInterceptor(closedWorld);
}
+ @override
int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE;
+ @override
bool typeEquals(other) => other is HInvokeDynamic;
+ @override
bool dataEquals(HInvokeDynamic other) {
// Use the name and the kind instead of [Selector.operator==]
// because we don't need to check the arity (already checked in
@@ -1666,6 +1780,7 @@
}
class HInvokeClosure extends HInvokeDynamic {
+ @override
final List<DartType> typeArguments;
HInvokeClosure(Selector selector, List<HInstruction> inputs,
@@ -1675,10 +1790,12 @@
assert(selector.callStructure.typeArgumentCount == typeArguments.length);
assert(!isInterceptedCall);
}
+ @override
accept(HVisitor visitor) => visitor.visitInvokeClosure(this);
}
class HInvokeDynamicMethod extends HInvokeDynamic {
+ @override
final List<DartType> typeArguments;
HInvokeDynamicMethod(
@@ -1694,7 +1811,9 @@
assert(selector.callStructure.typeArgumentCount == typeArguments.length);
}
+ @override
String toString() => 'invoke dynamic method: selector=$selector, mask=$mask';
+ @override
accept(HVisitor visitor) => visitor.visitInvokeDynamicMethod(this);
}
@@ -1708,6 +1827,7 @@
AbstractValue type)
: super(selector, mask, element, inputs, isIntercepted, type);
+ @override
String toString() => 'invoke dynamic field: selector=$selector, mask=$mask';
}
@@ -1724,17 +1844,21 @@
this.sourceInformation = sourceInformation;
}
+ @override
accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this);
bool get isTearOff => element != null && element.isFunction;
+ @override
List<DartType> get typeArguments => const <DartType>[];
// There might be an interceptor input, so `inputs.last` is the dart receiver.
+ @override
bool canThrow(AbstractValueDomain domain) => isTearOff
? inputs.last.isNull(domain).isPotentiallyTrue
: super.canThrow(domain);
+ @override
String toString() => 'invoke dynamic getter: selector=$selector, mask=$mask';
}
@@ -1755,10 +1879,13 @@
this.sourceInformation = sourceInformation;
}
+ @override
accept(HVisitor visitor) => visitor.visitInvokeDynamicSetter(this);
+ @override
List<DartType> get typeArguments => const <DartType>[];
+ @override
String toString() =>
'invoke dynamic setter: selector=$selector, mask=$mask, element=$element';
}
@@ -1771,6 +1898,7 @@
final bool targetCanThrow;
+ @override
bool canThrow(AbstractValueDomain domain) => targetCanThrow;
/// If this instruction is a call to a constructor, [instantiatedTypes]
@@ -1786,10 +1914,13 @@
isInterceptedCall = isIntercepted;
}
+ @override
accept(HVisitor visitor) => visitor.visitInvokeStatic(this);
+ @override
int typeCode() => HInstruction.INVOKE_STATIC_TYPECODE;
+ @override
String toString() => 'invoke static: $element';
}
@@ -1797,6 +1928,7 @@
/// The class where the call to super is being done.
final ClassEntity caller;
final bool isSetter;
+ @override
final Selector selector;
HInvokeSuper(
@@ -1815,6 +1947,7 @@
}
HInstruction get receiver => inputs[0];
+ @override
HInstruction getDartReceiver(JClosedWorld closedWorld) {
return isCallOnInterceptor(closedWorld) ? inputs[1] : inputs[0];
}
@@ -1824,7 +1957,9 @@
return isInterceptedCall && receiver.isInterceptor(closedWorld);
}
+ @override
toString() => 'invoke super: $element';
+ @override
accept(HVisitor visitor) => visitor.visitInvokeSuper(this);
HInstruction get value {
@@ -1847,7 +1982,9 @@
this.sourceInformation = sourceInformation;
}
+ @override
String toString() => 'invoke constructor body: ${element.name}';
+ @override
accept(HVisitor visitor) => visitor.visitInvokeConstructorBody(this);
}
@@ -1866,7 +2003,9 @@
this.sourceInformation = sourceInformation;
}
+ @override
String toString() => 'HInvokeGeneratorBody(${element.name})';
+ @override
accept(HVisitor visitor) => visitor.visitInvokeGeneratorBody(this);
}
@@ -1897,6 +2036,7 @@
}
}
+ @override
bool isInterceptor(JClosedWorld closedWorld) {
if (sourceElement == null) return false;
// In case of a closure inside an interceptor class, [:this:] is
@@ -1910,18 +2050,26 @@
return false;
}
+ @override
bool canThrow(AbstractValueDomain domain) =>
receiver.isNull(domain).isPotentiallyTrue;
+ @override
HInstruction getDartReceiver(JClosedWorld closedWorld) => receiver;
+ @override
bool onlyThrowsNSM() => true;
bool get isNullCheck => element == null;
+ @override
accept(HVisitor visitor) => visitor.visitFieldGet(this);
+ @override
int typeCode() => HInstruction.FIELD_GET_TYPECODE;
+ @override
bool typeEquals(other) => other is HFieldGet;
+ @override
bool dataEquals(HFieldGet other) => element == other.element;
+ @override
String toString() => "FieldGet(element=$element,type=$instructionType)";
}
@@ -1934,18 +2082,24 @@
sideEffects.setChangesInstanceProperty();
}
+ @override
bool canThrow(AbstractValueDomain domain) =>
receiver.isNull(domain).isPotentiallyTrue;
+ @override
HInstruction getDartReceiver(JClosedWorld closedWorld) => receiver;
+ @override
bool onlyThrowsNSM() => true;
HInstruction get value => inputs[1];
+ @override
accept(HVisitor visitor) => visitor.visitFieldSet(this);
// HFieldSet is an expression if it has a user.
+ @override
bool isJsStatement() => usedBy.isEmpty;
+ @override
String toString() => "FieldSet(element=$element,type=$instructionType)";
}
@@ -1965,17 +2119,25 @@
HInstruction get receiver => inputs.single;
+ @override
bool canThrow(AbstractValueDomain domain) =>
receiver.isNull(domain).isPotentiallyTrue;
+ @override
HInstruction getDartReceiver(JClosedWorld closedWorld) => receiver;
+ @override
bool onlyThrowsNSM() => true;
+ @override
accept(HVisitor visitor) => visitor.visitGetLength(this);
+ @override
int typeCode() => HInstruction.GET_LENGTH_TYPECODE;
+ @override
bool typeEquals(other) => other is HGetLength;
+ @override
bool dataEquals(HGetLength other) => true;
+ @override
String toString() => "GetLength()";
}
@@ -2017,16 +2179,22 @@
bool get isPostOp => opKind == POST_OP;
bool get isAssignOp => opKind == ASSIGN_OP;
+ @override
bool canThrow(AbstractValueDomain domain) =>
receiver.isNull(domain).isPotentiallyTrue;
+ @override
HInstruction getDartReceiver(JClosedWorld closedWorld) => receiver;
+ @override
bool onlyThrowsNSM() => true;
HInstruction get value => inputs[1];
+ @override
accept(HVisitor visitor) => visitor.visitReadModifyWrite(this);
+ @override
bool isJsStatement() => isAssignOp;
+ @override
String toString() => "ReadModifyWrite $jsOp $opKind $element";
}
@@ -2048,6 +2216,7 @@
this.sourceInformation = sourceInformation;
}
+ @override
accept(HVisitor visitor) => visitor.visitLocalGet(this);
HLocalValue get local => inputs[0];
@@ -2058,10 +2227,12 @@
HInstruction value)
: super(variable, <HInstruction>[local, value], domain.emptyType);
+ @override
accept(HVisitor visitor) => visitor.visitLocalSet(this);
HLocalValue get local => inputs[0];
HInstruction get value => inputs[1];
+ @override
bool isJsStatement() => true;
}
@@ -2071,6 +2242,7 @@
bool get isStatement => false;
NativeBehavior get nativeBehavior => null;
+ @override
bool canThrow(AbstractValueDomain domain) {
return sideEffects.hasSideEffects() || sideEffects.dependsOnSomething();
}
@@ -2078,7 +2250,9 @@
class HForeignCode extends HForeign {
final js.Template codeTemplate;
+ @override
final bool isStatement;
+ @override
final NativeBehavior nativeBehavior;
NativeThrowBehavior throwBehavior;
final FunctionEntity foreignFunction;
@@ -2116,9 +2290,12 @@
effects: effects,
nativeBehavior: nativeBehavior);
+ @override
accept(HVisitor visitor) => visitor.visitForeignCode(this);
+ @override
bool isJsStatement() => isStatement;
+ @override
bool canThrow(AbstractValueDomain domain) {
if (inputs.length > 0) {
return inputs.first.isNull(domain).isPotentiallyTrue
@@ -2128,24 +2305,31 @@
return throwBehavior.canThrow;
}
+ @override
bool onlyThrowsNSM() => throwBehavior.isOnlyNullNSMGuard;
+ @override
bool isAllocation(AbstractValueDomain domain) =>
nativeBehavior != null &&
nativeBehavior.isAllocation &&
isNull(domain).isDefinitelyFalse;
+ @override
int typeCode() => HInstruction.FOREIGN_CODE_TYPECODE;
+ @override
bool typeEquals(other) => other is HForeignCode;
+ @override
bool dataEquals(HForeignCode other) {
return codeTemplate.source != null &&
codeTemplate.source == other.codeTemplate.source;
}
+ @override
String toString() => 'HForeignCode("${codeTemplate.source}")';
}
abstract class HInvokeBinary extends HInstruction {
+ @override
final Selector selector;
HInvokeBinary(
HInstruction left, HInstruction right, this.selector, AbstractValue type)
@@ -2165,6 +2349,7 @@
HBinaryArithmetic(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
constant_system.BinaryOperation operation();
}
@@ -2172,11 +2357,16 @@
HAdd(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitAdd(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.add;
+ @override
int typeCode() => HInstruction.ADD_TYPECODE;
+ @override
bool typeEquals(other) => other is HAdd;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2184,11 +2374,16 @@
HDivide(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitDivide(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.divide;
+ @override
int typeCode() => HInstruction.DIVIDE_TYPECODE;
+ @override
bool typeEquals(other) => other is HDivide;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2196,11 +2391,16 @@
HMultiply(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitMultiply(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.multiply;
+ @override
int typeCode() => HInstruction.MULTIPLY_TYPECODE;
+ @override
bool typeEquals(other) => other is HMultiply;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2208,11 +2408,16 @@
HSubtract(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitSubtract(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.subtract;
+ @override
int typeCode() => HInstruction.SUBTRACT_TYPECODE;
+ @override
bool typeEquals(other) => other is HSubtract;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2220,12 +2425,17 @@
HTruncatingDivide(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitTruncatingDivide(this);
+ @override
constant_system.BinaryOperation operation() =>
constant_system.truncatingDivide;
+ @override
int typeCode() => HInstruction.TRUNCATING_DIVIDE_TYPECODE;
+ @override
bool typeEquals(other) => other is HTruncatingDivide;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2233,11 +2443,16 @@
HRemainder(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitRemainder(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.remainder;
+ @override
int typeCode() => HInstruction.REMAINDER_TYPECODE;
+ @override
bool typeEquals(other) => other is HRemainder;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2256,8 +2471,10 @@
/// following join-block.
HBasicBlock get defaultTarget => block.successors.last;
+ @override
accept(HVisitor visitor) => visitor.visitSwitch(this);
+ @override
String toString() => "HSwitch cases = $inputs";
}
@@ -2271,11 +2488,16 @@
HShiftLeft(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitShiftLeft(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.shiftLeft;
+ @override
int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE;
+ @override
bool typeEquals(other) => other is HShiftLeft;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2283,11 +2505,16 @@
HShiftRight(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitShiftRight(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.shiftRight;
+ @override
int typeCode() => HInstruction.SHIFT_RIGHT_TYPECODE;
+ @override
bool typeEquals(other) => other is HShiftRight;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2295,11 +2522,16 @@
HBitOr(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitBitOr(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.bitOr;
+ @override
int typeCode() => HInstruction.BIT_OR_TYPECODE;
+ @override
bool typeEquals(other) => other is HBitOr;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2307,11 +2539,16 @@
HBitAnd(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitBitAnd(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.bitAnd;
+ @override
int typeCode() => HInstruction.BIT_AND_TYPECODE;
+ @override
bool typeEquals(other) => other is HBitAnd;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2319,15 +2556,21 @@
HBitXor(HInstruction left, HInstruction right, Selector selector,
AbstractValue type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitBitXor(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.bitXor;
+ @override
int typeCode() => HInstruction.BIT_XOR_TYPECODE;
+ @override
bool typeEquals(other) => other is HBitXor;
+ @override
bool dataEquals(HInstruction other) => true;
}
abstract class HInvokeUnary extends HInstruction {
+ @override
final Selector selector;
HInvokeUnary(HInstruction input, this.selector, type)
: super(<HInstruction>[input], type) {
@@ -2344,45 +2587,64 @@
class HNegate extends HInvokeUnary {
HNegate(HInstruction input, Selector selector, AbstractValue type)
: super(input, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitNegate(this);
+ @override
constant_system.UnaryOperation operation() => constant_system.negate;
+ @override
int typeCode() => HInstruction.NEGATE_TYPECODE;
+ @override
bool typeEquals(other) => other is HNegate;
+ @override
bool dataEquals(HInstruction other) => true;
}
class HAbs extends HInvokeUnary {
HAbs(HInstruction input, Selector selector, AbstractValue type)
: super(input, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitAbs(this);
+ @override
constant_system.UnaryOperation operation() => constant_system.abs;
+ @override
int typeCode() => HInstruction.ABS_TYPECODE;
+ @override
bool typeEquals(other) => other is HAbs;
+ @override
bool dataEquals(HInstruction other) => true;
}
class HBitNot extends HInvokeUnary {
HBitNot(HInstruction input, Selector selector, AbstractValue type)
: super(input, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitBitNot(this);
+ @override
constant_system.UnaryOperation operation() => constant_system.bitNot;
+ @override
int typeCode() => HInstruction.BIT_NOT_TYPECODE;
+ @override
bool typeEquals(other) => other is HBitNot;
+ @override
bool dataEquals(HInstruction other) => true;
}
class HExit extends HControlFlow {
HExit(AbstractValueDomain domain) : super(domain, const <HInstruction>[]);
+ @override
toString() => 'exit';
+ @override
accept(HVisitor visitor) => visitor.visitExit(this);
}
class HGoto extends HControlFlow {
HGoto(AbstractValueDomain domain) : super(domain, const <HInstruction>[]);
+ @override
toString() => 'goto';
+ @override
accept(HVisitor visitor) => visitor.visitGoto(this);
}
@@ -2420,8 +2682,10 @@
: breakSwitchContinueLoop = false,
super.toLabel(domain, label, sourceInformation);
+ @override
String toString() => (label != null) ? 'break ${label.labelName}' : 'break';
+ @override
accept(HVisitor visitor) => visitor.visitBreak(this);
}
@@ -2434,9 +2698,11 @@
SourceInformation sourceInformation)
: super.toLabel(domain, label, sourceInformation);
+ @override
String toString() =>
(label != null) ? 'continue ${label.labelName}' : 'continue';
+ @override
accept(HVisitor visitor) => visitor.visitContinue(this);
}
@@ -2445,7 +2711,9 @@
HBasicBlock catchBlock;
HBasicBlock finallyBlock;
HTry(AbstractValueDomain domain) : super(domain, const <HInstruction>[]);
+ @override
toString() => 'try';
+ @override
accept(HVisitor visitor) => visitor.visitTry(this);
HBasicBlock get joinBlock => this.block.successors.last;
}
@@ -2457,7 +2725,9 @@
// finally.
class HExitTry extends HControlFlow {
HExitTry(AbstractValueDomain domain) : super(domain, const <HInstruction>[]);
+ @override
toString() => 'exit try';
+ @override
accept(HVisitor visitor) => visitor.visitExitTry(this);
HBasicBlock get bodyTrySuccessor => block.successors[0];
}
@@ -2466,7 +2736,9 @@
HBlockFlow blockInformation = null;
HIf(AbstractValueDomain domain, HInstruction condition)
: super(domain, <HInstruction>[condition]);
+ @override
toString() => 'if';
+ @override
accept(HVisitor visitor) => visitor.visitIf(this);
HBasicBlock get thenBlock {
@@ -2490,7 +2762,9 @@
HLoopBranch(AbstractValueDomain domain, HInstruction condition,
[this.kind = CONDITION_FIRST_LOOP])
: super(domain, <HInstruction>[condition]);
+ @override
toString() => 'loop-branch';
+ @override
accept(HVisitor visitor) => visitor.visitLoopBranch(this);
}
@@ -2499,25 +2773,40 @@
HConstant.internal(this.constant, AbstractValue constantType)
: super(<HInstruction>[], constantType);
+ @override
toString() => 'literal: ${constant.toStructuredText()}';
+ @override
accept(HVisitor visitor) => visitor.visitConstant(this);
+ @override
bool isConstant() => true;
+ @override
bool isConstantBoolean() => constant.isBool;
+ @override
bool isConstantNull() => constant.isNull;
+ @override
bool isConstantNumber() => constant.isNum;
+ @override
bool isConstantInteger() => constant.isInt;
+ @override
bool isConstantString() => constant.isString;
+ @override
bool isConstantList() => constant.isList;
+ @override
bool isConstantMap() => constant.isMap;
+ @override
bool isConstantFalse() => constant.isFalse;
+ @override
bool isConstantTrue() => constant.isTrue;
+ @override
bool isInterceptor(JClosedWorld closedWorld) => constant.isInterceptor;
// Maybe avoid this if the literal is big?
+ @override
bool isCodeMotionInvariant() => true;
+ @override
set instructionType(type) {
// Only lists can be specialized. The SSA builder uses the
// inferrer for finding the type of a constant list. We should
@@ -2533,9 +2822,13 @@
setUseGvn();
}
+ @override
accept(HVisitor visitor) => visitor.visitNot(this);
+ @override
int typeCode() => HInstruction.NOT_TYPECODE;
+ @override
bool typeEquals(other) => other is HNot;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2548,7 +2841,9 @@
sourceElement = variable;
}
+ @override
toString() => 'local ${sourceElement.name}';
+ @override
accept(HVisitor visitor) => visitor.visitLocalValue(this);
}
@@ -2566,27 +2861,35 @@
return false;
}
+ @override
toString() => 'parameter ${sourceElement.name}';
+ @override
accept(HVisitor visitor) => visitor.visitParameterValue(this);
}
class HThis extends HParameterValue {
HThis(ThisLocal element, AbstractValue type) : super(element, type);
+ @override
ThisLocal get sourceElement => super.sourceElement;
+ @override
void set sourceElement(covariant ThisLocal local) {
super.sourceElement = local;
}
+ @override
accept(HVisitor visitor) => visitor.visitThis(this);
+ @override
bool isCodeMotionInvariant() => true;
+ @override
bool isInterceptor(JClosedWorld closedWorld) {
return closedWorld.interceptorData
.isInterceptedClass(sourceElement.enclosingClass);
}
+ @override
String toString() => 'this';
}
@@ -2618,7 +2921,9 @@
input.usedBy.add(this);
}
+ @override
toString() => 'phi $id';
+ @override
accept(HVisitor visitor) => visitor.visitPhi(this);
}
@@ -2632,52 +2937,77 @@
String singleComparisonOp; // null, '===', '=='
HIdentity(left, right, selector, type) : super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitIdentity(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.identity;
+ @override
int typeCode() => HInstruction.IDENTITY_TYPECODE;
+ @override
bool typeEquals(other) => other is HIdentity;
+ @override
bool dataEquals(HInstruction other) => true;
}
class HGreater extends HRelational {
HGreater(left, right, selector, type) : super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitGreater(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.greater;
+ @override
int typeCode() => HInstruction.GREATER_TYPECODE;
+ @override
bool typeEquals(other) => other is HGreater;
+ @override
bool dataEquals(HInstruction other) => true;
}
class HGreaterEqual extends HRelational {
HGreaterEqual(left, right, selector, type)
: super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitGreaterEqual(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.greaterEqual;
+ @override
int typeCode() => HInstruction.GREATER_EQUAL_TYPECODE;
+ @override
bool typeEquals(other) => other is HGreaterEqual;
+ @override
bool dataEquals(HInstruction other) => true;
}
class HLess extends HRelational {
HLess(left, right, selector, type) : super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitLess(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.less;
+ @override
int typeCode() => HInstruction.LESS_TYPECODE;
+ @override
bool typeEquals(other) => other is HLess;
+ @override
bool dataEquals(HInstruction other) => true;
}
class HLessEqual extends HRelational {
HLessEqual(left, right, selector, type) : super(left, right, selector, type);
+ @override
accept(HVisitor visitor) => visitor.visitLessEqual(this);
+ @override
constant_system.BinaryOperation operation() => constant_system.lessEqual;
+ @override
int typeCode() => HInstruction.LESS_EQUAL_TYPECODE;
+ @override
bool typeEquals(other) => other is HLessEqual;
+ @override
bool dataEquals(HInstruction other) => true;
}
@@ -2687,7 +3017,9 @@
: super(domain, <HInstruction>[value]) {
this.sourceInformation = sourceInformation;
}
+ @override
toString() => 'return';
+ @override
accept(HVisitor visitor) => visitor.visitReturn(this);
}
@@ -2697,18 +3029,25 @@
: super(<HInstruction>[value], domain.emptyType) {
this.sourceInformation = sourceInformation;
}
+ @override
toString() => 'throw expression';
+ @override
accept(HVisitor visitor) => visitor.visitThrowExpression(this);
+ @override
bool canThrow(AbstractValueDomain domain) => true;
}
class HAwait extends HInstruction {
HAwait(HInstruction value, AbstractValue type)
: super(<HInstruction>[value], type);
+ @override
toString() => 'await';
+ @override
accept(HVisitor visitor) => visitor.visitAwait(this);
// An await will throw if its argument is not a real future.
+ @override
bool canThrow(AbstractValueDomain domain) => true;
+ @override
SideEffects sideEffects = new SideEffects();
}
@@ -2719,9 +3058,13 @@
this.sourceInformation = sourceInformation;
}
bool hasStar;
+ @override
toString() => 'yield';
+ @override
accept(HVisitor visitor) => visitor.visitYield(this);
+ @override
bool canThrow(AbstractValueDomain domain) => false;
+ @override
SideEffects sideEffects = new SideEffects();
}
@@ -2733,7 +3076,9 @@
: super(domain, <HInstruction>[value]) {
this.sourceInformation = sourceInformation;
}
+ @override
toString() => 'throw';
+ @override
accept(HVisitor visitor) => visitor.visitThrow(this);
}
@@ -2750,13 +3095,20 @@
setUseGvn();
this.sourceInformation = sourceInformation;
}
+ @override
toString() => 'static ${element.name}';
+ @override
accept(HVisitor visitor) => visitor.visitStatic(this);
+ @override
int gvnHashCode() => super.gvnHashCode() ^ element.hashCode;
+ @override
int typeCode() => HInstruction.STATIC_TYPECODE;
+ @override
bool typeEquals(other) => other is HStatic;
+ @override
bool dataEquals(HStatic other) => element == other.element;
+ @override
bool isCodeMotionInvariant() => !element.isAssignable;
}
@@ -2782,7 +3134,9 @@
setUseGvn();
}
+ @override
String toString() => 'interceptor on $interceptedClasses';
+ @override
accept(HVisitor visitor) => visitor.visitInterceptor(this);
HInstruction get receiver => inputs[0];
@@ -2793,10 +3147,14 @@
inputs.add(constant);
}
+ @override
bool isInterceptor(JClosedWorld closedWorld) => true;
+ @override
int typeCode() => HInstruction.INTERCEPTOR_TYPECODE;
+ @override
bool typeEquals(other) => other is HInterceptor;
+ @override
bool dataEquals(HInterceptor other) {
return interceptedClasses == other.interceptedClasses ||
(interceptedClasses.length == other.interceptedClasses.length &&
@@ -2812,6 +3170,7 @@
/// calls, this class extends [HInvokeDynamic] and also has the null
/// constant as the first input.
class HOneShotInterceptor extends HInvokeDynamic {
+ @override
List<DartType> typeArguments;
Set<ClassEntity> interceptedClasses;
@@ -2828,9 +3187,12 @@
assert(inputs[0].instructionType == domain.nullType);
assert(selector.callStructure.typeArgumentCount == typeArguments.length);
}
+ @override
bool isCallOnInterceptor(JClosedWorld closedWorld) => true;
+ @override
String toString() => 'one shot interceptor: selector=$selector, mask=$mask';
+ @override
accept(HVisitor visitor) => visitor.visitOneShotInterceptor(this);
}
@@ -2848,12 +3210,17 @@
this.sourceInformation = sourceInformation;
}
+ @override
toString() => 'lazy static ${element.name}';
+ @override
accept(HVisitor visitor) => visitor.visitLazyStatic(this);
+ @override
int typeCode() => 30;
// TODO(4931): can we do better here?
+ @override
bool isCodeMotionInvariant() => false;
+ @override
bool canThrow(AbstractValueDomain domain) => true;
}
@@ -2865,29 +3232,39 @@
sideEffects.clearAllDependencies();
sideEffects.setChangesStaticProperty();
}
+ @override
toString() => 'static store ${element.name}';
+ @override
accept(HVisitor visitor) => visitor.visitStaticStore(this);
HInstruction get value => inputs.single;
+ @override
int typeCode() => HInstruction.STATIC_STORE_TYPECODE;
+ @override
bool typeEquals(other) => other is HStaticStore;
+ @override
bool dataEquals(HStaticStore other) => element == other.element;
+ @override
bool isJsStatement() => usedBy.isEmpty;
}
class HLiteralList extends HInstruction {
HLiteralList(List<HInstruction> inputs, AbstractValue type)
: super(inputs, type);
+ @override
toString() => 'literal list';
+ @override
accept(HVisitor visitor) => visitor.visitLiteralList(this);
+ @override
bool isAllocation(AbstractValueDomain domain) => true;
}
/// The primitive array indexing operation. Note that this instruction
/// does not throw because we generate the checks explicitly.
class HIndex extends HInstruction {
+ @override
final Selector selector;
HIndex(HInstruction receiver, HInstruction index, this.selector,
AbstractValue type)
@@ -2898,7 +3275,9 @@
setUseGvn();
}
+ @override
String toString() => 'index operator';
+ @override
accept(HVisitor visitor) => visitor.visitIndex(this);
HInstruction get receiver => inputs[0];
@@ -2906,21 +3285,29 @@
// Implicit dependency on HBoundsCheck or constraints on index.
// TODO(27272): Make HIndex dependent on bounds checking.
+ @override
bool get isMovable => false;
+ @override
HInstruction getDartReceiver(JClosedWorld closedWorld) => receiver;
+ @override
bool onlyThrowsNSM() => true;
+ @override
bool canThrow(AbstractValueDomain domain) =>
receiver.isNull(domain).isPotentiallyTrue;
+ @override
int typeCode() => HInstruction.INDEX_TYPECODE;
+ @override
bool typeEquals(HInstruction other) => other is HIndex;
+ @override
bool dataEquals(HIndex other) => true;
}
/// The primitive array assignment operation. Note that this instruction
/// does not throw because we generate the checks explicitly.
class HIndexAssign extends HInstruction {
+ @override
final Selector selector;
HIndexAssign(AbstractValueDomain domain, HInstruction receiver,
HInstruction index, HInstruction value, this.selector)
@@ -2929,7 +3316,9 @@
sideEffects.clearAllDependencies();
sideEffects.setChangesIndex();
}
+ @override
String toString() => 'index assign operator';
+ @override
accept(HVisitor visitor) => visitor.visitIndexAssign(this);
HInstruction get receiver => inputs[0];
@@ -2938,10 +3327,14 @@
// Implicit dependency on HBoundsCheck or constraints on index.
// TODO(27272): Make HIndex dependent on bounds checking.
+ @override
bool get isMovable => false;
+ @override
HInstruction getDartReceiver(JClosedWorld closedWorld) => receiver;
+ @override
bool onlyThrowsNSM() => true;
+ @override
bool canThrow(AbstractValueDomain domain) =>
receiver.isNull(domain).isPotentiallyTrue;
}
@@ -3030,14 +3423,19 @@
bool get isVariableCheck => kind == VARIABLE_CHECK;
bool get isCompoundCheck => kind == COMPOUND_CHECK;
+ @override
accept(HVisitor visitor) => visitor.visitIs(this);
+ @override
toString() => "$expression is $typeExpression";
+ @override
int typeCode() => HInstruction.IS_TYPECODE;
+ @override
bool typeEquals(HInstruction other) => other is HIs;
+ @override
bool dataEquals(HIs other) {
return typeExpression == other.typeExpression && kind == other.kind;
}
@@ -3056,10 +3454,15 @@
HInstruction get interceptor => inputs[0];
+ @override
accept(HVisitor visitor) => visitor.visitIsViaInterceptor(this);
+ @override
toString() => "$interceptor is $typeExpression";
+ @override
int typeCode() => HInstruction.IS_VIA_INTERCEPTOR_TYPECODE;
+ @override
bool typeEquals(HInstruction other) => other is HIsViaInterceptor;
+ @override
bool dataEquals(HIs other) {
return typeExpression == other.typeExpression;
}
@@ -3077,7 +3480,9 @@
HInstruction get target => inputs.single;
+ @override
accept(HVisitor visitor) => visitor.visitLateValue(this);
+ @override
toString() => 'HLateValue($target)';
}
@@ -3143,8 +3548,10 @@
HInstruction get typeRepresentation => inputs[1];
+ @override
HInstruction get checkedInput => super.checkedInput;
+ @override
HInstruction convertType(JClosedWorld closedWorld, DartType type, int kind) {
if (typeExpression == type) {
// Don't omit a boolean conversion (which doesn't allow `null`) unless
@@ -3165,15 +3572,22 @@
bool get isCastTypeCheck => kind == CAST_TYPE_CHECK;
bool get isBooleanConversionCheck => kind == BOOLEAN_CONVERSION_CHECK;
+ @override
accept(HVisitor visitor) => visitor.visitTypeConversion(this);
+ @override
bool isJsStatement() => isControlFlow();
+ @override
bool isControlFlow() => isArgumentTypeCheck || isReceiverTypeCheck;
+ @override
int typeCode() => HInstruction.TYPE_CONVERSION_TYPECODE;
+ @override
bool typeEquals(HInstruction other) => other is HTypeConversion;
+ @override
bool isCodeMotionInvariant() => false;
+ @override
bool dataEquals(HTypeConversion other) {
return kind == other.kind &&
typeExpression == other.typeExpression &&
@@ -3220,6 +3634,7 @@
return abstractValueDomain.isIn(inputType, checkedType).isDefinitelyTrue;
}
+ @override
String toString() => 'HTypeConversion(type=$typeExpression, kind=$kind, '
'${hasTypeRepresentation ? 'representation=$typeRepresentation, ' : ''}'
'checkedInput=$checkedInput)';
@@ -3241,22 +3656,32 @@
this._isMovable = true,
super(<HInstruction>[input, witness], knownType);
+ @override
toString() => 'TypeKnown $knownType';
+ @override
accept(HVisitor visitor) => visitor.visitTypeKnown(this);
+ @override
bool isJsStatement() => false;
+ @override
bool isControlFlow() => false;
+ @override
bool canThrow(AbstractValueDomain domain) => false;
bool get isPinned => inputs.length == 1;
HInstruction get witness => inputs.length == 2 ? inputs[1] : null;
+ @override
int typeCode() => HInstruction.TYPE_KNOWN_TYPECODE;
+ @override
bool typeEquals(HInstruction other) => other is HTypeKnown;
+ @override
bool isCodeMotionInvariant() => true;
+ @override
bool get isMovable => _isMovable && useGvn();
+ @override
bool dataEquals(HTypeKnown other) {
return knownType == other.knownType &&
instructionType == other.instructionType;
@@ -3278,8 +3703,10 @@
sourceElement = input.sourceElement;
}
+ @override
bool get isMovable => false;
+ @override
accept(HVisitor visitor) => visitor.visitRangeConversion(this);
}
@@ -3295,7 +3722,9 @@
HInstruction get left => inputs[0];
HInstruction get right => inputs[1];
+ @override
accept(HVisitor visitor) => visitor.visitStringConcat(this);
+ @override
toString() => "string concat";
}
@@ -3308,7 +3737,9 @@
sideEffects.setDependsOnSomething();
}
+ @override
accept(HVisitor visitor) => visitor.visitStringify(this);
+ @override
toString() => "stringify";
}
@@ -3372,11 +3803,13 @@
/// Information about a statement-like structure.
abstract class HStatementInformation extends HBlockInformation {
+ @override
bool accept(HStatementInformationVisitor visitor);
}
/// Information about an expression-like structure.
abstract class HExpressionInformation extends HBlockInformation {
+ @override
bool accept(HExpressionInformationVisitor visitor);
HInstruction get conditionExpression;
}
@@ -3407,9 +3840,12 @@
final SubGraph subGraph;
HSubGraphBlockInformation(this.subGraph);
+ @override
HBasicBlock get start => subGraph.start;
+ @override
HBasicBlock get end => subGraph.end;
+ @override
bool accept(HStatementInformationVisitor visitor) =>
visitor.visitSubGraphInfo(this);
}
@@ -3420,11 +3856,15 @@
final SubExpression subExpression;
HSubExpressionBlockInformation(this.subExpression);
+ @override
HBasicBlock get start => subExpression.start;
+ @override
HBasicBlock get end => subExpression.end;
+ @override
HInstruction get conditionExpression => subExpression.conditionExpression;
+ @override
bool accept(HExpressionInformationVisitor visitor) =>
visitor.visitSubExpressionInfo(this);
}
@@ -3434,9 +3874,12 @@
final List<HStatementInformation> statements;
HStatementSequenceInformation(this.statements);
+ @override
HBasicBlock get start => statements[0].start;
+ @override
HBasicBlock get end => statements.last.end;
+ @override
bool accept(HStatementInformationVisitor visitor) =>
visitor.visitSequenceInfo(this);
}
@@ -3456,9 +3899,12 @@
{this.isContinue: false})
: this.labels = const <LabelDefinition>[];
+ @override
HBasicBlock get start => body.start;
+ @override
HBasicBlock get end => body.end;
+ @override
bool accept(HStatementInformationVisitor visitor) =>
visitor.visitLabeledBlockInfo(this);
}
@@ -3486,6 +3932,7 @@
(kind == DO_WHILE_LOOP ? body.start : condition.start).isLoopHeader());
}
+ @override
HBasicBlock get start {
if (initializer != null) return initializer.start;
if (kind == DO_WHILE_LOOP) {
@@ -3498,6 +3945,7 @@
return kind == DO_WHILE_LOOP ? body.start : condition.start;
}
+ @override
HBasicBlock get end {
if (updates != null) return updates.end;
if (kind == DO_WHILE_LOOP && condition != null) {
@@ -3506,6 +3954,7 @@
return body.end;
}
+ @override
bool accept(HStatementInformationVisitor visitor) =>
visitor.visitLoopInfo(this);
}
@@ -3516,9 +3965,12 @@
final HStatementInformation elseGraph;
HIfBlockInformation(this.condition, this.thenGraph, this.elseGraph);
+ @override
HBasicBlock get start => condition.start;
+ @override
HBasicBlock get end => elseGraph == null ? thenGraph.end : elseGraph.end;
+ @override
bool accept(HStatementInformationVisitor visitor) =>
visitor.visitIfInfo(this);
}
@@ -3529,14 +3981,18 @@
final HExpressionInformation right;
HAndOrBlockInformation(this.isAnd, this.left, this.right);
+ @override
HBasicBlock get start => left.start;
+ @override
HBasicBlock get end => right.end;
// We don't currently use HAndOrBlockInformation.
+ @override
HInstruction get conditionExpression {
return null;
}
+ @override
bool accept(HExpressionInformationVisitor visitor) =>
visitor.visitAndOrInfo(this);
}
@@ -3549,10 +4005,13 @@
HTryBlockInformation(
this.body, this.catchVariable, this.catchBlock, this.finallyBlock);
+ @override
HBasicBlock get start => body.start;
+ @override
HBasicBlock get end =>
finallyBlock == null ? catchBlock.end : finallyBlock.end;
+ @override
bool accept(HStatementInformationVisitor visitor) =>
visitor.visitTryInfo(this);
}
@@ -3567,13 +4026,16 @@
HSwitchBlockInformation(this.expression, this.statements, this.target,
this.labels, this.sourceInformation);
+ @override
HBasicBlock get start => expression.start;
+ @override
HBasicBlock get end {
// We don't create a switch block if there are no cases.
assert(!statements.isEmpty);
return statements.last.end;
}
+ @override
bool accept(HStatementInformationVisitor visitor) =>
visitor.visitSwitchInfo(this);
}
@@ -3585,13 +4047,18 @@
setUseGvn();
}
+ @override
accept(HVisitor visitor) => visitor.visitTypeInfoReadRaw(this);
+ @override
bool canThrow(AbstractValueDomain domain) => false;
+ @override
int typeCode() => HInstruction.TYPE_INFO_READ_RAW_TYPECODE;
+ @override
bool typeEquals(HInstruction other) => other is HTypeInfoReadRaw;
+ @override
bool dataEquals(HTypeInfoReadRaw other) {
return true;
}
@@ -3626,17 +4093,23 @@
HInstruction get object => inputs.last;
+ @override
accept(HVisitor visitor) => visitor.visitTypeInfoReadVariable(this);
+ @override
bool canThrow(AbstractValueDomain domain) => false;
+ @override
int typeCode() => HInstruction.TYPE_INFO_READ_VARIABLE_TYPECODE;
+ @override
bool typeEquals(HInstruction other) => other is HTypeInfoReadVariable;
+ @override
bool dataEquals(HTypeInfoReadVariable other) {
return variable == other.variable;
}
+ @override
String toString() => 'HTypeInfoReadVariable($variable)';
}
@@ -3706,17 +4179,23 @@
setUseGvn();
}
+ @override
accept(HVisitor visitor) => visitor.visitTypeInfoExpression(this);
+ @override
bool canThrow(AbstractValueDomain domain) => false;
+ @override
int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE;
+ @override
bool typeEquals(HInstruction other) => other is HTypeInfoExpression;
+ @override
bool dataEquals(HTypeInfoExpression other) {
return kind == other.kind && dartType == other.dartType;
}
+ @override
String toString() => 'HTypeInfoExpression($kindAsString, $dartType)';
// ignore: MISSING_RETURN
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index e40719b..e584210 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -48,6 +48,7 @@
SsaOptimizerTask(this._backend) : super(_backend.compiler.measurer);
+ @override
String get name => 'SSA optimizer';
Compiler get _compiler => _backend.compiler;
@@ -191,6 +192,7 @@
// strings.
static const MAX_SHARED_CONSTANT_FOLDED_STRING_LENGTH = 512;
+ @override
final String name = "SsaInstructionSimplifier";
final GlobalTypeInferenceResults _globalInferenceResults;
final CompilerOptions _options;
@@ -210,11 +212,13 @@
NativeData get _nativeData => _closedWorld.nativeData;
+ @override
void visitGraph(HGraph visitee) {
_graph = visitee;
visitDominatorTree(visitee);
}
+ @override
visitBasicBlock(HBasicBlock block) {
simplifyPhis(block);
HInstruction instruction = block.first;
@@ -383,6 +387,7 @@
return true;
}
+ @override
HInstruction visitInstruction(HInstruction node) {
return node;
}
@@ -411,6 +416,7 @@
}
}
+ @override
HInstruction visitParameterValue(HParameterValue node) {
// [HParameterValue]s are either the value of the parameter (in fully SSA
// converted code), or the mutable variable containing the value (in
@@ -436,6 +442,7 @@
return node;
}
+ @override
HInstruction visitBoolify(HBoolify node) {
List<HInstruction> inputs = node.inputs;
assert(inputs.length == 1);
@@ -462,6 +469,7 @@
return node;
}
+ @override
HInstruction visitNot(HNot node) {
List<HInstruction> inputs = node.inputs;
assert(inputs.length == 1);
@@ -476,6 +484,7 @@
return node;
}
+ @override
HInstruction visitInvokeUnary(HInvokeUnary node) {
HInstruction folded = foldUnary(node.operation(), node.operand);
return folded != null ? folded : node;
@@ -688,6 +697,7 @@
return tagInstruction;
}
+ @override
HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
propagateConstantValueToUses(node);
if (node.isInterceptedCall) {
@@ -849,6 +859,7 @@
return result;
}
+ @override
HInstruction visitBoundsCheck(HBoundsCheck node) {
HInstruction index = node.index;
if (index.isInteger(_abstractValueDomain).isDefinitelyTrue) {
@@ -876,6 +887,7 @@
return null;
}
+ @override
HInstruction visitAdd(HAdd node) {
HInstruction left = node.left;
HInstruction right = node.right;
@@ -889,6 +901,7 @@
return super.visitAdd(node);
}
+ @override
HInstruction visitMultiply(HMultiply node) {
HInstruction left = node.left;
HInstruction right = node.right;
@@ -900,6 +913,7 @@
return super.visitMultiply(node);
}
+ @override
HInstruction visitInvokeBinary(HInvokeBinary node) {
HInstruction left = node.left;
HInstruction right = node.right;
@@ -918,6 +932,7 @@
return true;
}
+ @override
HInstruction visitRelational(HRelational node) {
if (allUsersAreBoolifies(node)) {
// TODO(ngeoffray): Call a boolified selector.
@@ -987,6 +1002,7 @@
return null;
}
+ @override
HInstruction visitIdentity(HIdentity node) {
HInstruction newInstruction = handleIdentityCheck(node);
return newInstruction == null ? super.visitIdentity(node) : newInstruction;
@@ -1019,6 +1035,7 @@
uses.replaceWith(_graph.addConstantBool(value, _closedWorld));
}
+ @override
HInstruction visitIf(HIf node) {
HInstruction condition = node.condition;
if (condition.isConstant()) return node;
@@ -1044,6 +1061,7 @@
return node;
}
+ @override
HInstruction visitIs(HIs node) {
DartType type = node.typeExpression;
@@ -1118,6 +1136,7 @@
return node;
}
+ @override
HInstruction visitTypeConversion(HTypeConversion node) {
if (node.isRedundant(_closedWorld)) return node.checkedInput;
@@ -1139,6 +1158,7 @@
return node;
}
+ @override
HInstruction visitTypeKnown(HTypeKnown node) {
return node.isRedundant(_closedWorld) ? node.checkedInput : node;
}
@@ -1152,6 +1172,7 @@
return member is FieldEntity ? member : null;
}
+ @override
HInstruction visitFieldGet(HFieldGet node) {
if (node.isNullCheck) return node;
var receiver = node.receiver;
@@ -1173,6 +1194,7 @@
return node;
}
+ @override
HInstruction visitGetLength(HGetLength node) {
HInstruction receiver = node.receiver;
if (_graph.allocatedFixedLists.contains(receiver)) {
@@ -1219,6 +1241,7 @@
return node;
}
+ @override
HInstruction visitIndex(HIndex node) {
if (node.receiver.isConstantList() && node.index.isConstantInteger()) {
HConstant instruction = node.receiver;
@@ -1234,6 +1257,7 @@
return node;
}
+ @override
HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
propagateConstantValueToUses(node);
if (node.isInterceptedCall) {
@@ -1312,6 +1336,7 @@
isAssignable: isAssignable);
}
+ @override
HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
if (node.isInterceptedCall) {
HInstruction folded = handleInterceptedCall(node);
@@ -1356,6 +1381,7 @@
}
}
+ @override
HInstruction visitInvokeClosure(HInvokeClosure node) {
HInstruction closure = node.getDartReceiver(_closedWorld);
@@ -1378,6 +1404,7 @@
return node;
}
+ @override
HInstruction visitInvokeStatic(HInvokeStatic node) {
propagateConstantValueToUses(node);
MemberEntity element = node.element;
@@ -1478,6 +1505,7 @@
return source;
}
+ @override
HInstruction visitStringConcat(HStringConcat node) {
// Simplify string concat:
//
@@ -1525,6 +1553,7 @@
return new HStringConcat(prefix, folded, _abstractValueDomain.stringType);
}
+ @override
HInstruction visitStringify(HStringify node) {
HInstruction input = node.inputs[0];
if (input.isString(_abstractValueDomain).isDefinitelyTrue) {
@@ -1602,6 +1631,7 @@
return tryConstant() ?? tryToString() ?? node;
}
+ @override
HInstruction visitOneShotInterceptor(HOneShotInterceptor node) {
return handleInterceptedCall(node);
}
@@ -1615,6 +1645,7 @@
});
}
+ @override
HInstruction visitTypeInfoExpression(HTypeInfoExpression node) {
// Identify the case where the type info expression would be of the form:
//
@@ -1673,6 +1704,7 @@
return tryCopyInfo() ?? node;
}
+ @override
HInstruction visitTypeInfoReadVariable(HTypeInfoReadVariable node) {
TypeVariableType variable = node.variable;
ClassEntity contextClass = variable.element.typeDeclaration;
@@ -1810,6 +1842,7 @@
final Set<HInstruction> boundsChecked;
final bool trustPrimitives;
final JClosedWorld closedWorld;
+ @override
final String name = "SsaCheckInserter";
HGraph graph;
@@ -1818,6 +1851,7 @@
AbstractValueDomain get _abstractValueDomain =>
closedWorld.abstractValueDomain;
+ @override
void visitGraph(HGraph graph) {
this.graph = graph;
@@ -1829,6 +1863,7 @@
visitDominatorTree(graph);
}
+ @override
void visitBasicBlock(HBasicBlock block) {
HInstruction instruction = block.first;
while (instruction != null) {
@@ -1866,18 +1901,21 @@
return check;
}
+ @override
void visitIndex(HIndex node) {
if (boundsChecked.contains(node)) return;
HInstruction index = node.index;
index = insertBoundsCheck(node, node.receiver, index);
}
+ @override
void visitIndexAssign(HIndexAssign node) {
if (boundsChecked.contains(node)) return;
HInstruction index = node.index;
index = insertBoundsCheck(node, node.receiver, index);
}
+ @override
void visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
MemberEntity element = node.element;
if (node.isInterceptedCall) return;
@@ -1894,6 +1932,7 @@
}
class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
+ @override
final String name = "SsaDeadCodeEliminator";
final JClosedWorld closedWorld;
@@ -2018,6 +2057,7 @@
return true;
}
+ @override
void visitGraph(HGraph graph) {
_graph = graph;
analyzer = new SsaLiveBlockAnalyzer(graph, closedWorld, optimizer);
@@ -2026,6 +2066,7 @@
cleanPhis();
}
+ @override
void visitBasicBlock(HBasicBlock block) {
bool isDeadBlock = analyzer.isDeadBlock(block);
block.isLive = !isDeadBlock;
@@ -2247,10 +2288,12 @@
}
}
+ @override
void visitControlFlow(HControlFlow instruction) {
instruction.block.successors.forEach(markBlockLive);
}
+ @override
void visitIf(HIf instruction) {
HInstruction condition = instruction.condition;
if (condition.isConstant()) {
@@ -2264,6 +2307,7 @@
}
}
+ @override
void visitSwitch(HSwitch node) {
if (node.expression.isInteger(_abstractValueDomain).isDefinitelyTrue) {
Range switchRange = ranges[node.expression];
@@ -2296,8 +2340,10 @@
}
class SsaDeadPhiEliminator implements OptimizationPhase {
+ @override
final String name = "SsaDeadPhiEliminator";
+ @override
void visitGraph(HGraph graph) {
final List<HPhi> worklist = <HPhi>[];
// A set to keep track of the live phis that we found.
@@ -2353,8 +2399,10 @@
}
class SsaRedundantPhiEliminator implements OptimizationPhase {
+ @override
final String name = "SsaRedundantPhiEliminator";
+ @override
void visitGraph(HGraph graph) {
final List<HPhi> worklist = <HPhi>[];
@@ -2412,6 +2460,7 @@
class SsaGlobalValueNumberer implements OptimizationPhase {
final AbstractValueDomain _abstractValueDomain;
+ @override
final String name = "SsaGlobalValueNumberer";
final Set<int> visited;
@@ -2420,6 +2469,7 @@
SsaGlobalValueNumberer(this._abstractValueDomain) : visited = new Set<int>();
+ @override
void visitGraph(HGraph graph) {
computeChangesFlags(graph);
moveLoopInvariantCode(graph);
@@ -2635,6 +2685,7 @@
class SsaCodeMotion extends HBaseVisitor implements OptimizationPhase {
final AbstractValueDomain _abstractValueDomain;
+ @override
final String name = "SsaCodeMotion";
bool movedCode = false;
@@ -2642,6 +2693,7 @@
SsaCodeMotion(this._abstractValueDomain);
+ @override
void visitGraph(HGraph graph) {
values = new List<ValueSet>(graph.blocks.length);
for (int i = 0; i < graph.blocks.length; i++) {
@@ -2650,6 +2702,7 @@
visitPostDominatorTree(graph);
}
+ @override
void visitBasicBlock(HBasicBlock block) {
List<HBasicBlock> successors = block.successors;
@@ -2739,6 +2792,7 @@
class SsaTypeConversionInserter extends HBaseVisitor
implements OptimizationPhase {
+ @override
final String name = "SsaTypeconversionInserter";
final JClosedWorld closedWorld;
@@ -2747,6 +2801,7 @@
AbstractValueDomain get _abstractValueDomain =>
closedWorld.abstractValueDomain;
+ @override
void visitGraph(HGraph graph) {
visitDominatorTree(graph);
}
@@ -2776,6 +2831,7 @@
dominatedUses.replaceWith(newInput);
}
+ @override
void visitIs(HIs instruction) {
DartType type = instruction.typeExpression;
if (!instruction.isRawCheck) {
@@ -2806,6 +2862,7 @@
// false. Avoid strengthening to `null`.
}
+ @override
void visitIdentity(HIdentity instruction) {
// At HIf(HIdentity(x, null)) strengthens x to non-null on else branch.
HInstruction left = instruction.left;
@@ -2885,6 +2942,7 @@
final Compiler compiler;
final JClosedWorld closedWorld;
final JFieldAnalysis _fieldAnalysis;
+ @override
final String name = "SsaLoadElimination";
MemorySet memorySet;
List<MemorySet> memories;
@@ -2897,6 +2955,7 @@
AbstractValueDomain get _abstractValueDomain =>
closedWorld.abstractValueDomain;
+ @override
void visitGraph(HGraph graph) {
_graph = graph;
memories = new List<MemorySet>(graph.blocks.length);
@@ -2915,6 +2974,7 @@
}
}
+ @override
void visitBasicBlock(HBasicBlock block) {
if (block.predecessors.length == 0) {
// Entry block.
@@ -2957,6 +3017,7 @@
}
}
+ @override
void visitFieldGet(HFieldGet instruction) {
if (instruction.isNullCheck) return;
FieldEntity element = instruction.element;
@@ -2964,6 +3025,7 @@
_visitFieldGet(element, receiver, instruction);
}
+ @override
void visitGetLength(HGetLength instruction) {
HInstruction receiver = instruction.receiver.nonCheck();
HInstruction existing =
@@ -2989,6 +3051,7 @@
}
}
+ @override
void visitFieldSet(HFieldSet instruction) {
FieldEntity element = instruction.element;
HInstruction receiver = instruction.getDartReceiver(closedWorld).nonCheck();
@@ -2998,6 +3061,7 @@
}
}
+ @override
void visitCreate(HCreate instruction) {
memorySet.registerAllocation(instruction);
if (shouldTrackInitialValues(instruction)) {
@@ -3063,6 +3127,7 @@
return interestingUse(instruction, 0);
}
+ @override
void visitInstruction(HInstruction instruction) {
if (instruction.isAllocation(_abstractValueDomain)) {
memorySet.registerAllocation(instruction);
@@ -3070,6 +3135,7 @@
memorySet.killAffectedBy(instruction);
}
+ @override
void visitLazyStatic(HLazyStatic instruction) {
FieldEntity field = instruction.element;
handleStaticLoad(field, instruction);
@@ -3086,10 +3152,12 @@
}
}
+ @override
void visitStatic(HStatic instruction) {
handleStaticLoad(instruction.element, instruction);
}
+ @override
void visitStaticStore(HStaticStore instruction) {
if (memorySet.registerFieldValueUpdate(
instruction.element, null, instruction.inputs.last)) {
@@ -3097,6 +3165,7 @@
}
}
+ @override
void visitLiteralList(HLiteralList instruction) {
memorySet.registerAllocation(instruction);
memorySet.killAffectedBy(instruction);
@@ -3104,6 +3173,7 @@
// TODO(sra): Set initial length.
}
+ @override
void visitIndex(HIndex instruction) {
HInstruction receiver = instruction.receiver.nonCheck();
HInstruction existing =
@@ -3117,6 +3187,7 @@
}
}
+ @override
void visitIndexAssign(HIndexAssign instruction) {
HInstruction receiver = instruction.receiver.nonCheck();
memorySet.registerKeyedValueUpdate(
@@ -3124,20 +3195,35 @@
}
// Pure operations that do not escape their inputs.
+ @override
void visitBinaryArithmetic(HBinaryArithmetic instruction) {}
+ @override
void visitBoundsCheck(HBoundsCheck instruction) {}
+ @override
void visitConstant(HConstant instruction) {}
+ @override
void visitIf(HIf instruction) {}
+ @override
void visitInterceptor(HInterceptor instruction) {}
+ @override
void visitIs(HIs instruction) {}
+ @override
void visitIsViaInterceptor(HIsViaInterceptor instruction) {}
+ @override
void visitNot(HNot instruction) {}
+ @override
void visitParameterValue(HParameterValue instruction) {}
+ @override
void visitRelational(HRelational instruction) {}
+ @override
void visitStringConcat(HStringConcat instruction) {}
+ @override
void visitTypeKnown(HTypeKnown instruction) {}
+ @override
void visitTypeInfoReadRaw(HTypeInfoReadRaw instruction) {}
+ @override
void visitTypeInfoReadVariable(HTypeInfoReadVariable instruction) {}
+ @override
void visitTypeInfoExpression(HTypeInfoExpression instruction) {}
}
diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart
index ca0a323..cdcc910 100644
--- a/pkg/compiler/lib/src/ssa/ssa.dart
+++ b/pkg/compiler/lib/src/ssa/ssa.dart
@@ -33,12 +33,14 @@
optimizer = new SsaOptimizerTask(backend),
backend = backend;
+ @override
void onCodegenStart() {
_builder.onCodegenStart();
}
/// Generates JavaScript code for `work.element`.
/// Using the ssa builder, optimizer and code generator.
+ @override
js.Fun compile(CodegenWorkItem work, JClosedWorld closedWorld,
GlobalTypeInferenceResults globalInferenceResults) {
HGraph graph = _builder.build(work, closedWorld, globalInferenceResults);
@@ -62,6 +64,7 @@
return result;
}
+ @override
Iterable<CompilerTask> get tasks {
return <CompilerTask>[_builder, optimizer, generator];
}
@@ -82,6 +85,7 @@
SsaBuilderTask(this._backend, this._sourceInformationFactory)
: super(_backend.compiler.measurer);
+ @override
String get name => 'SSA builder';
void onCodegenStart() {
diff --git a/pkg/compiler/lib/src/ssa/ssa_tracer.dart b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
index ee7bc98..40770be 100644
--- a/pkg/compiler/lib/src/ssa/ssa_tracer.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
@@ -18,6 +18,7 @@
class HTracer extends HGraphVisitor with TracerUtil {
final JClosedWorld closedWorld;
final Namer namer;
+ @override
final OutputSink output;
HTracer(this.output, this.closedWorld, this.namer);
@@ -72,6 +73,7 @@
}
}
+ @override
void visitBasicBlock(HBasicBlock block) {
HInstructionStringifier stringifier =
new HInstructionStringifier(block, closedWorld, namer);
@@ -168,10 +170,12 @@
return "$prefix${instruction.id}";
}
+ @override
String visitLateValue(HLateValue node) {
return "LateValue: ${temporaryId(node.inputs[0])}";
}
+ @override
String visitBoolify(HBoolify node) {
return "Boolify: ${temporaryId(node.inputs[0])}";
}
@@ -182,30 +186,38 @@
return '$opcode: $left $right';
}
+ @override
String visitAbs(HAbs node) {
String operand = temporaryId(node.operand);
return "Abs: $operand";
}
+ @override
String visitAdd(HAdd node) => handleInvokeBinary(node, 'Add');
+ @override
String visitBitAnd(HBitAnd node) => handleInvokeBinary(node, 'BitAnd');
+ @override
String visitBitNot(HBitNot node) {
String operand = temporaryId(node.operand);
return "BitNot: $operand";
}
+ @override
String visitBitOr(HBitOr node) => handleInvokeBinary(node, 'BitOr');
+ @override
String visitBitXor(HBitXor node) => handleInvokeBinary(node, 'BitXor');
+ @override
String visitBoundsCheck(HBoundsCheck node) {
String lengthId = temporaryId(node.length);
String indexId = temporaryId(node.index);
return "BoundsCheck: length = $lengthId, index = $indexId";
}
+ @override
String visitBreak(HBreak node) {
HBasicBlock target = currentBlock.successors[0];
if (node.label != null) {
@@ -214,8 +226,10 @@
return "Break: (B${target.id})";
}
+ @override
String visitConstant(HConstant constant) => "Constant: ${constant.constant}";
+ @override
String visitContinue(HContinue node) {
HBasicBlock target = currentBlock.successors[0];
if (node.label != null) {
@@ -224,18 +238,23 @@
return "Continue: (B${target.id})";
}
+ @override
String visitCreate(HCreate node) {
return handleGenericInvoke("Create", "${node.element.name}", node.inputs);
}
+ @override
String visitCreateBox(HCreateBox node) {
return handleGenericInvoke("CreateBox", "", node.inputs);
}
+ @override
String visitDivide(HDivide node) => handleInvokeBinary(node, 'Divide');
+ @override
String visitExit(HExit node) => "Exit";
+ @override
String visitFieldGet(HFieldGet node) {
if (node.isNullCheck) {
return 'FieldGet: NullCheck ${temporaryId(node.receiver)}';
@@ -244,12 +263,14 @@
return 'FieldGet: ${temporaryId(node.receiver)}.$fieldName';
}
+ @override
String visitFieldSet(HFieldSet node) {
String valueId = temporaryId(node.value);
String fieldName = node.element.name;
return 'FieldSet: ${temporaryId(node.receiver)}.$fieldName to $valueId';
}
+ @override
String visitReadModifyWrite(HReadModifyWrite node) {
String fieldName = node.element.name;
String receiverId = temporaryId(node.receiver);
@@ -264,33 +285,41 @@
}
}
+ @override
String visitGetLength(HGetLength node) {
return 'GetLength: ${temporaryId(node.receiver)}';
}
+ @override
String visitLocalGet(HLocalGet node) {
String localName = node.variable.name;
return 'LocalGet: ${temporaryId(node.local)}.$localName';
}
+ @override
String visitLocalSet(HLocalSet node) {
String valueId = temporaryId(node.value);
String localName = node.variable.name;
return 'LocalSet: ${temporaryId(node.local)}.$localName to $valueId';
}
+ @override
String visitGoto(HGoto node) {
HBasicBlock target = currentBlock.successors[0];
return "Goto: (B${target.id})";
}
+ @override
String visitGreater(HGreater node) => handleInvokeBinary(node, 'Greater');
+ @override
String visitGreaterEqual(HGreaterEqual node) {
return handleInvokeBinary(node, 'GreaterEqual');
}
+ @override
String visitIdentity(HIdentity node) => handleInvokeBinary(node, 'Identity');
+ @override
String visitIf(HIf node) {
HBasicBlock thenBlock = currentBlock.successors[0];
HBasicBlock elseBlock = currentBlock.successors[1];
@@ -308,12 +337,14 @@
return "$invokeType: $functionName($argumentsString)";
}
+ @override
String visitIndex(HIndex node) {
String receiver = temporaryId(node.receiver);
String index = temporaryId(node.index);
return "Index: $receiver[$index]";
}
+ @override
String visitIndexAssign(HIndexAssign node) {
String receiver = temporaryId(node.receiver);
String index = temporaryId(node.index);
@@ -321,6 +352,7 @@
return "IndexAssign: $receiver[$index] = $value";
}
+ @override
String visitInterceptor(HInterceptor node) {
String value = temporaryId(node.inputs[0]);
if (node.interceptedClasses != null) {
@@ -330,6 +362,7 @@
return "Interceptor: $value";
}
+ @override
String visitInvokeClosure(HInvokeClosure node) =>
handleInvokeDynamic(node, "InvokeClosure");
@@ -342,33 +375,41 @@
return handleGenericInvoke(kind, target, arguments) + "(${invoke.mask})";
}
+ @override
String visitInvokeDynamicMethod(HInvokeDynamicMethod node) =>
handleInvokeDynamic(node, "InvokeDynamicMethod");
+ @override
String visitInvokeDynamicGetter(HInvokeDynamicGetter node) =>
handleInvokeDynamic(node, "InvokeDynamicGetter");
+ @override
String visitInvokeDynamicSetter(HInvokeDynamicSetter node) =>
handleInvokeDynamic(node, "InvokeDynamicSetter");
+ @override
String visitInvokeStatic(HInvokeStatic invoke) {
String target = invoke.element.name;
return handleGenericInvoke("InvokeStatic", target, invoke.inputs);
}
+ @override
String visitInvokeSuper(HInvokeSuper invoke) {
String target = invoke.element.name;
return handleGenericInvoke("InvokeSuper", target, invoke.inputs);
}
+ @override
String visitInvokeConstructorBody(HInvokeConstructorBody invoke) {
String target = invoke.element.name;
return handleGenericInvoke("InvokeConstructorBody", target, invoke.inputs);
}
+ @override
String visitInvokeGeneratorBody(HInvokeGeneratorBody invoke) {
String target = invoke.element.name;
return handleGenericInvoke("InvokeGeneratorBody", target, invoke.inputs);
}
+ @override
String visitForeignCode(HForeignCode node) {
var template = node.codeTemplate;
String code = '${template.ast}';
@@ -376,10 +417,13 @@
return "ForeignCode: $code ($inputs)";
}
+ @override
String visitLess(HLess node) => handleInvokeBinary(node, 'Less');
+ @override
String visitLessEqual(HLessEqual node) =>
handleInvokeBinary(node, 'LessEqual');
+ @override
String visitLiteralList(HLiteralList node) {
StringBuffer elementsString = new StringBuffer();
for (int i = 0; i < node.inputs.length; i++) {
@@ -389,6 +433,7 @@
return "LiteralList: [$elementsString]";
}
+ @override
String visitLoopBranch(HLoopBranch branch) {
HBasicBlock bodyBlock = currentBlock.successors[0];
HBasicBlock exitBlock = currentBlock.successors[1];
@@ -396,23 +441,29 @@
return "LoopBranch ($conditionId): (B${bodyBlock.id}) then (B${exitBlock.id})";
}
+ @override
String visitMultiply(HMultiply node) => handleInvokeBinary(node, 'Multiply');
+ @override
String visitNegate(HNegate node) {
String operand = temporaryId(node.operand);
return "Negate: $operand";
}
+ @override
String visitNot(HNot node) => "Not: ${temporaryId(node.inputs[0])}";
+ @override
String visitParameterValue(HParameterValue node) {
return "ParameterValue: ${node.sourceElement.name}";
}
+ @override
String visitLocalValue(HLocalValue node) {
return "LocalValue: ${node.sourceElement.name}";
}
+ @override
String visitPhi(HPhi phi) {
StringBuffer buffer = new StringBuffer();
buffer.write("Phi: ");
@@ -423,42 +474,54 @@
return buffer.toString();
}
+ @override
String visitRef(HRef node) {
return 'Ref: ${temporaryId(node.value)}';
}
+ @override
String visitReturn(HReturn node) => "Return: ${temporaryId(node.inputs[0])}";
+ @override
String visitShiftLeft(HShiftLeft node) =>
handleInvokeBinary(node, 'ShiftLeft');
+ @override
String visitShiftRight(HShiftRight node) =>
handleInvokeBinary(node, 'ShiftRight');
+ @override
String visitStatic(HStatic node) => "Static: ${node.element.name}";
+ @override
String visitLazyStatic(HLazyStatic node) =>
"LazyStatic: ${node.element.name}";
+ @override
String visitOneShotInterceptor(HOneShotInterceptor node) =>
handleInvokeDynamic(node, "OneShotInterceptor");
+ @override
String visitStaticStore(HStaticStore node) {
String lhs = node.element.name;
return "StaticStore: $lhs = ${temporaryId(node.inputs[0])}";
}
+ @override
String visitStringConcat(HStringConcat node) {
var leftId = temporaryId(node.left);
var rightId = temporaryId(node.right);
return "StringConcat: $leftId + $rightId";
}
+ @override
String visitStringify(HStringify node) {
return "Stringify: ${temporaryId(node.inputs[0])}";
}
+ @override
String visitSubtract(HSubtract node) => handleInvokeBinary(node, 'Subtract');
+ @override
String visitSwitch(HSwitch node) {
StringBuffer buf = new StringBuffer();
buf.write("Switch: (");
@@ -475,26 +538,33 @@
return buf.toString();
}
+ @override
String visitThis(HThis node) => "This";
+ @override
String visitThrow(HThrow node) => "Throw: ${temporaryId(node.inputs[0])}";
+ @override
String visitThrowExpression(HThrowExpression node) {
return "ThrowExpression: ${temporaryId(node.inputs[0])}";
}
+ @override
String visitTruncatingDivide(HTruncatingDivide node) {
return handleInvokeBinary(node, 'TruncatingDivide');
}
+ @override
String visitRemainder(HRemainder node) {
return handleInvokeBinary(node, 'Remainder');
}
+ @override
String visitExitTry(HExitTry node) {
return "ExitTry";
}
+ @override
String visitTry(HTry node) {
List<HBasicBlock> successors = currentBlock.successors;
String tryBlock = 'B${successors[0].id}';
@@ -512,16 +582,19 @@
"Join: B${successors.last.id}";
}
+ @override
String visitIs(HIs node) {
String type = node.typeExpression.toString();
return "Is: ${temporaryId(node.expression)} is $type";
}
+ @override
String visitIsViaInterceptor(HIsViaInterceptor node) {
String type = node.typeExpression.toString();
return "IsViaInterceptor: ${temporaryId(node.inputs[0])} is $type";
}
+ @override
String visitTypeConversion(HTypeConversion node) {
String checkedInput = temporaryId(node.checkedInput);
String rest;
@@ -551,6 +624,7 @@
return '?';
}
+ @override
String visitTypeKnown(HTypeKnown node) {
assert(node.inputs.length <= 2);
String result =
@@ -561,30 +635,36 @@
return result;
}
+ @override
String visitRangeConversion(HRangeConversion node) {
return "RangeConversion: ${node.checkedInput}";
}
+ @override
String visitTypeInfoReadRaw(HTypeInfoReadRaw node) {
var inputs = node.inputs.map(temporaryId).join(', ');
return "TypeInfoReadRaw: $inputs";
}
+ @override
String visitTypeInfoReadVariable(HTypeInfoReadVariable node) {
var inputs = node.inputs.map(temporaryId).join(', ');
return "TypeInfoReadVariable: ${node.variable} $inputs";
}
+ @override
String visitTypeInfoExpression(HTypeInfoExpression node) {
var inputs = node.inputs.map(temporaryId).join(', ');
return "TypeInfoExpression: ${node.kindAsString} ${node.dartType}"
" ($inputs)";
}
+ @override
String visitAwait(HAwait node) {
return "Await: ${temporaryId(node.inputs[0])}";
}
+ @override
String visitYield(HYield node) {
return "Yield${node.hasStar ? "*" : ""}: ${temporaryId(node.inputs[0])}";
}
diff --git a/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart b/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
index 1efc255..bebc7e6 100644
--- a/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
+++ b/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
@@ -10,6 +10,7 @@
return switchCaseBody.accept(new SwitchContinueAnalysis._());
}
+ @override
bool visitContinueSwitchStatement(ir.ContinueSwitchStatement continueStmt) {
// TODO(efortuna): Check what the target of this continue statement actually
// IS, because depending on where the label points if we have a nested
@@ -18,6 +19,7 @@
return true;
}
+ @override
bool visitBlock(ir.Block block) {
for (ir.Statement statement in block.statements) {
if (statement.accept(this)) {
@@ -27,22 +29,27 @@
return false;
}
+ @override
bool visitLabeledStatement(ir.LabeledStatement statement) {
return statement.body.accept(this);
}
+ @override
bool visitDoStatement(ir.DoStatement doStatement) {
return doStatement.body.accept(this);
}
+ @override
bool visitForStatement(ir.ForStatement forStatement) {
return forStatement.body.accept(this);
}
+ @override
bool visitForInStatement(ir.ForInStatement forInStatement) {
return forInStatement.body.accept(this);
}
+ @override
bool visitSwitchStatement(ir.SwitchStatement switchStatement) {
for (var switchCase in switchStatement.cases) {
if (switchCase.accept(this)) {
@@ -52,15 +59,18 @@
return false;
}
+ @override
bool visitSwitchCase(ir.SwitchCase switchCase) {
return switchCase.body.accept(this);
}
+ @override
bool visitIfStatement(ir.IfStatement ifStatement) {
return ifStatement.then.accept(this) ||
(ifStatement.otherwise != null && ifStatement.otherwise.accept(this));
}
+ @override
bool visitTryCatch(ir.TryCatch tryCatch) {
if (tryCatch.body.accept(this)) {
for (var catchStatement in tryCatch.catches) {
@@ -72,26 +82,32 @@
return false;
}
+ @override
bool visitWhileStatement(ir.WhileStatement statement) {
return statement.body.accept(this);
}
+ @override
bool visitCatch(ir.Catch catchStatement) {
return catchStatement.body.accept(this);
}
+ @override
bool visitTryFinally(ir.TryFinally tryFinally) {
return tryFinally.body.accept(this) && tryFinally.finalizer.accept(this);
}
+ @override
bool visitFunctionDeclaration(ir.FunctionDeclaration declaration) {
return declaration.function.accept(this);
}
+ @override
bool visitFunctionNode(ir.FunctionNode node) {
return node.body.accept(this);
}
+ @override
bool defaultStatement(ir.Statement node) {
if (node is ir.ExpressionStatement ||
node is ir.EmptyStatement ||
@@ -106,5 +122,6 @@
'SwitchContinueAnalysis';
}
+ @override
bool defaultNode(ir.Node node) => false;
}
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index 0c7b575..e716108 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -41,6 +41,7 @@
final CommonElements commonElements;
final JClosedWorld closedWorld;
final OptimizationTestLog _log;
+ @override
String get name => 'SsaTypePropagator';
SsaTypePropagator(this.results, this.options, this.commonElements,
@@ -66,11 +67,13 @@
return oldType != newType;
}
+ @override
void visitGraph(HGraph graph) {
visitDominatorTree(graph);
processWorklist();
}
+ @override
visitBasicBlock(HBasicBlock block) {
if (block.isLoopHeader()) {
block.forEachPhi((HPhi phi) {
@@ -129,6 +132,7 @@
}
}
+ @override
AbstractValue visitBinaryArithmetic(HBinaryArithmetic instruction) {
HInstruction left = instruction.left;
HInstruction right = instruction.right;
@@ -152,29 +156,35 @@
return visitBinaryArithmetic(instruction);
}
+ @override
AbstractValue visitMultiply(HMultiply instruction) {
return checkPositiveInteger(instruction);
}
+ @override
AbstractValue visitAdd(HAdd instruction) {
return checkPositiveInteger(instruction);
}
+ @override
AbstractValue visitDivide(HDivide instruction) {
// Always double, as initialized.
return instruction.instructionType;
}
+ @override
AbstractValue visitTruncatingDivide(HTruncatingDivide instruction) {
// Always as initialized.
return instruction.instructionType;
}
+ @override
AbstractValue visitRemainder(HRemainder instruction) {
// Always as initialized.
return instruction.instructionType;
}
+ @override
AbstractValue visitNegate(HNegate instruction) {
HInstruction operand = instruction.operand;
// We have integer subclasses that represent ranges, so widen any int
@@ -185,16 +195,19 @@
return instruction.operand.instructionType;
}
+ @override
AbstractValue visitAbs(HAbs instruction) {
// TODO(sra): Can narrow to non-negative type for integers.
return instruction.operand.instructionType;
}
+ @override
AbstractValue visitInstruction(HInstruction instruction) {
assert(instruction.instructionType != null);
return instruction.instructionType;
}
+ @override
AbstractValue visitPhi(HPhi phi) {
AbstractValue candidateType = abstractValueDomain.emptyType;
for (int i = 0, length = phi.inputs.length; i < length; i++) {
@@ -204,6 +217,7 @@
return candidateType;
}
+ @override
AbstractValue visitTypeConversion(HTypeConversion instruction) {
HInstruction input = instruction.checkedInput;
AbstractValue inputType = input.instructionType;
@@ -261,6 +275,7 @@
return outputType;
}
+ @override
AbstractValue visitTypeKnown(HTypeKnown instruction) {
HInstruction input = instruction.checkedInput;
AbstractValue inputType = input.instructionType;
@@ -392,6 +407,7 @@
});
}
+ @override
AbstractValue visitInvokeDynamic(HInvokeDynamic instruction) {
if (instruction.isInterceptedCall) {
// We cannot do the following optimization now, because we have to wait
diff --git a/pkg/compiler/lib/src/ssa/validate.dart b/pkg/compiler/lib/src/ssa/validate.dart
index 1f93b4e..74a852a 100644
--- a/pkg/compiler/lib/src/ssa/validate.dart
+++ b/pkg/compiler/lib/src/ssa/validate.dart
@@ -20,6 +20,7 @@
// Note that during construction of the Ssa graph the basic blocks are
// not required to be valid yet.
+ @override
void visitBasicBlock(HBasicBlock block) {
currentBlock = block;
if (!isValid) return; // Don't need to continue if we are already invalid.
@@ -164,6 +165,7 @@
return true;
}
+ @override
void visitInstruction(HInstruction instruction) {
// Verifies that we are in the use list of our inputs.
bool hasCorrectInputs() {
diff --git a/pkg/compiler/lib/src/ssa/value_range_analyzer.dart b/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
index 639c727..a0af6be 100644
--- a/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
+++ b/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
@@ -102,6 +102,7 @@
const MarkerValue(this.positive, info) : super(info);
+ @override
Value operator +(Value other) {
if (other.isPositive && positive) return const MaxIntValue();
if (other.isNegative && !positive) return const MinIntValue();
@@ -109,6 +110,7 @@
return const UnknownValue();
}
+ @override
Value operator -(Value other) {
if (other.isPositive && !positive) return const MinIntValue();
if (other.isNegative && positive) return const MaxIntValue();
@@ -123,6 +125,7 @@
const IntValue(this.value, info) : super(info);
+ @override
Value operator +(dynamic other) {
if (other.isZero) return this;
if (other is! IntValue) return other + this;
@@ -133,6 +136,7 @@
return info.newIntValue(constant.intValue);
}
+ @override
Value operator -(dynamic other) {
if (other.isZero) return this;
if (other is! IntValue) return -other + this;
@@ -143,6 +147,7 @@
return info.newIntValue(constant.intValue);
}
+ @override
Value operator -() {
if (isZero) return this;
dynamic constant =
@@ -151,6 +156,7 @@
return info.newIntValue(constant.intValue);
}
+ @override
Value operator &(dynamic other) {
if (other is! IntValue) return const UnknownValue();
dynamic constant = constant_system.bitAnd.fold(
@@ -159,26 +165,34 @@
return info.newIntValue(constant.intValue);
}
+ @override
Value min(dynamic other) {
if (other is! IntValue) return other.min(this);
return this.value < other.value ? this : other;
}
+ @override
Value max(dynamic other) {
if (other is! IntValue) return other.max(this);
return this.value < other.value ? other : this;
}
+ @override
bool operator ==(other) {
if (other is! IntValue) return false;
return this.value == other.value;
}
+ @override
int get hashCode => throw new UnsupportedError('IntValue.hashCode');
+ @override
String toString() => 'IntValue $value';
+ @override
bool get isNegative => value < BigInt.zero;
+ @override
bool get isPositive => value >= BigInt.zero;
+ @override
bool get isZero => value == BigInt.zero;
}
@@ -186,13 +200,21 @@
/// which is currently +infinity.
class MaxIntValue extends Value {
const MaxIntValue() : super(null);
+ @override
Value operator +(Value other) => this;
+ @override
Value operator -(Value other) => this;
+ @override
Value operator -() => const MinIntValue();
+ @override
Value min(Value other) => other;
+ @override
Value max(Value other) => this;
+ @override
String toString() => 'Max';
+ @override
bool get isNegative => false;
+ @override
bool get isPositive => true;
}
@@ -200,13 +222,21 @@
/// which is currently -infinity.
class MinIntValue extends Value {
const MinIntValue() : super(null);
+ @override
Value operator +(Value other) => this;
+ @override
Value operator -(Value other) => this;
+ @override
Value operator -() => const MaxIntValue();
+ @override
Value min(Value other) => this;
+ @override
Value max(Value other) => other;
+ @override
String toString() => 'Min';
+ @override
bool get isNegative => true;
+ @override
bool get isPositive => false;
}
@@ -214,13 +244,21 @@
/// operation that could not be done because of too much complexity.
class UnknownValue extends Value {
const UnknownValue() : super(null);
+ @override
Value operator +(Value other) => const UnknownValue();
+ @override
Value operator -(Value other) => const UnknownValue();
+ @override
Value operator -() => const UnknownValue();
+ @override
Value min(Value other) => const UnknownValue();
+ @override
Value max(Value other) => const UnknownValue();
+ @override
bool get isNegative => false;
+ @override
bool get isPositive => false;
+ @override
String toString() => 'Unknown';
}
@@ -229,13 +267,16 @@
final HInstruction instruction;
InstructionValue(this.instruction, info) : super(info);
+ @override
bool operator ==(other) {
if (other is! InstructionValue) return false;
return this.instruction == other.instruction;
}
+ @override
int get hashCode => throw new UnsupportedError('InstructionValue.hashCode');
+ @override
Value operator +(Value other) {
if (other.isZero) return this;
if (other is IntValue) {
@@ -250,6 +291,7 @@
return other + this;
}
+ @override
Value operator -(Value other) {
if (other.isZero) return this;
if (this == other) return info.intZero;
@@ -265,19 +307,24 @@
return -other + this;
}
+ @override
Value operator -() {
return info.newNegateValue(this);
}
+ @override
bool get isNegative => false;
+ @override
bool get isPositive => false;
+ @override
String toString() => 'Instruction: $instruction';
}
/// Special value for instructions whose type is a positive integer.
class PositiveValue extends InstructionValue {
PositiveValue(HInstruction instruction, info) : super(instruction, info);
+ @override
bool get isPositive => true;
}
@@ -292,16 +339,20 @@
class AddValue extends BinaryOperationValue {
AddValue(left, right, info) : super(left, right, info);
+ @override
bool operator ==(other) {
if (other is! AddValue) return false;
return (left == other.left && right == other.right) ||
(left == other.right && right == other.left);
}
+ @override
int get hashCode => throw new UnsupportedError('AddValue.hashCode');
+ @override
Value operator -() => -left - right;
+ @override
Value operator +(Value other) {
if (other.isZero) return this;
Value value = left + other;
@@ -317,6 +368,7 @@
return const UnknownValue();
}
+ @override
Value operator -(Value other) {
if (other.isZero) return this;
Value value = left - other;
@@ -332,23 +384,30 @@
return const UnknownValue();
}
+ @override
bool get isNegative => left.isNegative && right.isNegative;
+ @override
bool get isPositive => left.isPositive && right.isPositive;
+ @override
String toString() => '$left + $right';
}
class SubtractValue extends BinaryOperationValue {
SubtractValue(left, right, info) : super(left, right, info);
+ @override
bool operator ==(other) {
if (other is! SubtractValue) return false;
return left == other.left && right == other.right;
}
+ @override
int get hashCode => throw new UnsupportedError('SubtractValue.hashCode');
+ @override
Value operator -() => right - left;
+ @override
Value operator +(Value other) {
if (other.isZero) return this;
Value value = left + other;
@@ -364,6 +423,7 @@
return const UnknownValue();
}
+ @override
Value operator -(Value other) {
if (other.isZero) return this;
Value value = left - other;
@@ -379,8 +439,11 @@
return const UnknownValue();
}
+ @override
bool get isNegative => left.isNegative && right.isPositive;
+ @override
bool get isPositive => left.isPositive && right.isNegative;
+ @override
String toString() => '$left - $right';
}
@@ -388,13 +451,16 @@
final Value value;
NegateValue(this.value, info) : super(info);
+ @override
bool operator ==(other) {
if (other is! NegateValue) return false;
return value == other.value;
}
+ @override
int get hashCode => throw new UnsupportedError('Negate.hashCode');
+ @override
Value operator +(other) {
if (other.isZero) return this;
if (other == value) return info.intZero;
@@ -411,8 +477,10 @@
return other - value;
}
+ @override
Value operator &(Value other) => const UnknownValue();
+ @override
Value operator -(other) {
if (other.isZero) return this;
if (other is IntValue) {
@@ -428,10 +496,14 @@
return -other - value;
}
+ @override
Value operator -() => value;
+ @override
bool get isNegative => value.isPositive;
+ @override
bool get isPositive => value.isNegative;
+ @override
String toString() => '-$value';
}
@@ -523,11 +595,13 @@
}
}
+ @override
bool operator ==(other) {
if (other is! Range) return false;
return other.lower == lower && other.upper == upper;
}
+ @override
int get hashCode => throw new UnsupportedError('Range.hashCode');
bool operator <(Range other) {
@@ -550,6 +624,7 @@
bool get isPositive => lower.isPositive;
bool get isSingleValue => lower == upper;
+ @override
String toString() => '[$lower, $upper]';
}
@@ -558,6 +633,7 @@
/// removes unnecessary bounds checks, and comparisons that are proven
/// to be true or false.
class SsaValueRangeAnalyzer extends HBaseVisitor implements OptimizationPhase {
+ @override
String get name => 'SSA value range builder';
/// List of [HRangeConversion] instructions created by the phase. We
@@ -578,6 +654,7 @@
: info = new ValueRangeInfo(),
this.closedWorld = closedWorld;
+ @override
void visitGraph(HGraph graph) {
this.graph = graph;
visitDominatorTree(graph);
@@ -596,6 +673,7 @@
});
}
+ @override
void visitBasicBlock(HBasicBlock block) {
void visit(HInstruction instruction) {
Range range = instruction.accept(this);
@@ -611,6 +689,7 @@
block.forEachInstruction(visit);
}
+ @override
Range visitInstruction(HInstruction instruction) {
if (instruction
.isPositiveInteger(closedWorld.abstractValueDomain)
@@ -627,6 +706,7 @@
}
}
+ @override
Range visitPhi(HPhi phi) {
if (phi.isInteger(closedWorld.abstractValueDomain).isPotentiallyFalse)
return info.newUnboundRange();
@@ -652,6 +732,7 @@
return range;
}
+ @override
Range visitConstant(HConstant hConstant) {
if (hConstant
.isInteger(closedWorld.abstractValueDomain)
@@ -679,10 +760,12 @@
return info.newNormalizedRange(value, value);
}
+ @override
Range visitFieldGet(HFieldGet fieldGet) {
return visitInstruction(fieldGet);
}
+ @override
Range visitGetLength(HGetLength node) {
PositiveValue value = info.newPositiveValue(node);
// We know this range is above zero. To simplify the analysis, we
@@ -692,6 +775,7 @@
return info.newNormalizedRange(info.intZero, value);
}
+ @override
Range visitBoundsCheck(HBoundsCheck check) {
// Save the next instruction, in case the check gets removed.
HInstruction next = check.next;
@@ -761,6 +845,7 @@
return newIndexRange;
}
+ @override
Range visitRelational(HRelational relational) {
HInstruction right = relational.right;
HInstruction left = relational.left;
@@ -828,6 +913,7 @@
return info.newUnboundRange();
}
+ @override
Range visitRemainder(HRemainder instruction) {
HInstruction left = instruction.inputs[0];
HInstruction right = instruction.inputs[1];
@@ -862,6 +948,7 @@
return info.newUnboundRange();
}
+ @override
Range visitInvokeDynamicMethod(HInvokeDynamicMethod invoke) {
if ((invoke.inputs.length == 3) && (invoke.selector.name == "%"))
return handleInvokeModulo(invoke);
@@ -879,14 +966,17 @@
.apply(ranges[instruction.left], ranges[instruction.right]);
}
+ @override
Range visitAdd(HAdd add) {
return handleBinaryOperation(add);
}
+ @override
Range visitSubtract(HSubtract sub) {
return handleBinaryOperation(sub);
}
+ @override
Range visitBitAnd(HBitAnd node) {
if (node.isInteger(closedWorld.abstractValueDomain).isPotentiallyFalse) {
return info.newUnboundRange();
@@ -918,6 +1008,7 @@
return info.newUnboundRange();
}
+ @override
Range visitCheck(HCheck instruction) {
if (ranges[instruction.checkedInput] == null) {
return visitInstruction(instruction);
@@ -986,6 +1077,7 @@
return range.intersection(leftRange);
}
+ @override
Range visitConditionalBranch(HConditionalBranch branch) {
dynamic condition = branch.condition;
// TODO(ngeoffray): Handle complex conditions.
@@ -1051,6 +1143,7 @@
return info.newUnboundRange();
}
+ @override
Range visitRangeConversion(HRangeConversion conversion) {
return ranges[conversion];
}
@@ -1095,6 +1188,7 @@
return instruction.accept(this);
}
+ @override
Range visitPhi(HPhi phi) {
// If the update of a loop phi involves another loop phi, we give
// up.
@@ -1112,14 +1206,17 @@
return phiRange;
}
+ @override
Range visitCheck(HCheck instruction) {
return visit(instruction.checkedInput);
}
+ @override
Range visitAdd(HAdd operation) {
return handleBinaryOperation(operation);
}
+ @override
Range visitSubtract(HSubtract operation) {
return handleBinaryOperation(operation);
}
diff --git a/pkg/compiler/lib/src/ssa/value_set.dart b/pkg/compiler/lib/src/ssa/value_set.dart
index 89dbeca..b24a560 100644
--- a/pkg/compiler/lib/src/ssa/value_set.dart
+++ b/pkg/compiler/lib/src/ssa/value_set.dart
@@ -152,6 +152,7 @@
class ValueSetNode {
final HInstruction value;
final int hash;
+ @override
int get hashCode => hash;
ValueSetNode next;
ValueSetNode(this.value, this.hash, this.next);
diff --git a/pkg/compiler/lib/src/ssa/variable_allocator.dart b/pkg/compiler/lib/src/ssa/variable_allocator.dart
index aca7c88..a9f6e39 100644
--- a/pkg/compiler/lib/src/ssa/variable_allocator.dart
+++ b/pkg/compiler/lib/src/ssa/variable_allocator.dart
@@ -16,6 +16,7 @@
assert(start <= end);
}
+ @override
String toString() => '[$start $end[';
}
@@ -56,6 +57,7 @@
return false;
}
+ @override
String toString() {
List<String> res = new List<String>();
for (final interval in ranges) res.add(interval.toString());
@@ -148,6 +150,7 @@
bool get isEmpty => liveInstructions.isEmpty && loopMarkers.isEmpty;
bool contains(HInstruction instruction) =>
liveInstructions.containsKey(instruction);
+ @override
String toString() => liveInstructions.toString();
}
@@ -174,6 +177,7 @@
: liveInstructions = new Map<HBasicBlock, LiveEnvironment>(),
liveIntervals = new Map<HInstruction, LiveInterval>();
+ @override
void visitGraph(HGraph graph) {
visitPostDominatorTree(graph);
if (!liveInstructions[graph.entry].isEmpty) {
@@ -251,6 +255,7 @@
}
}
+ @override
void visitBasicBlock(HBasicBlock block) {
LiveEnvironment environment =
new LiveEnvironment(liveIntervals, instructionId);
@@ -356,6 +361,7 @@
Copy(this.source, this.destination);
+ @override
String toString() => '$destination <- $source';
}
@@ -381,6 +387,7 @@
assignments.add(new Copy<HInstruction>(source, destination));
}
+ @override
String toString() => 'Copies: $copies, assignments: $assignments';
bool get isEmpty => copies.isEmpty && assignments.isEmpty;
@@ -574,10 +581,12 @@
this.generateAtUseSite)
: this.names = new VariableNames();
+ @override
void visitGraph(HGraph graph) {
visitDominatorTree(graph);
}
+ @override
void visitBasicBlock(HBasicBlock block) {
VariableNamer variableNamer =
new VariableNamer(liveInstructions[block], names, _namer);
diff --git a/pkg/compiler/lib/src/tracer.dart b/pkg/compiler/lib/src/tracer.dart
index f4e7870..2c687bf 100644
--- a/pkg/compiler/lib/src/tracer.dart
+++ b/pkg/compiler/lib/src/tracer.dart
@@ -26,6 +26,7 @@
final JClosedWorld closedWorld;
final Namer namer;
bool traceActive = false;
+ @override
final api.OutputSink output;
final RegExp traceFilter;
diff --git a/pkg/compiler/lib/src/universe/call_structure.dart b/pkg/compiler/lib/src/universe/call_structure.dart
index d40a26e..8c148c8 100644
--- a/pkg/compiler/lib/src/universe/call_structure.dart
+++ b/pkg/compiler/lib/src/universe/call_structure.dart
@@ -109,6 +109,7 @@
return sb.toString();
}
+ @override
String toString() => 'CallStructure(${structureToString()})';
Selector get callSelector => new Selector.call(Names.call, this);
@@ -122,6 +123,7 @@
}
// TODO(johnniwinther): Cache hash code?
+ @override
int get hashCode {
return Hashing.listHash(
namedArguments,
@@ -129,6 +131,7 @@
Hashing.objectHash(typeArgumentCount, namedArguments.length)));
}
+ @override
bool operator ==(other) {
if (other is! CallStructure) return false;
return match(other);
@@ -184,6 +187,7 @@
///
class NamedCallStructure extends CallStructure {
+ @override
final List<String> namedArguments;
final List<String> _orderedNamedArguments = <String>[];
diff --git a/pkg/compiler/lib/src/universe/class_hierarchy.dart b/pkg/compiler/lib/src/universe/class_hierarchy.dart
index e5707ad..940d180 100644
--- a/pkg/compiler/lib/src/universe/class_hierarchy.dart
+++ b/pkg/compiler/lib/src/universe/class_hierarchy.dart
@@ -184,6 +184,7 @@
commonElements, classHierarchyNodes, classSets);
}
+ @override
void writeToDataSink(DataSink sink) {
sink.begin(tag);
sink.writeInt(_classSets.length);
@@ -231,6 +232,7 @@
/// Returns `true` if [x] is a subtype of [y], that is, if [x] implements an
/// instance of [y].
+ @override
bool isSubtypeOf(ClassEntity x, ClassEntity y) {
ClassSet classSet = _classSets[y];
assert(
@@ -246,12 +248,14 @@
}
/// Return `true` if [x] is a (non-strict) subclass of [y].
+ @override
bool isSubclassOf(ClassEntity x, ClassEntity y) {
return _classHierarchyNodes[y].hasSubclass(_classHierarchyNodes[x]);
}
/// Returns an iterable over the directly instantiated classes that extend
/// [cls] possibly including [cls] itself, if it is live.
+ @override
Iterable<ClassEntity> subclassesOf(ClassEntity cls) {
ClassHierarchyNode hierarchy = _classHierarchyNodes[cls];
if (hierarchy == null) return const <ClassEntity>[];
@@ -261,6 +265,7 @@
/// Returns an iterable over the directly instantiated classes that extend
/// [cls] _not_ including [cls] itself.
+ @override
Iterable<ClassEntity> strictSubclassesOf(ClassEntity cls) {
ClassHierarchyNode subclasses = _classHierarchyNodes[cls];
if (subclasses == null) return const <ClassEntity>[];
@@ -271,6 +276,7 @@
/// Returns the number of live classes that extend [cls] _not_
/// including [cls] itself.
+ @override
int strictSubclassCount(ClassEntity cls) {
ClassHierarchyNode subclasses = _classHierarchyNodes[cls];
if (subclasses == null) return 0;
@@ -279,6 +285,7 @@
/// Applies [f] to each live class that extend [cls] _not_ including [cls]
/// itself.
+ @override
void forEachStrictSubclassOf(
ClassEntity cls, IterationStep f(ClassEntity cls)) {
ClassHierarchyNode subclasses = _classHierarchyNodes[cls];
@@ -289,6 +296,7 @@
/// Returns `true` if [predicate] applies to any live class that extend [cls]
/// _not_ including [cls] itself.
+ @override
bool anyStrictSubclassOf(ClassEntity cls, bool predicate(ClassEntity cls)) {
ClassHierarchyNode subclasses = _classHierarchyNodes[cls];
if (subclasses == null) return false;
@@ -299,6 +307,7 @@
/// Returns an iterable over the directly instantiated that implement [cls]
/// possibly including [cls] itself, if it is live.
+ @override
Iterable<ClassEntity> subtypesOf(ClassEntity cls) {
ClassSet classSet = _classSets[cls];
if (classSet == null) {
@@ -311,6 +320,7 @@
/// Returns an iterable over the directly instantiated that implement [cls]
/// _not_ including [cls].
+ @override
Iterable<ClassEntity> strictSubtypesOf(ClassEntity cls) {
ClassSet classSet = _classSets[cls];
if (classSet == null) {
@@ -323,6 +333,7 @@
/// Returns the number of live classes that implement [cls] _not_
/// including [cls] itself.
+ @override
int strictSubtypeCount(ClassEntity cls) {
ClassSet classSet = _classSets[cls];
if (classSet == null) return 0;
@@ -331,6 +342,7 @@
/// Applies [f] to each live class that implements [cls] _not_ including [cls]
/// itself.
+ @override
void forEachStrictSubtypeOf(
ClassEntity cls, IterationStep f(ClassEntity cls)) {
ClassSet classSet = _classSets[cls];
@@ -341,6 +353,7 @@
/// Returns `true` if [predicate] applies to any live class that extend [cls]
/// _not_ including [cls] itself.
+ @override
bool anyStrictSubtypeOf(ClassEntity cls, bool predicate(ClassEntity cls)) {
ClassSet classSet = _classSets[cls];
if (classSet == null) return false;
@@ -350,6 +363,7 @@
}
/// Returns `true` if [a] and [b] have any known common subtypes.
+ @override
bool haveAnyCommonSubtypes(ClassEntity a, ClassEntity b) {
ClassSet classSetA = _classSets[a];
ClassSet classSetB = _classSets[b];
@@ -366,6 +380,7 @@
/// Returns `true` if any directly instantiated class other than [cls] extends
/// [cls].
+ @override
bool hasAnyStrictSubclass(ClassEntity cls) {
ClassHierarchyNode subclasses = _classHierarchyNodes[cls];
if (subclasses == null) return false;
@@ -374,12 +389,14 @@
/// Returns `true` if any directly instantiated class other than [cls]
/// implements [cls].
+ @override
bool hasAnyStrictSubtype(ClassEntity cls) {
return strictSubtypeCount(cls) > 0;
}
/// Returns `true` if all directly instantiated classes that implement [cls]
/// extend it.
+ @override
bool hasOnlySubclasses(ClassEntity cls) {
// TODO(johnniwinther): move this to ClassSet?
if (cls == _commonElements.objectClass) return true;
@@ -391,6 +408,7 @@
return classSet.hasOnlyInstantiatedSubclasses;
}
+ @override
SubclassResult commonSubclasses(ClassEntity cls1, ClassQuery query1,
ClassEntity cls2, ClassQuery query2) {
if (query1 == ClassQuery.EXACT && query2 == ClassQuery.EXACT) {
@@ -541,6 +559,7 @@
///
/// This method is only provided for testing. For queries on classes, use the
/// methods defined in [JClosedWorld].
+ @override
ClassHierarchyNode getClassHierarchyNode(ClassEntity cls) {
return _classHierarchyNodes[cls];
}
@@ -550,6 +569,7 @@
///
/// This method is only provided for testing. For queries on classes, use the
/// methods defined in [JClosedWorld].
+ @override
ClassSet getClassSet(ClassEntity cls) {
return _classSets[cls];
}
@@ -1004,5 +1024,6 @@
static const SubclassResult SUBTYPE2 =
const SubclassResult.internal(SubclassResultKind.SUBTYPE2);
+ @override
String toString() => 'SubclassResult($kind,classes=$classes)';
}
diff --git a/pkg/compiler/lib/src/universe/class_set.dart b/pkg/compiler/lib/src/universe/class_set.dart
index fa29bf7..a2eaee0 100644
--- a/pkg/compiler/lib/src/universe/class_set.dart
+++ b/pkg/compiler/lib/src/universe/class_set.dart
@@ -448,6 +448,7 @@
return sb.toString();
}
+ @override
String toString() => cls.toString();
}
@@ -841,6 +842,7 @@
return null;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('[\n');
@@ -1040,6 +1042,7 @@
/// Singleton map implemented as a field on the key.
class ClassHierarchyNodesMap extends MapBase<ClassEntity, ClassHierarchyNode> {
+ @override
ClassHierarchyNode operator [](Object cls) {
// TODO(sra): Change the key type to `covariant ClassHierarchyNodesMapKey`.
if (cls is ClassHierarchyNodesMapKey) {
@@ -1048,6 +1051,7 @@
throw new UnimplementedError('ClassHierarchyNodesMap for $cls');
}
+ @override
operator []=(Object cls, ClassHierarchyNode node) {
// TODO(sra): Change the key type to `covariant ClassHierarchyNodesMapKey`.
if (cls is ClassHierarchyNodesMapKey) {
@@ -1057,19 +1061,23 @@
throw new UnimplementedError('ClassHierarchyNodesMap for $cls');
}
+ @override
ClassHierarchyNode putIfAbsent(
ClassEntity cls, ClassHierarchyNode ifAbsent()) {
return this[cls] ??= ifAbsent();
}
+ @override
Iterable<ClassEntity> get keys {
throw new UnimplementedError('ClassHierarchyNodesMap.keys');
}
+ @override
ClassHierarchyNode remove(Object key) {
throw new UnimplementedError('ClassHierarchyNodesMap.remove');
}
+ @override
void clear() {
throw new UnimplementedError('ClassHierarchyNodesMap.clear');
}
diff --git a/pkg/compiler/lib/src/universe/codegen_world_builder.dart b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
index 4bf8ac1..4ece571 100644
--- a/pkg/compiler/lib/src/universe/codegen_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
@@ -90,6 +90,7 @@
Iterable<FieldEntity> get allReferencedStaticFields;
/// Set of methods in instantiated classes that are potentially closurized.
+ @override
Iterable<FunctionEntity> get closurizedMembers;
/// Register [constant] as needed for emission.
@@ -136,13 +137,16 @@
/// The set of all referenced static fields.
///
/// Invariant: Elements are declaration elements.
+ @override
final Set<FieldEntity> allReferencedStaticFields = new Set<FieldEntity>();
/// Documentation wanted -- johnniwinther
///
/// Invariant: Elements are declaration elements.
+ @override
final Set<FunctionEntity> staticFunctionsNeedingGetter =
new Set<FunctionEntity>();
+ @override
final Set<FunctionEntity> methodsNeedingSuperGetter =
new Set<FunctionEntity>();
final Map<String, Map<Selector, SelectorConstraints>> _invokedNames =
@@ -181,6 +185,7 @@
final Map<String, Set<MemberUsage>> _instanceFunctionsByName =
<String, Set<MemberUsage>>{};
+ @override
final Set<DartType> isChecks = new Set<DartType>();
final SelectorConstraintsStrategy selectorConstraintsStrategy;
@@ -201,6 +206,7 @@
GlobalLocalsMap get _globalLocalsMap => _world.globalLocalsMap;
+ @override
Iterable<ClassEntity> get instantiatedClasses => _processedClasses.keys
.where((cls) => _processedClasses[cls].isInstantiated);
@@ -208,6 +214,7 @@
/// constructor that has been called directly and not only through a
/// super-call.
// TODO(johnniwinther): Improve semantic precision.
+ @override
Iterable<ClassEntity> get directlyInstantiatedClasses {
return _directlyInstantiatedClasses;
}
@@ -217,6 +224,7 @@
///
/// See [directlyInstantiatedClasses].
// TODO(johnniwinther): Improve semantic precision.
+ @override
Iterable<InterfaceType> get instantiatedTypes => _instantiatedTypes;
/// Register [type] as (directly) instantiated.
@@ -270,11 +278,13 @@
return _hasMatchingSelector(_invokedNames[member.name], member, _world);
}
+ @override
bool hasInvokedGetter(MemberEntity member) {
return _hasMatchingSelector(_invokedGetters[member.name], member, _world) ||
member.isFunction && methodsNeedingSuperGetter.contains(member);
}
+ @override
bool hasInvokedSetter(MemberEntity member) {
return _hasMatchingSelector(_invokedSetters[member.name], member, _world);
}
@@ -347,28 +357,34 @@
return new UnmodifiableMapView(map);
}
+ @override
Map<Selector, SelectorConstraints> invocationsByName(String name) {
return _asUnmodifiable(_invokedNames[name]);
}
+ @override
Map<Selector, SelectorConstraints> getterInvocationsByName(String name) {
return _asUnmodifiable(_invokedGetters[name]);
}
+ @override
Map<Selector, SelectorConstraints> setterInvocationsByName(String name) {
return _asUnmodifiable(_invokedSetters[name]);
}
+ @override
void forEachInvokedName(
f(String name, Map<Selector, SelectorConstraints> selectors)) {
_invokedNames.forEach(f);
}
+ @override
void forEachInvokedGetter(
f(String name, Map<Selector, SelectorConstraints> selectors)) {
_invokedGetters.forEach(f);
}
+ @override
void forEachInvokedSetter(
f(String name, Map<Selector, SelectorConstraints> selectors)) {
_invokedSetters.forEach(f);
@@ -723,11 +739,13 @@
_constTypeLiterals.add(type);
}
+ @override
Iterable<DartType> get constTypeLiterals => _constTypeLiterals;
void registerTypeArgument(DartType type) {
_liveTypeArguments.add(type);
}
+ @override
Iterable<DartType> get liveTypeArguments => _liveTypeArguments;
}
diff --git a/pkg/compiler/lib/src/universe/feature.dart b/pkg/compiler/lib/src/universe/feature.dart
index f0c29bc..484ce10 100644
--- a/pkg/compiler/lib/src/universe/feature.dart
+++ b/pkg/compiler/lib/src/universe/feature.dart
@@ -103,12 +103,14 @@
MapLiteralUse(this.type, {this.isConstant: false, this.isEmpty: false});
+ @override
int get hashCode {
return type.hashCode * 13 +
isConstant.hashCode * 17 +
isEmpty.hashCode * 19;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! MapLiteralUse) return false;
@@ -117,6 +119,7 @@
isEmpty == other.isEmpty;
}
+ @override
String toString() {
return 'MapLiteralUse($type,isConstant:$isConstant,isEmpty:$isEmpty)';
}
@@ -130,9 +133,11 @@
SetLiteralUse(this.type, {this.isConstant: false, this.isEmpty: false});
+ @override
int get hashCode =>
type.hashCode * 13 + isConstant.hashCode * 17 + isEmpty.hashCode * 19;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! SetLiteralUse) return false;
@@ -141,6 +146,7 @@
isEmpty == other.isEmpty;
}
+ @override
String toString() =>
'SetLiteralUse($type,isConstant:$isConstant,isEmpty:$isEmpty)';
}
@@ -153,12 +159,14 @@
ListLiteralUse(this.type, {this.isConstant: false, this.isEmpty: false});
+ @override
int get hashCode {
return type.hashCode * 13 +
isConstant.hashCode * 17 +
isEmpty.hashCode * 19;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! ListLiteralUse) return false;
@@ -167,6 +175,7 @@
isEmpty == other.isEmpty;
}
+ @override
String toString() {
return 'ListLiteralUse($type,isConstant:$isConstant,isEmpty:$isEmpty)';
}
@@ -185,11 +194,13 @@
RuntimeTypeUse(this.kind, this.receiverType, this.argumentType);
+ @override
int get hashCode =>
kind.hashCode * 13 +
receiverType.hashCode * 17 +
argumentType.hashCode * 19;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! RuntimeTypeUse) return false;
@@ -220,6 +231,7 @@
return sb.toString();
}
+ @override
String toString() => 'RuntimeTypeUse(kind=$kind,receiver=$receiverType'
',argument=$argumentType)';
}
@@ -238,9 +250,11 @@
/// Short textual representation use for testing.
String get shortText => '<${typeArguments.join(',')}>';
+ @override
int get hashCode =>
Hashing.listHash(typeArguments, Hashing.objectHash(functionType));
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! GenericInstantiation) return false;
@@ -248,6 +262,7 @@
equalElements(typeArguments, other.typeArguments);
}
+ @override
String toString() {
return 'GenericInstantiation(functionType:$functionType,'
'typeArguments:$typeArguments)';
diff --git a/pkg/compiler/lib/src/universe/function_set.dart b/pkg/compiler/lib/src/universe/function_set.dart
index e8edd4b..d12781c 100644
--- a/pkg/compiler/lib/src/universe/function_set.dart
+++ b/pkg/compiler/lib/src/universe/function_set.dart
@@ -96,6 +96,7 @@
class SelectorMask {
final Selector selector;
final AbstractValue receiver;
+ @override
final int hashCode;
SelectorMask(this.selector, this.receiver)
@@ -119,11 +120,13 @@
.isPotentiallyTrue;
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
return selector == other.selector && receiver == other.receiver;
}
+ @override
String toString() => '($selector,$receiver)';
}
@@ -238,6 +241,7 @@
return result;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('FunctionSetNode(');
@@ -273,6 +277,7 @@
@override
Iterable<MemberEntity> get functions => const <MemberEntity>[];
+ @override
String toString() => '<empty>';
}
@@ -289,5 +294,6 @@
return _receiver ??= domain.computeReceiver(functions);
}
+ @override
String toString() => '$_receiver:$functions';
}
diff --git a/pkg/compiler/lib/src/universe/member_usage.dart b/pkg/compiler/lib/src/universe/member_usage.dart
index b0898df..50fc2dc 100644
--- a/pkg/compiler/lib/src/universe/member_usage.dart
+++ b/pkg/compiler/lib/src/universe/member_usage.dart
@@ -140,20 +140,26 @@
@override
EnumSet<MemberUse> get _originalUse => MemberUses.NORMAL_ONLY;
+ @override
int get hashCode => entity.hashCode;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! MemberUsage) return false;
return entity == other.entity;
}
+ @override
String toString() => '$entity:${appliedUse.iterable(MemberUse.values)}';
}
class FieldUsage extends MemberUsage {
+ @override
bool hasInit = false;
+ @override
bool hasRead = false;
+ @override
bool hasWrite = false;
FieldUsage(FieldEntity field, {bool isNative: false})
@@ -221,12 +227,15 @@
return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
}
+ @override
String toString() => 'FieldUsage($entity,hasInit=$hasInit,hasRead=$hasRead,'
'hasWrite=$hasWrite,pendingUse=${_pendingUse.iterable(MemberUse.values)}';
}
class FinalFieldUsage extends MemberUsage {
+ @override
bool hasInit = false;
+ @override
bool hasRead = false;
FinalFieldUsage(FieldEntity field, {bool isNative: false})
@@ -280,12 +289,15 @@
return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
}
+ @override
String toString() => 'FinalFieldUsage($entity,hasInit=$hasInit,'
'hasRead=$hasRead,pendingUse=${_pendingUse.iterable(MemberUse.values)}';
}
class FunctionUsage extends MemberUsage {
+ @override
bool hasInvoke = false;
+ @override
bool hasRead = false;
FunctionUsage(FunctionEntity function) : super.internal(function) {
@@ -297,11 +309,14 @@
}
}
+ @override
FunctionEntity get entity => super.entity;
+ @override
EnumSet<MemberUse> get _originalUse =>
entity.isInstanceMember ? MemberUses.ALL_INSTANCE : MemberUses.ALL_STATIC;
+ @override
bool get hasPendingClosurizationUse => entity.isInstanceMember
? _pendingUse.contains(MemberUse.CLOSURIZE_INSTANCE)
: _pendingUse.contains(MemberUse.CLOSURIZE_STATIC);
@@ -349,6 +364,7 @@
}
class ParameterTrackingFunctionUsage extends MemberUsage {
+ @override
bool hasRead = false;
final ParameterUsage _parameterUsage;
@@ -364,12 +380,15 @@
}
}
+ @override
bool get hasInvoke => _parameterUsage.hasInvoke;
+ @override
bool get hasPendingClosurizationUse => entity.isInstanceMember
? _pendingUse.contains(MemberUse.CLOSURIZE_INSTANCE)
: _pendingUse.contains(MemberUse.CLOSURIZE_STATIC);
+ @override
EnumSet<MemberUse> get _originalUse =>
entity.isInstanceMember ? MemberUses.ALL_INSTANCE : MemberUses.ALL_STATIC;
@@ -420,6 +439,7 @@
@override
bool get hasPendingNormalUse => !isFullyInvoked;
+ @override
bool get isFullyInvoked => _parameterUsage.isFullyUsed;
@override
@@ -430,6 +450,7 @@
}
class GetterUsage extends MemberUsage {
+ @override
bool hasRead = false;
GetterUsage(FunctionEntity getter) : super.internal(getter);
@@ -454,6 +475,7 @@
}
class SetterUsage extends MemberUsage {
+ @override
bool hasWrite = false;
SetterUsage(FunctionEntity setter) : super.internal(setter);
@@ -475,12 +497,15 @@
}
class ConstructorUsage extends MemberUsage {
+ @override
bool hasInvoke = false;
ConstructorUsage(ConstructorEntity constructor) : super.internal(constructor);
+ @override
ConstructorEntity get entity => super.entity;
+ @override
EnumSet<MemberUse> get _originalUse => MemberUses.NORMAL_ONLY;
@override
@@ -512,8 +537,10 @@
: _parameterUsage = new ParameterUsage(constructor.parameterStructure),
super.internal(constructor);
+ @override
ConstructorEntity get entity => super.entity;
+ @override
EnumSet<MemberUse> get _originalUse => MemberUses.NORMAL_ONLY;
@override
@@ -548,6 +575,7 @@
@override
bool get hasPendingNormalUse => !isFullyInvoked;
+ @override
bool get isFullyInvoked => _parameterUsage.isFullyUsed;
@override
@@ -620,6 +648,7 @@
@override
EnumSet<ClassUse> get _originalUse => ClassUses.ALL;
+ @override
String toString() => '$cls:${appliedUse.iterable(ClassUse.values)}';
}
@@ -641,6 +670,7 @@
// TODO(johnniwinther): Merge this with [MemberUsage].
abstract class StaticMemberUsage extends AbstractUsage<MemberUse>
implements MemberUsage {
+ @override
final MemberEntity entity;
bool hasNormalUse = false;
@@ -658,14 +688,19 @@
EnumSet<MemberUse> tearOff();
+ @override
EnumSet<MemberUse> init() => normalUse();
+ @override
EnumSet<MemberUse> read() => tearOff();
+ @override
EnumSet<MemberUse> write() => normalUse();
+ @override
EnumSet<MemberUse> invoke(CallStructure callStructure) => normalUse();
+ @override
EnumSet<MemberUse> fullyUse() => normalUse();
@override
@@ -677,12 +712,14 @@
@override
EnumSet<MemberUse> get _originalUse => MemberUses.NORMAL_ONLY;
+ @override
String toString() => '$entity:${appliedUse.iterable(MemberUse.values)}';
}
class GeneralStaticMemberUsage extends StaticMemberUsage {
GeneralStaticMemberUsage(MemberEntity entity) : super.internal(entity);
+ @override
EnumSet<MemberUse> tearOff() => normalUse();
@override
@@ -708,15 +745,18 @@
}
class StaticFunctionUsage extends StaticMemberUsage {
+ @override
bool hasClosurization = false;
StaticFunctionUsage(FunctionEntity entity) : super.internal(entity);
+ @override
FunctionEntity get entity => super.entity;
@override
bool get hasInit => true;
+ @override
EnumSet<MemberUse> tearOff() {
if (hasClosurization) {
return MemberUses.NONE;
diff --git a/pkg/compiler/lib/src/universe/resolution_world_builder.dart b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
index 9835da3..0111c4d 100644
--- a/pkg/compiler/lib/src/universe/resolution_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
@@ -144,11 +144,13 @@
Instance(this.type, this.kind, {this.isRedirection: false});
+ @override
int get hashCode {
return Hashing.objectHash(
type, Hashing.objectHash(kind, Hashing.objectHash(isRedirection)));
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! Instance) return false;
@@ -157,6 +159,7 @@
isRedirection == other.isRedirection;
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write(type);
@@ -270,6 +273,7 @@
/// `true` if the class is abstractly instantiated.
bool isAbstractlyInstantiated = false;
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('InstantiationInfo[');
@@ -366,11 +370,14 @@
<String, Set<MemberUsage>>{};
/// Fields set.
+ @override
final Set<FieldEntity> fieldSetters = new Set<FieldEntity>();
+ @override
final Set<DartType> isChecks = new Set<DartType>();
/// Set of all closures in the program. Used by the mirror tracking system
/// to find all live closure instances.
+ @override
final Set<Local> localFunctions = new Set<Local>();
/// Set of live local functions (closures) whose signatures reference type
@@ -378,12 +385,14 @@
///
/// A local function is considered live if the enclosing member function is
/// live.
+ @override
final Set<Local> localFunctionsWithFreeTypeVariables = new Set<Local>();
/// Set of live closurized members whose signatures reference type variables.
///
/// A closurized method is considered live if the enclosing class has been
/// instantiated.
+ @override
final Set<FunctionEntity> closurizedMembersWithFreeTypeVariables =
new Set<FunctionEntity>();
@@ -415,6 +424,7 @@
final Set<ConstantValue> _constantValues = new Set<ConstantValue>();
+ @override
final Set<Local> genericLocalFunctions = new Set<Local>();
Set<MemberEntity> _processedMembers = new Set<MemberEntity>();
@@ -442,16 +452,20 @@
this._classHierarchyBuilder,
this._classQueries);
+ @override
Iterable<ClassEntity> get processedClasses => _processedClasses.keys
.where((cls) => _processedClasses[cls].isInstantiated);
+ @override
bool isMemberProcessed(MemberEntity member) =>
_processedMembers.contains(member);
+ @override
void registerProcessedMember(MemberEntity member) {
_processedMembers.add(member);
}
+ @override
Iterable<FunctionEntity> get genericInstanceMethods {
List<FunctionEntity> functions = <FunctionEntity>[];
for (MemberEntity member in processedMembers) {
@@ -464,6 +478,7 @@
return functions;
}
+ @override
Iterable<FunctionEntity> get userNoSuchMethods {
List<FunctionEntity> functions = <FunctionEntity>[];
for (MemberEntity member in processedMembers) {
@@ -477,8 +492,10 @@
return functions;
}
+ @override
Iterable<MemberEntity> get processedMembers => _processedMembers;
+ @override
KClosedWorld get closedWorldForTesting {
if (!_closed) {
failedAt(
@@ -491,6 +508,7 @@
/// constructor that has been called directly and not only through a
/// super-call.
// TODO(johnniwinther): Improve semantic precision.
+ @override
Iterable<ClassEntity> get directlyInstantiatedClasses {
Set<ClassEntity> classes = new Set<ClassEntity>();
getInstantiationMap().forEach((ClassEntity cls, InstantiationInfo info) {
@@ -506,6 +524,7 @@
///
/// See [directlyInstantiatedClasses].
// TODO(johnniwinther): Improve semantic precision.
+ @override
Iterable<InterfaceType> get instantiatedTypes {
Set<InterfaceType> types = new Set<InterfaceType>();
getInstantiationMap().forEach((_, InstantiationInfo info) {
@@ -520,10 +539,12 @@
return types;
}
+ @override
bool isImplemented(ClassEntity cls) {
return _implementedClasses.contains(cls);
}
+ @override
void registerClosurizedMember(MemberEntity element) {
closurizedMembers.add(element);
FunctionType type = _elementEnvironment.getFunctionType(element);
@@ -538,6 +559,7 @@
// TODO(johnniwinther): Fully enforce the separation between exact, through
// subclass and through subtype instantiated types/classes.
// TODO(johnniwinther): Support unknown type arguments for generic types.
+ @override
void registerTypeInstantiation(
InterfaceType type, ClassUsedCallback classUsed,
{ConstructorEntity constructor, bool isRedirection: false}) {
@@ -628,10 +650,12 @@
member.isFunction && methodsNeedingSuperGetter.contains(member);
}
+ @override
bool hasInvokedSetter(MemberEntity member) {
return _hasMatchingSelector(_invokedSetters[member.name], member);
}
+ @override
void registerDynamicUse(
DynamicUse dynamicUse, MemberUsedCallback memberUsed) {
Selector selector = dynamicUse.selector;
@@ -696,14 +720,17 @@
return constraints.addReceiverConstraint(constraint);
}
+ @override
void registerIsCheck(covariant DartType type) {
isChecks.add(type);
}
+ @override
bool registerConstantUse(ConstantUse use) {
return _constantValues.add(use.value);
}
+ @override
void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) {
if (staticUse.kind == StaticUseKind.CLOSURE) {
Local localFunction = staticUse.element;
@@ -828,6 +855,7 @@
/// Computes usage for all members declared by [cls]. Calls [membersUsed] with
/// the usage changes for each member.
+ @override
void processClassMembers(ClassEntity cls, MemberUsedCallback memberUsed) {
_elementEnvironment.forEachClassMember(cls,
(ClassEntity cls, MemberEntity member) {
@@ -946,11 +974,13 @@
}
/// Returns an iterable over all mixin applications that mixin [cls].
+ @override
Iterable<ClassEntity> allMixinUsesOf(ClassEntity cls) {
Iterable<ClassEntity> uses = _classHierarchyBuilder.mixinUses[cls];
return uses != null ? uses : const <ClassEntity>[];
}
+ @override
void registerUsedElement(MemberEntity element) {
if (element.isInstanceMember && !element.isAbstract) {
_liveInstanceMembers.add(element);
@@ -1011,6 +1041,7 @@
return assignedInstanceMembers;
}
+ @override
void registerClass(ClassEntity cls) {
_classHierarchyBuilder.registerClass(cls);
}
diff --git a/pkg/compiler/lib/src/universe/selector.dart b/pkg/compiler/lib/src/universe/selector.dart
index f8a1dc4..2f70e16 100644
--- a/pkg/compiler/lib/src/universe/selector.dart
+++ b/pkg/compiler/lib/src/universe/selector.dart
@@ -17,6 +17,7 @@
class SelectorKind {
final String name;
+ @override
final int hashCode;
const SelectorKind(this.name, this.hashCode);
@@ -29,6 +30,7 @@
int get index => hashCode;
+ @override
String toString() => name;
static List<SelectorKind> values = const <SelectorKind>[
@@ -50,6 +52,7 @@
final Name memberName;
final CallStructure callStructure;
+ @override
final int hashCode;
int get argumentCount => callStructure.argumentCount;
@@ -307,6 +310,7 @@
return Hashing.mixHashCodeBits(hash, callStructure.hashCode);
}
+ @override
String toString() {
return 'Selector($kind, $name, ${callStructure.structureToString()})';
}
diff --git a/pkg/compiler/lib/src/universe/side_effects.dart b/pkg/compiler/lib/src/universe/side_effects.dart
index aac589a..2a63070 100644
--- a/pkg/compiler/lib/src/universe/side_effects.dart
+++ b/pkg/compiler/lib/src/universe/side_effects.dart
@@ -57,8 +57,10 @@
sink.end(tag);
}
+ @override
bool operator ==(other) => _flags == other._flags;
+ @override
int get hashCode => throw new UnsupportedError('SideEffects.hashCode');
bool _getFlag(int position) {
@@ -200,6 +202,7 @@
int get flags => _flags;
+ @override
String toString() {
StringBuffer buffer = new StringBuffer();
buffer.write('SideEffects(reads');
@@ -307,6 +310,7 @@
MemberEntity get member => _member;
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('SideEffectsBuilder(member=$member,');
diff --git a/pkg/compiler/lib/src/universe/use.dart b/pkg/compiler/lib/src/universe/use.dart
index ab3ffbb..6e19b31 100644
--- a/pkg/compiler/lib/src/universe/use.dart
+++ b/pkg/compiler/lib/src/universe/use.dart
@@ -85,9 +85,11 @@
List<DartType> get typeArguments => const <DartType>[];
+ @override
int get hashCode => Hashing.listHash(
typeArguments, Hashing.objectsHash(selector, receiverConstraint));
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! DynamicUse) return false;
@@ -96,6 +98,7 @@
equalElements(typeArguments, other.typeArguments);
}
+ @override
String toString() => '$selector,$receiverConstraint';
}
@@ -112,6 +115,7 @@
"${typeArguments?.length ?? 0} were passed.");
}
+ @override
List<DartType> get typeArguments => _typeArguments ?? const <DartType>[];
}
@@ -120,6 +124,7 @@
/// This is used in the codegen phase where receivers are constrained to a
/// type mask or similar.
class ConstrainedDynamicUse extends DynamicUse {
+ @override
final Object receiverConstraint;
final List<DartType> _typeArguments;
@@ -134,6 +139,7 @@
"${_typeArguments?.length ?? 0} were passed.");
}
+ @override
List<DartType> get typeArguments => _typeArguments ?? const <DartType>[];
}
@@ -163,6 +169,7 @@
class StaticUse {
final Entity element;
final StaticUseKind kind;
+ @override
final int hashCode;
final InterfaceType type;
final CallStructure callStructure;
@@ -588,6 +595,7 @@
return new GenericStaticUse.methodInlining(element, typeArguments);
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! StaticUse) return false;
@@ -598,11 +606,13 @@
equalElements(typeArguments, other.typeArguments);
}
+ @override
String toString() =>
'StaticUse($element,$kind,$type,$typeArguments,$callStructure)';
}
class GenericStaticUse extends StaticUse {
+ @override
final List<DartType> typeArguments;
GenericStaticUse(Entity entity, StaticUseKind kind,
@@ -643,6 +653,7 @@
class TypeUse {
final DartType type;
final TypeUseKind kind;
+ @override
final int hashCode;
final ImportEntity deferredImport;
@@ -758,12 +769,14 @@
return new TypeUse.internal(type, TypeUseKind.TYPE_ARGUMENT);
}
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! TypeUse) return false;
return type == other.type && kind == other.kind;
}
+ @override
String toString() => 'TypeUse($type,$kind)';
}
@@ -778,6 +791,7 @@
class ConstantUse {
final ConstantValue value;
final ConstantUseKind kind;
+ @override
final int hashCode;
ConstantUse._(this.value, this.kind)
@@ -809,11 +823,13 @@
ConstantUse.literal(ConstantValue value)
: this._(value, ConstantUseKind.DIRECT);
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! ConstantUse) return false;
return value == other.value;
}
+ @override
String toString() => 'ConstantUse(${value.toStructuredText()},$kind)';
}
diff --git a/pkg/compiler/lib/src/universe/world_builder.dart b/pkg/compiler/lib/src/universe/world_builder.dart
index e80c180..49d452d 100644
--- a/pkg/compiler/lib/src/universe/world_builder.dart
+++ b/pkg/compiler/lib/src/universe/world_builder.dart
@@ -91,6 +91,7 @@
class StrongModeWorldStrategy implements SelectorConstraintsStrategy {
const StrongModeWorldStrategy();
+ @override
StrongModeWorldConstraints createSelectorConstraints(
Selector selector, Object initialConstraint) {
return new StrongModeWorldConstraints()
@@ -151,6 +152,7 @@
return _constraints.add(constraint);
}
+ @override
String toString() {
if (isAll) {
return '<all>';
@@ -190,6 +192,7 @@
bool get isThis => relation == ClassRelation.thisExpression;
+ @override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is StrongModeConstraint &&
@@ -197,8 +200,10 @@
relation == other.relation;
}
+ @override
int get hashCode => cls.hashCode * 13;
+ @override
String toString() => 'StrongModeConstraint($cls,$relation)';
}
diff --git a/pkg/compiler/lib/src/universe/world_impact.dart b/pkg/compiler/lib/src/universe/world_impact.dart
index af5eaae..cc9a92c 100644
--- a/pkg/compiler/lib/src/universe/world_impact.dart
+++ b/pkg/compiler/lib/src/universe/world_impact.dart
@@ -43,6 +43,7 @@
constantUses.forEach(visitor.visitConstantUse);
}
+ @override
String toString() => dump(this);
static String dump(WorldImpact worldImpact) {
@@ -97,42 +98,50 @@
impact.constantUses.forEach(registerConstantUse);
}
+ @override
void registerDynamicUse(DynamicUse dynamicUse) {
assert(dynamicUse != null);
_dynamicUses ??= new Setlet<DynamicUse>();
_dynamicUses.add(dynamicUse);
}
+ @override
Iterable<DynamicUse> get dynamicUses {
return _dynamicUses != null ? _dynamicUses : const <DynamicUse>[];
}
+ @override
void registerTypeUse(TypeUse typeUse) {
assert(typeUse != null);
_typeUses ??= new Setlet<TypeUse>();
_typeUses.add(typeUse);
}
+ @override
Iterable<TypeUse> get typeUses {
return _typeUses != null ? _typeUses : const <TypeUse>[];
}
+ @override
void registerStaticUse(StaticUse staticUse) {
assert(staticUse != null);
_staticUses ??= new Setlet<StaticUse>();
_staticUses.add(staticUse);
}
+ @override
Iterable<StaticUse> get staticUses {
return _staticUses != null ? _staticUses : const <StaticUse>[];
}
+ @override
void registerConstantUse(ConstantUse constantUse) {
assert(constantUse != null);
_constantUses ??= new Setlet<ConstantUse>();
_constantUses.add(constantUse);
}
+ @override
Iterable<ConstantUse> get constantUses {
return _constantUses != null ? _constantUses : const <ConstantUse>[];
}
@@ -221,6 +230,7 @@
return _dynamicUses != null ? _dynamicUses : worldImpact.dynamicUses;
}
+ @override
void registerDynamicUse(DynamicUse dynamicUse) {
if (_dynamicUses == null) {
_dynamicUses = new Setlet<DynamicUse>();
@@ -229,6 +239,7 @@
_dynamicUses.add(dynamicUse);
}
+ @override
void registerTypeUse(TypeUse typeUse) {
if (_typeUses == null) {
_typeUses = new Setlet<TypeUse>();
@@ -242,6 +253,7 @@
return _typeUses != null ? _typeUses : worldImpact.typeUses;
}
+ @override
void registerStaticUse(StaticUse staticUse) {
if (_staticUses == null) {
_staticUses = new Setlet<StaticUse>();
@@ -260,6 +272,7 @@
return _constantUses != null ? _constantUses : worldImpact.constantUses;
}
+ @override
void registerConstantUse(ConstantUse constantUse) {
if (_constantUses == null) {
_constantUses = new Setlet<ConstantUse>();
@@ -268,6 +281,7 @@
_constantUses.add(constantUse);
}
+ @override
void apply(WorldImpactVisitor visitor) {
staticUses.forEach(visitor.visitStaticUse);
dynamicUses.forEach(visitor.visitDynamicUse);
@@ -275,6 +289,7 @@
constantUses.forEach(visitor.visitConstantUse);
}
+ @override
String toString() {
StringBuffer sb = new StringBuffer();
sb.write('TransformedWorldImpact($worldImpact)');
@@ -289,6 +304,7 @@
const ImpactUseCase(this.name);
+ @override
String toString() => 'ImpactUseCase($name)';
}
diff --git a/pkg/compiler/lib/src/util/emptyset.dart b/pkg/compiler/lib/src/util/emptyset.dart
index 796498b..6fe644c 100644
--- a/pkg/compiler/lib/src/util/emptyset.dart
+++ b/pkg/compiler/lib/src/util/emptyset.dart
@@ -9,37 +9,59 @@
class ImmutableEmptySet<E> extends IterableBase<E> implements Set<E> {
const ImmutableEmptySet();
+ @override
Set<R> cast<R>() => new ImmutableEmptySet<R>();
+ @override
get iterator => const _EmptySetIterator();
+ @override
int get length => 0;
+ @override
bool get isEmpty => true;
get _immutableError => throw new UnsupportedError("EmptySet is immutable");
+ @override
bool add(E element) => _immutableError;
+ @override
void addAll(Iterable<E> elements) => _immutableError;
+ @override
E lookup(Object element) => null;
+ @override
bool remove(Object element) => false;
+ @override
void removeAll(Iterable<Object> elements) {}
+ @override
void removeWhere(bool test(E element)) {}
+ @override
void retainAll(Iterable<Object> elements) {}
+ @override
void retainWhere(bool test(E element)) {}
+ @override
void forEach(void action(E element)) {}
+ @override
void clear() {}
+ @override
bool contains(Object element) => false;
+ @override
bool containsAll(Iterable<Object> other) => other.isEmpty;
+ @override
Set<E> union(Set<E> other) => new Set.from(other);
+ @override
Set<E> intersection(Set<Object> other) => this;
+ @override
Set<E> difference(Set<Object> other) => this;
+ @override
Set<E> toSet() => new Set<E>();
}
class _EmptySetIterator implements Iterator<Null> {
const _EmptySetIterator();
+ @override
Null get current => null;
+ @override
bool moveNext() => false;
}
diff --git a/pkg/compiler/lib/src/util/enumset.dart b/pkg/compiler/lib/src/util/enumset.dart
index e292aa6..587b00064 100644
--- a/pkg/compiler/lib/src/util/enumset.dart
+++ b/pkg/compiler/lib/src/util/enumset.dart
@@ -98,14 +98,17 @@
/// Returns `true` if this set is not empty.
bool get isNotEmpty => value != 0;
+ @override
int get hashCode => value.hashCode * 19;
+ @override
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! EnumSet<E>) return false;
return value == other.value;
}
+ @override
String toString() {
if (value == 0) return '0';
int index = value.bitLength - 1;
@@ -172,6 +175,7 @@
/// Immutable implementation of [EnumSet].
class _ConstEnumSet<E> extends EnumSet<E> {
+ @override
final int value;
const _ConstEnumSet(this.value) : super._();
@@ -188,6 +192,7 @@
return new _ConstEnumSet(value);
}
+ @override
void set value(int mask) {
throw new UnsupportedError('EnumSet.value=');
}
diff --git a/pkg/compiler/lib/src/util/features.dart b/pkg/compiler/lib/src/util/features.dart
index d0547d3..bf98932 100644
--- a/pkg/compiler/lib/src/util/features.dart
+++ b/pkg/compiler/lib/src/util/features.dart
@@ -62,6 +62,7 @@
return sb.toString();
}
+ @override
String toString() => 'Features(${getText()})';
/// Creates a [Features] object by parse the [text] encoding.
diff --git a/pkg/compiler/lib/src/util/maplet.dart b/pkg/compiler/lib/src/util/maplet.dart
index b9dc6744..329853c 100644
--- a/pkg/compiler/lib/src/util/maplet.dart
+++ b/pkg/compiler/lib/src/util/maplet.dart
@@ -34,6 +34,7 @@
});
}
+ @override
bool get isEmpty {
if (_extra == null) {
return _MARKER == _key;
@@ -44,6 +45,7 @@
}
}
+ @override
int get length {
if (_extra == null) {
return (_MARKER == _key) ? 0 : 1;
@@ -54,6 +56,7 @@
}
}
+ @override
bool containsKey(Object key) {
if (_extra == null) {
return _key == key;
@@ -70,6 +73,7 @@
}
}
+ @override
V operator [](Object key) {
if (_extra == null) {
return (_key == key) ? _value : null;
@@ -86,6 +90,7 @@
}
}
+ @override
void operator []=(K key, V value) {
if (_extra == null) {
if (_MARKER == _key) {
@@ -166,6 +171,7 @@
}
}
+ @override
V remove(Object key) {
if (_extra == null) {
if (_key != key) return null;
@@ -193,6 +199,7 @@
}
}
+ @override
void forEach(void action(K key, V value)) {
if (_extra == null) {
if (_MARKER != _key) action(_key, _value);
@@ -208,11 +215,13 @@
}
}
+ @override
void clear() {
_key = _MARKER;
_value = _extra = null;
}
+ @override
Iterable<K> get keys => new _MapletKeyIterable<K>(this);
}
@@ -225,6 +234,7 @@
_MapletKeyIterable(this.maplet);
+ @override
Iterator<K> get iterator {
if (maplet._extra == null) {
return new _MapletSingleIterator<K>(maplet._key);
@@ -242,8 +252,10 @@
_MapletSingleIterator(this._element);
+ @override
K get current => _current;
+ @override
bool moveNext() {
if (Maplet._MARKER == _element) {
_current = null;
@@ -263,8 +275,10 @@
_MapletListIterator(this._list, this._remaining);
+ @override
K get current => _current;
+ @override
bool moveNext() {
while (_remaining > 0) {
var candidate = _list[_index++];
diff --git a/pkg/compiler/lib/src/util/setlet.dart b/pkg/compiler/lib/src/util/setlet.dart
index ab1911b..e35c12b 100644
--- a/pkg/compiler/lib/src/util/setlet.dart
+++ b/pkg/compiler/lib/src/util/setlet.dart
@@ -29,7 +29,9 @@
static Set<R> _newSet<R>() => new Setlet<R>();
+ @override
Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newSet);
+ @override
Iterator<E> get iterator {
if (_extra == null) {
return new _SetletSingleIterator<E>(_contents);
@@ -40,6 +42,7 @@
}
}
+ @override
int get length {
if (_extra == null) {
return (_MARKER == _contents) ? 0 : 1;
@@ -50,6 +53,7 @@
}
}
+ @override
bool get isEmpty {
if (_extra == null) {
return _MARKER == _contents;
@@ -60,6 +64,7 @@
}
}
+ @override
bool contains(Object element) {
if (_extra == null) {
return _contents == element;
@@ -76,6 +81,7 @@
}
}
+ @override
bool add(E element) {
if (_extra == null) {
if (_MARKER == _contents) {
@@ -142,10 +148,12 @@
}
}
+ @override
void addAll(Iterable<E> elements) {
elements.forEach((each) => add(each));
}
+ @override
E lookup(Object element) {
if (_extra == null) {
return _contents == element ? _contents : null;
@@ -162,6 +170,7 @@
}
}
+ @override
bool remove(Object element) {
if (_extra == null) {
if (_contents == element) {
@@ -187,10 +196,12 @@
}
}
+ @override
void removeAll(Iterable<Object> other) {
other.forEach(remove);
}
+ @override
void removeWhere(bool test(E element)) {
if (_extra == null) {
if (test(_contents)) {
@@ -211,15 +222,18 @@
}
}
+ @override
void retainWhere(bool test(E element)) {
removeWhere((E element) => !test(element));
}
+ @override
void retainAll(Iterable<Object> elements) {
Set set = elements is Set ? elements : elements.toSet();
removeWhere((E element) => !set.contains(element));
}
+ @override
void forEach(void action(E element)) {
if (_extra == null) {
if (_MARKER != _contents) action(_contents);
@@ -235,6 +249,7 @@
}
}
+ @override
bool containsAll(Iterable<Object> other) {
for (E e in other) {
if (!this.contains(e)) return false;
@@ -242,19 +257,24 @@
return true;
}
+ @override
clear() {
_contents = _MARKER;
_extra = null;
}
+ @override
Set<E> union(Set<E> other) => new Set<E>.from(this)..addAll(other);
+ @override
Setlet<E> intersection(Set<Object> other) =>
new Setlet<E>.from(this.where((e) => other.contains(e)));
+ @override
Setlet<E> difference(Set<Object> other) =>
new Setlet<E>.from(this.where((e) => !other.contains(e)));
+ @override
Setlet<E> toSet() {
Setlet<E> result = new Setlet<E>();
if (_extra == null) {
@@ -272,6 +292,7 @@
class _SetletMarker {
const _SetletMarker();
+ @override
toString() => "-";
}
@@ -280,8 +301,10 @@
E _current;
_SetletSingleIterator(this._element);
+ @override
E get current => _current;
+ @override
bool moveNext() {
if (Setlet._MARKER == _element) {
_current = null;
@@ -300,8 +323,10 @@
E _current;
_SetletListIterator(this._list, this._remaining);
+ @override
E get current => _current;
+ @override
bool moveNext() {
while (_remaining > 0) {
var candidate = _list[_index++];
diff --git a/pkg/compiler/lib/src/util/util.dart b/pkg/compiler/lib/src/util/util.dart
index 785253d..3dfee4b 100644
--- a/pkg/compiler/lib/src/util/util.dart
+++ b/pkg/compiler/lib/src/util/util.dart
@@ -234,14 +234,17 @@
Pair(this.a, this.b);
+ @override
int get hashCode => 13 * a.hashCode + 17 * b.hashCode;
+ @override
bool operator ==(var other) {
if (identical(this, other)) return true;
if (other is! Pair) return false;
return a == other.a && b == other.b;
}
+ @override
String toString() => '($a,$b)';
}
diff --git a/pkg/compiler/tool/status_files/rank_stacks.dart b/pkg/compiler/tool/status_files/rank_stacks.dart
index 27cf37b..b0c2c1b 100644
--- a/pkg/compiler/tool/status_files/rank_stacks.dart
+++ b/pkg/compiler/tool/status_files/rank_stacks.dart
@@ -129,6 +129,7 @@
TrieNode(this.key, this.depth);
+ @override
String toString() => 'TrieNode(#$length)';
}
diff --git a/pkg/compiler/tool/status_files/record.dart b/pkg/compiler/tool/status_files/record.dart
index f2a6e97..cbe52e6 100644
--- a/pkg/compiler/tool/status_files/record.dart
+++ b/pkg/compiler/tool/status_files/record.dart
@@ -26,6 +26,7 @@
Record(this.suite, this.test, this.config, this.expected, this.actual,
this.reason, this.repro, this.fullReason, this.stack);
+ @override
int compareTo(Record other) {
if (suite == null && other.suite != null) return -1;
if (suite != null && other.suite == null) return 1;
@@ -43,6 +44,7 @@
return repro.compareTo(other.repro);
}
+ @override
bool operator ==(covariant Record other) =>
suite == other.suite &&
test == other.test &&