Version 2.15.0-130.0.dev
Merge commit '9872fd192e883952d86c49668bd1a38c1075763d' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 298aa20..fee0ec7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -101,7 +101,10 @@
#### Linter
-Updated the Linter to `1.11.0`, which includes changes that
+Updated the Linter to `1.12.0`, which includes changes that
+- update `avoid_print` to allow `kDebugMode`-wrapped print calls.
+- fix handling of initializing formals in `prefer_final_parameters`.
+- fix `unnecessary_parenthesis` false positive with function expressions.
- adds support for constructor tear-offs to `avoid_redundant_argument_values`,
`unnecessary_lambdas`, and `unnecessary_parenthesis`.
- adds a new lint: `unnecessary_constructor_name` to flag unnecessary uses of
diff --git a/DEPS b/DEPS
index 7c61dee..c431fa6 100644
--- a/DEPS
+++ b/DEPS
@@ -105,7 +105,7 @@
# For more details, see https://github.com/dart-lang/sdk/issues/30164
"dart_style_rev": "14d9b6fd58cc4744676c12be3cc5eee2a779db82",
- "dartdoc_rev" : "7fd237db737752800505eff510bf3fa8d3e00eb7",
+ "dartdoc_rev" : "e5ebb7a6e88427db25c21811dc91190475934b17",
"devtools_rev" : "2b47d9ed486479153ca2fd038000950674ed1beb",
"jsshell_tag": "version:88.0",
"ffi_rev": "4dd32429880a57b64edaf54c9d5af8a9fa9a4ffb",
@@ -121,7 +121,7 @@
"intl_tag": "0.17.0-nullsafety",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_rev": "7e00f893440a72de0637970325e4ea44bd1e8c8e",
- "linter_tag": "1.11.0",
+ "linter_tag": "1.12.0",
"lints_tag": "f9670df2a66e0ec12eb51554e70c1cbf56c8f5d0",
"logging_rev": "575781ef196e4fed4fb737e38fb4b73d62727187",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
diff --git a/pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart b/pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart
index c5933d5..1e03d65 100644
--- a/pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart
+++ b/pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart
@@ -6,7 +6,6 @@
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/type_environment.dart';
-import 'package:kernel/kernel.dart';
/// Replaces js_util methods with inline calls to foreign_helper JS which
/// emits the code as a JavaScript code fragment.
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 3ff56b9..d80043e 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -5,7 +5,6 @@
import 'dart:collection';
import 'package:_fe_analyzer_shared/src/base/errors.dart';
-import 'package:_fe_analyzer_shared/src/messages/codes.dart';
import 'package:analyzer/diagnostic/diagnostic.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/error/ffi_code.dart';
@@ -1014,23 +1013,15 @@
/// [length]. The error will have the given [errorCode] and the map of
/// [arguments] will be used to complete the message and correction. If any
/// [contextMessages] are provided, they will be recorded with the error.
- AnalysisError.withNamedArguments(this.source, int offset, int length,
- this.errorCode, Map<String, dynamic> arguments,
+ ///
+ /// Deprecated - no analyzer errors use named arguments anymore. Please use
+ /// `AnalysisError()`.
+ @deprecated
+ AnalysisError.withNamedArguments(Source source, int offset, int length,
+ ErrorCode errorCode, Map<String, dynamic> arguments,
{List<DiagnosticMessage> contextMessages = const []})
- : _contextMessages = contextMessages {
- var messageText = applyArgumentsToTemplate(errorCode.message, arguments);
- var correctionTemplate = errorCode.correction;
- if (correctionTemplate != null) {
- _correction = applyArgumentsToTemplate(correctionTemplate, arguments);
- }
- _problemMessage = DiagnosticMessageImpl(
- filePath: source.fullName,
- length: length,
- message: messageText,
- offset: offset,
- url: null,
- );
- }
+ : this(source, offset, length, errorCode,
+ _translateNamedArguments(arguments), contextMessages);
@override
List<DiagnosticMessage> get contextMessages => _contextMessages;
@@ -1130,4 +1121,21 @@
}
return errors.toList();
}
+
+ static List<Object?>? _translateNamedArguments(
+ Map<String, dynamic> arguments) {
+ // All analyzer errors now use positional arguments, so if this method is
+ // being called, either no arguments were provided to the
+ // AnalysisError.withNamedArguments constructor, or the client was
+ // developed against an older version of the analyzer that used named
+ // arguments. In either case, we'll make a best effort translation of named
+ // arguments to positional ones. In the case where some arguments were
+ // provided, we have an assertion to alert the developer that they may not
+ // get correct results.
+ assert(
+ arguments.isEmpty,
+ 'AnalysisError.withNamedArguments is no longer supported. Making a '
+ 'best effort translation to positional arguments. Please use '
+ 'AnalysisError() instead.');
+ }
}
diff --git a/pkg/analyzer/lib/error/listener.dart b/pkg/analyzer/lib/error/listener.dart
index af873be..346f462 100644
--- a/pkg/analyzer/lib/error/listener.dart
+++ b/pkg/analyzer/lib/error/listener.dart
@@ -127,6 +127,11 @@
/// Report an error with the given [errorCode] and [message]. The location of
/// the error is specified by the given [offset] and [length].
+ ///
+ /// Deprecated - the [Message] type assumes named arguments, and no analyzer
+ /// errors use named arguments anymore. Please use other methods of
+ /// [ErrorReporter].
+ @deprecated
void reportErrorMessage(
ErrorCode errorCode, int offset, int length, Message message) {
_errorListener.onError(AnalysisError.withNamedArguments(
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index 76b90a1..c023d3b 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -480,7 +480,9 @@
var canonicalPath = provider._resolveLinks(path);
var data = provider._pathToData[canonicalPath];
if (data is! _FileData) {
- throw FileSystemException(path, 'File does not exist.');
+ // TODO(scheglov) Remove the path from the message.
+ // When https://github.com/dart-lang/dartdoc/pull/2796 is in google3.
+ throw FileSystemException(path, 'File "$path" does not exist.');
}
return data.bytes;
}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index a62d6d3..a8b5cae 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -8922,6 +8922,16 @@
/// Initialize a newly created identifier.
SimpleIdentifierImpl(this.token);
+ /// Return the cascade that contains this [SimpleIdentifier].
+ CascadeExpressionImpl? get ancestorCascade {
+ var operatorType = token.previous?.type;
+ if (operatorType == TokenType.PERIOD_PERIOD ||
+ operatorType == TokenType.QUESTION_PERIOD_PERIOD) {
+ return thisOrAncestorOfType<CascadeExpressionImpl>();
+ }
+ return null;
+ }
+
@override
Token get beginToken => token;
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index a24b695..d498abb 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -161,8 +161,8 @@
const ParserErrorCode _BINARY_OPERATOR_WRITTEN_OUT = ParserErrorCode(
'BINARY_OPERATOR_WRITTEN_OUT',
- r"Binary operator '#string' is written as '#string2' instead of the written out word.",
- correction: "Try replacing '#string' with '#string2'.");
+ r"Binary operator '{0}' is written as '{1}' instead of the written out word.",
+ correction: "Try replacing '{0}' with '{1}'.");
const ParserErrorCode _BREAK_OUTSIDE_OF_LOOP = ParserErrorCode(
'BREAK_OUTSIDE_OF_LOOP',
@@ -190,7 +190,7 @@
const ParserErrorCode _CONFLICTING_MODIFIERS = ParserErrorCode(
'CONFLICTING_MODIFIERS',
- r"Members can't be declared to be both '#string' and '#string2'.",
+ r"Members can't be declared to be both '{0}' and '{1}'.",
correction: "Try removing one of the keywords.");
const ParserErrorCode _CONSTRUCTOR_WITH_RETURN_TYPE = ParserErrorCode(
@@ -252,7 +252,7 @@
correction: "Try moving the directive before any declarations.");
const ParserErrorCode _DUPLICATED_MODIFIER = ParserErrorCode(
- 'DUPLICATED_MODIFIER', r"The modifier '#lexeme' was already specified.",
+ 'DUPLICATED_MODIFIER', r"The modifier '{0}' was already specified.",
correction: "Try removing all but one occurrence of the modifier.");
const ParserErrorCode _DUPLICATE_DEFERRED = ParserErrorCode(
@@ -262,7 +262,7 @@
const ParserErrorCode _DUPLICATE_LABEL_IN_SWITCH_STATEMENT = ParserErrorCode(
'DUPLICATE_LABEL_IN_SWITCH_STATEMENT',
- r"The label '#name' was already used in this switch statement.",
+ r"The label '{0}' was already used in this switch statement.",
correction: "Try choosing a different name for this label.");
const ParserErrorCode _DUPLICATE_PREFIX = ParserErrorCode('DUPLICATE_PREFIX',
@@ -279,7 +279,7 @@
correction: "Try putting parentheses around one of the comparisons.");
const ParserErrorCode _EXPECTED_BODY = ParserErrorCode(
- 'EXPECTED_BODY', r"A #string must have a body, even if it is empty.",
+ 'EXPECTED_BODY', r"A {0} must have a body, even if it is empty.",
correction: "Try adding an empty body.");
const ParserErrorCode _EXPECTED_ELSE_OR_COMMA =
@@ -287,17 +287,17 @@
const ParserErrorCode _EXPECTED_IDENTIFIER_BUT_GOT_KEYWORD = ParserErrorCode(
'EXPECTED_IDENTIFIER_BUT_GOT_KEYWORD',
- r"'#lexeme' can't be used as an identifier because it's a keyword.",
+ r"'{0}' can't be used as an identifier because it's a keyword.",
correction: "Try renaming this to be an identifier that isn't a keyword.");
const ParserErrorCode _EXPECTED_INSTEAD =
- ParserErrorCode('EXPECTED_INSTEAD', r"Expected '#string' instead of this.");
+ ParserErrorCode('EXPECTED_INSTEAD', r"Expected '{0}' instead of this.");
const ParserErrorCode _EXPERIMENT_NOT_ENABLED = ParserErrorCode(
'EXPERIMENT_NOT_ENABLED',
- r"This requires the '#string' language feature to be enabled.",
+ r"This requires the '{0}' language feature to be enabled.",
correction:
- "Try updating your pubspec.yaml to set the minimum SDK constraint to #string2 or higher, and running 'pub get'.");
+ "Try updating your pubspec.yaml to set the minimum SDK constraint to {1} or higher, and running 'pub get'.");
const ParserErrorCode _EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = ParserErrorCode(
'EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE',
@@ -367,8 +367,8 @@
correction: "Try removing the keyword 'external'.");
const ParserErrorCode _EXTRANEOUS_MODIFIER = ParserErrorCode(
- 'EXTRANEOUS_MODIFIER', r"Can't have modifier '#lexeme' here.",
- correction: "Try removing '#lexeme'.");
+ 'EXTRANEOUS_MODIFIER', r"Can't have modifier '{0}' here.",
+ correction: "Try removing '{0}'.");
const ParserErrorCode _FACTORY_TOP_LEVEL_DECLARATION = ParserErrorCode(
'FACTORY_TOP_LEVEL_DECLARATION',
@@ -452,8 +452,8 @@
'INVALID_INITIALIZER', r"Not a valid initializer.",
correction: "To initialize a field, use the syntax 'name = value'.");
-const ParserErrorCode _INVALID_OPERATOR = ParserErrorCode('INVALID_OPERATOR',
- r"The string '#lexeme' isn't a user-definable operator.");
+const ParserErrorCode _INVALID_OPERATOR = ParserErrorCode(
+ 'INVALID_OPERATOR', r"The string '{0}' isn't a user-definable operator.");
const ParserErrorCode _INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER =
ParserErrorCode('INVALID_OPERATOR_QUESTIONMARK_PERIOD_FOR_SUPER',
@@ -474,8 +474,8 @@
const ParserErrorCode _INVALID_USE_OF_COVARIANT_IN_EXTENSION = ParserErrorCode(
'INVALID_USE_OF_COVARIANT_IN_EXTENSION',
- r"Can't have modifier '#lexeme' in an extension.",
- correction: "Try removing '#lexeme'.",
+ r"Can't have modifier '{0}' in an extension.",
+ correction: "Try removing '{0}'.",
hasPublishedDocs: true);
const ParserErrorCode _LIBRARY_DIRECTIVE_NOT_FIRST = ParserErrorCode(
@@ -485,13 +485,13 @@
"Try moving the library directive before any other directives.");
const ParserErrorCode _LITERAL_WITH_CLASS = ParserErrorCode(
- 'LITERAL_WITH_CLASS', r"A #string literal can't be prefixed by '#lexeme'.",
- correction: "Try removing '#lexeme'");
+ 'LITERAL_WITH_CLASS', r"A {0} literal can't be prefixed by '{1}'.",
+ correction: "Try removing '{1}'");
const ParserErrorCode _LITERAL_WITH_CLASS_AND_NEW = ParserErrorCode(
'LITERAL_WITH_CLASS_AND_NEW',
- r"A #string literal can't be prefixed by 'new #lexeme'.",
- correction: "Try removing 'new' and '#lexeme'");
+ r"A {0} literal can't be prefixed by 'new {1}'.",
+ correction: "Try removing 'new' and '{1}'");
const ParserErrorCode _LITERAL_WITH_NEW = ParserErrorCode(
'LITERAL_WITH_NEW', r"A literal can't be prefixed by 'new'.",
@@ -550,7 +550,7 @@
const ParserErrorCode _MODIFIER_OUT_OF_ORDER = ParserErrorCode(
'MODIFIER_OUT_OF_ORDER',
- r"The modifier '#string' should be before the modifier '#string2'.",
+ r"The modifier '{0}' should be before the modifier '{1}'.",
correction: "Try re-ordering the modifiers.");
const ParserErrorCode _MULTIPLE_EXTENDS_CLAUSES = ParserErrorCode(
@@ -650,7 +650,7 @@
const ParserErrorCode _TYPE_ARGUMENTS_ON_TYPE_VARIABLE = ParserErrorCode(
'TYPE_ARGUMENTS_ON_TYPE_VARIABLE',
- r"Can't use type arguments with type variable '#name'.",
+ r"Can't use type arguments with type variable '{0}'.",
correction: "Try removing the type arguments.");
const ParserErrorCode _TYPE_BEFORE_FACTORY = ParserErrorCode(
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
index 0427d04..48be249 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
@@ -89,7 +89,6 @@
prefixType = prefixElement.returnType;
}
- function.prefix.staticType = prefixType;
if (prefixType != null && prefixType.isDynamic) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC,
@@ -301,19 +300,15 @@
/// There are three possible valid cases: tearing off the `call` method of a
/// function element, tearing off an extension element declared on [Function],
/// and tearing off an extension element declared on a function type.
- ExecutableElement? _resolveFunctionElementFunction(
+ Element? _resolveFunctionTypeFunction(
Expression receiver,
SimpleIdentifier methodName,
- FunctionElement receiverElement,
+ FunctionType receiverType,
) {
- if (methodName.name == FunctionElement.CALL_METHOD_NAME) {
- return receiverElement;
- }
-
var methodElement = _resolver.typePropertyResolver
.resolve(
receiver: receiver,
- receiverType: receiverElement.type,
+ receiverType: receiverType,
name: methodName.name,
propertyErrorEntity: methodName,
nameErrorEntity: methodName,
@@ -342,6 +337,7 @@
}
function.prefix.staticElement = prefixElement;
+ function.prefix.staticType = prefixElement.referenceType;
var functionName = function.identifier.name;
if (prefixElement is PrefixElement) {
@@ -376,28 +372,22 @@
return;
}
- var methodElement = _resolveTypeProperty(
+ var functionType = _resolveTypeProperty(
receiver: function.prefix,
- receiverElement: prefixElement,
name: function.identifier,
nameErrorEntity: function,
);
- if (methodElement is MethodElement) {
- function.identifier.staticElement = methodElement;
- function.staticType = methodElement.type;
- _resolve(
- node: node,
- rawType: methodElement.type,
- name: functionName,
- );
- return;
- }
-
- if (methodElement is PropertyAccessorElement) {
- function.accept(_resolver);
- _resolveDisallowedExpression(node, methodElement.returnType);
- return;
+ if (functionType != null) {
+ if (functionType is FunctionType) {
+ function.staticType = functionType;
+ _resolve(
+ node: node,
+ rawType: functionType,
+ name: functionName,
+ );
+ return;
+ }
}
function.accept(_resolver);
@@ -425,39 +415,12 @@
node.staticType = DynamicTypeImpl.instance;
return;
}
- } else if (target is PrefixedIdentifierImpl) {
- var prefixElement = target.prefix.scopeLookupResult!.getter;
- if (prefixElement is PrefixElement) {
- var prefixName = target.identifier.name;
- var targetElement = prefixElement.scope.lookup(prefixName).getter;
-
- var methodElement = _resolveTypeProperty(
- receiver: target,
- receiverElement: targetElement,
- name: function.propertyName,
- nameErrorEntity: function,
- );
-
- if (methodElement == null) {
- // The target is known, but the method is not; [UNDEFINED_GETTER] is
- // reported elsewhere.
- node.staticType = DynamicTypeImpl.instance;
- return;
- } else {
- _resolveReceiverPrefix(node, prefixElement, target, methodElement);
- return;
- }
- } else {
- // The prefix is unknown; [UNDEFINED_IDENTIFIER] is reported elsewhere.
- node.staticType = DynamicTypeImpl.instance;
- return;
- }
} else if (target is ExtensionOverrideImpl) {
_resolveExtensionOverride(node, function, target);
return;
} else {
- targetType = target.typeOrThrow;
- if (targetType.isDynamic) {
+ var targetType = target.staticType;
+ if (targetType != null && targetType.isDynamic) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC,
node,
@@ -466,6 +429,29 @@
node.staticType = DynamicTypeImpl.instance;
return;
}
+ var functionType = _resolveTypeProperty(
+ receiver: target,
+ name: function.propertyName,
+ nameErrorEntity: function,
+ );
+
+ if (functionType == null) {
+ // The target is known, but the method is not; [UNDEFINED_GETTER] is
+ // reported elsewhere.
+ node.staticType = DynamicTypeImpl.instance;
+ return;
+ } else {
+ if (functionType is FunctionType) {
+ function.staticType = functionType;
+ _resolve(
+ node: node,
+ rawType: functionType,
+ name: function.propertyName.name,
+ );
+ }
+
+ return;
+ }
}
var propertyElement = _resolver.typePropertyResolver
@@ -719,47 +705,52 @@
NodeReplacer.replace(node, typeLiteral);
}
- /// Resolves [name] as a property on [receiver] (with element
- /// [receiverElement]).
+ /// Resolves [name] as a property on [receiver].
///
- /// Returns `null` if [receiverElement] is `null`, a [TypeParameterElement],
- /// or a [TypeAliasElement] for a non-interface type.
- ExecutableElement? _resolveTypeProperty({
+ /// Returns `null` if [receiver]'s type is `null`, a [TypeParameterType],
+ /// or a type alias for a non-interface type.
+ DartType? _resolveTypeProperty({
required Expression receiver,
- required Element? receiverElement,
- required SimpleIdentifier name,
+ required SimpleIdentifierImpl name,
required SyntacticEntity nameErrorEntity,
}) {
- if (receiverElement == null) {
- return null;
- }
- if (receiverElement is TypeParameterElement) {
- return null;
- }
- if (receiverElement is ClassElement) {
- return _resolveStaticElement(receiverElement, name);
- } else if (receiverElement is FunctionElement) {
- return _resolveFunctionElementFunction(receiver, name, receiverElement);
- } else if (receiverElement is TypeAliasElement) {
- var aliasedType = receiverElement.aliasedType;
- if (aliasedType is InterfaceType) {
- return _resolveStaticElement(aliasedType.element, name);
- } else {
- return null;
+ if (receiver is Identifier) {
+ var receiverElement = receiver.staticElement;
+ if (receiverElement is ClassElement) {
+ var element = _resolveStaticElement(receiverElement, name);
+ name.staticElement = element;
+ // TODO(srawlins): Should this use referenceType? E.g. if `element`
+ // is a function-typed static getter.
+ return element?.type;
+ } else if (receiverElement is TypeAliasElement) {
+ var aliasedType = receiverElement.aliasedType;
+ if (aliasedType is InterfaceType) {
+ var element = _resolveStaticElement(aliasedType.element, name);
+ name.staticElement = element;
+ // TODO(srawlins): Should this use referenceType? E.g. if `element`
+ // is a function-typed static getter.
+ return element?.type;
+ } else {
+ return null;
+ }
}
}
- DartType receiverType;
- if (receiverElement is VariableElement) {
- receiverType = receiverElement.type;
- } else if (receiverElement is PropertyAccessorElement) {
- receiverType = receiverElement.returnType;
- } else {
- assert(false,
- 'Unexpected receiverElement type: ${receiverElement.runtimeType}');
+ var receiverType = receiver.staticType;
+ if (receiverType == null) {
return null;
+ } else if (receiverType is TypeParameterType) {
+ return null;
+ } else if (receiverType is FunctionType) {
+ if (name.name == FunctionElement.CALL_METHOD_NAME) {
+ return receiverType;
+ }
+ var element = _resolveFunctionTypeFunction(receiver, name, receiverType);
+ name.staticElement = element;
+ return element?.referenceType;
}
- var methodElement = _resolver.typePropertyResolver
+
+ var element = _resolver.typePropertyResolver
.resolve(
receiver: receiver,
receiverType: receiverType,
@@ -768,10 +759,35 @@
nameErrorEntity: nameErrorEntity,
)
.getter;
- if (methodElement != null && methodElement.isStatic) {
- _reportInvalidAccessToStaticMember(name, methodElement,
+ name.staticElement = element;
+ if (element != null && element.isStatic) {
+ _reportInvalidAccessToStaticMember(name, element,
implicitReceiver: false);
}
- return methodElement;
+ return element?.referenceType;
+ }
+}
+
+extension on Element {
+ /// Returns the 'type' of `this`, when accessed as a "reference", not
+ /// immediately followed by parentheses and arguments.
+ ///
+ /// For all elements that don't have a type (for example, [ExportElement]),
+ /// `null` is returned. For [PropertyAccessorElement], the return value is
+ /// returned. For all other elements, their `type` property is returned.
+ DartType? get referenceType {
+ if (this is ConstructorElement) {
+ return (this as ConstructorElement).type;
+ } else if (this is FunctionElement) {
+ return (this as FunctionElement).type;
+ } else if (this is PropertyAccessorElement) {
+ return (this as PropertyAccessorElement).returnType;
+ } else if (this is MethodElement) {
+ return (this as MethodElement).type;
+ } else if (this is VariableElement) {
+ return (this as VariableElement).type;
+ } else {
+ return null;
+ }
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
index 307a656..dd2e688 100644
--- a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
@@ -197,6 +197,19 @@
required bool hasRead,
required bool hasWrite,
}) {
+ var ancestorCascade = node.ancestorCascade;
+ if (ancestorCascade != null) {
+ return _resolve(
+ node: node,
+ target: ancestorCascade.target,
+ isCascaded: true,
+ isNullAware: ancestorCascade.isNullAware,
+ propertyName: node,
+ hasRead: hasRead,
+ hasWrite: hasWrite,
+ );
+ }
+
Element? readElementRequested;
Element? readElementRecovery;
if (hasRead) {
@@ -479,7 +492,7 @@
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.PRIVATE_SETTER,
propertyName,
- [propertyName.name, typeReference.name],
+ [propertyName.name],
);
}
_checkForStaticAccessToInstanceMember(propertyName, writeElement);
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 53d62f5..e7ac1b0 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -240,7 +240,7 @@
_errorReporter.reportErrorForNode(
HintCode.INVALID_VISIBLE_FOR_OVERRIDING_ANNOTATION,
node,
- [declaredElement.name, node.name.name]);
+ [declaredElement.name]);
}
if (parent is TopLevelVariableDeclaration) {
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 2974e8f..3945838 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -14793,7 +14793,6 @@
correction:
"Try adjusting the number of type arguments to match the number "
"of type parameters.",
- hasPublishedDocs: true,
uniqueName: 'WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION');
/**
@@ -14912,8 +14911,7 @@
"but {2} type arguments were given.",
correction:
"Try adjusting the number of type arguments to match the number "
- "of type parameters.",
- hasPublishedDocs: true);
+ "of type parameters.");
/**
* Parameters:
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index d4e4833..f207a06 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -340,12 +340,8 @@
if (index > 0 && index < fastaAnalyzerErrorCodes.length) {
var errorCode = fastaAnalyzerErrorCodes[index];
if (errorCode != null) {
- errorReporter!.reportError(AnalysisError.withNamedArguments(
- errorReporter!.source,
- offset,
- length,
- errorCode,
- message.arguments));
+ errorReporter!.reportError(AnalysisError(errorReporter!.source, offset,
+ length, errorCode, message.arguments.values.toList()));
return;
}
}
@@ -362,8 +358,8 @@
void _reportByCode(
ErrorCode errorCode, Message message, int offset, int length) {
if (errorReporter != null) {
- errorReporter!.reportError(AnalysisError.withNamedArguments(
- errorReporter!.source, offset, length, errorCode, message.arguments));
+ errorReporter!.reportError(AnalysisError(errorReporter!.source, offset,
+ length, errorCode, message.arguments.values.toList()));
}
}
}
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index f34c237..5c672ce 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -701,8 +701,15 @@
} else if (declaredType.isArray) {
final typeArg = (declaredType as InterfaceType).typeArguments.single;
if (!_isSized(typeArg)) {
+ AstNode errorNode = fieldType;
+ if (fieldType is TypeName) {
+ var typeArguments = fieldType.typeArguments?.arguments;
+ if (typeArguments != null && typeArguments.isNotEmpty) {
+ errorNode = typeArguments[0];
+ }
+ }
_errorReporter.reportErrorForNode(FfiCode.NON_SIZED_TYPE_ARGUMENT,
- fieldType, [_arrayClassName, typeArg.toString()]);
+ errorNode, [_arrayClassName, typeArg]);
}
final arrayDimensions = declaredType.arrayDimensions;
_validateSizeOfAnnotation(fieldType, annotations, arrayDimensions);
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index ff6050c..a332a6c 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -13,101 +13,11 @@
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/token.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/fasta/ast_builder.dart';
import 'package:analyzer/src/generated/source.dart';
export 'package:analyzer/src/dart/error/syntactic_errors.dart';
-/// A simple data-holder for a method that needs to return multiple values.
-class CommentAndMetadata {
- /// The documentation comment that was parsed, or `null` if none was given.
- final Comment? comment;
-
- /// The metadata that was parsed, or `null` if none was given.
- final List<Annotation>? metadata;
-
- /// Initialize a newly created holder with the given [comment] and [metadata].
- CommentAndMetadata(this.comment, this.metadata);
-
- /// Return `true` if some metadata was parsed.
- bool get hasMetadata => metadata != null && metadata!.isNotEmpty;
-}
-
-/// A simple data-holder for a method that needs to return multiple values.
-class FinalConstVarOrType {
- /// The 'final', 'const' or 'var' keyword, or `null` if none was given.
- final Token keyword;
-
- /// The type, or `null` if no type was specified.
- final TypeAnnotation type;
-
- /// Initialize a newly created holder with the given [keyword] and [type].
- FinalConstVarOrType(this.keyword, this.type);
-}
-
-/// A simple data-holder for a method that needs to return multiple values.
-class Modifiers {
- /// The token representing the keyword 'abstract', or `null` if the keyword
- /// was not found.
- Token? abstractKeyword;
-
- /// The token representing the keyword 'const', or `null` if the keyword was
- /// not found.
- Token? constKeyword;
-
- /// The token representing the keyword 'covariant', or `null` if the keyword
- /// was not found.
- Token? covariantKeyword;
-
- /// The token representing the keyword 'external', or `null` if the keyword
- /// was not found.
- Token? externalKeyword;
-
- /// The token representing the keyword 'factory', or `null` if the keyword was
- /// not found.
- Token? factoryKeyword;
-
- /// The token representing the keyword 'final', or `null` if the keyword was
- /// not found.
- Token? finalKeyword;
-
- /// The token representing the keyword 'static', or `null` if the keyword was
- /// not found.
- Token? staticKeyword;
-
- /// The token representing the keyword 'var', or `null` if the keyword was not
- /// found.
- Token? varKeyword;
-
- @override
- String toString() {
- StringBuffer buffer = StringBuffer();
- bool needsSpace = _appendKeyword(buffer, false, abstractKeyword);
- needsSpace = _appendKeyword(buffer, needsSpace, constKeyword);
- needsSpace = _appendKeyword(buffer, needsSpace, externalKeyword);
- needsSpace = _appendKeyword(buffer, needsSpace, factoryKeyword);
- needsSpace = _appendKeyword(buffer, needsSpace, finalKeyword);
- needsSpace = _appendKeyword(buffer, needsSpace, staticKeyword);
- _appendKeyword(buffer, needsSpace, varKeyword);
- return buffer.toString();
- }
-
- /// If the given [keyword] is not `null`, append it to the given [buffer],
- /// prefixing it with a space if [needsSpace] is `true`. Return `true` if
- /// subsequent keywords need to be prefixed with a space.
- bool _appendKeyword(StringBuffer buffer, bool needsSpace, Token? keyword) {
- if (keyword != null) {
- if (needsSpace) {
- buffer.writeCharCode(0x20);
- }
- buffer.write(keyword.lexeme);
- return true;
- }
- return needsSpace;
- }
-}
-
/// A parser used to parse tokens into an AST structure.
class Parser {
late Token currentToken;
diff --git a/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart b/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
index 9585048..abb0b8d 100644
--- a/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
@@ -129,6 +129,10 @@
a.b.foo<int>;
}
''', [
+ // TODO(srawlins): Get the information to [FunctionReferenceResolve] that
+ // [PropertyElementResolver] encountered an error, to avoid double reporting.
+ error(CompileTimeErrorCode.GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC,
+ 10, 12),
error(CompileTimeErrorCode.UNDEFINED_IDENTIFIER, 10, 1),
]);
@@ -431,7 +435,7 @@
}
test_instanceGetter_explicitReceiver() async {
- await assertErrorsInCode('''
+ await assertNoErrorsInCode('''
class A {
late void Function<T>(T) foo;
}
@@ -439,10 +443,7 @@
bar(A a) {
a.foo<int>;
}
-''', [
- error(
- CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION, 58, 5),
- ]);
+''');
assertFunctionReference(findNode.functionReference('foo<int>;'),
findElement.getter('foo'), 'void Function(int)');
@@ -480,6 +481,42 @@
reference, findElement.method('foo'), 'void Function(int)');
}
+ test_instanceMethod_call() async {
+ await assertNoErrorsInCode('''
+class C {
+ void foo<T>(T a) {}
+
+ void bar() {
+ foo.call<int>;
+ }
+}
+''');
+
+ var reference = findNode.functionReference('foo.call<int>;');
+ // TODO(srawlins): PropertyElementResolver does not return an element for
+ // `.call`. If we want `findElement.method('foo')` here, we must change the
+ // policy over there.
+ assertFunctionReference(reference, null, 'void Function(int)');
+ }
+
+ test_instanceMethod_explicitReceiver_call() async {
+ await assertNoErrorsInCode('''
+class C {
+ void foo<T>(T a) {}
+}
+
+void bar(C c) {
+ c.foo.call<int>;
+}
+''');
+
+ var reference = findNode.functionReference('foo.call<int>;');
+ // TODO(srawlins): PropertyElementResolver does not return an element for
+ // `.call`. If we want `findElement.method('foo')` here, we must change the
+ // policy over there.
+ assertFunctionReference(reference, null, 'void Function(int)');
+ }
+
test_instanceMethod_explicitReceiver_field() async {
await assertNoErrorsInCode('''
class A {
@@ -515,6 +552,22 @@
findElement.method('foo'), 'void Function(int)');
}
+ test_instanceMethod_explicitReceiver_receiverIsNotIdentifier_call() async {
+ await assertNoErrorsInCode('''
+extension on List<Object?> {
+ void foo<T>(T a) {}
+}
+
+var a = [].foo.call<int>;
+''');
+
+ var reference = findNode.functionReference('foo.call<int>;');
+ // TODO(srawlins): PropertyElementResolver does not return an element for
+ // `.call`. If we want `findElement.method('foo')` here, we must change the
+ // policy over there.
+ assertFunctionReference(reference, null, 'void Function(int)');
+ }
+
test_instanceMethod_explicitReceiver_super() async {
await assertNoErrorsInCode('''
class A {
@@ -785,6 +838,43 @@
reference, findElement.parameter('foo'), 'void Function(int)');
}
+ test_localVariable_call() async {
+ await assertNoErrorsInCode('''
+void foo<T>(T a) {}
+
+void bar() {
+ var fn = foo;
+ fn.call<int>;
+}
+''');
+
+ var reference = findNode.functionReference('fn.call<int>;');
+ // TODO(srawlins): PropertyElementResolver does not return an element for
+ // `.call`. If we want `findElement.method('foo')` here, we must change the
+ // policy over there.
+ assertFunctionReference(reference, null, 'void Function(int)');
+ }
+
+ test_localVariable_call_tooManyTypeArgs() async {
+ await assertErrorsInCode('''
+void foo<T>(T a) {}
+
+void bar() {
+ void Function(int) fn = foo;
+ fn.call<int>;
+}
+''', [
+ error(
+ CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION, 74, 5),
+ ]);
+
+ var reference = findNode.functionReference('fn.call<int>;');
+ // TODO(srawlins): PropertyElementResolver does not return an element for
+ // `.call`. If we want `findElement.method('fn')` here, we must change the
+ // policy over there.
+ assertFunctionReference(reference, null, 'void Function(int)');
+ }
+
test_localVariable_typeVariable_boundToFunction() async {
await assertErrorsInCode('''
void bar<T extends Function>(T foo) {
@@ -1176,6 +1266,8 @@
prefix.a.foo<int>;
}
''', [
+ error(CompileTimeErrorCode.GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC,
+ 38, 17),
error(CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME, 45, 1),
]);
diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
index 4fe187f..8b89110 100644
--- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
@@ -1561,6 +1561,39 @@
assertType(foo.propertyName, 'double Function(int)');
}
+ /// It is important to use this expression as an initializer of a top-level
+ /// variable, because of the way top-level inference works, at the time of
+ /// writing this. We resolve initializers twice - first for dependencies,
+ /// then for resolution. This has its issues (for example we miss some
+ /// dependencies), but the important thing is that we rewrite `foo(0)` from
+ /// being a [MethodInvocation] to [FunctionExpressionInvocation]. So, during
+ /// the second pass we see [SimpleIdentifier] `foo` as a `function`. And
+ /// we should be aware that it is not a stand-alone identifier, but a
+ /// cascade section.
+ test_hasReceiver_instance_getter_cascade() async {
+ await resolveTestCode(r'''
+class C {
+ double Function(int) get foo => 0;
+}
+
+var v = C()..foo(0) = 0;
+''');
+
+ var invocation = findNode.functionExpressionInvocation('foo(0)');
+ assertFunctionExpressionInvocation(
+ invocation,
+ element: null,
+ typeArgumentTypes: [],
+ invokeType: 'double Function(int)',
+ type: 'double',
+ );
+ assertSimpleIdentifier(
+ invocation.function,
+ element: findElement.getter('foo'),
+ type: 'double Function(int)',
+ );
+ }
+
test_hasReceiver_instance_getter_switchStatementExpression() async {
await assertNoErrorsInCode(r'''
class C {
diff --git a/pkg/analyzer/test/src/diagnostics/non_sized_type_argument_test.dart b/pkg/analyzer/test/src/diagnostics/non_sized_type_argument_test.dart
index c06084a..ca3c9b5 100644
--- a/pkg/analyzer/test/src/diagnostics/non_sized_type_argument_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_sized_type_argument_test.dart
@@ -24,7 +24,7 @@
external Array<Void> a0;
}
''', [
- error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 68, 11),
+ error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 74, 4),
]);
}
@@ -37,7 +37,7 @@
external Array<Void> a0;
}
''', [
- error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 67, 11),
+ error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 73, 4),
]);
}
diff --git a/pkg/analyzer/test/src/summary/element_text.dart b/pkg/analyzer/test/src/summary/element_text.dart
index a4ad397..1c07a3e 100644
--- a/pkg/analyzer/test/src/summary/element_text.dart
+++ b/pkg/analyzer/test/src/summary/element_text.dart
@@ -796,13 +796,12 @@
}
var aliasedElement = e.aliasedElement;
- if (aliasedElement is GenericFunctionTypeElement) {
- final aliasedElement_ = aliasedElement as GenericFunctionTypeElement;
+ if (aliasedElement is GenericFunctionTypeElementImpl) {
_writelnWithIndent('aliasedElement: GenericFunctionTypeElement');
_withIndent(() {
- _writeTypeParameterElements(aliasedElement_.typeParameters);
- _writeParameterElements(aliasedElement_.parameters);
- _writeType(aliasedElement_.returnType, name: 'returnType');
+ _writeTypeParameterElements(aliasedElement.typeParameters);
+ _writeParameterElements(aliasedElement.parameters);
+ _writeType(aliasedElement.returnType, name: 'returnType');
});
}
});
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index da67bc4..9a10697 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -7100,7 +7100,7 @@
### invalid_use_of_covariant_in_extension
-_Can't have modifier '#lexeme' in an extension._
+_Can't have modifier '{0}' in an extension._
#### Description
diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart
index 2e1c1a7..3747771 100644
--- a/pkg/analyzer/tool/messages/generate.dart
+++ b/pkg/analyzer/tool/messages/generate.dart
@@ -14,6 +14,7 @@
///
/// It is expected that 'pkg/front_end/tool/fasta generate-messages'
/// has already been successfully run.
+import 'dart:convert';
import 'dart:io';
import 'package:_fe_analyzer_shared/src/scanner/scanner.dart';
@@ -60,6 +61,12 @@
final String analyzerPkgPath =
normalize(join(pkg_root.packageRoot, 'analyzer'));
+/// Pattern used by the front end to identify placeholders in error message
+/// strings. TODO(paulberry): share this regexp (and the code for interpreting
+/// it) between the CFE and analyzer.
+final RegExp _placeholderPattern =
+ RegExp("#\([-a-zA-Z0-9_]+\)(?:%\([0-9]*\)\.\([0-9]+\))?");
+
/// Return an entry containing 2 strings,
/// the name of the class containing the error and the name of the error,
/// or throw an exception if 'analyzerCode:' field is invalid.
@@ -188,10 +195,13 @@
out.writeln('const $className _$errorCode =');
out.writeln('$className(');
out.writeln("'$errorCode',");
- out.writeln('r"${entry['template']}"');
+ final placeholderToIndexMap = _computePlaceholderToIndexMap(entry);
+ out.writeln(
+ 'r"${_convertTemplate(placeholderToIndexMap, entry['template'])}"');
final tip = entry['tip'];
if (tip is String) {
- out.writeln(',correction: "$tip"');
+ out.writeln(
+ ',correction: "${_convertTemplate(placeholderToIndexMap, tip)}"');
}
final hasPublishedDocs = entry['hasPublishedDocs'];
if (hasPublishedDocs is bool && hasPublishedDocs) {
@@ -334,4 +344,33 @@
}
}
}
+
+ /// Given a messages.yaml entry, come up with a mapping from placeholder
+ /// patterns in its message and tip strings to their corresponding indices.
+ Map<String, int> _computePlaceholderToIndexMap(Map<Object?, Object?> entry) {
+ var mapping = <String, int>{};
+ for (var key in const ['template', 'tip']) {
+ var value = entry[key];
+ if (value is! String) continue;
+ for (Match match in _placeholderPattern.allMatches(value)) {
+ // CFE supports a bunch of formatting options that we don't; make sure
+ // none of those are used.
+ if (match.group(0) != '#${match.group(1)}') {
+ throw 'Template string ${json.encode(entry)} contains unsupported '
+ 'placeholder pattern ${json.encode(match.group(0))}';
+ }
+
+ mapping[match.group(0)!] ??= mapping.length;
+ }
+ }
+ return mapping;
+ }
+
+ /// Convert a CFE template string (which uses placeholders like `#string`) to
+ /// an analyzer template string (which uses placeholders like `{0}`).
+ String _convertTemplate(
+ Map<String, int> placeholderToIndexMap, String entry) {
+ return entry.replaceAllMapped(_placeholderPattern,
+ (match) => '{${placeholderToIndexMap[match.group(0)!]}}');
+ }
}
diff --git a/pkg/compiler/lib/src/deferred_load/algorithm_state.dart b/pkg/compiler/lib/src/deferred_load/algorithm_state.dart
index ad11986..4aca919 100644
--- a/pkg/compiler/lib/src/deferred_load/algorithm_state.dart
+++ b/pkg/compiler/lib/src/deferred_load/algorithm_state.dart
@@ -22,7 +22,7 @@
final KClosedWorld closedWorld;
final EntityDataRegistry registry;
final Map<EntityData, ImportSet> entityToSet = {};
- final Map<EntityData, EntityDataInfo> entityDataToInfo = {};
+ final Map<EntityData, Set<EntityData>> directDependencies = {};
final ImportSetLattice importSets;
final WorkQueue queue;
@@ -80,41 +80,35 @@
}
}
- /// Returns the [EntityDataInfo] associated with a given [EntityData].
- /// Note: In the event of a cache miss, i.e. the first time we ever see a new
- /// [EntityData], we will add all reachable deferred roots to the queue for
- /// processing.
- EntityDataInfo getInfo(EntityData data) {
- // Check for cached [EntityDataInfo], otherwise create a new one and
- // collect dependencies.
- var info = entityDataToInfo[data];
- if (info == null) {
- var infoBuilder =
- EntityDataInfoBuilder(closedWorld, elementMap, compiler, registry);
- var visitor = EntityDataInfoVisitor(infoBuilder);
- data.accept(visitor);
- info = infoBuilder.info;
- entityDataToInfo[data] = info;
+ /// Processes an [EntityData], if we haven't seen it before we enqueue all
+ /// deferred roots and recursively populate caches.
+ void processEntity(EntityData entityData) {
+ if (directDependencies.containsKey(entityData)) return;
+ var infoBuilder =
+ EntityDataInfoBuilder(closedWorld, elementMap, compiler, registry);
+ var visitor = EntityDataInfoVisitor(infoBuilder);
+ entityData.accept(visitor);
+ var info = infoBuilder.info;
+ directDependencies[entityData] = info.directDependencies;
- // This is the first time we have seen this [EntityData] before so process
- // all deferred roots.
- info.deferredRoots.forEach((entity, imports) {
- for (ImportEntity deferredImport in imports) {
- queue.addEntityData(entity, importSets.initialSetOf(deferredImport));
- }
- });
- }
- return info;
+ // This is the first time we have seen this [EntityData] before so process
+ // all deferred roots and direct dependencies.
+ info.deferredRoots.forEach((entity, imports) {
+ processEntity(entity);
+ for (ImportEntity deferredImport in imports) {
+ queue.addEntityData(entity, importSets.initialSetOf(deferredImport));
+ }
+ });
+ info.directDependencies.forEach(processEntity);
}
/// Updates the dependencies of a given [EntityData] from [oldSet] to
/// [newSet].
void updateDependencies(
EntityData entityData, ImportSet oldSet, ImportSet newSet) {
- var info = getInfo(entityData);
-
- // Process all direct dependencies.
- for (var entity in info.directDependencies) {
+ assert(directDependencies.containsKey(entityData));
+ var directDependenciesList = directDependencies[entityData];
+ for (var entity in directDependenciesList) {
update(entity, oldSet, newSet);
}
}
diff --git a/pkg/compiler/lib/src/deferred_load/work_queue.dart b/pkg/compiler/lib/src/deferred_load/work_queue.dart
index 90bf329..9c9c554 100644
--- a/pkg/compiler/lib/src/deferred_load/work_queue.dart
+++ b/pkg/compiler/lib/src/deferred_load/work_queue.dart
@@ -64,6 +64,7 @@
var item = nextItem();
var entityData = item.entityData;
pendingWorkItems.remove(entityData);
+ state.processEntity(entityData);
ImportSet oldSet = state.entityToSet[entityData];
ImportSet newSet = _importSets.union(oldSet, item.importsToAdd);
state.update(entityData, oldSet, newSet);
diff --git a/pkg/compiler/lib/src/inferrer/abstract_value_domain.dart b/pkg/compiler/lib/src/inferrer/abstract_value_domain.dart
index d2b10ed..582d331 100644
--- a/pkg/compiler/lib/src/inferrer/abstract_value_domain.dart
+++ b/pkg/compiler/lib/src/inferrer/abstract_value_domain.dart
@@ -30,15 +30,15 @@
/// A value of `Abstract.True` is used when the property is known _always_ to
/// be true.
- static const AbstractBool True = const AbstractBool._(true);
+ static const AbstractBool True = AbstractBool._(true);
/// A value of `Abstract.False` is used when the property is known _never_ to
/// be true.
- static const AbstractBool False = const AbstractBool._(false);
+ static const AbstractBool False = AbstractBool._(false);
/// A value of `Abstract.Maybe` is used when the property might or might not
/// be true.
- static const AbstractBool Maybe = const AbstractBool._(null);
+ static const AbstractBool Maybe = AbstractBool._(null);
static AbstractBool trueOrMaybe(bool value) => value ? True : Maybe;
diff --git a/pkg/compiler/lib/src/inferrer/builder_kernel.dart b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
index 7429e8d..12f0069 100644
--- a/pkg/compiler/lib/src/inferrer/builder_kernel.dart
+++ b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
@@ -105,7 +105,7 @@
final Map<JumpTarget, List<LocalState>> _continuesFor =
<JumpTarget, List<LocalState>>{};
TypeInformation _returnType;
- final Set<Local> _capturedVariables = new Set<Local>();
+ final Set<Local> _capturedVariables = Set<Local>();
final Map<Local, FieldEntity> _capturedAndBoxed;
final StaticTypeProvider _staticTypeProvider;
@@ -131,15 +131,15 @@
this._sideEffectsBuilder = _analyzedMember is FunctionEntity
? _inferrer.inferredDataBuilder
.getSideEffectsBuilder(_analyzedMember)
- : new SideEffectsBuilder.free(_analyzedMember),
+ : SideEffectsBuilder.free(_analyzedMember),
this._inGenerativeConstructor = _analyzedNode is ir.Constructor,
this._capturedAndBoxed = capturedAndBoxed != null
- ? new Map<Local, FieldEntity>.from(capturedAndBoxed)
+ ? Map<Local, FieldEntity>.from(capturedAndBoxed)
: <Local, FieldEntity>{} {
if (_state != null) return;
- _state = new LocalState.initial(
- inGenerativeConstructor: _inGenerativeConstructor);
+ _state =
+ LocalState.initial(inGenerativeConstructor: _inGenerativeConstructor);
}
JsToElementMap get _elementMap => _closedWorld.elementMap;
@@ -253,7 +253,7 @@
}
}
- TypeInformation visit(ir.Node node, {bool conditionContext: false}) {
+ TypeInformation visit(ir.Node node, {bool conditionContext = false}) {
var oldAccumulateIsChecks = _accumulateIsChecks;
_accumulateIsChecks = conditionContext;
var result = node?.accept(this);
@@ -339,7 +339,7 @@
visitSuperInitializer(ir.SuperInitializer node) {
ConstructorEntity constructor = _elementMap.getConstructor(node.target);
ArgumentsTypes arguments = analyzeArguments(node.arguments);
- Selector selector = new Selector(SelectorKind.CALL, constructor.memberName,
+ Selector selector = Selector(SelectorKind.CALL, constructor.memberName,
_elementMap.getCallStructure(node.arguments));
handleConstructorInvoke(
node, node.arguments, selector, constructor, arguments);
@@ -355,7 +355,7 @@
visitRedirectingInitializer(ir.RedirectingInitializer node) {
ConstructorEntity constructor = _elementMap.getConstructor(node.target);
ArgumentsTypes arguments = analyzeArguments(node.arguments);
- Selector selector = new Selector(SelectorKind.CALL, constructor.memberName,
+ Selector selector = Selector(SelectorKind.CALL, constructor.memberName,
_elementMap.getCallStructure(node.arguments));
handleConstructorInvoke(
node, node.arguments, selector, constructor, arguments);
@@ -452,13 +452,13 @@
@override
TypeInformation defaultExpression(ir.Expression node) {
- throw new UnimplementedError(
+ throw UnimplementedError(
'Unhandled expression: ${node} (${node.runtimeType})');
}
@override
defaultStatement(ir.Statement node) {
- throw new UnimplementedError(
+ throw UnimplementedError(
'Unhandled statement: ${node} (${node.runtimeType})');
}
@@ -503,7 +503,7 @@
handleCondition(node.condition);
LocalState afterConditionWhenTrue = _stateAfterWhenTrue;
LocalState afterConditionWhenFalse = _stateAfterWhenFalse;
- _state = new LocalState.childPath(afterConditionWhenFalse);
+ _state = LocalState.childPath(afterConditionWhenFalse);
visit(node.message);
LocalState stateAfterMessage = _state;
stateAfterMessage.seenReturnOrThrow = true;
@@ -529,9 +529,9 @@
// Do a deep-copy of the locals, because the code following the
// break will change them.
if (_localsMap.generateContinueForBreak(node)) {
- _continuesFor[target].add(new LocalState.deepCopyOf(_state));
+ _continuesFor[target].add(LocalState.deepCopyOf(_state));
} else {
- _breaksFor[target].add(new LocalState.deepCopyOf(_state));
+ _breaksFor[target].add(LocalState.deepCopyOf(_state));
}
return null;
}
@@ -579,7 +579,7 @@
changed = false;
for (ir.SwitchCase switchCase in node.cases) {
LocalState stateBeforeCase = _state;
- _state = new LocalState.childPath(stateBeforeCase);
+ _state = LocalState.childPath(stateBeforeCase);
visit(switchCase);
LocalState stateAfterCase = _state;
changed =
@@ -599,7 +599,7 @@
if (switchCase.isDefault) {
hasDefaultCase = true;
}
- _state = new LocalState.childPath(stateBeforeCase);
+ _state = LocalState.childPath(stateBeforeCase);
visit(switchCase);
statesToMerge.add(_state);
}
@@ -623,7 +623,7 @@
_state.seenBreakOrContinue = true;
// Do a deep-copy of the locals, because the code following the
// break will change them.
- _continuesFor[target].add(new LocalState.deepCopyOf(_state));
+ _continuesFor[target].add(LocalState.deepCopyOf(_state));
return null;
}
@@ -687,7 +687,7 @@
@override
TypeInformation visitMapLiteral(ir.MapLiteral node) {
return createMapTypeInformation(
- node, node.entries.map((e) => new Pair(visit(e.key), visit(e.value))),
+ node, node.entries.map((e) => Pair(visit(e.key), visit(e.value))),
isConst: node.isConst);
}
@@ -859,7 +859,7 @@
named[argument.name] = visit(value);
}
- return new ArgumentsTypes(positional, named);
+ return ArgumentsTypes(positional, named);
}
AbstractValue _typeOfReceiver(ir.TreeNode node, ir.TreeNode receiver) {
@@ -1103,7 +1103,7 @@
TypeInformation receiverType,
TypeInformation rhsType,
ir.VariableDeclaration variable) {
- ArgumentsTypes arguments = new ArgumentsTypes([rhsType], null);
+ ArgumentsTypes arguments = ArgumentsTypes([rhsType], null);
return _handleDynamic(CallType.access, node, selector, mask, receiverType,
arguments, variable);
}
@@ -1154,7 +1154,7 @@
/// Synthesize a call to the [StreamIterator] constructor.
iteratorType = handleStaticInvoke(
- node, null, constructor, new ArgumentsTypes([expressionType], null));
+ node, null, constructor, ArgumentsTypes([expressionType], null));
} else {
TypeInformation expressionType = visit(node.iterable);
Selector iteratorSelector = Selectors.iterator;
@@ -1163,18 +1163,18 @@
moveNextMask = _memberData.typeOfIteratorMoveNext(node);
iteratorType = handleDynamicInvoke(CallType.forIn, node, iteratorSelector,
- iteratorMask, expressionType, new ArgumentsTypes.empty(), null);
+ iteratorMask, expressionType, ArgumentsTypes.empty(), null);
}
handleDynamicInvoke(CallType.forIn, node, Selectors.moveNext, moveNextMask,
- iteratorType, new ArgumentsTypes.empty(), null);
+ iteratorType, ArgumentsTypes.empty(), null);
TypeInformation currentType = handleDynamicInvoke(
CallType.forIn,
node,
Selectors.current,
currentMask,
iteratorType,
- new ArgumentsTypes.empty(),
+ ArgumentsTypes.empty(),
null);
Local variable = _localsMap.getLocalVariable(node.variable);
@@ -1226,7 +1226,7 @@
// Setup (and clear in case of multiple iterations of the loop)
// the lists of breaks and continues seen in the loop.
_setupBreaksAndContinues(target);
- _state = new LocalState.childPath(stateBefore);
+ _state = LocalState.childPath(stateBefore);
logic();
changed = stateBefore.mergeAll(_inferrer, _getLoopBackEdges(target));
} while (changed);
@@ -1576,7 +1576,7 @@
ir.Node node, ir.Member target) {
MemberEntity member = _elementMap.getMember(target);
return handleStaticInvoke(
- node, new Selector.getter(member.memberName), member, null);
+ node, Selector.getter(member.memberName), member, null);
}
@override
@@ -1586,8 +1586,8 @@
_state.markThisAsExposed();
}
MemberEntity member = _elementMap.getMember(node.target);
- handleStaticInvoke(node, new Selector.setter(member.memberName), member,
- new ArgumentsTypes([rhsType], null));
+ handleStaticInvoke(node, Selector.setter(member.memberName), member,
+ ArgumentsTypes([rhsType], null));
return rhsType;
}
@@ -1706,8 +1706,8 @@
if (operand is ir.VariableGet) {
Local local = _localsMap.getLocalVariable(operand.variable);
DartType localType = _elementMap.getDartType(node.type);
- LocalState stateAfterCheckWhenTrue = new LocalState.childPath(_state);
- LocalState stateAfterCheckWhenFalse = new LocalState.childPath(_state);
+ LocalState stateAfterCheckWhenTrue = LocalState.childPath(_state);
+ LocalState stateAfterCheckWhenFalse = LocalState.childPath(_state);
// Narrow variable to tested type on true branch.
TypeInformation currentTypeInformation = stateAfterCheckWhenTrue
@@ -1724,8 +1724,8 @@
if (receiver is ir.VariableGet) {
Local local = _localsMap.getLocalVariable(receiver.variable);
DartType localType = _localsMap.getLocalType(_elementMap, local);
- LocalState stateAfterCheckWhenNull = new LocalState.childPath(_state);
- LocalState stateAfterCheckWhenNotNull = new LocalState.childPath(_state);
+ LocalState stateAfterCheckWhenNull = LocalState.childPath(_state);
+ LocalState stateAfterCheckWhenNotNull = LocalState.childPath(_state);
// Narrow tested variable to 'Null' on true branch.
stateAfterCheckWhenNull.updateLocal(_inferrer, _capturedAndBoxed, local,
@@ -1753,10 +1753,10 @@
handleCondition(node.condition);
LocalState stateAfterConditionWhenTrue = _stateAfterWhenTrue;
LocalState stateAfterConditionWhenFalse = _stateAfterWhenFalse;
- _state = new LocalState.childPath(stateAfterConditionWhenTrue);
+ _state = LocalState.childPath(stateAfterConditionWhenTrue);
visit(node.then);
LocalState stateAfterThen = _state;
- _state = new LocalState.childPath(stateAfterConditionWhenFalse);
+ _state = LocalState.childPath(stateAfterConditionWhenFalse);
visit(node.otherwise);
LocalState stateAfterElse = _state;
_state =
@@ -1787,16 +1787,16 @@
TypeInformation visitLogicalExpression(ir.LogicalExpression node) {
if (node.operatorEnum == ir.LogicalExpressionOperator.AND) {
LocalState stateBefore = _state;
- _state = new LocalState.childPath(stateBefore);
+ _state = LocalState.childPath(stateBefore);
TypeInformation leftInfo = handleCondition(node.left);
LocalState stateAfterLeftWhenTrue = _stateAfterWhenTrue;
LocalState stateAfterLeftWhenFalse = _stateAfterWhenFalse;
- _state = new LocalState.childPath(stateAfterLeftWhenTrue);
+ _state = LocalState.childPath(stateAfterLeftWhenTrue);
TypeInformation rightInfo = handleCondition(node.right);
LocalState stateAfterRightWhenTrue = _stateAfterWhenTrue;
LocalState stateAfterRightWhenFalse = _stateAfterWhenFalse;
LocalState stateAfterWhenTrue = stateAfterRightWhenTrue;
- LocalState stateAfterWhenFalse = new LocalState.childPath(stateBefore)
+ LocalState stateAfterWhenFalse = LocalState.childPath(stateBefore)
.mergeDiamondFlow(
_inferrer, stateAfterLeftWhenFalse, stateAfterRightWhenFalse);
LocalState after = stateBefore.mergeDiamondFlow(
@@ -1812,15 +1812,15 @@
return _types.boolType;
} else if (node.operatorEnum == ir.LogicalExpressionOperator.OR) {
LocalState stateBefore = _state;
- _state = new LocalState.childPath(stateBefore);
+ _state = LocalState.childPath(stateBefore);
TypeInformation leftInfo = handleCondition(node.left);
LocalState stateAfterLeftWhenTrue = _stateAfterWhenTrue;
LocalState stateAfterLeftWhenFalse = _stateAfterWhenFalse;
- _state = new LocalState.childPath(stateAfterLeftWhenFalse);
+ _state = LocalState.childPath(stateAfterLeftWhenFalse);
TypeInformation rightInfo = handleCondition(node.right);
LocalState stateAfterRightWhenTrue = _stateAfterWhenTrue;
LocalState stateAfterRightWhenFalse = _stateAfterWhenFalse;
- LocalState stateAfterWhenTrue = new LocalState.childPath(stateBefore)
+ LocalState stateAfterWhenTrue = LocalState.childPath(stateBefore)
.mergeDiamondFlow(
_inferrer, stateAfterLeftWhenTrue, stateAfterRightWhenTrue);
LocalState stateAfterWhenFalse = stateAfterRightWhenFalse;
@@ -1847,10 +1847,10 @@
handleCondition(node.condition);
LocalState stateAfterWhenTrue = _stateAfterWhenTrue;
LocalState stateAfterWhenFalse = _stateAfterWhenFalse;
- _state = new LocalState.childPath(stateAfterWhenTrue);
+ _state = LocalState.childPath(stateAfterWhenTrue);
TypeInformation firstType = visit(node.then);
LocalState stateAfterThen = _state;
- _state = new LocalState.childPath(stateAfterWhenFalse);
+ _state = LocalState.childPath(stateAfterWhenFalse);
TypeInformation secondType = visit(node.otherwise);
LocalState stateAfterElse = _state;
_state =
@@ -1903,8 +1903,8 @@
// We don't put the closure in the work queue of the
// inferrer, because it will share information with its enclosing
// method, like for example the types of local variables.
- LocalState closureState = new LocalState.closure(_state);
- KernelTypeGraphBuilder visitor = new KernelTypeGraphBuilder(
+ LocalState closureState = LocalState.closure(_state);
+ KernelTypeGraphBuilder visitor = KernelTypeGraphBuilder(
_options,
_closedWorld,
_inferrer,
@@ -1934,7 +1934,7 @@
visitWhileStatement(ir.WhileStatement node) {
return handleLoop(node, _localsMap.getJumpTargetForWhile(node), () {
handleCondition(node.condition);
- _state = new LocalState.childPath(_stateAfterWhenTrue);
+ _state = LocalState.childPath(_stateAfterWhenTrue);
visit(node.body);
});
}
@@ -1959,7 +1959,7 @@
}
return handleLoop(node, _localsMap.getJumpTargetForFor(node), () {
handleCondition(node.condition);
- _state = new LocalState.childPath(_stateAfterWhenTrue);
+ _state = LocalState.childPath(_stateAfterWhenTrue);
visit(node.body);
for (ir.Expression update in node.updates) {
visit(update);
@@ -1970,14 +1970,14 @@
@override
visitTryCatch(ir.TryCatch node) {
LocalState stateBefore = _state;
- _state = new LocalState.tryBlock(stateBefore, node);
+ _state = LocalState.tryBlock(stateBefore, node);
_state.markInitializationAsIndefinite();
visit(node.body);
LocalState stateAfterBody = _state;
_state = stateBefore.mergeFlow(_inferrer, stateAfterBody);
for (ir.Catch catchBlock in node.catches) {
LocalState stateBeforeCatch = _state;
- _state = new LocalState.childPath(stateBeforeCatch);
+ _state = LocalState.childPath(stateBeforeCatch);
visit(catchBlock);
LocalState stateAfterCatch = _state;
_state = stateBeforeCatch.mergeFlow(_inferrer, stateAfterCatch);
@@ -1988,7 +1988,7 @@
@override
visitTryFinally(ir.TryFinally node) {
LocalState stateBefore = _state;
- _state = new LocalState.tryBlock(stateBefore, node);
+ _state = LocalState.tryBlock(stateBefore, node);
_state.markInitializationAsIndefinite();
visit(node.body);
LocalState stateAfterBody = _state;
@@ -2058,7 +2058,7 @@
_state.markThisAsExposed();
ir.Member target = getEffectiveSuperTarget(node.interfaceTarget);
- Selector selector = new Selector.getter(_elementMap.getName(node.name));
+ Selector selector = Selector.getter(_elementMap.getName(node.name));
if (target == null) {
// TODO(johnniwinther): Remove this when the CFE checks for missing
// concrete super targets.
@@ -2094,8 +2094,8 @@
TypeInformation rhsType = visit(node.value);
ir.Member target = getEffectiveSuperTarget(node.interfaceTarget);
- Selector selector = new Selector.setter(_elementMap.getName(node.name));
- ArgumentsTypes arguments = new ArgumentsTypes([rhsType], null);
+ Selector selector = Selector.setter(_elementMap.getName(node.name));
+ ArgumentsTypes arguments = ArgumentsTypes([rhsType], null);
if (target == null) {
// TODO(johnniwinther): Remove this when the CFE checks for missing
// concrete super targets.
@@ -2176,7 +2176,7 @@
@override
TypeInformation visitConstantExpression(ir.ConstantExpression node) {
- return new TypeInformationConstantVisitor(this, node)
+ return TypeInformationConstantVisitor(this, node)
.visitConstant(node.constant);
}
}
@@ -2190,7 +2190,7 @@
@override
TypeInformation defaultConstant(ir.Constant node) {
- throw new UnsupportedError("Unexpected constant: "
+ throw UnsupportedError("Unexpected constant: "
"${node} (${node.runtimeType})");
}
@@ -2227,24 +2227,23 @@
@override
TypeInformation visitMapConstant(ir.MapConstant node) {
return builder.createMapTypeInformation(
- new ConstantReference(expression, node),
+ ConstantReference(expression, node),
node.entries
- .map((e) => new Pair(visitConstant(e.key), visitConstant(e.value))),
+ .map((e) => Pair(visitConstant(e.key), visitConstant(e.value))),
isConst: true);
}
@override
TypeInformation visitListConstant(ir.ListConstant node) {
return builder.createListTypeInformation(
- new ConstantReference(expression, node),
+ ConstantReference(expression, node),
node.entries.map((e) => visitConstant(e)),
isConst: true);
}
@override
TypeInformation visitSetConstant(ir.SetConstant node) {
- return builder.createSetTypeInformation(
- new ConstantReference(expression, node),
+ return builder.createSetTypeInformation(ConstantReference(expression, node),
node.entries.map((e) => visitConstant(e)),
isConst: true);
}
@@ -2299,34 +2298,31 @@
LocalsHandler _tryBlock;
LocalState.initial({bool inGenerativeConstructor})
- : this.internal(
- new LocalsHandler(),
- inGenerativeConstructor ? new FieldInitializationScope() : null,
- null,
- seenReturnOrThrow: false,
- seenBreakOrContinue: false);
+ : this.internal(LocalsHandler(),
+ inGenerativeConstructor ? FieldInitializationScope() : null, null,
+ seenReturnOrThrow: false, seenBreakOrContinue: false);
LocalState.childPath(LocalState other)
- : this.internal(new LocalsHandler.from(other._locals),
- new FieldInitializationScope.from(other._fields), other._tryBlock,
+ : this.internal(LocalsHandler.from(other._locals),
+ FieldInitializationScope.from(other._fields), other._tryBlock,
seenReturnOrThrow: false, seenBreakOrContinue: false);
LocalState.closure(LocalState other)
- : this.internal(new LocalsHandler.from(other._locals),
- new FieldInitializationScope.from(other._fields), null,
+ : this.internal(LocalsHandler.from(other._locals),
+ FieldInitializationScope.from(other._fields), null,
seenReturnOrThrow: false, seenBreakOrContinue: false);
factory LocalState.tryBlock(LocalState other, ir.TreeNode node) {
- LocalsHandler locals = new LocalsHandler.tryBlock(other._locals, node);
+ LocalsHandler locals = LocalsHandler.tryBlock(other._locals, node);
FieldInitializationScope fieldScope =
- new FieldInitializationScope.from(other._fields);
+ FieldInitializationScope.from(other._fields);
LocalsHandler tryBlock = locals;
- return new LocalState.internal(locals, fieldScope, tryBlock,
+ return LocalState.internal(locals, fieldScope, tryBlock,
seenReturnOrThrow: false, seenBreakOrContinue: false);
}
LocalState.deepCopyOf(LocalState other)
- : _locals = new LocalsHandler.deepCopyOf(other._locals),
+ : _locals = LocalsHandler.deepCopyOf(other._locals),
_tryBlock = other._tryBlock,
_fields = other._fields;
@@ -2374,8 +2370,8 @@
TypeInformation type,
ir.Node node,
DartType staticType,
- {isCast: true,
- excludeNull: false}) {
+ {isCast = true,
+ excludeNull = false}) {
assert(type != null);
type = inferrer.types.narrowType(type, staticType,
isCast: isCast, excludeNull: excludeNull, excludeLateSentinel: true);
@@ -2396,7 +2392,7 @@
return this;
}
LocalsHandler locals = _locals.mergeFlow(inferrer, other._locals);
- return new LocalState.internal(locals, _fields, _tryBlock,
+ return LocalState.internal(locals, _fields, _tryBlock,
seenReturnOrThrow: seenReturnOrThrow,
seenBreakOrContinue: seenBreakOrContinue);
}
@@ -2422,13 +2418,13 @@
FieldInitializationScope fieldScope = _fields?.mergeDiamondFlow(
inferrer, thenBranch._fields, elseBranch._fields);
- return new LocalState.internal(locals, fieldScope, _tryBlock,
+ return LocalState.internal(locals, fieldScope, _tryBlock,
seenReturnOrThrow: seenReturnOrThrow,
seenBreakOrContinue: seenBreakOrContinue);
}
LocalState mergeAfterBreaks(InferrerEngine inferrer, List<LocalState> states,
- {bool keepOwnLocals: true}) {
+ {bool keepOwnLocals = true}) {
bool allBranchesAbort = true;
for (LocalState state in states) {
allBranchesAbort = allBranchesAbort && state.seenReturnOrThrow;
@@ -2443,7 +2439,7 @@
.map((LocalState state) => state._locals),
keepOwnLocals: keepOwnLocals);
seenReturnOrThrow = allBranchesAbort && !keepOwnLocals;
- return new LocalState.internal(locals, _fields, _tryBlock,
+ return LocalState.internal(locals, _fields, _tryBlock,
seenReturnOrThrow: seenReturnOrThrow,
seenBreakOrContinue: seenBreakOrContinue);
}
@@ -2466,7 +2462,7 @@
}
String toStructuredText(String indent) {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
_toStructuredText(sb, indent);
return sb.toString();
}
@@ -2480,7 +2476,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('LocalState(');
sb.write('locals=$_locals');
if (_fields != null) {
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
index defc8a7..d0f7742 100644
--- a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
@@ -47,16 +47,15 @@
class InferrerEngine {
/// A set of selector names that [List] implements, that we know return their
/// element type.
- final Set<Selector> returnsListElementTypeSet =
- new Set<Selector>.from(<Selector>[
- new Selector.getter(const PublicName('first')),
- new Selector.getter(const PublicName('last')),
- new Selector.getter(const PublicName('single')),
- new Selector.call(const PublicName('singleWhere'), CallStructure.ONE_ARG),
- new Selector.call(const PublicName('elementAt'), CallStructure.ONE_ARG),
- new Selector.index(),
- new Selector.call(const PublicName('removeAt'), CallStructure.ONE_ARG),
- new Selector.call(const PublicName('removeLast'), CallStructure.NO_ARGS)
+ final Set<Selector> returnsListElementTypeSet = Set<Selector>.from(<Selector>[
+ Selector.getter(const PublicName('first')),
+ Selector.getter(const PublicName('last')),
+ Selector.getter(const PublicName('single')),
+ Selector.call(const PublicName('singleWhere'), CallStructure.ONE_ARG),
+ Selector.call(const PublicName('elementAt'), CallStructure.ONE_ARG),
+ Selector.index(),
+ Selector.call(const PublicName('removeAt'), CallStructure.ONE_ARG),
+ Selector.call(const PublicName('removeLast'), CallStructure.NO_ARGS)
]);
/// The [JClosedWorld] on which inference reasoning is based.
@@ -91,12 +90,12 @@
final CompilerOutput _compilerOutput;
final Set<ConstructorEntity> _generativeConstructorsExposingThis =
- new Set<ConstructorEntity>();
+ Set<ConstructorEntity>();
/// Data computed internally within elements, like the type-mask of a send a
/// list allocation, or a for-in loop.
final Map<MemberEntity, GlobalTypeInferenceElementData> _memberData =
- new Map<MemberEntity, GlobalTypeInferenceElementData>();
+ Map<MemberEntity, GlobalTypeInferenceElementData>();
ElementEnvironment get _elementEnvironment => closedWorld.elementEnvironment;
@@ -117,8 +116,8 @@
this.mainElement,
this.globalLocalsMap,
this.inferredDataBuilder)
- : this.types = new TypeSystem(closedWorld,
- new KernelTypeSystemStrategy(closedWorld, globalLocalsMap));
+ : this.types = TypeSystem(closedWorld,
+ KernelTypeSystemStrategy(closedWorld, globalLocalsMap));
/// Applies [f] to all elements in the universe that match [selector] and
/// [mask]. If [f] returns false, aborts the iteration.
@@ -132,7 +131,7 @@
// TODO(johnniwinther): Make this private again.
GlobalTypeInferenceElementData dataOfMember(MemberEntity element) =>
- _memberData[element] ??= new KernelGlobalTypeInferenceElementData();
+ _memberData[element] ??= KernelGlobalTypeInferenceElementData();
/// Update [sideEffects] with the side effects of [callee] being
/// called with [selector].
@@ -254,7 +253,7 @@
if (info.analyzed) return;
info.analyzed = true;
- ListTracerVisitor tracer = new ListTracerVisitor(info, this);
+ ListTracerVisitor tracer = ListTracerVisitor(info, this);
bool succeeded = tracer.run();
if (!succeeded) return;
@@ -274,7 +273,7 @@
if (info.analyzed) return;
info.analyzed = true;
- SetTracerVisitor tracer = new SetTracerVisitor(info, this);
+ SetTracerVisitor tracer = SetTracerVisitor(info, this);
bool succeeded = tracer.run();
if (!succeeded) return;
@@ -290,7 +289,7 @@
void analyzeMapAndEnqueue(MapTypeInformation info) {
if (info.analyzed) return;
info.analyzed = true;
- MapTracerVisitor tracer = new MapTracerVisitor(info, this);
+ MapTracerVisitor tracer = MapTracerVisitor(info, this);
bool succeeded = tracer.run();
if (!succeeded) return;
@@ -319,7 +318,7 @@
void _runOverAllElements() {
metrics.analyze.measure(_analyzeAllElements);
TypeGraphDump dump =
- debug.PRINT_GRAPH ? new TypeGraphDump(_compilerOutput, this) : null;
+ debug.PRINT_GRAPH ? TypeGraphDump(_compilerOutput, this) : null;
dump?.beforeAnalysis();
_buildWorkQueue();
@@ -341,7 +340,7 @@
analyzeMapAndEnqueue(info);
});
- Set<FunctionEntity> bailedOutOn = new Set<FunctionEntity>();
+ Set<FunctionEntity> bailedOutOn = Set<FunctionEntity>();
// Trace closures to potentially infer argument types.
types.allocatedClosures.forEach((dynamic info) {
@@ -384,7 +383,7 @@
if (info is ClosureTypeInformation) {
Iterable<FunctionEntity> elements = [info.closure];
- trace(elements, new ClosureTracerVisitor(elements, info, this));
+ trace(elements, ClosureTracerVisitor(elements, info, this));
} else if (info is CallSiteTypeInformation) {
if (info is StaticCallSiteTypeInformation &&
info.selector != null &&
@@ -398,18 +397,18 @@
FunctionEntity callMethod = _lookupCallMethod(cls);
assert(callMethod != null, failedAt(cls));
Iterable<FunctionEntity> elements = [callMethod];
- trace(elements, new ClosureTracerVisitor(elements, info, this));
+ trace(elements, ClosureTracerVisitor(elements, info, this));
} else {
// We only are interested in functions here, as other targets
// of this closure call are not a root to trace but an intermediate
// for some other function.
- Iterable<FunctionEntity> elements = new List<FunctionEntity>.from(
+ Iterable<FunctionEntity> elements = List<FunctionEntity>.from(
info.callees.where((e) => e.isFunction));
- trace(elements, new ClosureTracerVisitor(elements, info, this));
+ trace(elements, ClosureTracerVisitor(elements, info, this));
}
} else if (info is MemberTypeInformation) {
trace(<FunctionEntity>[info.member],
- new StaticTearOffClosureTracerVisitor(info.member, info, this));
+ StaticTearOffClosureTracerVisitor(info.member, info, this));
} else if (info is ParameterTypeInformation) {
failedAt(
NO_LOCATION_SPANNABLE, 'Unexpected closure allocation info $info');
@@ -421,7 +420,7 @@
// Reset all nodes that use lists/maps that have been inferred, as well
// as nodes that use elements fetched from these lists/maps. The
// workset for a new run of the analysis will be these nodes.
- Set<TypeInformation> seenTypes = new Set<TypeInformation>();
+ Set<TypeInformation> seenTypes = Set<TypeInformation>();
while (!_workQueue.isEmpty) {
TypeInformation info = _workQueue.remove();
if (seenTypes.contains(info)) continue;
@@ -595,7 +594,7 @@
// of the type graph and do not drop any flow edges.
AbstractValue refinedType =
abstractValueDomain.computeAbstractValueForConstant(value);
- type = new NarrowTypeInformation(
+ type = NarrowTypeInformation(
abstractValueDomain, type, refinedType);
types.allocatedTypes.add(type);
}
@@ -630,7 +629,7 @@
/// Visits [body] to compute the [TypeInformation] node for [member].
TypeInformation _computeMemberTypeInformation(
MemberEntity member, ir.Node body) {
- KernelTypeGraphBuilder visitor = new KernelTypeGraphBuilder(
+ KernelTypeGraphBuilder visitor = KernelTypeGraphBuilder(
_options,
closedWorld,
this,
@@ -753,7 +752,7 @@
/// added to the work queue.
void updateParameterInputs(TypeInformation caller, MemberEntity callee,
ArgumentsTypes arguments, Selector selector,
- {bool remove, bool addToQueue: true}) {
+ {bool remove, bool addToQueue = true}) {
if (callee.name == Identifiers.noSuchMethod_) return;
if (callee.isField) {
if (selector.isSetter) {
@@ -855,7 +854,7 @@
/// should be present and a default type for each parameter should exist.
TypeInformation getDefaultTypeOfParameter(Local parameter) {
return _defaultTypeOfParameter.putIfAbsent(parameter, () {
- return new PlaceholderTypeInformation(
+ return PlaceholderTypeInformation(
abstractValueDomain, types.currentMember);
});
}
@@ -927,7 +926,7 @@
ArgumentsTypes arguments,
SideEffectsBuilder sideEffectsBuilder,
bool inLoop) {
- CallSiteTypeInformation info = new StaticCallSiteTypeInformation(
+ CallSiteTypeInformation info = StaticCallSiteTypeInformation(
abstractValueDomain,
types.currentMember,
node,
@@ -988,7 +987,7 @@
_updateSideEffects(sideEffectsBuilder, selector, callee);
});
- CallSiteTypeInformation info = new DynamicCallSiteTypeInformation(
+ CallSiteTypeInformation info = DynamicCallSiteTypeInformation(
abstractValueDomain,
types.currentMember,
callType,
@@ -1008,8 +1007,8 @@
/// Registers a call to await with an expression of type [argumentType] as
/// argument.
TypeInformation registerAwait(ir.Node node, TypeInformation argument) {
- AwaitTypeInformation info = new AwaitTypeInformation(
- abstractValueDomain, types.currentMember, node);
+ AwaitTypeInformation info =
+ AwaitTypeInformation(abstractValueDomain, types.currentMember, node);
info.addInput(argument);
types.allocatedTypes.add(info);
return info;
@@ -1018,8 +1017,8 @@
/// Registers a call to yield with an expression of type [argumentType] as
/// argument.
TypeInformation registerYield(ir.Node node, TypeInformation argument) {
- YieldTypeInformation info = new YieldTypeInformation(
- abstractValueDomain, types.currentMember, node);
+ YieldTypeInformation info =
+ YieldTypeInformation(abstractValueDomain, types.currentMember, node);
info.addInput(argument);
types.allocatedTypes.add(info);
return info;
@@ -1040,7 +1039,7 @@
SideEffectsBuilder sideEffectsBuilder,
{bool inLoop}) {
sideEffectsBuilder.setAllSideEffectsAndDependsOnSomething();
- CallSiteTypeInformation info = new ClosureCallSiteTypeInformation(
+ CallSiteTypeInformation info = ClosureCallSiteTypeInformation(
abstractValueDomain,
types.currentMember,
node,
@@ -1149,21 +1148,21 @@
if (info != null) return info;
TypeInformation receiverType =
- new IndirectParameterTypeInformation(abstractValueDomain, 'receiver');
+ IndirectParameterTypeInformation(abstractValueDomain, 'receiver');
List<TypeInformation> positional = [];
for (int i = 0; i < structure.positionalArgumentCount; i++) {
positional
- .add(new IndirectParameterTypeInformation(abstractValueDomain, '$i'));
+ .add(IndirectParameterTypeInformation(abstractValueDomain, '$i'));
}
Map<String, TypeInformation> named = {};
if (structure.namedArgumentCount > 0) {
for (var name in structure.namedArguments) {
named[name] =
- new IndirectParameterTypeInformation(abstractValueDomain, name);
+ IndirectParameterTypeInformation(abstractValueDomain, name);
}
}
- info = _sharedCalls[selector] = new DynamicCallSiteTypeInformation(
+ info = _sharedCalls[selector] = DynamicCallSiteTypeInformation(
abstractValueDomain,
null,
CallType.indirectAccess,
@@ -1295,18 +1294,13 @@
MemberTypeInformation memberTypeInformation =
types.getInferredTypeOfMember(member);
if (isClosure) {
- return new ParameterTypeInformation.localFunction(
+ return ParameterTypeInformation.localFunction(
abstractValueDomain, memberTypeInformation, parameter, type, member);
} else if (member.isInstanceMember) {
- return new ParameterTypeInformation.instanceMember(
- abstractValueDomain,
- memberTypeInformation,
- parameter,
- type,
- member,
- new ParameterInputs());
+ return ParameterTypeInformation.instanceMember(abstractValueDomain,
+ memberTypeInformation, parameter, type, member, ParameterInputs());
} else {
- return new ParameterTypeInformation.static(
+ return ParameterTypeInformation.static(
abstractValueDomain, memberTypeInformation, parameter, type, member);
}
}
@@ -1317,26 +1311,26 @@
if (member.isField) {
FieldEntity field = member;
DartType type = _elementEnvironment.getFieldType(field);
- return new FieldTypeInformation(abstractValueDomain, field, type);
+ return FieldTypeInformation(abstractValueDomain, field, type);
} else if (member.isGetter) {
FunctionEntity getter = member;
DartType type = _elementEnvironment.getFunctionType(getter);
- return new GetterTypeInformation(abstractValueDomain, getter, type);
+ return GetterTypeInformation(abstractValueDomain, getter, type);
} else if (member.isSetter) {
FunctionEntity setter = member;
- return new SetterTypeInformation(abstractValueDomain, setter);
+ return SetterTypeInformation(abstractValueDomain, setter);
} else if (member.isFunction) {
FunctionEntity method = member;
DartType type = _elementEnvironment.getFunctionType(method);
- return new MethodTypeInformation(abstractValueDomain, method, type);
+ return MethodTypeInformation(abstractValueDomain, method, type);
} else {
ConstructorEntity constructor = member;
if (constructor.isFactoryConstructor) {
DartType type = _elementEnvironment.getFunctionType(constructor);
- return new FactoryConstructorTypeInformation(
+ return FactoryConstructorTypeInformation(
abstractValueDomain, constructor, type);
} else {
- return new GenerativeConstructorTypeInformation(
+ return GenerativeConstructorTypeInformation(
abstractValueDomain, constructor);
}
}
@@ -1383,7 +1377,7 @@
() => abstractValueDomain.readAbstractValueFromDataSource(source),
emptyAsNull: true);
source.end(tag);
- return new KernelGlobalTypeInferenceElementData.internal(
+ return KernelGlobalTypeInferenceElementData.internal(
sendMap, iteratorMap, currentMap, moveNextMap);
});
}
diff --git a/pkg/compiler/lib/src/inferrer/list_tracer.dart b/pkg/compiler/lib/src/inferrer/list_tracer.dart
index 17bb7ed..4918a33 100644
--- a/pkg/compiler/lib/src/inferrer/list_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/list_tracer.dart
@@ -15,7 +15,7 @@
/// A set of selector names that [List] implements, that we know do not
/// change the element type of the list, or let the list escape to code
/// that might change the element type.
-Set<String> okListSelectorsSet = new Set<String>.from(const <String>[
+Set<String> okListSelectorsSet = Set<String>.from(const <String>[
// From Object.
'==',
'hashCode',
@@ -75,7 +75,7 @@
'checkGrowable',
]);
-Set<String> doNotChangeLengthSelectorsSet = new Set<String>.from(const <String>[
+Set<String> doNotChangeLengthSelectorsSet = Set<String>.from(const <String>[
// From Object.
'==',
'hashCode',
@@ -131,7 +131,7 @@
class ListTracerVisitor extends TracerVisitor {
// The [Set] of found assignments to the list.
- Set<TypeInformation> inputs = new Setlet<TypeInformation>();
+ Set<TypeInformation> inputs = Setlet<TypeInformation>();
bool callsGrowableMethod = false;
ListTracerVisitor(tracedType, inferrer) : super(tracedType, inferrer);
diff --git a/pkg/compiler/lib/src/inferrer/locals_handler.dart b/pkg/compiler/lib/src/inferrer/locals_handler.dart
index 49ee715..ed565ca 100644
--- a/pkg/compiler/lib/src/inferrer/locals_handler.dart
+++ b/pkg/compiler/lib/src/inferrer/locals_handler.dart
@@ -51,13 +51,13 @@
VariableScope.deepCopyOf(VariableScope other)
: variables = other.variables == null
? null
- : new Map<Local, TypeInformation>.from(other.variables),
+ : Map<Local, TypeInformation>.from(other.variables),
tryBlock = other.tryBlock,
copyOf = other.copyOf ?? other,
_level = other._level,
parent = other.parent == null
? null
- : new VariableScope.deepCopyOf(other.parent);
+ : VariableScope.deepCopyOf(other.parent);
/// `true` if this scope is for a try block.
bool get isTry => tryBlock != null;
@@ -94,7 +94,7 @@
void operator []=(Local variable, TypeInformation mask) {
assert(mask != null);
if (variables == null) {
- variables = new Map<Local, TypeInformation>();
+ variables = Map<Local, TypeInformation>();
}
variables[variable] = mask;
}
@@ -103,7 +103,7 @@
/// [scope]. [f] is called at most once for each variable.
void forEachLocalUntilScope(
VariableScope scope, void f(Local variable, TypeInformation type)) {
- _forEachLocalUntilScope(scope, f, new Setlet<Local>(), this);
+ _forEachLocalUntilScope(scope, f, Setlet<Local>(), this);
}
void _forEachLocalUntilScope(
@@ -142,7 +142,7 @@
}
String toStructuredText(String indent) {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
_toStructuredText(sb, indent);
return sb.toString();
}
@@ -196,13 +196,13 @@
factory FieldInitializationScope.from(FieldInitializationScope other) {
if (other == null) return null;
- return new FieldInitializationScope.internalFrom(other);
+ return FieldInitializationScope.internalFrom(other);
}
void updateField(FieldEntity field, TypeInformation type) {
if (isThisExposed) return;
if (isIndefinite) return;
- fields ??= new Map<FieldEntity, TypeInformation>();
+ fields ??= Map<FieldEntity, TypeInformation>();
fields[field] = type;
}
@@ -259,7 +259,7 @@
int get length => positional.length + named.length;
@override
- Iterator<TypeInformation> get iterator => new ArgumentsTypesIterator(this);
+ Iterator<TypeInformation> get iterator => ArgumentsTypesIterator(this);
@override
String toString() => "{ positional = $positional, named = $named }";
@@ -279,7 +279,7 @@
}
@override
- int get hashCode => throw new UnsupportedError('ArgumentsTypes.hashCode');
+ int get hashCode => throw UnsupportedError('ArgumentsTypes.hashCode');
bool hasNoArguments() => positional.isEmpty && named.isEmpty;
@@ -329,16 +329,16 @@
class LocalsHandler {
final VariableScope _locals;
- LocalsHandler() : _locals = new VariableScope();
+ LocalsHandler() : _locals = VariableScope();
LocalsHandler.from(LocalsHandler other)
- : _locals = new VariableScope(parent: other._locals);
+ : _locals = VariableScope(parent: other._locals);
LocalsHandler.tryBlock(LocalsHandler other, ir.TreeNode block)
- : _locals = new VariableScope.tryBlock(block, parent: other._locals);
+ : _locals = VariableScope.tryBlock(block, parent: other._locals);
LocalsHandler.deepCopyOf(LocalsHandler other)
- : _locals = new VariableScope.deepCopyOf(other._locals);
+ : _locals = VariableScope.deepCopyOf(other._locals);
TypeInformation use(InferrerEngine inferrer, Local local) {
return _locals[local];
@@ -376,7 +376,7 @@
/// replaced by the variables types in [other]. Otherwise the variable types
/// from both are merged with a phi type.
LocalsHandler mergeFlow(InferrerEngine inferrer, LocalsHandler other,
- {bool inPlace: false}) {
+ {bool inPlace = false}) {
VariableScope common = _locals.commonParent(other._locals);
assert(
common != null,
@@ -475,15 +475,15 @@
/// labeled statement that do not break out.
LocalsHandler mergeAfterBreaks(
InferrerEngine inferrer, Iterable<LocalsHandler> handlers,
- {bool keepOwnLocals: true}) {
+ {bool keepOwnLocals = true}) {
ir.Node tryBlock = _locals.tryBlock;
// Use a separate locals handler to perform the merge in, so that Phi
// creation does not invalidate previous type knowledge while we might
// still look it up.
VariableScope merged = tryBlock != null
- ? new VariableScope.tryBlock(tryBlock, parent: _locals)
- : new VariableScope(parent: _locals);
- Set<Local> seenLocals = new Setlet<Local>();
+ ? VariableScope.tryBlock(tryBlock, parent: _locals)
+ : VariableScope(parent: _locals);
+ Set<Local> seenLocals = Setlet<Local>();
// Merge all other handlers.
for (LocalsHandler handler in handlers) {
VariableScope common = _locals.commonParent(handler._locals);
@@ -587,7 +587,7 @@
}
String toStructuredText(String indent) {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
_toStructuredText(sb, indent);
return sb.toString();
}
@@ -601,7 +601,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('LocalsHandler(');
sb.write('locals=$_locals');
sb.write(')');
diff --git a/pkg/compiler/lib/src/inferrer/map_tracer.dart b/pkg/compiler/lib/src/inferrer/map_tracer.dart
index 3f29c0c..70f36d1 100644
--- a/pkg/compiler/lib/src/inferrer/map_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/map_tracer.dart
@@ -10,7 +10,7 @@
import 'node_tracer.dart';
import 'type_graph_nodes.dart';
-Set<String> okMapSelectorsSet = new Set.from(const <String>[
+Set<String> okMapSelectorsSet = Set.from(const <String>[
// From Object.
"==",
"hashCode",
diff --git a/pkg/compiler/lib/src/inferrer/node_tracer.dart b/pkg/compiler/lib/src/inferrer/node_tracer.dart
index 4d4a4bd..8500f56 100644
--- a/pkg/compiler/lib/src/inferrer/node_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/node_tracer.dart
@@ -14,7 +14,7 @@
// A set of selectors we know do not escape the elements inside the
// list.
-Set<String> doesNotEscapeListSet = new Set<String>.from(const <String>[
+Set<String> doesNotEscapeListSet = Set<String>.from(const <String>[
// From Object.
'==',
'hashCode',
@@ -51,7 +51,7 @@
'checkGrowable',
]);
-Set<String> doesNotEscapeSetSet = new Set<String>.from(const <String>[
+Set<String> doesNotEscapeSetSet = Set<String>.from(const <String>[
// From Object.
'==',
'hashCode',
@@ -76,7 +76,7 @@
'retainAll',
]);
-Set<String> doesNotEscapeMapSet = new Set<String>.from(const <String>[
+Set<String> doesNotEscapeMapSet = Set<String>.from(const <String>[
// From Object.
'==',
'hashCode',
@@ -101,8 +101,8 @@
final InferrerEngine inferrer;
static const int MAX_ANALYSIS_COUNT =
- const int.fromEnvironment('dart2js.tracing.limit', defaultValue: 32);
- final Setlet<MemberEntity> analyzedElements = new Setlet<MemberEntity>();
+ int.fromEnvironment('dart2js.tracing.limit', defaultValue: 32);
+ final Setlet<MemberEntity> analyzedElements = Setlet<MemberEntity>();
TracerVisitor(this.tracedType, this.inferrer);
@@ -125,7 +125,7 @@
/// maps and we must check how it escapes from these maps.
final List<MapTypeInformation> mapsToAnalyze = <MapTypeInformation>[];
- final Setlet<TypeInformation> flowsInto = new Setlet<TypeInformation>();
+ final Setlet<TypeInformation> flowsInto = Setlet<TypeInformation>();
// The current [TypeInformation] in the analysis.
TypeInformation currentUser;
diff --git a/pkg/compiler/lib/src/inferrer/set_tracer.dart b/pkg/compiler/lib/src/inferrer/set_tracer.dart
index 8a98719..df495bf 100644
--- a/pkg/compiler/lib/src/inferrer/set_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/set_tracer.dart
@@ -13,7 +13,7 @@
/// A set of selector names that [Set] implements and which we know do not
/// change the element type of the set or let the set escape to code that might
/// change the element type.
-Set<String> okSetSelectorSet = new Set<String>.from(const <String>[
+Set<String> okSetSelectorSet = Set<String>.from(const <String>[
// From Object.
'==',
'hashCode',
diff --git a/pkg/compiler/lib/src/inferrer/trivial.dart b/pkg/compiler/lib/src/inferrer/trivial.dart
index 3f6fe3a..6ba231b 100644
--- a/pkg/compiler/lib/src/inferrer/trivial.dart
+++ b/pkg/compiler/lib/src/inferrer/trivial.dart
@@ -101,14 +101,13 @@
@override
AbstractValue getDictionaryValueForKey(AbstractValue value, String key) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"TrivialAbstractValueDomain.getDictionaryValueForKey");
}
@override
bool containsDictionaryKey(AbstractValue value, String key) {
- throw new UnsupportedError(
- "TrivialAbstractValueDomain.containsDictionaryKey");
+ throw UnsupportedError("TrivialAbstractValueDomain.containsDictionaryKey");
}
@override
@@ -126,12 +125,12 @@
@override
AbstractValue getMapValueType(AbstractValue value) {
- throw new UnsupportedError("TrivialAbstractValueDomain.getMapValueType");
+ throw UnsupportedError("TrivialAbstractValueDomain.getMapValueType");
}
@override
AbstractValue getMapKeyType(AbstractValue value) {
- throw new UnsupportedError("TrivialAbstractValueDomain.getMapKeyType");
+ throw UnsupportedError("TrivialAbstractValueDomain.getMapKeyType");
}
@override
@@ -148,7 +147,7 @@
@override
AbstractValue getSetElementType(AbstractValue value) {
- throw new UnsupportedError("TrivialAbstractValueDomain.getSetElementType");
+ throw UnsupportedError("TrivialAbstractValueDomain.getSetElementType");
}
@override
@@ -167,7 +166,7 @@
@override
AbstractValue getContainerElementType(AbstractValue value) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"TrivialAbstractValueDomain.getContainerElementType");
}
@@ -363,8 +362,7 @@
AbstractValueWithPrecision createFromStaticType(DartType type,
{ClassRelation classRelation = ClassRelation.subtype, bool nullable}) {
assert(nullable != null);
- return const AbstractValueWithPrecision(
- const TrivialAbstractValue(), false);
+ return const AbstractValueWithPrecision(TrivialAbstractValue(), false);
}
@override
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
index ac9c901..ff82843 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
@@ -36,7 +36,7 @@
<TypeInformation, Set<TypeInformation>>{};
final Map<TypeInformation, Set<TypeInformation>> assignmentsBeforeTracing =
<TypeInformation, Set<TypeInformation>>{};
- final Set<String> usedFilenames = new Set<String>();
+ final Set<String> usedFilenames = Set<String>();
TypeGraphDump(this.compilerOutput, this.inferrer);
@@ -80,7 +80,7 @@
String name = filenameFromElement(element);
output = compilerOutput.createOutputSink(
'$outputDir/$name', 'dot', OutputType.debug);
- _GraphGenerator visitor = new _GraphGenerator(
+ _GraphGenerator visitor = _GraphGenerator(
this, element, output, inferrer.abstractValueDomain.getCompactText);
for (TypeInformation node in nodes[element]) {
visitor.visit(node);
@@ -135,7 +135,7 @@
/// Builds the Graphviz Dot file for one function body.
class _GraphGenerator extends TypeInformationVisitor {
final TypeGraphDump global;
- final Set<TypeInformation> seen = new Set<TypeInformation>();
+ final Set<TypeInformation> seen = Set<TypeInformation>();
final List<TypeInformation> worklist = <TypeInformation>[];
final Map<TypeInformation, int> nodeId = <TypeInformation, int>{};
final String Function(AbstractValue) formatType;
@@ -172,7 +172,9 @@
}
void append(String string) {
- output..add(string)..add('\n');
+ output
+ ..add(string)
+ ..add('\n');
}
String shorten(String text) {
@@ -193,7 +195,7 @@
return '$id';
}
- final RegExp escapeRegexp = new RegExp('["{}<>|]');
+ final RegExp escapeRegexp = RegExp('["{}<>|]');
/// Escapes characters in [text] so it can be used as part of a label.
String escapeLabel(String text) {
@@ -205,7 +207,7 @@
/// If [dst] is a record type node, [port] may refer to one of the fields
/// defined in that record (e.g. `obj`, `arg0`, `arg1`, etc)
void addEdge(TypeInformation src, TypeInformation dst,
- {String port, String color: 'black'}) {
+ {String port, String color = 'black'}) {
if (isExternal(src) && isExternal(dst)) {
return; // Do not add edges between external nodes.
}
@@ -268,7 +270,7 @@
/// [inputs] specify named inputs to the node. If omitted, edges will be
/// based on [node.inputs].
void addNode(TypeInformation node, String text,
- {String color: defaultNodeColor, Map<String, TypeInformation> inputs}) {
+ {String color = defaultNodeColor, Map<String, TypeInformation> inputs}) {
seen.add(node);
String style = getStyleForNode(node, color);
text = appendDetails(node, text);
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
index f770d9b..97278f3 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
@@ -25,7 +25,7 @@
/// [TypeInformation.inQueue] that a node is in the queue only once at
/// a time.
class WorkQueue {
- final Queue<TypeInformation> queue = new Queue<TypeInformation>();
+ final Queue<TypeInformation> queue = Queue<TypeInformation>();
void add(TypeInformation element) {
if (element.doNotEnqueue) return;
@@ -125,12 +125,12 @@
bool isCalledOnce = typeInformation.isCalledOnce();
- memberResults[member] = new GlobalTypeInferenceMemberResultImpl(
+ memberResults[member] = GlobalTypeInferenceMemberResultImpl(
data, returnType, type,
throwsAlways: throwsAlways, isCalledOnce: isCalledOnce);
}
- Set<FieldEntity> freeVariables = new Set<FieldEntity>();
+ Set<FieldEntity> freeVariables = Set<FieldEntity>();
inferrer.types.forEachMemberType(
(MemberEntity member, MemberTypeInformation typeInformation) {
createMemberResults(member, typeInformation);
@@ -169,7 +169,7 @@
allocatedLists[node] = typeInformation.type;
});
- GlobalTypeInferenceResults results = new GlobalTypeInferenceResultsImpl(
+ GlobalTypeInferenceResults results = GlobalTypeInferenceResultsImpl(
closedWorld,
_globalLocalsMap,
_inferredDataBuilder.close(closedWorld),
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index b388116..02dbfd2 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -85,11 +85,11 @@
TypeInformation(this.type, this.context)
: _inputs = <TypeInformation>[],
- users = new Setlet<TypeInformation>();
+ users = Setlet<TypeInformation>();
TypeInformation.noInputs(this.type, this.context)
: _inputs = const <TypeInformation>[],
- users = new Setlet<TypeInformation>();
+ users = Setlet<TypeInformation>();
TypeInformation.untracked(this.type)
: _inputs = const <TypeInformation>[],
@@ -97,7 +97,7 @@
context = null;
TypeInformation.withInputs(this.type, this.context, this._inputs)
- : users = new Setlet<TypeInformation>();
+ : users = Setlet<TypeInformation>();
void addUser(TypeInformation user) {
assert(!user.isConcrete);
@@ -116,7 +116,7 @@
// The below is not a compile time constant to make it differentiable
// from other empty lists of [TypeInformation].
static final STOP_TRACKING_INPUTS_MARKER =
- new List<TypeInformation>.filled(0, null);
+ List<TypeInformation>.filled(0, null);
bool areInputsTracked() {
return inputs != STOP_TRACKING_INPUTS_MARKER;
@@ -158,7 +158,7 @@
return inferrer.types.dynamicType.type;
}
- void giveUp(InferrerEngine inferrer, {bool clearInputs: true}) {
+ void giveUp(InferrerEngine inferrer, {bool clearInputs = true}) {
abandonInferencing = true;
// Do not remove [this] as a user of nodes in [inputs],
// because our tracing analysis could be interested in tracing
@@ -223,8 +223,8 @@
}
String toStructuredText(String indent) {
- StringBuffer sb = new StringBuffer();
- _toStructuredText(sb, indent, new Set<TypeInformation>());
+ StringBuffer sb = StringBuffer();
+ _toStructuredText(sb, indent, Set<TypeInformation>());
return sb.toString();
}
@@ -251,12 +251,12 @@
@override
void accept(TypeInformationVisitor visitor) {
- throw new UnsupportedError("Cannot visit placeholder");
+ throw UnsupportedError("Cannot visit placeholder");
}
@override
AbstractValue computeType(InferrerEngine inferrer) {
- throw new UnsupportedError("Cannot refine placeholder");
+ throw UnsupportedError("Cannot refine placeholder");
}
@override
@@ -269,7 +269,7 @@
/// to a type where we know more about which instance method is being
/// called.
class ParameterInputs extends IterableBase<TypeInformation> {
- final Map<TypeInformation, int> _inputs = new Map<TypeInformation, int>();
+ final Map<TypeInformation, int> _inputs = Map<TypeInformation, int>();
void remove(TypeInformation info) {
int existing = _inputs[info];
@@ -400,7 +400,7 @@
void addCall(MemberEntity caller, Object node) {
_callers ??= <MemberEntity, Setlet<Object>>{};
- _callers.putIfAbsent(caller, () => new Setlet()).add(node);
+ _callers.putIfAbsent(caller, () => Setlet()).add(node);
}
void removeCall(MemberEntity caller, Object node) {
@@ -725,7 +725,7 @@
ParameterTypeInformation.static(AbstractValueDomain abstractValueDomain,
MemberTypeInformation context, this._parameter, this._type, this._method,
- {bool isInitializingFormal: false})
+ {bool isInitializingFormal = false})
: _isInstanceMemberParameter = false,
_isClosureParameter = false,
_isInitializingFormal = isInitializingFormal,
@@ -882,7 +882,7 @@
@override
String getInferredSignature(TypeSystem types) {
- throw new UnsupportedError('ParameterTypeInformation.getInferredSignature');
+ throw UnsupportedError('ParameterTypeInformation.getInferredSignature');
}
}
@@ -923,7 +923,7 @@
case CallType.forIn:
return call is ir.ForInStatement;
}
- throw new StateError('Unexpected call type $callType.');
+ throw StateError('Unexpected call type $callType.');
}
/// A [CallSiteTypeInformation] is a call found in the AST, or a
@@ -1121,7 +1121,7 @@
}
@override
- void giveUp(InferrerEngine inferrer, {bool clearInputs: true}) {
+ void giveUp(InferrerEngine inferrer, {bool clearInputs = true}) {
if (!abandonInferencing) {
inferrer.updateSelectorInMember(
caller, CallType.access, _call, selector, mask);
@@ -1451,7 +1451,7 @@
}
@override
- void giveUp(InferrerEngine inferrer, {bool clearInputs: true}) {
+ void giveUp(InferrerEngine inferrer, {bool clearInputs = true}) {
if (!abandonInferencing) {
inferrer.updateSelectorInMember(caller, _callType, _call, selector, mask);
Iterable<MemberEntity> oldTargets = _concreteTargets;
@@ -1541,7 +1541,7 @@
@override
Iterable<MemberEntity> get callees {
- throw new UnsupportedError("Cannot compute callees of a closure call.");
+ throw UnsupportedError("Cannot compute callees of a closure call.");
}
@override
@@ -1631,7 +1631,7 @@
StringLiteralTypeInformation(
AbstractValueDomain abstractValueDomain, this.value, AbstractValue mask)
: super(abstractValueDomain.createPrimitiveValue(
- mask, new StringConstantValue(value)));
+ mask, StringConstantValue(value)));
String asString() => value;
@override
@@ -1649,7 +1649,7 @@
BoolLiteralTypeInformation(
AbstractValueDomain abstractValueDomain, this.value, AbstractValue mask)
: super(abstractValueDomain.createPrimitiveValue(
- mask, value ? new TrueConstantValue() : new FalseConstantValue()));
+ mask, value ? TrueConstantValue() : FalseConstantValue()));
@override
String toString() => 'Type $type value ${value}';
@@ -1921,7 +1921,7 @@
if (_allKeysAreStrings && key is StringLiteralTypeInformation) {
String keyString = key.asString();
typeInfoMap.putIfAbsent(keyString, () {
- newInfo = new ValueInMapTypeInformation(
+ newInfo = ValueInMapTypeInformation(
abstractValueDomain, context, null, nonNull);
return newInfo;
});
@@ -1943,7 +1943,7 @@
if (_allKeysAreStrings && other.inDictionaryMode) {
other.typeInfoMap.forEach((keyString, value) {
typeInfoMap.putIfAbsent(keyString, () {
- TypeInformation newInfo = new ValueInMapTypeInformation(
+ TypeInformation newInfo = ValueInMapTypeInformation(
abstractValueDomain, context, null, false);
newInfos.add(newInfo);
return newInfo;
@@ -1978,7 +1978,7 @@
AbstractValue toTypeMask(InferrerEngine inferrer) {
AbstractValueDomain abstractValueDomain = inferrer.abstractValueDomain;
if (inDictionaryMode) {
- Map<String, AbstractValue> mappings = new Map<String, AbstractValue>();
+ Map<String, AbstractValue> mappings = Map<String, AbstractValue>();
for (var key in typeInfoMap.keys) {
mappings[key] = typeInfoMap[key].type;
}
@@ -2281,7 +2281,7 @@
AbstractValue _narrowType(
JClosedWorld closedWorld, AbstractValue type, DartType annotation,
- {bool isNullable: true}) {
+ {bool isNullable = true}) {
AbstractValueDomain abstractValueDomain = closedWorld.abstractValueDomain;
AbstractValue _intersectionWith(AbstractValue otherType) {
diff --git a/pkg/compiler/lib/src/inferrer/type_system.dart b/pkg/compiler/lib/src/inferrer/type_system.dart
index 33bf709..d45f291 100644
--- a/pkg/compiler/lib/src/inferrer/type_system.dart
+++ b/pkg/compiler/lib/src/inferrer/type_system.dart
@@ -58,30 +58,30 @@
/// [ParameterTypeInformation]s for parameters.
final Map<Local, ParameterTypeInformation> parameterTypeInformations =
- new Map<Local, ParameterTypeInformation>();
+ Map<Local, ParameterTypeInformation>();
/// [MemberTypeInformation]s for members.
final Map<MemberEntity, MemberTypeInformation> memberTypeInformations =
- new Map<MemberEntity, MemberTypeInformation>();
+ Map<MemberEntity, MemberTypeInformation>();
/// [ListTypeInformation] for allocated lists.
final Map<ir.TreeNode, ListTypeInformation> allocatedLists =
- new Map<ir.TreeNode, ListTypeInformation>();
+ Map<ir.TreeNode, ListTypeInformation>();
/// [SetTypeInformation] for allocated Sets.
final Map<ir.TreeNode, SetTypeInformation> allocatedSets =
- new Map<ir.TreeNode, SetTypeInformation>();
+ Map<ir.TreeNode, SetTypeInformation>();
/// [MapTypeInformation] for allocated Maps.
final Map<ir.TreeNode, TypeInformation> allocatedMaps =
- new Map<ir.TreeNode, TypeInformation>();
+ Map<ir.TreeNode, TypeInformation>();
/// Closures found during the analysis.
- final Set<TypeInformation> allocatedClosures = new Set<TypeInformation>();
+ final Set<TypeInformation> allocatedClosures = Set<TypeInformation>();
/// Cache of [ConcreteTypeInformation].
final Map<AbstractValue, TypeInformation> concreteTypes =
- new Map<AbstractValue, TypeInformation>();
+ Map<AbstractValue, TypeInformation>();
/// Cache of some primitive constant types.
final Map<Object, TypeInformation> primitiveConstantTypes = {};
@@ -285,7 +285,7 @@
TypeInformation nonNullEmptyType;
TypeInformation stringLiteralType(String value) {
- return new StringLiteralTypeInformation(
+ return StringLiteralTypeInformation(
_abstractValueDomain, value, _abstractValueDomain.stringType);
}
@@ -345,9 +345,9 @@
/// [narrowType] will not exclude the late sentinel value by default, only if
/// [excludeLateSentinel] is `true`.
TypeInformation narrowType(TypeInformation type, DartType annotation,
- {bool isCast: true,
- bool excludeNull: false,
- bool excludeLateSentinel: false}) {
+ {bool isCast = true,
+ bool excludeNull = false,
+ bool excludeLateSentinel = false}) {
// Avoid refining an input with an exact type. It we are almost always
// adding a narrowing to a subtype of the same class or a superclass.
if (_abstractValueDomain.isExact(type.type).isDefinitelyTrue) return type;
@@ -417,7 +417,7 @@
ConcreteTypeInformation getConcreteTypeFor(AbstractValue mask) {
assert(mask != null);
return concreteTypes.putIfAbsent(mask, () {
- return new ConcreteTypeInformation(mask);
+ return ConcreteTypeInformation(mask);
});
}
@@ -477,12 +477,12 @@
AbstractValue mask = _abstractValueDomain.createContainerValue(
type.type, node, enclosing, elementTypeMask, inferredLength);
ElementInContainerTypeInformation element =
- new ElementInContainerTypeInformation(
+ ElementInContainerTypeInformation(
_abstractValueDomain, currentMember, elementType);
element.inferred = isElementInferred;
allocatedTypes.add(element);
- return allocatedLists[node] = new ListTypeInformation(
+ return allocatedLists[node] = ListTypeInformation(
_abstractValueDomain, currentMember, mask, element, length);
}
@@ -490,8 +490,8 @@
/// static or top-level method [element] used as a function constant or for
/// the synthesized 'call' method [element] created for a local function.
TypeInformation allocateClosure(FunctionEntity element) {
- TypeInformation result = new ClosureTypeInformation(
- _abstractValueDomain, currentMember, element);
+ TypeInformation result =
+ ClosureTypeInformation(_abstractValueDomain, currentMember, element);
allocatedClosures.add(result);
return result;
}
@@ -506,13 +506,13 @@
isConst ? elementType.type : dynamicType.type;
AbstractValue mask = _abstractValueDomain.createSetValue(
type.type, node, enclosing, elementTypeMask);
- ElementInSetTypeInformation element = new ElementInSetTypeInformation(
+ ElementInSetTypeInformation element = ElementInSetTypeInformation(
_abstractValueDomain, currentMember, elementType);
element.inferred = isConst;
allocatedTypes.add(element);
return allocatedSets[node] =
- new SetTypeInformation(currentMember, mask, element);
+ SetTypeInformation(currentMember, mask, element);
}
TypeInformation allocateMap(
@@ -550,15 +550,15 @@
AbstractValue mask = _abstractValueDomain.createMapValue(
type.type, node, element, keyTypeMask, valueTypeMask);
- TypeInformation keyTypeInfo = new KeyInMapTypeInformation(
- _abstractValueDomain, currentMember, keyType);
- TypeInformation valueTypeInfo = new ValueInMapTypeInformation(
+ TypeInformation keyTypeInfo =
+ KeyInMapTypeInformation(_abstractValueDomain, currentMember, keyType);
+ TypeInformation valueTypeInfo = ValueInMapTypeInformation(
_abstractValueDomain, currentMember, valueType);
allocatedTypes.add(keyTypeInfo);
allocatedTypes.add(valueTypeInfo);
MapTypeInformation map =
- new MapTypeInformation(currentMember, mask, keyTypeInfo, valueTypeInfo);
+ MapTypeInformation(currentMember, mask, keyTypeInfo, valueTypeInfo);
for (int i = 0; i < keyTypes.length; ++i) {
TypeInformation newType = map.addEntryInput(
@@ -584,7 +584,7 @@
/// Returns a new type that unions [firstInput] and [secondInput].
TypeInformation allocateDiamondPhi(
TypeInformation firstInput, TypeInformation secondInput) {
- PhiElementTypeInformation result = new PhiElementTypeInformation(
+ PhiElementTypeInformation result = PhiElementTypeInformation(
_abstractValueDomain, currentMember, null, null,
isTry: false);
result.addInput(firstInput);
@@ -595,7 +595,7 @@
PhiElementTypeInformation _addPhi(
ir.Node node, Local variable, TypeInformation inputType, bool isTry) {
- PhiElementTypeInformation result = new PhiElementTypeInformation(
+ PhiElementTypeInformation result = PhiElementTypeInformation(
_abstractValueDomain, currentMember, node, variable,
isTry: isTry);
allocatedTypes.add(result);
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/constants.dart b/pkg/compiler/lib/src/inferrer/typemasks/constants.dart
index 4c92f07..e46212b 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/constants.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/constants.dart
@@ -26,7 +26,7 @@
if (closedWorld.interceptorData.isInterceptedClass(constant.type.element)) {
return _abstractValueDomain.nonNullType;
}
- return new TypeMask.nonNullExact(constant.type.element, closedWorld);
+ return TypeMask.nonNullExact(constant.type.element, closedWorld);
}
@override
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 0aa5b30..321a8d7 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/flat_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/flat_type_mask.dart
@@ -26,7 +26,7 @@
final int flags;
static int _computeFlags(_FlatTypeMaskKind kind,
- {bool isNullable: false, bool hasLateSentinel: false}) {
+ {bool isNullable = false, bool hasLateSentinel = false}) {
int mask = _NONE_MASK;
if (isNullable) mask |= _NULL_MASK;
if (hasLateSentinel) mask |= _LATE_SENTINEL_MASK;
@@ -45,43 +45,43 @@
flags & _LATE_SENTINEL_MASK != _NONE_MASK;
factory FlatTypeMask.exact(ClassEntity base, JClosedWorld world,
- {bool hasLateSentinel: false}) =>
+ {bool hasLateSentinel = false}) =>
FlatTypeMask._canonicalize(base, _FlatTypeMaskKind.exact, world,
isNullable: true, hasLateSentinel: hasLateSentinel);
factory FlatTypeMask.subclass(ClassEntity base, JClosedWorld world,
- {bool hasLateSentinel: false}) =>
+ {bool hasLateSentinel = false}) =>
FlatTypeMask._canonicalize(base, _FlatTypeMaskKind.subclass, world,
isNullable: true, hasLateSentinel: hasLateSentinel);
factory FlatTypeMask.subtype(ClassEntity base, JClosedWorld world,
- {bool hasLateSentinel: false}) =>
+ {bool hasLateSentinel = false}) =>
FlatTypeMask._canonicalize(base, _FlatTypeMaskKind.subtype, world,
isNullable: true, hasLateSentinel: hasLateSentinel);
- factory FlatTypeMask.nonNullEmpty({bool hasLateSentinel: false}) =>
+ factory FlatTypeMask.nonNullEmpty({bool hasLateSentinel = false}) =>
hasLateSentinel
? const FlatTypeMask._(null, _LATE_SENTINEL_MASK)
: const FlatTypeMask._(null, _NONE_MASK);
- factory FlatTypeMask.empty({bool hasLateSentinel: false}) => hasLateSentinel
+ factory FlatTypeMask.empty({bool hasLateSentinel = false}) => hasLateSentinel
? const FlatTypeMask._(null, _NULL_MASK | _LATE_SENTINEL_MASK)
: const FlatTypeMask._(null, _NULL_MASK);
factory FlatTypeMask.nonNullExact(ClassEntity base, JClosedWorld world,
- {bool hasLateSentinel: false}) =>
+ {bool hasLateSentinel = false}) =>
FlatTypeMask._canonicalize(base, _FlatTypeMaskKind.exact, world,
hasLateSentinel: hasLateSentinel);
factory FlatTypeMask.nonNullSubclass(ClassEntity base, JClosedWorld world,
- {bool hasLateSentinel: false}) =>
+ {bool hasLateSentinel = false}) =>
FlatTypeMask._canonicalize(base, _FlatTypeMaskKind.subclass, world,
hasLateSentinel: hasLateSentinel);
factory FlatTypeMask.nonNullSubtype(ClassEntity base, JClosedWorld world,
- {bool hasLateSentinel: false}) =>
+ {bool hasLateSentinel = false}) =>
FlatTypeMask._canonicalize(base, _FlatTypeMaskKind.subtype, world,
hasLateSentinel: hasLateSentinel);
factory FlatTypeMask._canonicalize(
ClassEntity base, _FlatTypeMaskKind kind, JClosedWorld world,
- {bool isNullable: false, bool hasLateSentinel: false}) {
+ {bool isNullable = false, bool hasLateSentinel = false}) {
if (base == world.commonElements.nullClass) {
return FlatTypeMask.empty(hasLateSentinel: hasLateSentinel);
}
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart
index 7b62f9c..4702bdf 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart
@@ -110,11 +110,11 @@
abstract class TypeMask implements AbstractValue {
const TypeMask();
- factory TypeMask.empty({bool hasLateSentinel: false}) =>
+ factory TypeMask.empty({bool hasLateSentinel = false}) =>
FlatTypeMask.empty(hasLateSentinel: hasLateSentinel);
factory TypeMask.exact(ClassEntity base, JClosedWorld closedWorld,
- {bool hasLateSentinel: false}) {
+ {bool hasLateSentinel = false}) {
assert(
closedWorld.classHierarchy.isInstantiated(base),
failedAt(
@@ -126,7 +126,7 @@
}
factory TypeMask.exactOrEmpty(ClassEntity base, JClosedWorld closedWorld,
- {bool hasLateSentinel: false}) {
+ {bool hasLateSentinel = false}) {
if (closedWorld.classHierarchy.isInstantiated(base)) {
return FlatTypeMask.exact(base, closedWorld,
hasLateSentinel: hasLateSentinel);
@@ -135,7 +135,7 @@
}
factory TypeMask.subclass(ClassEntity base, JClosedWorld closedWorld,
- {bool hasLateSentinel: false}) {
+ {bool hasLateSentinel = false}) {
assert(
closedWorld.classHierarchy.isInstantiated(base),
failedAt(
@@ -155,7 +155,7 @@
}
factory TypeMask.subtype(ClassEntity base, JClosedWorld closedWorld,
- {bool hasLateSentinel: false}) {
+ {bool hasLateSentinel = false}) {
ClassEntity topmost = closedWorld.getLubOfInstantiatedSubtypes(base);
if (topmost == null) {
return TypeMask.empty(hasLateSentinel: hasLateSentinel);
@@ -173,11 +173,11 @@
}
}
- factory TypeMask.nonNullEmpty({bool hasLateSentinel: false}) =>
+ factory TypeMask.nonNullEmpty({bool hasLateSentinel = false}) =>
FlatTypeMask.nonNullEmpty(hasLateSentinel: hasLateSentinel);
factory TypeMask.nonNullExact(ClassEntity base, JClosedWorld closedWorld,
- {bool hasLateSentinel: false}) {
+ {bool hasLateSentinel = false}) {
assert(
closedWorld.classHierarchy.isInstantiated(base),
failedAt(
@@ -190,7 +190,7 @@
factory TypeMask.nonNullExactOrEmpty(
ClassEntity base, JClosedWorld closedWorld,
- {bool hasLateSentinel: false}) {
+ {bool hasLateSentinel = false}) {
if (closedWorld.classHierarchy.isInstantiated(base)) {
return FlatTypeMask.nonNullExact(base, closedWorld,
hasLateSentinel: hasLateSentinel);
@@ -199,7 +199,7 @@
}
factory TypeMask.nonNullSubclass(ClassEntity base, JClosedWorld closedWorld,
- {bool hasLateSentinel: false}) {
+ {bool hasLateSentinel = false}) {
assert(
closedWorld.classHierarchy.isInstantiated(base),
failedAt(
@@ -219,7 +219,7 @@
}
factory TypeMask.nonNullSubtype(ClassEntity base, JClosedWorld closedWorld,
- {bool hasLateSentinel: false}) {
+ {bool hasLateSentinel = false}) {
ClassEntity topmost = closedWorld.getLubOfInstantiatedSubtypes(base);
if (topmost == null) {
return TypeMask.nonNullEmpty(hasLateSentinel: hasLateSentinel);
diff --git a/pkg/compiler/lib/src/inferrer/types.dart b/pkg/compiler/lib/src/inferrer/types.dart
index 2345d53..c72c1f5 100644
--- a/pkg/compiler/lib/src/inferrer/types.dart
+++ b/pkg/compiler/lib/src/inferrer/types.dart
@@ -117,10 +117,9 @@
InferredData inferredData) {
bool isTrivial = source.readBool();
if (isTrivial) {
- return new TrivialGlobalTypeInferenceResults(
- closedWorld, globalLocalsMap);
+ return TrivialGlobalTypeInferenceResults(closedWorld, globalLocalsMap);
}
- return new GlobalTypeInferenceResultsImpl.readFromDataSource(
+ return GlobalTypeInferenceResultsImpl.readFromDataSource(
source, elementMap, closedWorld, globalLocalsMap, inferredData);
}
@@ -186,7 +185,7 @@
GlobalTypeInferenceResults results;
if (compiler.disableTypeInference) {
results =
- new TrivialGlobalTypeInferenceResults(closedWorld, globalLocalsMap);
+ TrivialGlobalTypeInferenceResults(closedWorld, globalLocalsMap);
_metrics = Metrics.none();
} else {
typesInferrerInternal ??= compiler.backendStrategy.createTypesInferrer(
@@ -233,9 +232,9 @@
this.checkedForGrowableLists,
this.returnsListElementTypeSet,
this._allocatedLists)
- : _deadFieldResult = new DeadFieldGlobalTypeInferenceResult(
- closedWorld.abstractValueDomain),
- _deadMethodResult = new DeadMethodGlobalTypeInferenceResult(
+ : _deadFieldResult =
+ DeadFieldGlobalTypeInferenceResult(closedWorld.abstractValueDomain),
+ _deadMethodResult = DeadMethodGlobalTypeInferenceResult(
closedWorld.abstractValueDomain),
_trivialParameterResult = closedWorld.abstractValueDomain.dynamicType;
@@ -245,12 +244,12 @@
JClosedWorld closedWorld,
GlobalLocalsMap globalLocalsMap,
InferredData inferredData) {
- source.registerLocalLookup(new LocalLookupImpl(globalLocalsMap));
+ source.registerLocalLookup(LocalLookupImpl(globalLocalsMap));
source.begin(tag);
Map<MemberEntity, GlobalTypeInferenceMemberResult> memberResults =
source.readMemberMap((MemberEntity member) =>
- new GlobalTypeInferenceMemberResult.readFromDataSource(
+ GlobalTypeInferenceMemberResult.readFromDataSource(
source,
elementMap.getMemberContextNode(member),
closedWorld.abstractValueDomain));
@@ -259,12 +258,12 @@
.readAbstractValueFromDataSource(source));
Set<ir.TreeNode> checkedForGrowableLists = source.readTreeNodes().toSet();
Set<Selector> returnsListElementTypeSet =
- source.readList(() => new Selector.readFromDataSource(source)).toSet();
+ source.readList(() => Selector.readFromDataSource(source)).toSet();
Map<ir.TreeNode, AbstractValue> allocatedLists = source.readTreeNodeMap(
() => closedWorld.abstractValueDomain
.readAbstractValueFromDataSource(source));
source.end(tag);
- return new GlobalTypeInferenceResultsImpl(
+ return GlobalTypeInferenceResultsImpl(
closedWorld,
globalLocalsMap,
inferredData,
@@ -442,7 +441,7 @@
AbstractValueDomain abstractValueDomain) {
source.begin(tag);
GlobalTypeInferenceElementData data = source.readValueOrNull(() {
- return new GlobalTypeInferenceElementData.readFromDataSource(
+ return GlobalTypeInferenceElementData.readFromDataSource(
source, context, abstractValueDomain);
});
AbstractValue returnType =
@@ -452,7 +451,7 @@
bool throwsAlways = source.readBool();
bool isCalledOnce = source.readBool();
source.end(tag);
- return new GlobalTypeInferenceMemberResultImpl(data, returnType, type,
+ return GlobalTypeInferenceMemberResultImpl(data, returnType, type,
throwsAlways: throwsAlways, isCalledOnce: isCalledOnce);
}
@@ -488,12 +487,12 @@
final TrivialGlobalTypeInferenceMemberResult _trivialMemberResult;
final AbstractValue _trivialParameterResult;
@override
- final InferredData inferredData = new TrivialInferredData();
+ final InferredData inferredData = TrivialInferredData();
@override
final GlobalLocalsMap globalLocalsMap;
TrivialGlobalTypeInferenceResults(this.closedWorld, this.globalLocalsMap)
- : _trivialMemberResult = new TrivialGlobalTypeInferenceMemberResult(
+ : _trivialMemberResult = TrivialGlobalTypeInferenceMemberResult(
closedWorld.abstractValueDomain.dynamicType),
_trivialParameterResult = closedWorld.abstractValueDomain.dynamicType;
@@ -560,7 +559,7 @@
@override
void writeToDataSink(DataSink sink, ir.Member context,
AbstractValueDomain abstractValueDomain) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"TrivialGlobalTypeInferenceMemberResult.writeToDataSink");
}
}
@@ -601,7 +600,7 @@
@override
void writeToDataSink(DataSink sink, ir.Member context,
AbstractValueDomain abstractValueDomain) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"DeadFieldGlobalTypeInferenceResult.writeToDataSink");
}
}
@@ -642,7 +641,7 @@
@override
void writeToDataSink(DataSink sink, ir.Member context,
AbstractValueDomain abstractValueDomain) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"DeadFieldGlobalTypeInferenceResult.writeToDataSink");
}
}
diff --git a/pkg/compiler/lib/src/ir/annotations.dart b/pkg/compiler/lib/src/ir/annotations.dart
index fa04392..a1c84e4 100644
--- a/pkg/compiler/lib/src/ir/annotations.dart
+++ b/pkg/compiler/lib/src/ir/annotations.dart
@@ -123,10 +123,10 @@
IrAnnotationData processAnnotations(ModularCore modularCore) {
ir.Component component = modularCore.component;
- IrAnnotationData data = new IrAnnotationData();
+ IrAnnotationData data = IrAnnotationData();
void processMember(ir.Member member) {
- ir.StaticTypeContext staticTypeContext = new ir.StaticTypeContext(
+ ir.StaticTypeContext staticTypeContext = ir.StaticTypeContext(
member, modularCore.constantEvaluator.typeEnvironment);
List<PragmaAnnotationData> pragmaAnnotations;
List<String> createsAnnotations;
@@ -180,7 +180,7 @@
for (ir.Library library in component.libraries) {
ir.StaticTypeContext staticTypeContext =
- new ir.StaticTypeContext.forAnnotations(
+ ir.StaticTypeContext.forAnnotations(
library, modularCore.constantEvaluator.typeEnvironment);
for (ir.Expression annotation in library.annotations) {
if (annotation is ir.ConstantExpression) {
@@ -324,7 +324,7 @@
// TODO(johnniwinther): Support options objects when necessary.
final bool hasOptions;
- const PragmaAnnotationData(this.suffix, {this.hasOptions: false});
+ const PragmaAnnotationData(this.suffix, {this.hasOptions = false});
String get name => 'dart2js:$suffix';
@@ -360,7 +360,7 @@
String prefix = 'dart2js:';
if (!name.startsWith(prefix)) return null;
String suffix = name.substring(prefix.length);
- return new PragmaAnnotationData(suffix,
+ return PragmaAnnotationData(suffix,
hasOptions: optionsValue is! ir.NullConstant);
}
return null;
diff --git a/pkg/compiler/lib/src/ir/closure.dart b/pkg/compiler/lib/src/ir/closure.dart
index 39ceeb5..8954f46 100644
--- a/pkg/compiler/lib/src/ir/closure.dart
+++ b/pkg/compiler/lib/src/ir/closure.dart
@@ -37,7 +37,7 @@
/// this scope. The items in this set are either of type VariableDeclaration
/// or TypeParameterTypeWithContext.
Set<ir.Node /* VariableDeclaration | TypeParameterTypeWithContext */ >
- freeVariables = new Set<ir.Node>();
+ freeVariables = Set<ir.Node>();
/// A set of type parameters that are defined in another scope and are only
/// used if runtime type information is checked. If runtime type information
@@ -57,11 +57,11 @@
/// performing runtime type checks. It is stored
/// separately from [thisUsedAsFreeVariable] because we don't know at this
/// stage if we will be needing type checks for this scope.
- Set<VariableUse> thisUsedAsFreeVariableIfNeedsRti = new Set<VariableUse>();
+ Set<VariableUse> thisUsedAsFreeVariableIfNeedsRti = Set<VariableUse>();
KernelScopeInfo(this.hasThisLocal)
- : localsUsedInTryOrSync = new Set<ir.VariableDeclaration>(),
- boxedVariables = new Set<ir.VariableDeclaration>(),
+ : localsUsedInTryOrSync = Set<ir.VariableDeclaration>(),
+ boxedVariables = Set<ir.VariableDeclaration>(),
capturedVariablesAccessor = null;
KernelScopeInfo.from(this.hasThisLocal, KernelScopeInfo info)
@@ -81,7 +81,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('KernelScopeInfo(this=$hasThisLocal,');
sb.write('freeVriables=$freeVariables,');
sb.write('localsUsedInTryOrSync={${localsUsedInTryOrSync.join(', ')}}');
@@ -132,7 +132,7 @@
scope.hasThisLocal);
// Silly hack because we don't have const sets.
- static final Set<ir.VariableDeclaration> _empty = new Set();
+ static final Set<ir.VariableDeclaration> _empty = Set();
bool get requiresContextBox => boxedVariables.isNotEmpty;
}
@@ -293,25 +293,25 @@
this.invocation = null;
static const VariableUse explicit =
- const VariableUse._simple(VariableUseKind.explicit);
+ VariableUse._simple(VariableUseKind.explicit);
static const VariableUse localType =
- const VariableUse._simple(VariableUseKind.localType);
+ VariableUse._simple(VariableUseKind.localType);
static const VariableUse implicitCast =
- const VariableUse._simple(VariableUseKind.implicitCast);
+ VariableUse._simple(VariableUseKind.implicitCast);
static const VariableUse listLiteral =
- const VariableUse._simple(VariableUseKind.listLiteral);
+ VariableUse._simple(VariableUseKind.listLiteral);
static const VariableUse setLiteral =
- const VariableUse._simple(VariableUseKind.setLiteral);
+ VariableUse._simple(VariableUseKind.setLiteral);
static const VariableUse mapLiteral =
- const VariableUse._simple(VariableUseKind.mapLiteral);
+ VariableUse._simple(VariableUseKind.mapLiteral);
static const VariableUse fieldType =
- const VariableUse._simple(VariableUseKind.fieldType);
+ VariableUse._simple(VariableUseKind.fieldType);
@override
int get hashCode =>
@@ -386,7 +386,7 @@
typeDeclaration = typeDeclaration.parent;
context = typeDeclaration;
}
- return new TypeVariableTypeWithContext.internal(
+ return TypeVariableTypeWithContext.internal(
type, context, kind, typeDeclaration);
}
@@ -395,17 +395,17 @@
@override
R accept<R>(ir.Visitor<R> v) {
- throw new UnsupportedError('TypeVariableTypeWithContext.accept');
+ throw UnsupportedError('TypeVariableTypeWithContext.accept');
}
@override
R accept1<R, A>(ir.Visitor1<R, A> v, A arg) {
- throw new UnsupportedError('TypeVariableTypeWithContext.accept1');
+ throw UnsupportedError('TypeVariableTypeWithContext.accept1');
}
@override
visitChildren(ir.Visitor v) {
- throw new UnsupportedError('TypeVariableTypeWithContext.visitChildren');
+ throw UnsupportedError('TypeVariableTypeWithContext.visitChildren');
}
@override
diff --git a/pkg/compiler/lib/src/ir/constants.dart b/pkg/compiler/lib/src/ir/constants.dart
index 50cc0a6..6994046 100644
--- a/pkg/compiler/lib/src/ir/constants.dart
+++ b/pkg/compiler/lib/src/ir/constants.dart
@@ -20,8 +20,8 @@
Dart2jsConstantEvaluator(
ir.TypeEnvironment typeEnvironment, ReportErrorFunction reportError,
- {Map<String, String> environment: const {},
- bool supportReevaluationForTesting: false,
+ {Map<String, String> environment = const {},
+ bool supportReevaluationForTesting = false,
ir.EvaluationMode evaluationMode})
: _supportReevaluationForTesting = supportReevaluationForTesting,
assert(evaluationMode != null),
@@ -29,7 +29,7 @@
const Dart2jsConstantsBackend(supportsUnevaluatedConstants: false),
environment,
typeEnvironment,
- new ErrorReporter(reportError),
+ ErrorReporter(reportError),
enableTripleShift: true,
evaluationMode: evaluationMode);
@@ -49,8 +49,8 @@
ir.Constant evaluate(
ir.StaticTypeContext staticTypeContext, ir.Expression node,
{ir.TreeNode contextNode,
- bool requireConstant: true,
- bool replaceImplicitConstant: true}) {
+ bool requireConstant = true,
+ bool replaceImplicitConstant = true}) {
errorReporter.requiresConstant = requireConstant;
if (node is ir.ConstantExpression) {
ir.Constant constant = node.constant;
@@ -189,27 +189,27 @@
@override
void visitChildren(ir.Visitor v) {
- throw new UnsupportedError("ConstantReference.visitChildren");
+ throw UnsupportedError("ConstantReference.visitChildren");
}
@override
R accept<R>(ir.TreeVisitor<R> v) {
- throw new UnsupportedError("ConstantReference.accept");
+ throw UnsupportedError("ConstantReference.accept");
}
@override
R accept1<R, A>(ir.TreeVisitor1<R, A> v, A arg) {
- throw new UnsupportedError("ConstantReference.accept");
+ throw UnsupportedError("ConstantReference.accept");
}
@override
transformChildren(ir.Transformer v) {
- throw new UnsupportedError("ConstantReference.transformChildren");
+ throw UnsupportedError("ConstantReference.transformChildren");
}
@override
transformOrRemoveChildren(ir.RemovingTransformer v) {
- throw new UnsupportedError("ConstantReference.transformOrRemoveChildren");
+ throw UnsupportedError("ConstantReference.transformOrRemoveChildren");
}
@override
diff --git a/pkg/compiler/lib/src/ir/impact.dart b/pkg/compiler/lib/src/ir/impact.dart
index 703f19a..f3d8702 100644
--- a/pkg/compiler/lib/src/ir/impact.dart
+++ b/pkg/compiler/lib/src/ir/impact.dart
@@ -511,7 +511,7 @@
// instantiated as int and String.
registerNew(
node.target,
- new ir.InterfaceType(node.target.enclosingClass,
+ ir.InterfaceType(node.target.enclosingClass,
node.target.enclosingLibrary.nonNullable, typeArguments),
positionArguments,
namedArguments,
@@ -679,7 +679,7 @@
@override
void handleConstantExpression(ir.ConstantExpression node) {
ir.LibraryDependency import = getDeferredImport(node);
- new ConstantImpactVisitor(this, import, node, staticTypeContext)
+ ConstantImpactVisitor(this, import, node, staticTypeContext)
.visitConstant(node.constant);
}
}
@@ -697,8 +697,8 @@
StaticTypeCacheImpl staticTypeCache,
ir.ClassHierarchy classHierarchy,
VariableScopeModel variableScopeModel,
- {this.useAsserts: false,
- this.inferEffectivelyFinalVariableTypes: true})
+ {this.useAsserts = false,
+ this.inferEffectivelyFinalVariableTypes = true})
: super(staticTypeContext, staticTypeCache, classHierarchy,
variableScopeModel);
@@ -707,7 +707,7 @@
typeMapsForTesting = {};
}
node.accept(this);
- return new ImpactBuilderData(
+ return ImpactBuilderData(
node, impactData, typeMapsForTesting, getStaticTypeCache());
}
}
@@ -756,7 +756,7 @@
@override
void defaultConstant(ir.Constant node) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unexpected constant ${node} (${node.runtimeType}).");
}
@@ -795,7 +795,7 @@
node.fieldValues.forEach((ir.Reference reference, ir.Constant value) {
ir.Field field = reference.asField;
registry.registerFieldConstantInitialization(
- field, new ConstantReference(expression, value));
+ field, ConstantReference(expression, value));
visitConstant(value);
});
}
diff --git a/pkg/compiler/lib/src/ir/impact_data.dart b/pkg/compiler/lib/src/ir/impact_data.dart
index c7ff190..f73b96a8f 100644
--- a/pkg/compiler/lib/src/ir/impact_data.dart
+++ b/pkg/compiler/lib/src/ir/impact_data.dart
@@ -13,18 +13,18 @@
/// [ImpactRegistry] that stores registered impact in an [ImpactData] object.
abstract class ImpactRegistryMixin implements ImpactRegistry {
- final ImpactDataImpl _data = new ImpactDataImpl();
+ final ImpactDataImpl _data = ImpactDataImpl();
ImpactData get impactData => _data;
void _registerFeature(_Feature feature) {
- _data._features ??= new EnumSet<_Feature>();
+ _data._features ??= EnumSet<_Feature>();
_data._features.add(feature);
}
void _registerTypeUse(ir.DartType type, _TypeUseKind kind) {
_data._typeUses ??= [];
- _data._typeUses.add(new _TypeUse(type, kind));
+ _data._typeUses.add(_TypeUse(type, kind));
}
@override
@@ -35,11 +35,8 @@
List<String> namedArguments,
List<ir.DartType> typeArguments) {
_data._superInitializers ??= [];
- _data._superInitializers.add(new _SuperInitializer(
- source,
- target,
- new _CallStructure(
- positionalArguments, namedArguments, typeArguments)));
+ _data._superInitializers.add(_SuperInitializer(source, target,
+ _CallStructure(positionalArguments, namedArguments, typeArguments)));
}
@override
@@ -58,40 +55,36 @@
void registerSuperInvocation(ir.Member target, int positionalArguments,
List<String> namedArguments, List<ir.DartType> typeArguments) {
_data._superInvocations ??= [];
- _data._superInvocations.add(new _SuperInvocation(
- target,
- new _CallStructure(
- positionalArguments, namedArguments, typeArguments)));
+ _data._superInvocations.add(_SuperInvocation(target,
+ _CallStructure(positionalArguments, namedArguments, typeArguments)));
}
@override
void registerInstanceSet(
ir.DartType receiverType, ClassRelation relation, ir.Member target) {
_data._instanceSets ??= [];
- _data._instanceSets
- .add(new _InstanceAccess(receiverType, relation, target));
+ _data._instanceSets.add(_InstanceAccess(receiverType, relation, target));
}
@override
void registerDynamicSet(
ir.DartType receiverType, ClassRelation relation, ir.Name name) {
_data._dynamicSets ??= [];
- _data._dynamicSets.add(new _DynamicAccess(receiverType, relation, name));
+ _data._dynamicSets.add(_DynamicAccess(receiverType, relation, name));
}
@override
void registerInstanceGet(
ir.DartType receiverType, ClassRelation relation, ir.Member target) {
_data._instanceGets ??= [];
- _data._instanceGets
- .add(new _InstanceAccess(receiverType, relation, target));
+ _data._instanceGets.add(_InstanceAccess(receiverType, relation, target));
}
@override
void registerDynamicGet(
ir.DartType receiverType, ClassRelation relation, ir.Name name) {
_data._dynamicGets ??= [];
- _data._dynamicGets.add(new _DynamicAccess(receiverType, relation, name));
+ _data._dynamicGets.add(_DynamicAccess(receiverType, relation, name));
}
@override
@@ -101,10 +94,8 @@
List<String> namedArguments,
List<ir.DartType> typeArguments) {
_data._functionInvocations ??= [];
- _data._functionInvocations.add(new _FunctionInvocation(
- receiverType,
- new _CallStructure(
- positionalArguments, namedArguments, typeArguments)));
+ _data._functionInvocations.add(_FunctionInvocation(receiverType,
+ _CallStructure(positionalArguments, namedArguments, typeArguments)));
}
@override
@@ -116,12 +107,11 @@
List<String> namedArguments,
List<ir.DartType> typeArguments) {
_data._instanceInvocations ??= [];
- _data._instanceInvocations.add(new _InstanceInvocation(
+ _data._instanceInvocations.add(_InstanceInvocation(
receiverType,
relation,
target,
- new _CallStructure(
- positionalArguments, namedArguments, typeArguments)));
+ _CallStructure(positionalArguments, namedArguments, typeArguments)));
}
@override
@@ -133,12 +123,11 @@
List<String> namedArguments,
List<ir.DartType> typeArguments) {
_data._dynamicInvocations ??= [];
- _data._dynamicInvocations.add(new _DynamicInvocation(
+ _data._dynamicInvocations.add(_DynamicInvocation(
receiverType,
relation,
name,
- new _CallStructure(
- positionalArguments, namedArguments, typeArguments)));
+ _CallStructure(positionalArguments, namedArguments, typeArguments)));
}
@override
@@ -148,10 +137,8 @@
List<String> namedArguments,
List<ir.DartType> typeArguments) {
_data._localFunctionInvocations ??= [];
- _data._localFunctionInvocations.add(new _LocalFunctionInvocation(
- localFunction,
- new _CallStructure(
- positionalArguments, namedArguments, typeArguments)));
+ _data._localFunctionInvocations.add(_LocalFunctionInvocation(localFunction,
+ _CallStructure(positionalArguments, namedArguments, typeArguments)));
}
@override
@@ -162,9 +149,9 @@
List<ir.DartType> typeArguments,
ir.LibraryDependency import) {
_data._staticInvocations ??= [];
- _data._staticInvocations.add(new _StaticInvocation(
+ _data._staticInvocations.add(_StaticInvocation(
target,
- new _CallStructure(positionalArguments, namedArguments, typeArguments),
+ _CallStructure(positionalArguments, namedArguments, typeArguments),
import));
}
@@ -178,10 +165,10 @@
ir.LibraryDependency import,
{bool isConst}) {
_data._constructorInvocations ??= [];
- _data._constructorInvocations.add(new _ConstructorInvocation(
+ _data._constructorInvocations.add(_ConstructorInvocation(
constructor,
type,
- new _CallStructure(positionalArguments, namedArguments, typeArguments),
+ _CallStructure(positionalArguments, namedArguments, typeArguments),
import,
isConst: isConst));
}
@@ -191,7 +178,7 @@
ir.LibraryDependency import) {
_data._constInstantiations ??= [];
_data._constInstantiations
- .add(new _ConstInstantiation(cls, typeArguments, import));
+ .add(_ConstInstantiation(cls, typeArguments, import));
}
@override
@@ -211,10 +198,8 @@
List<String> namedArguments,
List<ir.DartType> typeArguments) {
_data._redirectingInitializers ??= [];
- _data._redirectingInitializers.add(new _RedirectingInitializer(
- constructor,
- new _CallStructure(
- positionalArguments, namedArguments, typeArguments)));
+ _data._redirectingInitializers.add(_RedirectingInitializer(constructor,
+ _CallStructure(positionalArguments, namedArguments, typeArguments)));
}
@override
@@ -238,7 +223,7 @@
@override
void registerTypeLiteral(ir.DartType type, ir.LibraryDependency import) {
_data._typeLiterals ??= [];
- _data._typeLiterals.add(new _TypeLiteral(type, import));
+ _data._typeLiterals.add(_TypeLiteral(type, import));
}
@override
@@ -260,7 +245,7 @@
void registerAsyncForIn(ir.DartType iterableType, ir.DartType iteratorType,
ClassRelation iteratorClassRelation) {
_data._forInData ??= [];
- _data._forInData.add(new _ForInData(
+ _data._forInData.add(_ForInData(
iterableType, iteratorType, iteratorClassRelation,
isAsync: true));
}
@@ -269,7 +254,7 @@
void registerSyncForIn(ir.DartType iterableType, ir.DartType iteratorType,
ClassRelation iteratorClassRelation) {
_data._forInData ??= [];
- _data._forInData.add(new _ForInData(
+ _data._forInData.add(_ForInData(
iterableType, iteratorType, iteratorClassRelation,
isAsync: false));
}
@@ -330,7 +315,7 @@
ir.FunctionType expressionType, List<ir.DartType> typeArguments) {
_data._genericInstantiations ??= [];
_data._genericInstantiations
- .add(new _GenericInstantiation(expressionType, typeArguments));
+ .add(_GenericInstantiation(expressionType, typeArguments));
}
@override
@@ -343,28 +328,28 @@
@override
void registerStaticSet(ir.Member member, ir.LibraryDependency import) {
_data._staticSets ??= [];
- _data._staticSets.add(new _StaticAccess(member, import));
+ _data._staticSets.add(_StaticAccess(member, import));
}
@override
void registerStaticGet(ir.Member member, ir.LibraryDependency import) {
_data._staticGets ??= [];
- _data._staticGets.add(new _StaticAccess(member, import));
+ _data._staticGets.add(_StaticAccess(member, import));
}
@override
void registerStaticTearOff(
ir.Procedure procedure, ir.LibraryDependency import) {
_data._staticTearOffs ??= [];
- _data._staticTearOffs.add(new _StaticAccess(procedure, import));
+ _data._staticTearOffs.add(_StaticAccess(procedure, import));
}
@override
void registerMapLiteral(ir.DartType keyType, ir.DartType valueType,
{bool isConst, bool isEmpty}) {
_data._mapLiterals ??= [];
- _data._mapLiterals.add(new _MapLiteral(keyType, valueType,
- isConst: isConst, isEmpty: isEmpty));
+ _data._mapLiterals.add(
+ _MapLiteral(keyType, valueType, isConst: isConst, isEmpty: isEmpty));
}
@override
@@ -372,7 +357,7 @@
{bool isConst, bool isEmpty}) {
_data._listLiterals ??= [];
_data._listLiterals.add(
- new _ContainerLiteral(elementType, isConst: isConst, isEmpty: isEmpty));
+ _ContainerLiteral(elementType, isConst: isConst, isEmpty: isEmpty));
}
@override
@@ -380,7 +365,7 @@
{bool isConst, bool isEmpty}) {
_data._setLiterals ??= [];
_data._setLiterals.add(
- new _ContainerLiteral(elementType, isConst: isConst, isEmpty: isEmpty));
+ _ContainerLiteral(elementType, isConst: isConst, isEmpty: isEmpty));
}
@override
@@ -425,7 +410,7 @@
ir.DartType receiverType, ir.DartType argumentType) {
_data._runtimeTypeUses ??= [];
_data._runtimeTypeUses
- .add(new _RuntimeTypeUse(node, kind, receiverType, argumentType));
+ .add(_RuntimeTypeUse(node, kind, receiverType, argumentType));
}
@override
@@ -529,77 +514,72 @@
ImpactDataImpl.fromDataSource(DataSource source) {
source.begin(tag);
_superInitializers = source.readList(
- () => new _SuperInitializer.fromDataSource(source),
+ () => _SuperInitializer.fromDataSource(source),
emptyAsNull: true);
_superSets =
source.readList(() => source.readMemberNode(), emptyAsNull: true);
_superGets =
source.readList(() => source.readMemberNode(), emptyAsNull: true);
_superInvocations = source.readList(
- () => new _SuperInvocation.fromDataSource(source),
+ () => _SuperInvocation.fromDataSource(source),
emptyAsNull: true);
_instanceSets = source.readList(
- () => new _InstanceAccess.fromDataSource(source),
+ () => _InstanceAccess.fromDataSource(source),
emptyAsNull: true);
- _dynamicSets = source.readList(
- () => new _DynamicAccess.fromDataSource(source),
+ _dynamicSets = source.readList(() => _DynamicAccess.fromDataSource(source),
emptyAsNull: true);
_instanceGets = source.readList(
- () => new _InstanceAccess.fromDataSource(source),
+ () => _InstanceAccess.fromDataSource(source),
emptyAsNull: true);
- _dynamicGets = source.readList(
- () => new _DynamicAccess.fromDataSource(source),
+ _dynamicGets = source.readList(() => _DynamicAccess.fromDataSource(source),
emptyAsNull: true);
_functionInvocations = source.readList(
- () => new _FunctionInvocation.fromDataSource(source),
+ () => _FunctionInvocation.fromDataSource(source),
emptyAsNull: true);
_instanceInvocations = source.readList(
- () => new _InstanceInvocation.fromDataSource(source),
+ () => _InstanceInvocation.fromDataSource(source),
emptyAsNull: true);
_dynamicInvocations = source.readList(
- () => new _DynamicInvocation.fromDataSource(source),
+ () => _DynamicInvocation.fromDataSource(source),
emptyAsNull: true);
_localFunctionInvocations = source.readList(
- () => new _LocalFunctionInvocation.fromDataSource(source),
+ () => _LocalFunctionInvocation.fromDataSource(source),
emptyAsNull: true);
_staticInvocations = source.readList(
- () => new _StaticInvocation.fromDataSource(source),
+ () => _StaticInvocation.fromDataSource(source),
emptyAsNull: true);
_constructorInvocations = source.readList(
- () => new _ConstructorInvocation.fromDataSource(source),
+ () => _ConstructorInvocation.fromDataSource(source),
emptyAsNull: true);
- _features = new EnumSet<_Feature>.fromValue(source.readInt());
- _typeUses = source.readList(() => new _TypeUse.fromDataSource(source),
+ _features = EnumSet<_Feature>.fromValue(source.readInt());
+ _typeUses = source.readList(() => _TypeUse.fromDataSource(source),
emptyAsNull: true);
_redirectingInitializers = source.readList(
- () => new _RedirectingInitializer.fromDataSource(source),
+ () => _RedirectingInitializer.fromDataSource(source),
emptyAsNull: true);
_fieldInitializers = source.readMemberNodes<ir.Field>(emptyAsNull: true);
_fieldConstantInitializers =
source.readMemberNodeMap(source.readTreeNodes, emptyAsNull: true);
- _typeLiterals = source.readList(
- () => new _TypeLiteral.fromDataSource(source),
+ _typeLiterals = source.readList(() => _TypeLiteral.fromDataSource(source),
emptyAsNull: true);
_localFunctions = source.readTreeNodes(emptyAsNull: true);
_genericInstantiations = source.readList(
- () => new _GenericInstantiation.fromDataSource(source),
+ () => _GenericInstantiation.fromDataSource(source),
emptyAsNull: true);
- _staticSets = source.readList(
- () => new _StaticAccess.fromDataSource(source),
+ _staticSets = source.readList(() => _StaticAccess.fromDataSource(source),
emptyAsNull: true);
- _staticGets = source.readList(
- () => new _StaticAccess.fromDataSource(source),
+ _staticGets = source.readList(() => _StaticAccess.fromDataSource(source),
emptyAsNull: true);
_staticTearOffs = source.readList(
- () => new _StaticAccess.fromDataSource(source),
+ () => _StaticAccess.fromDataSource(source),
emptyAsNull: true);
- _mapLiterals = source.readList(() => new _MapLiteral.fromDataSource(source),
+ _mapLiterals = source.readList(() => _MapLiteral.fromDataSource(source),
emptyAsNull: true);
_listLiterals = source.readList(
- () => new _ContainerLiteral.fromDataSource(source),
+ () => _ContainerLiteral.fromDataSource(source),
emptyAsNull: true);
_setLiterals = source.readList(
- () => new _ContainerLiteral.fromDataSource(source),
+ () => _ContainerLiteral.fromDataSource(source),
emptyAsNull: true);
_symbolLiterals = source.readStrings(emptyAsNull: true)?.toSet();
_stringLiterals = source.readStrings(emptyAsNull: true)?.toSet();
@@ -612,7 +592,7 @@
.readList(() => source.readIntegerValue(), emptyAsNull: true)
?.toSet();
_runtimeTypeUses = source.readList(
- () => new _RuntimeTypeUse.fromDataSource(source),
+ () => _RuntimeTypeUse.fromDataSource(source),
emptyAsNull: true);
// TODO(johnniwinther): Remove these when CFE provides constants.
@@ -1063,7 +1043,7 @@
factory _CallStructure(int positionalArguments, List<String> namedArguments,
List<ir.DartType> typeArguments) {
- return new _CallStructure.internal(
+ return _CallStructure.internal(
typeArguments, positionalArguments, namedArguments);
}
@@ -1073,7 +1053,7 @@
int positionalArguments = source.readInt();
List<String> namedArguments = source.readStrings();
source.end(tag);
- return new _CallStructure.internal(
+ return _CallStructure.internal(
typeArguments, positionalArguments, namedArguments);
}
@@ -1099,9 +1079,9 @@
source.begin(tag);
ir.Constructor sourceConstructor = source.readMemberNode();
ir.Constructor targetConstructor = source.readMemberNode();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
source.end(tag);
- return new _SuperInitializer(
+ return _SuperInitializer(
sourceConstructor, targetConstructor, callStructure);
}
@@ -1125,9 +1105,9 @@
factory _SuperInvocation.fromDataSource(DataSource source) {
source.begin(tag);
ir.Member member = source.readMemberNode();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
source.end(tag);
- return new _SuperInvocation(member, callStructure);
+ return _SuperInvocation(member, callStructure);
}
void toDataSink(DataSink sink) {
@@ -1153,7 +1133,7 @@
ClassRelation classRelation = source.readEnum(ClassRelation.values);
ir.Member target = source.readMemberNode();
source.end(tag);
- return new _InstanceAccess(receiverType, classRelation, target);
+ return _InstanceAccess(receiverType, classRelation, target);
}
void toDataSink(DataSink sink) {
@@ -1180,7 +1160,7 @@
ClassRelation classRelation = source.readEnum(ClassRelation.values);
ir.Name name = source.readName();
source.end(tag);
- return new _DynamicAccess(receiverType, classRelation, name);
+ return _DynamicAccess(receiverType, classRelation, name);
}
void toDataSink(DataSink sink) {
@@ -1203,9 +1183,9 @@
factory _FunctionInvocation.fromDataSource(DataSource source) {
source.begin(tag);
ir.DartType receiverType = source.readDartTypeNode();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
source.end(tag);
- return new _FunctionInvocation(receiverType, callStructure);
+ return _FunctionInvocation(receiverType, callStructure);
}
void toDataSink(DataSink sink) {
@@ -1232,9 +1212,9 @@
ir.DartType receiverType = source.readDartTypeNode();
ClassRelation classRelation = source.readEnum(ClassRelation.values);
ir.Member target = source.readMemberNode();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
source.end(tag);
- return new _InstanceInvocation(
+ return _InstanceInvocation(
receiverType, classRelation, target, callStructure);
}
@@ -1264,10 +1244,9 @@
ir.DartType receiverType = source.readDartTypeNode();
ClassRelation classRelation = source.readEnum(ClassRelation.values);
ir.Name name = source.readName();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
source.end(tag);
- return new _DynamicInvocation(
- receiverType, classRelation, name, callStructure);
+ return _DynamicInvocation(receiverType, classRelation, name, callStructure);
}
void toDataSink(DataSink sink) {
@@ -1291,9 +1270,9 @@
factory _LocalFunctionInvocation.fromDataSource(DataSource source) {
source.begin(tag);
ir.FunctionDeclaration localFunction = source.readTreeNode();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
source.end(tag);
- return new _LocalFunctionInvocation(localFunction, callStructure);
+ return _LocalFunctionInvocation(localFunction, callStructure);
}
void toDataSink(DataSink sink) {
@@ -1316,10 +1295,10 @@
factory _StaticInvocation.fromDataSource(DataSource source) {
source.begin(tag);
ir.Procedure target = source.readMemberNode();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
ir.LibraryDependency import = source.readLibraryDependencyNodeOrNull();
source.end(tag);
- return new _StaticInvocation(target, callStructure, import);
+ return _StaticInvocation(target, callStructure, import);
}
void toDataSink(DataSink sink) {
@@ -1348,11 +1327,11 @@
source.begin(tag);
ir.Member constructor = source.readMemberNode();
ir.InterfaceType type = source.readDartTypeNode();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
ir.LibraryDependency import = source.readLibraryDependencyNodeOrNull();
bool isConst = source.readBool();
source.end(tag);
- return new _ConstructorInvocation(constructor, type, callStructure, import,
+ return _ConstructorInvocation(constructor, type, callStructure, import,
isConst: isConst);
}
@@ -1401,7 +1380,7 @@
ir.DartType type = source.readDartTypeNode();
_TypeUseKind kind = source.readEnum(_TypeUseKind.values);
source.end(tag);
- return new _TypeUse(type, kind);
+ return _TypeUse(type, kind);
}
void toDataSink(DataSink sink) {
@@ -1434,9 +1413,9 @@
factory _RedirectingInitializer.fromDataSource(DataSource source) {
source.begin(tag);
ir.Constructor constructor = source.readMemberNode();
- _CallStructure callStructure = new _CallStructure.fromDataSource(source);
+ _CallStructure callStructure = _CallStructure.fromDataSource(source);
source.end(tag);
- return new _RedirectingInitializer(constructor, callStructure);
+ return _RedirectingInitializer(constructor, callStructure);
}
void toDataSink(DataSink sink) {
@@ -1460,7 +1439,7 @@
ir.DartType type = source.readDartTypeNode();
ir.LibraryDependency import = source.readLibraryDependencyNodeOrNull();
source.end(tag);
- return new _TypeLiteral(type, import);
+ return _TypeLiteral(type, import);
}
void toDataSink(DataSink sink) {
@@ -1484,7 +1463,7 @@
ir.FunctionType expressionType = source.readDartTypeNode();
List<ir.DartType> typeArguments = source.readDartTypeNodes();
source.end(tag);
- return new _GenericInstantiation(expressionType, typeArguments);
+ return _GenericInstantiation(expressionType, typeArguments);
}
void toDataSink(DataSink sink) {
@@ -1508,7 +1487,7 @@
ir.Member target = source.readMemberNode();
ir.LibraryDependency import = source.readLibraryDependencyNodeOrNull();
source.end(tag);
- return new _StaticAccess(target, import);
+ return _StaticAccess(target, import);
}
void toDataSink(DataSink sink) {
@@ -1564,8 +1543,7 @@
bool isConst = source.readBool();
bool isEmpty = source.readBool();
source.end(tag);
- return new _ContainerLiteral(elementType,
- isConst: isConst, isEmpty: isEmpty);
+ return _ContainerLiteral(elementType, isConst: isConst, isEmpty: isEmpty);
}
void toDataSink(DataSink sink) {
@@ -1596,7 +1574,7 @@
ir.DartType receiverType = source.readDartTypeNode();
ir.DartType argumentType = source.readDartTypeNode(allowNull: true);
source.end(tag);
- return new _RuntimeTypeUse(node, kind, receiverType, argumentType);
+ return _RuntimeTypeUse(node, kind, receiverType, argumentType);
}
void toDataSink(DataSink sink) {
diff --git a/pkg/compiler/lib/src/ir/modular.dart b/pkg/compiler/lib/src/ir/modular.dart
index 5c5d752..a924f16 100644
--- a/pkg/compiler/lib/src/ir/modular.dart
+++ b/pkg/compiler/lib/src/ir/modular.dart
@@ -14,7 +14,6 @@
import '../diagnostics/source_span.dart';
import '../kernel/element_map_impl.dart';
import '../environment.dart';
-import '../ir/constants.dart';
import '../ir/static_type.dart';
import '../js_backend/annotations.dart';
import '../options.dart';
diff --git a/pkg/compiler/lib/src/ir/runtime_type_analysis.dart b/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
index 3286fc3..d46b622 100644
--- a/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
+++ b/pkg/compiler/lib/src/ir/runtime_type_analysis.dart
@@ -64,7 +64,7 @@
case RuntimeTypeUseKind.equals:
return receiverType != null && argumentType != null;
}
- throw new UnsupportedError("Unexpected RuntimeTypeUseKind $kind.");
+ throw UnsupportedError("Unexpected RuntimeTypeUseKind $kind.");
}
@override
@@ -408,8 +408,8 @@
receiverGet = node;
}
- RuntimeTypeUseData data = new RuntimeTypeUseData(
- kind, receiverGet, receiver, argumentGet, argument);
+ RuntimeTypeUseData data =
+ RuntimeTypeUseData(kind, receiverGet, receiver, argumentGet, argument);
cache[receiverGet] = data;
if (argumentGet != null) {
cache[argumentGet] = data;
diff --git a/pkg/compiler/lib/src/ir/scope.dart b/pkg/compiler/lib/src/ir/scope.dart
index 90bc23a..762be46 100644
--- a/pkg/compiler/lib/src/ir/scope.dart
+++ b/pkg/compiler/lib/src/ir/scope.dart
@@ -22,7 +22,7 @@
/// be marked as free variables.
factory ScopeModel.from(
ir.Member node, ir.ConstantEvaluator constantEvaluator) {
- ScopeModelBuilder builder = new ScopeModelBuilder(constantEvaluator);
+ ScopeModelBuilder builder = ScopeModelBuilder(constantEvaluator);
return builder.computeModel(node);
}
}
@@ -38,11 +38,11 @@
Set<ir.VariableDeclaration> _assignedVariables;
VariableScope createScopeFor(ir.TreeNode node) {
- return _scopeMap[node] ??= new VariableScopeImpl();
+ return _scopeMap[node] ??= VariableScopeImpl();
}
void registerAssignedVariable(ir.VariableDeclaration node) {
- _assignedVariables ??= new Set<ir.VariableDeclaration>();
+ _assignedVariables ??= Set<ir.VariableDeclaration>();
_assignedVariables.add(node);
}
@@ -83,7 +83,7 @@
}
void registerAssignedVariable(ir.VariableDeclaration variable) {
- _assignedVariables ??= new Set<ir.VariableDeclaration>();
+ _assignedVariables ??= Set<ir.VariableDeclaration>();
_assignedVariables.add(variable);
}
@@ -102,7 +102,7 @@
abstract class VariableCollectorMixin {
VariableScopeImpl currentVariableScope;
- VariableScopeModelImpl variableScopeModel = new VariableScopeModelImpl();
+ VariableScopeModelImpl variableScopeModel = VariableScopeModelImpl();
void visitInVariableScope(ir.TreeNode root, void f()) {
VariableScopeImpl oldScope = currentVariableScope;
diff --git a/pkg/compiler/lib/src/ir/scope_visitor.dart b/pkg/compiler/lib/src/ir/scope_visitor.dart
index 7ea0790..a93bc05 100644
--- a/pkg/compiler/lib/src/ir/scope_visitor.dart
+++ b/pkg/compiler/lib/src/ir/scope_visitor.dart
@@ -23,7 +23,7 @@
ir.TypeEnvironment get _typeEnvironment => _constantEvaluator.typeEnvironment;
ir.CoreTypes get _coreTypes => _typeEnvironment.coreTypes;
- final ClosureScopeModel _model = new ClosureScopeModel();
+ final ClosureScopeModel _model = ClosureScopeModel();
/// A map of each visited call node with the associated information about what
/// variables are captured/used. Each ir.Node key corresponds to a scope that
@@ -56,13 +56,12 @@
/// Keep track of the mutated local variables so that we don't need to box
/// non-mutated variables. We know these are only VariableDeclarations because
/// type variable types and `this` types can't be mutated!
- Set<ir.VariableDeclaration> _mutatedVariables =
- new Set<ir.VariableDeclaration>();
+ Set<ir.VariableDeclaration> _mutatedVariables = Set<ir.VariableDeclaration>();
/// The set of variables that are accessed in some form, whether they are
/// mutated or not.
Set<ir.Node /* ir.VariableDeclaration | TypeParameterTypeWithContext */ >
- _capturedVariables = new Set<ir.Node>();
+ _capturedVariables = Set<ir.Node>();
/// If true, the visitor is currently traversing some nodes that are inside a
/// try block.
@@ -89,10 +88,10 @@
ScopeModel computeModel(ir.Member node) {
if (node.isAbstract && !node.isExternal) {
return const ScopeModel(
- initializerComplexity: const EvaluationComplexity.lazy());
+ initializerComplexity: EvaluationComplexity.lazy());
}
- _staticTypeContext = new ir.StaticTypeContext(node, _typeEnvironment);
+ _staticTypeContext = ir.StaticTypeContext(node, _typeEnvironment);
if (node is ir.Constructor) {
_hasThisLocal = true;
} else if (node is ir.Procedure && node.kind == ir.ProcedureKind.Factory) {
@@ -110,7 +109,7 @@
initializerComplexity = node.accept(this);
} else {
initializerComplexity = const EvaluationComplexity.constant();
- _model.scopeInfo = new KernelScopeInfo(_hasThisLocal);
+ _model.scopeInfo = KernelScopeInfo(_hasThisLocal);
}
} else {
assert(node is ir.Procedure || node is ir.Constructor);
@@ -120,7 +119,7 @@
node.accept(this);
}
}
- return new ScopeModel(
+ return ScopeModel(
closureScopeModel: _model,
variableScopeModel: variableScopeModel,
initializerComplexity: initializerComplexity);
@@ -159,7 +158,7 @@
ir.Constant constant = _constantEvaluator.evaluate(_staticTypeContext, node,
requireConstant: false, replaceImplicitConstant: false);
if (constant != null) {
- return new EvaluationComplexity.constant(constant);
+ return EvaluationComplexity.constant(constant);
}
return const EvaluationComplexity.lazy();
}
@@ -180,7 +179,7 @@
ir.Expression _handleExpression(ir.Expression node) {
_lastExpressionComplexity = visitNode(node);
if (_lastExpressionComplexity.isFreshConstant) {
- return new ir.ConstantExpression(_lastExpressionComplexity.constant,
+ return ir.ConstantExpression(_lastExpressionComplexity.constant,
node.getStaticType(_staticTypeContext))
..fileOffset = node.fileOffset
..parent = node.parent;
@@ -216,7 +215,7 @@
/// this node if any variables are captured.
void attachCapturedScopeVariables(ir.TreeNode node) {
Set<ir.VariableDeclaration> capturedVariablesForScope =
- new Set<ir.VariableDeclaration>();
+ Set<ir.VariableDeclaration>();
for (ir.Node variable in _scopeVariables) {
// No need to box non-assignable elements.
@@ -233,12 +232,12 @@
KernelScopeInfo from = _model.scopeInfo;
KernelCapturedScope capturedScope;
- var nodeBox = new NodeBox(getBoxName(), _executableContext);
+ var nodeBox = NodeBox(getBoxName(), _executableContext);
if (node is ir.ForStatement ||
node is ir.ForInStatement ||
node is ir.WhileStatement ||
node is ir.DoStatement) {
- capturedScope = new KernelCapturedLoopScope(
+ capturedScope = KernelCapturedLoopScope(
capturedVariablesForScope,
nodeBox,
[],
@@ -249,7 +248,7 @@
from.thisUsedAsFreeVariableIfNeedsRti,
_hasThisLocal);
} else {
- capturedScope = new KernelCapturedScope(
+ capturedScope = KernelCapturedScope(
capturedVariablesForScope,
nodeBox,
from.localsUsedInTryOrSync,
@@ -375,7 +374,7 @@
_currentScopeInfo.freeVariables.add(variable);
} else {
_currentScopeInfo.freeVariablesForRti
- .putIfAbsent(variable, () => new Set<VariableUse>())
+ .putIfAbsent(variable, () => Set<VariableUse>())
.add(usage);
}
}
@@ -395,7 +394,7 @@
@override
EvaluationComplexity visitTypeParameter(ir.TypeParameter typeParameter) {
TypeVariableTypeWithContext typeVariable(ir.Library library) =>
- new TypeVariableTypeWithContext(
+ TypeVariableTypeWithContext(
ir.TypeParameterType.withDefaultNullabilityForLibrary(
typeParameter, library),
// If this typeParameter is part of a typedef then its parent is
@@ -532,7 +531,7 @@
});
KernelCapturedScope scope = _scopesCapturedInClosureMap[node];
if (scope != null) {
- _scopesCapturedInClosureMap[node] = new KernelCapturedLoopScope(
+ _scopesCapturedInClosureMap[node] = KernelCapturedLoopScope(
scope.boxedVariables,
scope.capturedVariablesAccessor,
boxedLoopVariables,
@@ -554,7 +553,7 @@
}
if (node.arguments.types.isNotEmpty) {
visitNodesInContext(node.arguments.types,
- new VariableUse.staticTypeArgument(node.interfaceTarget));
+ VariableUse.staticTypeArgument(node.interfaceTarget));
}
visitArguments(node.arguments);
return const EvaluationComplexity.lazy();
@@ -588,7 +587,7 @@
_isInsideClosure = _outermostNode != null;
_executableContext = node;
- _currentScopeInfo = new KernelScopeInfo(_hasThisLocal);
+ _currentScopeInfo = KernelScopeInfo(_hasThisLocal);
if (_isInsideClosure) {
_closuresToGenerate[node] = _currentScopeInfo;
@@ -825,8 +824,8 @@
@override
EvaluationComplexity visitFunctionNode(ir.FunctionNode node) {
VariableUse parameterUsage = node.parent is ir.Member
- ? new VariableUse.memberParameter(node.parent)
- : new VariableUse.localParameter(node.parent);
+ ? VariableUse.memberParameter(node.parent)
+ : VariableUse.localParameter(node.parent);
visitNodesInContext(node.typeParameters, parameterUsage);
for (ir.VariableDeclaration declaration in node.positionalParameters) {
_handleVariableDeclaration(declaration, parameterUsage);
@@ -837,8 +836,8 @@
visitInContext(
node.returnType,
node.parent is ir.Member
- ? new VariableUse.memberReturnType(node.parent)
- : new VariableUse.localReturnType(node.parent));
+ ? VariableUse.memberReturnType(node.parent)
+ : VariableUse.localReturnType(node.parent));
if (node.body != null) {
visitNode(node.body);
}
@@ -933,7 +932,7 @@
if (target is ir.Field) {
return target.isConst
? const EvaluationComplexity.constant()
- : new EvaluationComplexity.eager(fields: <ir.Field>{target});
+ : EvaluationComplexity.eager(fields: <ir.Field>{target});
} else if (target is ir.Procedure &&
target.kind == ir.ProcedureKind.Method) {
return _evaluateImplicitConstant(node);
@@ -957,9 +956,9 @@
if (node.arguments.types.isNotEmpty) {
VariableUse usage;
if (node.target.kind == ir.ProcedureKind.Factory) {
- usage = new VariableUse.constructorTypeArgument(node.target);
+ usage = VariableUse.constructorTypeArgument(node.target);
} else {
- usage = new VariableUse.staticTypeArgument(node.target);
+ usage = VariableUse.staticTypeArgument(node.target);
}
visitNodesInContext(node.arguments.types, usage);
@@ -1000,8 +999,8 @@
}
if (node.arguments.types.isNotEmpty) {
- visitNodesInContext(node.arguments.types,
- new VariableUse.constructorTypeArgument(target));
+ visitNodesInContext(
+ node.arguments.types, VariableUse.constructorTypeArgument(target));
}
visitArguments(node.arguments);
return node.isConst
@@ -1041,7 +1040,7 @@
receiver.variable.parent is ir.LocalFunction),
"Unexpected local function invocation ${node} "
"(${node.runtimeType}).");
- VariableUse usage = new VariableUse.instanceTypeArgument(node);
+ VariableUse usage = VariableUse.instanceTypeArgument(node);
visitNodesInContext(node.arguments.types, usage);
}
EvaluationComplexity complexity = visitArguments(node.arguments);
@@ -1068,7 +1067,7 @@
receiver.variable.parent is ir.LocalFunction),
"Unexpected local function invocation ${node} "
"(${node.runtimeType}).");
- VariableUse usage = new VariableUse.instanceTypeArgument(node);
+ VariableUse usage = VariableUse.instanceTypeArgument(node);
visitNodesInContext(node.arguments.types, usage);
}
visitArguments(node.arguments);
@@ -1085,7 +1084,7 @@
receiver.variable.parent is ir.LocalFunction),
"Unexpected local function invocation ${node} "
"(${node.runtimeType}).");
- VariableUse usage = new VariableUse.instanceTypeArgument(node);
+ VariableUse usage = VariableUse.instanceTypeArgument(node);
visitNodesInContext(node.arguments.types, usage);
}
visitArguments(node.arguments);
@@ -1102,7 +1101,7 @@
is ir.LocalFunction)),
"Unexpected local function invocation ${node} "
"(${node.runtimeType}).");
- VariableUse usage = new VariableUse.instanceTypeArgument(node);
+ VariableUse usage = VariableUse.instanceTypeArgument(node);
visitNodesInContext(node.arguments.types, usage);
}
visitArguments(node.arguments);
@@ -1115,7 +1114,7 @@
_markVariableAsUsed(node.variable, VariableUse.explicit);
if (node.arguments.types.isNotEmpty) {
VariableUse usage =
- new VariableUse.localTypeArgument(node.localFunction, node);
+ VariableUse.localTypeArgument(node.localFunction, node);
visitNodesInContext(node.arguments.types, usage);
}
visitArguments(node.arguments);
@@ -1247,7 +1246,7 @@
@override
EvaluationComplexity visitInstantiation(ir.Instantiation node) {
EvaluationComplexity typeArgumentsComplexity = visitNodesInContext(
- node.typeArguments, new VariableUse.instantiationTypeArgument(node));
+ node.typeArguments, VariableUse.instantiationTypeArgument(node));
node.expression = _handleExpression(node.expression);
EvaluationComplexity expressionComplexity = _lastExpressionComplexity;
@@ -1354,7 +1353,7 @@
EvaluationComplexity visitSuperInitializer(ir.SuperInitializer node) {
if (node.arguments.types.isNotEmpty) {
visitNodesInContext(node.arguments.types,
- new VariableUse.constructorTypeArgument(node.target));
+ VariableUse.constructorTypeArgument(node.target));
}
visitArguments(node.arguments);
return const EvaluationComplexity.lazy();
@@ -1365,7 +1364,7 @@
ir.RedirectingInitializer node) {
if (node.arguments.types.isNotEmpty) {
visitNodesInContext(node.arguments.types,
- new VariableUse.constructorTypeArgument(node.target));
+ VariableUse.constructorTypeArgument(node.target));
}
visitArguments(node.arguments);
return const EvaluationComplexity.lazy();
@@ -1407,7 +1406,7 @@
assert(usage != null);
if (_outermostNode is ir.Member) {
TypeVariableTypeWithContext typeVariable =
- new TypeVariableTypeWithContext(type, _outermostNode);
+ TypeVariableTypeWithContext(type, _outermostNode);
switch (typeVariable.kind) {
case TypeVariableKind.cls:
if (_isFieldOrConstructor(_outermostNode)) {
@@ -1496,7 +1495,7 @@
if (isLazy || isEager) {
return this;
} else {
- return new EvaluationComplexity.eager();
+ return EvaluationComplexity.eager();
}
}
@@ -1510,7 +1509,7 @@
/// Returns a short textual representation used for testing.
String get shortText {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
switch (level) {
case ComplexityLevel.constant:
sb.write('constant');
@@ -1528,7 +1527,7 @@
sb.write('lazy');
break;
default:
- throw new UnsupportedError("Unexpected complexity level $level");
+ throw UnsupportedError("Unexpected complexity level $level");
}
return sb.toString();
}
diff --git a/pkg/compiler/lib/src/ir/static_type.dart b/pkg/compiler/lib/src/ir/static_type.dart
index 1baf922..21e975e 100644
--- a/pkg/compiler/lib/src/ir/static_type.dart
+++ b/pkg/compiler/lib/src/ir/static_type.dart
@@ -86,7 +86,7 @@
: super(typeEnvironment);
StaticTypeCache getStaticTypeCache() {
- return new StaticTypeCache(_staticTypeCache._expressionTypes,
+ return StaticTypeCache(_staticTypeCache._expressionTypes,
_staticTypeCache._forInIteratorTypes);
}
@@ -125,7 +125,7 @@
Set<ir.VariableDeclaration> _currentVariables;
Set<ir.VariableDeclaration> _invalidatedVariables =
- new Set<ir.VariableDeclaration>();
+ Set<ir.VariableDeclaration>();
TypeMap _typeMapBase = const TypeMap();
TypeMap _typeMapWhenTrue;
@@ -415,7 +415,7 @@
// We need to insert an implicit cast to preserve the invariant that
// a property set with a known interface target is also statically
// checked.
- return new ir.AsExpression(value, setterType)..isTypeError = true;
+ return ir.AsExpression(value, setterType)..isTypeError = true;
}
return null;
}
@@ -613,11 +613,11 @@
ir.Expression updateArgument(ir.Expression expression, ir.TreeNode parent,
ir.DartType argumentType, ir.DartType checkedParameterType) {
ir.VariableDeclaration variable =
- new ir.VariableDeclaration.forValue(expression, type: argumentType);
+ ir.VariableDeclaration.forValue(expression, type: argumentType);
// Visit the newly created variable declaration.
handleVariableDeclaration(variable);
letVariables.add(variable);
- ir.VariableGet get = new ir.VariableGet(variable)..parent = parent;
+ ir.VariableGet get = ir.VariableGet(variable)..parent = parent;
// Visit the newly created variable get.
handleVariableGet(get, argumentType);
_staticTypeCache._expressionTypes[get] = argumentType;
@@ -628,10 +628,9 @@
// We need to insert an implicit cast to preserve the invariant that
// a method invocation with a known interface target is also
// statically checked.
- ir.AsExpression implicitCast =
- new ir.AsExpression(get, checkedParameterType)
- ..isTypeError = true
- ..parent = parent;
+ ir.AsExpression implicitCast = ir.AsExpression(get, checkedParameterType)
+ ..isTypeError = true
+ ..parent = parent;
// Visit the newly created as expression; the original value has
// already been visited.
handleAsExpression(implicitCast, argumentType);
@@ -655,11 +654,11 @@
argumentType, neededNamedChecks[argumentIndex]);
}
- ir.Expression dummy = new ir.NullLiteral();
+ ir.Expression dummy = ir.NullLiteral();
node.replaceWith(dummy);
ir.Expression body = node;
for (ir.VariableDeclaration variable in letVariables.reversed) {
- body = new ir.Let(variable, body);
+ body = ir.Let(variable, body);
}
dummy.replaceWith(body);
}
@@ -738,7 +737,7 @@
ir.DartType argumentType = argumentTypes.positional[0];
ir.DartType resultType = typeEnvironment
.getTypeOfSpecialCasedBinaryOperator(receiverType, argumentType);
- return new ir.FunctionType(
+ return ir.FunctionType(
<ir.DartType>[argumentType], resultType, currentLibrary.nonNullable);
}
return getterType;
@@ -777,8 +776,7 @@
if (arguments.positional.isEmpty) {
positional = const <ir.DartType>[];
} else {
- positional =
- new List<ir.DartType>.filled(arguments.positional.length, null);
+ positional = List<ir.DartType>.filled(arguments.positional.length, null);
int index = 0;
for (ir.Expression argument in arguments.positional) {
positional[index++] = visitNode(argument);
@@ -787,13 +785,13 @@
if (arguments.named.isEmpty) {
named = const <ir.DartType>[];
} else {
- named = new List<ir.DartType>.filled(arguments.named.length, null);
+ named = List<ir.DartType>.filled(arguments.named.length, null);
int index = 0;
for (ir.NamedExpression argument in arguments.named) {
named[index++] = visitNode(argument);
}
}
- return new ArgumentTypes(positional, named);
+ return ArgumentTypes(positional, named);
}
void handleDynamicInvocation(
@@ -1115,9 +1113,9 @@
ir.DartType visitConstructorInvocation(ir.ConstructorInvocation node) {
ArgumentTypes argumentTypes = _visitArguments(node.arguments);
ir.DartType resultType = node.arguments.types.isEmpty
- ? new ExactInterfaceType.from(typeEnvironment.coreTypes
+ ? ExactInterfaceType.from(typeEnvironment.coreTypes
.nonNullableRawType(node.target.enclosingClass))
- : new ExactInterfaceType(node.target.enclosingClass,
+ : ExactInterfaceType(node.target.enclosingClass,
ir.Nullability.nonNullable, node.arguments.types);
_staticTypeCache._expressionTypes[node] = resultType;
handleConstructorInvocation(node, argumentTypes, resultType);
@@ -1566,7 +1564,7 @@
currentLibrary,
typeEnvironment.coreTypes);
if (streamType != null) {
- iteratorType = new ir.InterfaceType(
+ iteratorType = ir.InterfaceType(
typeEnvironment.coreTypes.streamIteratorClass,
ir.Nullability.nonNullable,
streamType.typeArguments);
@@ -1574,7 +1572,7 @@
} else {
ir.InterfaceType iterableInterfaceType = getInterfaceTypeOf(iterableType);
ir.Member member = hierarchy.getInterfaceMember(
- iterableInterfaceType.classNode, new ir.Name(Identifiers.iterator));
+ iterableInterfaceType.classNode, ir.Name(Identifiers.iterator));
if (member != null) {
iteratorType = ir.Substitution.fromInterfaceType(
typeEnvironment.getTypeAsInstanceOf(
@@ -1729,7 +1727,7 @@
@override
Null visitProcedure(ir.Procedure node) {
- thisType = new ThisInterfaceType.from(node.enclosingClass?.getThisType(
+ thisType = ThisInterfaceType.from(node.enclosingClass?.getThisType(
typeEnvironment.coreTypes, node.enclosingLibrary.nonNullable));
_currentVariables = {};
currentLibrary = node.enclosingLibrary;
@@ -1746,7 +1744,7 @@
@override
Null visitConstructor(ir.Constructor node) {
- thisType = new ThisInterfaceType.from(node.enclosingClass.getThisType(
+ thisType = ThisInterfaceType.from(node.enclosingClass.getThisType(
typeEnvironment.coreTypes, node.enclosingLibrary.nonNullable));
_currentVariables = {};
currentLibrary = node.enclosingLibrary;
@@ -1764,7 +1762,7 @@
@override
Null visitField(ir.Field node) {
- thisType = new ThisInterfaceType.from(node.enclosingClass?.getThisType(
+ thisType = ThisInterfaceType.from(node.enclosingClass?.getThisType(
typeEnvironment.coreTypes, node.enclosingLibrary.nonNullable));
_currentVariables = {};
currentLibrary = node.enclosingLibrary;
@@ -1911,7 +1909,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('TypeHolder(');
sb.write('declared=$declaredType');
if (trueTypes != null) {
@@ -1950,7 +1948,7 @@
/// be an instance of [type]. If [isTrue] is `false`, the local variable is
/// known _not_ to be an instance of [type].
TargetInfo promote(ir.DartType type, {bool isTrue}) {
- Set<TypeHolder> newTypeHolders = new Set<TypeHolder>();
+ Set<TypeHolder> newTypeHolders = Set<TypeHolder>();
bool addTypeHolder(TypeHolder typeHolder) {
bool changed = false;
@@ -1958,7 +1956,7 @@
Set<ir.DartType> addAsCopy(Set<ir.DartType> set, ir.DartType type) {
Set<ir.DartType> result;
if (set == null) {
- result = new Set<ir.DartType>();
+ result = Set<ir.DartType>();
} else if (set.contains(type)) {
return set;
} else {
@@ -1995,12 +1993,11 @@
if (typesOfInterest.contains(type)) {
newTypesOfInterest = typesOfInterest;
} else {
- newTypesOfInterest = new Set<ir.DartType>.from(typesOfInterest)
- ..add(type);
+ newTypesOfInterest = Set<ir.DartType>.from(typesOfInterest)..add(type);
changed = true;
}
return changed
- ? new TargetInfo(declaredType, newTypeHolders, newTypesOfInterest)
+ ? TargetInfo(declaredType, newTypeHolders, newTypesOfInterest)
: this;
}
@@ -2012,8 +2009,8 @@
if (other == null) return null;
if (identical(this, other)) return this;
- Set<TypeHolder> newTypeHolders = new Set<TypeHolder>();
- Set<ir.DartType> newTypesOfInterest = new Set<ir.DartType>();
+ Set<TypeHolder> newTypeHolders = Set<TypeHolder>();
+ Set<ir.DartType> newTypesOfInterest = Set<ir.DartType>();
/// Adds the [typeHolders] to [newTypeHolders] for types in
/// [otherTypesOfInterest] while removing the information
@@ -2026,7 +2023,7 @@
for (TypeHolder typeHolder in typeHolders) {
Set<ir.DartType> newTrueTypes;
if (typeHolder.trueTypes != null) {
- newTrueTypes = new Set<ir.DartType>.from(typeHolder.trueTypes);
+ newTrueTypes = Set<ir.DartType>.from(typeHolder.trueTypes);
/// Only types in [otherTypesOfInterest] has information from all
/// paths.
@@ -2044,7 +2041,7 @@
}
Set<ir.DartType> newFalseTypes;
if (typeHolder.falseTypes != null) {
- newFalseTypes = new Set<ir.DartType>.from(typeHolder.falseTypes);
+ newFalseTypes = Set<ir.DartType>.from(typeHolder.falseTypes);
/// Only types in [otherTypesOfInterest] has information from all
/// paths.
@@ -2063,13 +2060,13 @@
if (newTrueTypes != null || newFalseTypes != null) {
// Only include type holders with information.
newTypeHolders
- .add(new TypeHolder(declaredType, newTrueTypes, newFalseTypes));
+ .add(TypeHolder(declaredType, newTrueTypes, newFalseTypes));
}
}
}
- Set<ir.DartType> thisTrueTypes = new Set<ir.DartType>();
- Set<ir.DartType> thisFalseTypes = new Set<ir.DartType>();
+ Set<ir.DartType> thisTrueTypes = Set<ir.DartType>();
+ Set<ir.DartType> thisFalseTypes = Set<ir.DartType>();
for (TypeHolder typeHolder in typeHolders) {
if (typeHolder.trueTypes != null) {
thisTrueTypes.addAll(typeHolder.trueTypes);
@@ -2079,8 +2076,8 @@
}
}
- Set<ir.DartType> otherTrueTypes = new Set<ir.DartType>();
- Set<ir.DartType> otherFalseTypes = new Set<ir.DartType>();
+ Set<ir.DartType> otherTrueTypes = Set<ir.DartType>();
+ Set<ir.DartType> otherFalseTypes = Set<ir.DartType>();
for (TypeHolder typeHolder in other.typeHolders) {
if (typeHolder.trueTypes != null) {
otherTrueTypes.addAll(typeHolder.trueTypes);
@@ -2100,7 +2097,7 @@
return null;
}
- return new TargetInfo(declaredType, newTypeHolders, newTypesOfInterest);
+ return TargetInfo(declaredType, newTypeHolders, newTypesOfInterest);
}
/// Computes a single type that soundly represents the promoted type of the
@@ -2151,7 +2148,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('TargetInfo(');
sb.write('declaredType=$declaredType,');
sb.write('typeHolders=$typeHolders,');
@@ -2180,7 +2177,7 @@
TypeMap promote(ir.VariableDeclaration variable, ir.DartType type,
{bool isTrue}) {
Map<ir.VariableDeclaration, TargetInfo> newInfoMap =
- new Map<ir.VariableDeclaration, TargetInfo>.from(_targetInfoMap);
+ Map<ir.VariableDeclaration, TargetInfo>.from(_targetInfoMap);
TargetInfo targetInfo = newInfoMap[variable];
bool changed = false;
if (targetInfo != null) {
@@ -2190,16 +2187,15 @@
} else {
changed = true;
Set<ir.DartType> trueTypes =
- isTrue ? (new Set<ir.DartType>()..add(type)) : null;
+ isTrue ? (Set<ir.DartType>()..add(type)) : null;
Set<ir.DartType> falseTypes =
- isTrue ? null : (new Set<ir.DartType>()..add(type));
- TypeHolder typeHolder =
- new TypeHolder(variable.type, trueTypes, falseTypes);
- targetInfo = new TargetInfo(
+ isTrue ? null : (Set<ir.DartType>()..add(type));
+ TypeHolder typeHolder = TypeHolder(variable.type, trueTypes, falseTypes);
+ targetInfo = TargetInfo(
variable.type, <TypeHolder>[typeHolder], <ir.DartType>[type]);
}
newInfoMap[variable] = targetInfo;
- return changed ? new TypeMap(newInfoMap) : this;
+ return changed ? TypeMap(newInfoMap) : this;
}
/// Returns the [TypeMap] that describes that the locals are either of [this]
@@ -2217,7 +2213,7 @@
newInfoMap[variable] = result;
}
});
- return changed ? new TypeMap(newInfoMap) : this;
+ return changed ? TypeMap(newInfoMap) : this;
}
/// Returns the [TypeMap] in which all type information for any of the
@@ -2232,7 +2228,7 @@
changed = true;
}
});
- return changed ? new TypeMap(newInfoMap) : this;
+ return changed ? TypeMap(newInfoMap) : this;
}
/// Returns the [TypeMap] where type information for `node.variable` is
@@ -2247,7 +2243,7 @@
newInfoMap[variable] = info;
} else if (type != null) {
changed = true;
- Set<ir.DartType> newTypesOfInterest = new Set<ir.DartType>();
+ Set<ir.DartType> newTypesOfInterest = Set<ir.DartType>();
for (ir.DartType typeOfInterest in info.typesOfInterest) {
if (typeEnvironment.isSubtypeOf(type, typeOfInterest,
ir.SubtypeCheckMode.ignoringNullabilities)) {
@@ -2262,10 +2258,10 @@
// declared type or null) and the canonical way to represent this is
// to have _no_ target info.
TypeHolder typeHolderIfNonNull =
- new TypeHolder(info.declaredType, newTypesOfInterest, null);
- TypeHolder typeHolderIfNull = new TypeHolder(info.declaredType, null,
- new Set<ir.DartType>()..add(info.declaredType));
- newInfoMap[variable] = new TargetInfo(
+ TypeHolder(info.declaredType, newTypesOfInterest, null);
+ TypeHolder typeHolderIfNull = TypeHolder(info.declaredType, null,
+ Set<ir.DartType>()..add(info.declaredType));
+ newInfoMap[variable] = TargetInfo(
info.declaredType,
<TypeHolder>[typeHolderIfNonNull, typeHolderIfNull],
newTypesOfInterest);
@@ -2274,7 +2270,7 @@
changed = true;
}
});
- return changed ? new TypeMap(newInfoMap) : this;
+ return changed ? TypeMap(newInfoMap) : this;
}
/// Computes a single type that soundly represents the promoted type of
@@ -2289,7 +2285,7 @@
}
String getText(String Function(Iterable<ir.DartType>) typesToText) {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('{');
String comma = '';
_targetInfoMap.forEach((ir.VariableDeclaration variable, TargetInfo info) {
@@ -2303,7 +2299,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('TypeMap(');
String comma = '';
_targetInfoMap.forEach((ir.VariableDeclaration variable, TargetInfo info) {
diff --git a/pkg/compiler/lib/src/ir/static_type_base.dart b/pkg/compiler/lib/src/ir/static_type_base.dart
index 05a45ee1..2bd9146 100644
--- a/pkg/compiler/lib/src/ir/static_type_base.dart
+++ b/pkg/compiler/lib/src/ir/static_type_base.dart
@@ -23,8 +23,7 @@
: super(classNode, nullability, typeArguments);
factory ThisInterfaceType.from(ir.InterfaceType type) => type != null
- ? new ThisInterfaceType(
- type.classNode, type.nullability, type.typeArguments)
+ ? ThisInterfaceType(type.classNode, type.nullability, type.typeArguments)
: null;
@override
@@ -39,8 +38,7 @@
: super(classNode, nullability, typeArguments);
factory ExactInterfaceType.from(ir.InterfaceType type) => type != null
- ? new ExactInterfaceType(
- type.classNode, type.nullability, type.typeArguments)
+ ? ExactInterfaceType(type.classNode, type.nullability, type.typeArguments)
: null;
@override
diff --git a/pkg/compiler/lib/src/ir/static_type_cache.dart b/pkg/compiler/lib/src/ir/static_type_cache.dart
index dc20d4b..59f2d66 100644
--- a/pkg/compiler/lib/src/ir/static_type_cache.dart
+++ b/pkg/compiler/lib/src/ir/static_type_cache.dart
@@ -24,7 +24,7 @@
Map<ir.ForInStatement, ir.DartType> forInIteratorTypes = source
.readTreeNodeMapInContext(source.readDartTypeNode, emptyAsNull: true);
source.end(tag);
- return new StaticTypeCache(expressionTypes, forInIteratorTypes);
+ return StaticTypeCache(expressionTypes, forInIteratorTypes);
});
}
diff --git a/pkg/compiler/lib/src/ir/util.dart b/pkg/compiler/lib/src/ir/util.dart
index 5c5021f..27b00cb 100644
--- a/pkg/compiler/lib/src/ir/util.dart
+++ b/pkg/compiler/lib/src/ir/util.dart
@@ -42,7 +42,7 @@
node = node.parent;
}
if (uri != null) {
- return new SourceSpan(uri, offset, offset + 1);
+ return SourceSpan(uri, offset, offset + 1);
}
return null;
}
@@ -60,7 +60,7 @@
return AsyncMarker.SYNC_STAR;
case ir.AsyncMarker.SyncYielding:
default:
- throw new UnsupportedError(
+ throw UnsupportedError(
"Async marker ${node.asyncMarker} is not supported.");
}
}
@@ -76,7 +76,7 @@
case ir.Variance.invariant:
return Variance.invariant;
default:
- throw new UnsupportedError("Variance ${node.variance} is not supported.");
+ throw UnsupportedError("Variance ${node.variance} is not supported.");
}
}
@@ -125,7 +125,7 @@
if (receiver is ir.VariableGet && receiver.variable == node.variable) {
// We have
// let #t1 = e0 in #t1 == null ? null : e1
- return new NullAwareExpression(node.variable, body.otherwise);
+ return NullAwareExpression(node.variable, body.otherwise);
}
}
}
@@ -238,7 +238,7 @@
@override
bool defaultDartType(ir.DartType node) {
- throw new UnsupportedError("FreeVariableVisitor.defaultTypeNode");
+ throw UnsupportedError("FreeVariableVisitor.defaultTypeNode");
}
}
diff --git a/pkg/compiler/lib/src/ir/visitors.dart b/pkg/compiler/lib/src/ir/visitors.dart
index cbcfda9..8e014ab 100644
--- a/pkg/compiler/lib/src/ir/visitors.dart
+++ b/pkg/compiler/lib/src/ir/visitors.dart
@@ -18,7 +18,7 @@
@override
String visitStringConcatenation(ir.StringConcatenation node) {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
for (ir.Expression expression in node.expressions) {
String value = expression.accept(this);
if (value == null) return null;
@@ -78,7 +78,7 @@
List<DartType> visitTypes(List<ir.DartType> types) {
topLevel = false;
- return new List.generate(
+ return List.generate(
types.length, (int index) => types[index].accept(this));
}
@@ -196,13 +196,12 @@
@override
ConstantValue defaultConstant(ir.Constant node) {
- throw new UnsupportedError(
- "Unexpected constant $node (${node.runtimeType}).");
+ throw UnsupportedError("Unexpected constant $node (${node.runtimeType}).");
}
@override
ConstantValue visitUnevaluatedConstant(ir.UnevaluatedConstant node) {
- throw new UnsupportedError("Unexpected unevaluated constant $node.");
+ throw UnsupportedError("Unexpected unevaluated constant $node.");
}
@override
@@ -216,7 +215,7 @@
ir.Procedure member = node.target;
FunctionEntity function = elementMap.getMethod(member);
DartType type = elementMap.getFunctionType(member.function);
- return new FunctionConstantValue(function, type);
+ return FunctionConstantValue(function, type);
}
@override
@@ -226,7 +225,7 @@
typeArguments.add(elementMap.getDartType(type));
}
FunctionConstantValue function = visitConstant(node.tearOffConstant);
- return new InstantiationConstantValue(typeArguments, function);
+ return InstantiationConstantValue(typeArguments, function);
}
@override
@@ -238,7 +237,7 @@
FieldEntity field = elementMap.getField(reference.asField);
fields[field] = visitConstant(value);
});
- return new ConstructedConstantValue(type, fields);
+ return ConstructedConstantValue(type, fields);
}
@override
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 699f97a..164d917 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -50,10 +50,10 @@
static const int _canInlineInLoopMayInlineOutside = 3;
static const int _canInline = 4;
- final Map<FunctionEntity, int> _cachedDecisions = Map<FunctionEntity, int>();
+ final Map<FunctionEntity, int> _cachedDecisions = {};
- final Set<FunctionEntity> _noInlineFunctions = Set<FunctionEntity>();
- final Set<FunctionEntity> _tryInlineFunctions = Set<FunctionEntity>();
+ final Set<FunctionEntity> _noInlineFunctions = {};
+ final Set<FunctionEntity> _tryInlineFunctions = {};
FunctionInlineCache(AnnotationsData annotationsData) {
annotationsData.forEachNoInline((FunctionEntity function) {
diff --git a/pkg/compiler/lib/src/js_backend/backend_impact.dart b/pkg/compiler/lib/src/js_backend/backend_impact.dart
index 59a3310..fd4c2b8 100644
--- a/pkg/compiler/lib/src/js_backend/backend_impact.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_impact.dart
@@ -33,15 +33,14 @@
final EnumSet<BackendFeature> _features;
const BackendImpact(
- {this.staticUses = const <FunctionEntity>[],
- this.globalUses = const <FunctionEntity>[],
- this.dynamicUses = const <Selector>[],
- this.instantiatedTypes = const <InterfaceType>[],
- this.instantiatedClasses = const <ClassEntity>[],
- this.globalClasses = const <ClassEntity>[],
- this.otherImpacts = const <BackendImpact>[],
- EnumSet<BackendFeature> features =
- const EnumSet<BackendFeature>.fixed(0)})
+ {this.staticUses = const [],
+ this.globalUses = const [],
+ this.dynamicUses = const [],
+ this.instantiatedTypes = const [],
+ this.instantiatedClasses = const [],
+ this.globalClasses = const [],
+ this.otherImpacts = const [],
+ EnumSet<BackendFeature> features = const EnumSet.fixed(0)})
: this._features = features;
Iterable<BackendFeature> get features =>
@@ -738,7 +737,7 @@
BackendImpact(globalClasses: [_commonElements.closureClass]);
}
- Map<int, BackendImpact> _genericInstantiation = <int, BackendImpact>{};
+ Map<int, BackendImpact> _genericInstantiation = {};
BackendImpact getGenericInstantiation(int typeArgumentCount) =>
_genericInstantiation[typeArgumentCount] ??= BackendImpact(staticUses: [
diff --git a/pkg/compiler/lib/src/js_backend/backend_usage.dart b/pkg/compiler/lib/src/js_backend/backend_usage.dart
index 0119259..c4968ce 100644
--- a/pkg/compiler/lib/src/js_backend/backend_usage.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_usage.dart
@@ -110,12 +110,12 @@
Setlet<ClassEntity> _globalClassDependencies;
/// List of methods that the backend may use.
- final Set<FunctionEntity> _helperFunctionsUsed = Set<FunctionEntity>();
+ final Set<FunctionEntity> _helperFunctionsUsed = {};
/// List of classes that the backend may use.
- final Set<ClassEntity> _helperClassesUsed = Set<ClassEntity>();
+ final Set<ClassEntity> _helperClassesUsed = {};
- final Set<RuntimeTypeUse> _runtimeTypeUses = Set<RuntimeTypeUse>();
+ final Set<RuntimeTypeUse> _runtimeTypeUses = {};
bool _needToInitializeIsolateAffinityTag = false;
bool _needToInitializeDispatchProperty = false;
@@ -256,18 +256,14 @@
@override
void registerGlobalFunctionDependency(FunctionEntity element) {
assert(element != null);
- if (_globalFunctionDependencies == null) {
- _globalFunctionDependencies = Setlet<FunctionEntity>();
- }
+ _globalFunctionDependencies ??= Setlet();
_globalFunctionDependencies.add(element);
}
@override
void registerGlobalClassDependency(ClassEntity element) {
assert(element != null);
- if (_globalClassDependencies == null) {
- _globalClassDependencies = Setlet<ClassEntity>();
- }
+ _globalClassDependencies ??= Setlet();
_globalClassDependencies.add(element);
}
@@ -434,11 +430,11 @@
@override
Iterable<FunctionEntity> get globalFunctionDependencies =>
- _globalFunctionDependencies ?? const <FunctionEntity>[];
+ _globalFunctionDependencies ?? const [];
@override
Iterable<ClassEntity> get globalClassDependencies =>
- _globalClassDependencies ?? const <ClassEntity>[];
+ _globalClassDependencies ?? const [];
Iterable<FunctionEntity> get helperFunctionsUsed => _helperFunctionsUsed;
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 6bb4fc5..85d2323 100644
--- a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
@@ -28,7 +28,7 @@
CheckedModeHelpers();
/// All the checked mode helpers.
- static const List<CheckedModeHelper> helpers = <CheckedModeHelper>[
+ static const List<CheckedModeHelper> helpers = [
CheckedModeHelper('boolConversionCheck'),
];
}
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
index 7c90ccd..d08b4a8 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -265,7 +265,7 @@
classElement, "Compiler encoutered unexpected set class $className");
}
- List<jsAst.Expression> arguments = <jsAst.Expression>[
+ List<jsAst.Expression> arguments = [
_constantReferenceGenerator(constant.entries),
];
@@ -281,7 +281,7 @@
jsAst.Expression visitMap(constant_system.JavaScriptMapConstant constant,
[_]) {
jsAst.Expression jsMap() {
- List<jsAst.Property> properties = <jsAst.Property>[];
+ List<jsAst.Property> properties = [];
for (int i = 0; i < constant.length; i++) {
StringConstantValue key = constant.keys[i];
if (key.stringValue ==
@@ -299,7 +299,7 @@
}
jsAst.Expression jsGeneralMap() {
- List<jsAst.Expression> data = <jsAst.Expression>[];
+ List<jsAst.Expression> data = [];
for (int i = 0; i < constant.keys.length; i++) {
jsAst.Expression keyExpression =
_constantReferenceGenerator(constant.keys[i]);
@@ -314,7 +314,7 @@
ClassEntity classElement = constant.type.element;
String className = classElement.name;
- List<jsAst.Expression> arguments = <jsAst.Expression>[];
+ List<jsAst.Expression> arguments = [];
// The arguments of the JavaScript constructor for any given Dart class
// are in the same order as the members of the class element.
@@ -396,7 +396,7 @@
}
jsAst.Expression constructor =
_emitter.constructorAccess(constant.type.element);
- List<jsAst.Expression> fields = <jsAst.Expression>[];
+ List<jsAst.Expression> fields = [];
_elementEnvironment.forEachInstanceField(element, (_, FieldEntity field) {
FieldAnalysisData fieldData = _fieldAnalysis.getFieldData(field);
if (fieldData.isElided) return;
@@ -415,7 +415,7 @@
[_]) {
ClassEntity cls =
_commonElements.getInstantiationClass(constant.typeArguments.length);
- List<jsAst.Expression> fields = <jsAst.Expression>[
+ List<jsAst.Expression> fields = [
_constantReferenceGenerator(constant.function)
];
fields.add(_reifiedTypeNewRti(
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 d84d9a5..efbc78d 100644
--- a/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
@@ -158,10 +158,10 @@
// Classes that are candidates for needing constructors. Classes are moved to
// [activeClasses] when we know they need constructors.
- final Set<ClassEntity> instantiatedClasses = Set<ClassEntity>();
+ final Set<ClassEntity> instantiatedClasses = {};
// Classes explicitly named.
- final Set<ClassEntity> selectedClasses = Set<ClassEntity>();
+ final Set<ClassEntity> selectedClasses = {};
// True if we must conservatively include all extension classes.
bool allClassesSelected = false;
@@ -170,7 +170,7 @@
bool demanded = false;
// ClassesOutput: classes requiring metadata.
- final Set<ClassEntity> activeClasses = Set<ClassEntity>();
+ final Set<ClassEntity> activeClasses = {};
CustomElementsAnalysisJoin(
this._elementEnvironment, this._commonElements, this._nativeData,
@@ -217,7 +217,7 @@
}
List<ConstructorEntity> computeEscapingConstructors(ClassEntity cls) {
- List<ConstructorEntity> result = <ConstructorEntity>[];
+ List<ConstructorEntity> result = [];
// Only classes that extend native classes have constructors in the table.
// We could refine this to classes that extend Element, but that would break
// the tests and there is no sane reason to subclass other native classes.
diff --git a/pkg/compiler/lib/src/js_backend/enqueuer.dart b/pkg/compiler/lib/src/js_backend/enqueuer.dart
index 7d5e4d7..2741824 100644
--- a/pkg/compiler/lib/src/js_backend/enqueuer.dart
+++ b/pkg/compiler/lib/src/js_backend/enqueuer.dart
@@ -32,7 +32,7 @@
/// [Enqueuer] which is specific to code generation.
class CodegenEnqueuer extends EnqueuerImpl {
final String name;
- Set<ClassEntity> _recentClasses = Setlet<ClassEntity>();
+ Set<ClassEntity> _recentClasses = Setlet();
bool _recentConstants = false;
final CodegenWorldBuilderImpl _worldBuilder;
final WorkItemBuilder _workItemBuilder;
@@ -50,7 +50,7 @@
final Queue<WorkItem> _queue = Queue<WorkItem>();
/// All declaration elements that have been processed by codegen.
- final Set<MemberEntity> _processedEntities = Set<MemberEntity>();
+ final Set<MemberEntity> _processedEntities = {};
// If not `null` this is called when the queue has been emptied. It allows for
// applying additional impacts before re-emptying the queue.
diff --git a/pkg/compiler/lib/src/js_backend/inferred_data.dart b/pkg/compiler/lib/src/js_backend/inferred_data.dart
index a432c15..3dc454a 100644
--- a/pkg/compiler/lib/src/js_backend/inferred_data.dart
+++ b/pkg/compiler/lib/src/js_backend/inferred_data.dart
@@ -205,17 +205,15 @@
}
class InferredDataBuilderImpl implements InferredDataBuilder {
- final Set<MemberEntity> _functionsCalledInLoop = Set<MemberEntity>();
- Map<MemberEntity, SideEffectsBuilder> _sideEffectsBuilders =
- <MemberEntity, SideEffectsBuilder>{};
- final Set<FunctionEntity> prematureSideEffectAccesses = Set<FunctionEntity>();
+ final Set<MemberEntity> _functionsCalledInLoop = {};
+ Map<MemberEntity, SideEffectsBuilder> _sideEffectsBuilders = {};
+ final Set<FunctionEntity> prematureSideEffectAccesses = {};
- final Set<FunctionEntity> _sideEffectsFreeElements = Set<FunctionEntity>();
+ final Set<FunctionEntity> _sideEffectsFreeElements = {};
- final Set<FunctionEntity> _elementsThatCannotThrow = Set<FunctionEntity>();
+ final Set<FunctionEntity> _elementsThatCannotThrow = {};
- final Set<FunctionEntity> _functionsThatMightBePassedToApply =
- Set<FunctionEntity>();
+ final Set<FunctionEntity> _functionsThatMightBePassedToApply = {};
InferredDataBuilderImpl(AnnotationsData annotationsData) {
annotationsData.forEachNoThrows(registerCannotThrow);
@@ -239,8 +237,7 @@
InferredData close(JClosedWorld closedWorld) {
assert(_sideEffectsBuilders != null,
"Inferred data has already been computed.");
- Map<FunctionEntity, SideEffects> _sideEffects =
- <FunctionEntity, SideEffects>{};
+ Map<FunctionEntity, SideEffects> _sideEffects = {};
Iterable<SideEffectsBuilder> sideEffectsBuilders =
_sideEffectsBuilders.values;
emptyWorkList(sideEffectsBuilders);
@@ -260,8 +257,8 @@
static void emptyWorkList(Iterable<SideEffectsBuilder> sideEffectsBuilders) {
// TODO(johnniwinther): Optimize this algorithm.
- Queue<SideEffectsBuilder> queue = Queue<SideEffectsBuilder>();
- Set<SideEffectsBuilder> inQueue = Set<SideEffectsBuilder>();
+ Queue<SideEffectsBuilder> queue = Queue();
+ Set<SideEffectsBuilder> inQueue = {};
for (SideEffectsBuilder builder in sideEffectsBuilders) {
queue.addLast(builder);
diff --git a/pkg/compiler/lib/src/js_backend/interceptor_data.dart b/pkg/compiler/lib/src/js_backend/interceptor_data.dart
index 11340cd..2665c82 100644
--- a/pkg/compiler/lib/src/js_backend/interceptor_data.dart
+++ b/pkg/compiler/lib/src/js_backend/interceptor_data.dart
@@ -97,13 +97,11 @@
///
/// These members must be invoked with a correct explicit receiver even when
/// the receiver is not an intercepted class.
- final Map<String, Set<MemberEntity>> _interceptedMixinElements =
- Map<String, Set<MemberEntity>>();
+ final Map<String, Set<MemberEntity>> _interceptedMixinElements = {};
- final Map<String, Set<ClassEntity>> _interceptedClassesCache =
- Map<String, Set<ClassEntity>>();
+ final Map<String, Set<ClassEntity>> _interceptedClassesCache = {};
- final Set<ClassEntity> _noClasses = Set<ClassEntity>();
+ final Set<ClassEntity> _noClasses = {};
InterceptorDataImpl(
this._nativeData,
@@ -220,7 +218,7 @@
return _interceptedClassesCache.putIfAbsent(name, () {
// Populate the cache by running through all the elements and
// determine if the given selector applies to them.
- Set<ClassEntity> result = Set<ClassEntity>();
+ Set<ClassEntity> result = {};
for (MemberEntity element in intercepted) {
ClassEntity classElement = element.enclosingClass;
if (_isCompileTimeOnlyClass(classElement)) continue;
@@ -246,7 +244,7 @@
closedWorld.classHierarchy.forEachStrictSubclassOf(use,
(ClassEntity subclass) {
if (_nativeData.isNativeOrExtendsNative(subclass)) {
- if (result == null) result = Set<ClassEntity>();
+ if (result == null) result = {};
result.add(subclass);
}
return IterationStep.CONTINUE;
@@ -290,17 +288,15 @@
/// The members of instantiated interceptor classes: maps a member name to the
/// list of members that have that name. This map is used by the codegen to
/// know whether a send must be intercepted or not.
- final Map<String, Set<MemberEntity>> _interceptedElements =
- <String, Set<MemberEntity>>{};
+ final Map<String, Set<MemberEntity>> _interceptedElements = {};
/// Set of classes whose methods are intercepted.
- final Set<ClassEntity> _interceptedClasses = Set<ClassEntity>();
+ final Set<ClassEntity> _interceptedClasses = {};
/// Set of classes used as mixins on intercepted (native and primitive)
/// classes. Methods on these classes might also be mixed in to regular Dart
/// (unintercepted) classes.
- final Set<ClassEntity> _classesMixedIntoInterceptedClasses =
- Set<ClassEntity>();
+ final Set<ClassEntity> _classesMixedIntoInterceptedClasses = {};
InterceptorDataBuilderImpl(
this._nativeData, this._elementEnvironment, this._commonElements);
@@ -322,8 +318,7 @@
if (member.name == Identifiers.call) return;
// All methods on [Object] are shadowed by [Interceptor].
if (cls == _commonElements.objectClass) return;
- Set<MemberEntity> set =
- _interceptedElements[member.name] ??= Set<MemberEntity>();
+ Set<MemberEntity> set = _interceptedElements[member.name] ??= {};
set.add(member);
});
@@ -340,8 +335,7 @@
(ClassEntity cls, MemberEntity member) {
// All methods on [Object] are shadowed by [Interceptor].
if (cls == _commonElements.objectClass) return;
- Set<MemberEntity> set =
- _interceptedElements[member.name] ??= Set<MemberEntity>();
+ Set<MemberEntity> set = _interceptedElements[member.name] ??= {};
set.add(member);
});
}
diff --git a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
index b74afb2..175290c 100644
--- a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
@@ -17,7 +17,7 @@
jsAst.Statement buildJsInteropBootstrap(
CodegenWorld codegenWorld, NativeBasicData nativeBasicData, Namer namer) {
if (!nativeBasicData.isJsInteropUsed) return null;
- List<jsAst.Statement> statements = <jsAst.Statement>[];
+ List<jsAst.Statement> statements = [];
codegenWorld.forEachInvokedName(
(String name, Map<Selector, SelectorConstraints> selectors) {
selectors.forEach((Selector selector, SelectorConstraints constraints) {
diff --git a/pkg/compiler/lib/src/js_backend/minify_namer.dart b/pkg/compiler/lib/src/js_backend/minify_namer.dart
index 61d0628..b102340 100644
--- a/pkg/compiler/lib/src/js_backend/minify_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/minify_namer.dart
@@ -48,7 +48,7 @@
// variables) because they clash with names from the DOM. However, it is
// OK to use them as fields, as we only access fields directly if we know
// the receiver type.
- static const List<String> _reservedNativeProperties = <String>[
+ static const List<String> _reservedNativeProperties = [
'a', 'b', 'c', 'd', 'e', 'f', 'r', 'x', 'y', 'z', 'Q',
// 2-letter:
'ch', 'cx', 'cy', 'db', 'dx', 'dy', 'fr', 'fx', 'fy', 'go', 'id', 'k1',
@@ -95,7 +95,7 @@
// individually per program, but that would mean that the output of the
// minifier was less stable from version to version of the program being
// minified.
- _populateSuggestedNames(instanceScope, const <String>[
+ _populateSuggestedNames(instanceScope, const [
r'$add',
r'add$1',
r'$and',
@@ -136,7 +136,7 @@
r'toString$0'
]);
- _populateSuggestedNames(globalScope, const <String>[
+ _populateSuggestedNames(globalScope, const [
r'Object',
'wrapException',
r'$eq',
@@ -208,7 +208,7 @@
for (int n = 1; n <= 3; n++) {
int h = hash;
while (h > 10) {
- List<int> codes = <int>[_letterNumber(h)];
+ List<int> codes = [_letterNumber(h)];
int h2 = h ~/ ALPHABET_CHARACTERS;
for (int i = 1; i < n; i++) {
codes.add(_alphaNumericNumber(h2));
@@ -251,7 +251,7 @@
/// Remember bad hashes to avoid using a the same character with long numbers
/// for frequent hashes. For example, `closure` is a very common name.
- Map<int, int> _badNames = Map<int, int>();
+ Map<int, int> _badNames = {};
/// If we can't find a hash based name in the three-letter space, then base
/// the name on a letter and a counter.
@@ -360,8 +360,7 @@
}
abstract class _MinifyConstructorBodyNamer implements Namer {
- Map<ClassEntity, _ConstructorBodyNamingScope> _constructorBodyScopes =
- Map<ClassEntity, _ConstructorBodyNamingScope>();
+ Map<ClassEntity, _ConstructorBodyNamingScope> _constructorBodyScopes = {};
@override
jsAst.Name constructorBodyName(ConstructorBodyEntity method) {
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 6d60ea5..11d3b51 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -135,7 +135,7 @@
/// For local variables, the [Namer] only provides *proposed names*. These names
/// must be disambiguated elsewhere.
class Namer extends ModularNamer {
- static const List<String> javaScriptKeywords = <String>[
+ static const List<String> javaScriptKeywords = [
// ES5 7.6.1.1 Keywords.
'break',
'do',
@@ -238,7 +238,7 @@
// Other words to avoid due to non-standard keyword-like behavior.
];
- static const List<String> reservedPropertySymbols = <String>[
+ static const List<String> reservedPropertySymbols = [
"__proto__", "prototype", "constructor", "call",
// "use strict" disallows the use of "arguments" and "eval" as
// variable names or property names. See ECMA-262, Edition 5.1,
@@ -304,7 +304,7 @@
/// Symbols that we might be using in our JS snippets. Some of the symbols in
/// these sections are in [reservedGlobalUpperCaseSymbols] above.
- static const List<String> reservedGlobalSymbols = <String>[
+ static const List<String> reservedGlobalSymbols = [
// Section references are from Ecma-262
// (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf)
@@ -394,7 +394,7 @@
// TODO(joshualitt): Stop reserving these names after local naming is updated
// to use frequencies.
- static const List<String> reservedGlobalObjectNames = <String>[
+ static const List<String> reservedGlobalObjectNames = [
"A",
"B",
"C", // Global object for *C*onstants.
@@ -423,7 +423,7 @@
"Z",
];
- static const List<String> reservedGlobalHelperFunctions = <String>[
+ static const List<String> reservedGlobalHelperFunctions = [
"init",
];
@@ -1606,7 +1606,7 @@
String root = null; // First word, usually a type name.
bool failed = false; // Failed to generate something pretty.
- List<String> fragments = <String>[];
+ List<String> fragments = [];
int length = 0;
ConstantNamingVisitor(this._namer, this._closedWorld, this._hasher);
diff --git a/pkg/compiler/lib/src/js_backend/namer_names.dart b/pkg/compiler/lib/src/js_backend/namer_names.dart
index fe43140..b549098 100644
--- a/pkg/compiler/lib/src/js_backend/namer_names.dart
+++ b/pkg/compiler/lib/src/js_backend/namer_names.dart
@@ -152,7 +152,7 @@
CompoundName(this._parts);
- CompoundName.from(List<jsAst.Name> parts) : this(<_NamerName>[...parts]);
+ CompoundName.from(List<jsAst.Name> parts) : this([...parts]);
@override
bool get isFinalized => _parts.every((name) => name.isFinalized);
diff --git a/pkg/compiler/lib/src/js_backend/native_data.dart b/pkg/compiler/lib/src/js_backend/native_data.dart
index 11c8e41..1ef691d 100644
--- a/pkg/compiler/lib/src/js_backend/native_data.dart
+++ b/pkg/compiler/lib/src/js_backend/native_data.dart
@@ -186,20 +186,19 @@
/// Tag info for native JavaScript classes names. See
/// [setNativeClassTagInfo].
- Map<ClassEntity, NativeClassTag> nativeClassTagInfo =
- <ClassEntity, NativeClassTag>{};
+ Map<ClassEntity, NativeClassTag> nativeClassTagInfo = {};
/// The JavaScript libraries implemented via typed JavaScript interop.
- Map<LibraryEntity, String> jsInteropLibraries = <LibraryEntity, String>{};
+ Map<LibraryEntity, String> jsInteropLibraries = {};
/// The JavaScript classes implemented via typed JavaScript interop.
- Map<ClassEntity, String> jsInteropClasses = <ClassEntity, String>{};
+ Map<ClassEntity, String> jsInteropClasses = {};
/// JavaScript interop classes annotated with `@anonymous`
- Set<ClassEntity> anonymousJsInteropClasses = Set<ClassEntity>();
+ Set<ClassEntity> anonymousJsInteropClasses = {};
/// The JavaScript members implemented via typed JavaScript interop.
- Map<MemberEntity, String> jsInteropMembers = <MemberEntity, String>{};
+ Map<MemberEntity, String> jsInteropMembers = {};
@override
void setNativeClassTagInfo(ClassEntity cls, String tagText) {
@@ -477,19 +476,16 @@
final NativeBasicDataImpl _nativeBasicData;
/// The JavaScript names for native JavaScript elements implemented.
- Map<MemberEntity, String> nativeMemberName = <MemberEntity, String>{};
+ Map<MemberEntity, String> nativeMemberName = {};
/// Cache for [NativeBehavior]s for calling native methods.
- Map<FunctionEntity, NativeBehavior> nativeMethodBehavior =
- <FunctionEntity, NativeBehavior>{};
+ Map<FunctionEntity, NativeBehavior> nativeMethodBehavior = {};
/// Cache for [NativeBehavior]s for reading from native fields.
- Map<MemberEntity, NativeBehavior> nativeFieldLoadBehavior =
- <FieldEntity, NativeBehavior>{};
+ Map<MemberEntity, NativeBehavior> nativeFieldLoadBehavior = {};
/// Cache for [NativeBehavior]s for writing to native fields.
- Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior =
- <FieldEntity, NativeBehavior>{};
+ Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior = {};
NativeDataBuilderImpl(this._nativeBasicData);
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 ffca921..1ef96e6 100644
--- a/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
+++ b/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
@@ -67,25 +67,25 @@
class NoSuchMethodRegistryImpl implements NoSuchMethodRegistry {
/// The implementations that fall into category A, described above.
- final Set<FunctionEntity> defaultImpls = Set<FunctionEntity>();
+ final Set<FunctionEntity> defaultImpls = {};
/// The implementations that fall into category B, described above.
- final Set<FunctionEntity> throwingImpls = Set<FunctionEntity>();
+ final Set<FunctionEntity> throwingImpls = {};
/// The implementations that fall into category C, described above.
// TODO(johnniwinther): Remove this category when Dart 1 is no longer
// supported.
- final Set<FunctionEntity> notApplicableImpls = Set<FunctionEntity>();
+ final Set<FunctionEntity> notApplicableImpls = {};
/// The implementations that fall into category D, described above.
- final Set<FunctionEntity> otherImpls = Set<FunctionEntity>();
+ final Set<FunctionEntity> otherImpls = {};
/// The implementations that have not yet been categorized.
- final Set<FunctionEntity> _uncategorizedImpls = Set<FunctionEntity>();
+ final Set<FunctionEntity> _uncategorizedImpls = {};
/// The implementations that a forwarding syntax as defined by
/// [NoSuchMethodResolver.hasForwardSyntax].
- final Set<FunctionEntity> forwardingSyntaxImpls = Set<FunctionEntity>();
+ final Set<FunctionEntity> forwardingSyntaxImpls = {};
final CommonElements _commonElements;
final NoSuchMethodResolver _resolver;
@@ -210,10 +210,10 @@
final Set<FunctionEntity> otherImpls;
/// The implementations that fall into category D1
- final Set<FunctionEntity> complexNoReturnImpls = Set<FunctionEntity>();
+ final Set<FunctionEntity> complexNoReturnImpls = {};
/// The implementations that fall into category D2
- final Set<FunctionEntity> complexReturningImpls = Set<FunctionEntity>();
+ final Set<FunctionEntity> complexReturningImpls = {};
final Set<FunctionEntity> forwardingSyntaxImpls;
diff --git a/pkg/compiler/lib/src/js_backend/resolution_listener.dart b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
index 3bccb68..02fc83a 100644
--- a/pkg/compiler/lib/src/js_backend/resolution_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
@@ -265,10 +265,11 @@
FunctionType functionType =
_elementEnvironment.getFunctionType(function);
- var allParameterTypes = <DartType>[]
- ..addAll(functionType.parameterTypes)
- ..addAll(functionType.optionalParameterTypes)
- ..addAll(functionType.namedParameterTypes);
+ var allParameterTypes = <DartType>[
+ ...functionType.parameterTypes,
+ ...functionType.optionalParameterTypes,
+ ...functionType.namedParameterTypes
+ ];
for (var type in allParameterTypes) {
if (type.withoutNullability is FunctionType) {
var closureConverter = _commonElements.closureConverter;
@@ -454,7 +455,7 @@
void _registerCheckedModeHelpers(WorldImpactBuilder impactBuilder) {
// We register all the _commonElements in the resolution queue.
// TODO(13155): Find a way to register fewer _commonElements.
- List<FunctionEntity> staticUses = <FunctionEntity>[];
+ List<FunctionEntity> staticUses = [];
for (CheckedModeHelper helper in CheckedModeHelpers.helpers) {
staticUses.add(helper.getStaticUse(_commonElements).element);
}
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index ef78879..01df853 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -81,7 +81,7 @@
CodegenWorld codegenWorld, CompilerOptions options) {
rtiChecksBuilderClosed = true;
- Map<ClassEntity, ClassUse> classUseMap = <ClassEntity, ClassUse>{};
+ Map<ClassEntity, ClassUse> classUseMap = {};
for (ClassEntity cls in _closedWorld.classHierarchy
.getClassSet(_closedWorld.commonElements.objectClass)
.subtypes()) {
@@ -109,7 +109,7 @@
Set<FunctionType> computeCheckedFunctions(
CodegenWorldBuilder codegenWorldBuilder, Set<DartType> implicitIsChecks) {
- return Set<FunctionType>();
+ return {};
}
}
@@ -132,7 +132,7 @@
// arguments and record all combination where the element of a checked
// argument is a superclass of the element of an instantiated type.
TypeCheckMapping result = TypeCheckMapping();
- Set<ClassEntity> handled = Set<ClassEntity>();
+ Set<ClassEntity> handled = {};
// Empty usage object for classes with no direct rti usage.
final ClassUse emptyUse = ClassUse();
@@ -182,7 +182,7 @@
//
// This set reflects the emitted class hierarchy and therefore uses
// `getEffectiveMixinClass` to find the inherited mixins.
- Set<ClassEntity> inheritedClasses = Set<ClassEntity>();
+ Set<ClassEntity> inheritedClasses = {};
ClassEntity other = cls;
while (other != null) {
inheritedClasses.add(other);
@@ -354,7 +354,7 @@
@override
Set<ClassEntity> getClassesUsedInSubstitutions(TypeChecks checks) {
- Set<ClassEntity> instantiated = Set<ClassEntity>();
+ Set<ClassEntity> instantiated = {};
ArgumentCollector collector = ArgumentCollector();
for (ClassEntity target in checks.classes) {
ClassChecks classChecks = checks[target];
@@ -474,12 +474,11 @@
@override
Iterable<ClassEntity> get requiredClasses {
- Set<ClassEntity> required = Set<ClassEntity>();
- required.addAll(_typeArguments);
- required.addAll(_typeLiterals);
- required
- .addAll(_substitutions.getClassesUsedInSubstitutions(requiredChecks));
- return required;
+ return {
+ ..._typeArguments,
+ ..._typeLiterals,
+ ..._substitutions.getClassesUsedInSubstitutions(requiredChecks)
+ };
}
}
@@ -490,9 +489,9 @@
final JClosedWorld _closedWorld;
// The set of type arguments tested against type variable bounds.
- final Set<DartType> checkedTypeArguments = Set<DartType>();
+ final Set<DartType> checkedTypeArguments = {};
// The set of tested type variable bounds.
- final Set<DartType> checkedBounds = Set<DartType>();
+ final Set<DartType> checkedBounds = {};
TypeChecks cachedRequiredChecks;
@@ -513,8 +512,7 @@
Map<ClassEntity, ClassUse> classUseMapForTesting;
- final Set<GenericInstantiation> _genericInstantiations =
- Set<GenericInstantiation>();
+ final Set<GenericInstantiation> _genericInstantiations = {};
@override
void registerTypeVariableBoundsSubtypeCheck(
@@ -537,14 +535,14 @@
Set<DartType> explicitIsChecks = typeVariableTests.explicitIsChecks;
Set<DartType> implicitIsChecks = typeVariableTests.implicitIsChecks;
- Map<ClassEntity, ClassUse> classUseMap = <ClassEntity, ClassUse>{};
+ Map<ClassEntity, ClassUse> classUseMap = {};
if (retainDataForTesting) {
classUseMapForTesting = classUseMap;
}
- Set<FunctionType> checkedFunctionTypes = Set<FunctionType>();
- Set<ClassEntity> typeLiterals = Set<ClassEntity>();
- Set<ClassEntity> typeArguments = Set<ClassEntity>();
+ Set<FunctionType> checkedFunctionTypes = {};
+ Set<ClassEntity> typeLiterals = {};
+ Set<ClassEntity> typeArguments = {};
// The [liveTypeVisitor] is used to register class use in the type of
// instantiated objects like `new T` and the function types of
@@ -711,7 +709,7 @@
// Collect classes that are 'live' either through instantiation or use in
// type arguments.
- List<ClassEntity> liveClasses = <ClassEntity>[];
+ List<ClassEntity> liveClasses = [];
classUseMap.forEach((ClassEntity cls, ClassUse classUse) {
if (classUse.isLive) {
liveClasses.add(cls);
@@ -774,7 +772,7 @@
}
class TypeCheckMapping implements TypeChecks {
- final Map<ClassEntity, ClassChecks> map = Map<ClassEntity, ClassChecks>();
+ final Map<ClassEntity, ClassChecks> map = {};
@override
ClassChecks operator [](ClassEntity element) {
@@ -802,7 +800,7 @@
}
class ArgumentCollector extends DartTypeVisitor<void, void> {
- final Set<ClassEntity> classes = Set<ClassEntity>();
+ final Set<ClassEntity> classes = {};
void addClass(ClassEntity cls) {
classes.add(cls);
@@ -875,8 +873,7 @@
}
class TypeVisitor extends DartTypeVisitor<void, TypeVisitorState> {
- Set<FunctionTypeVariable> _visitedFunctionTypeVariables =
- Set<FunctionTypeVariable>();
+ Set<FunctionTypeVariable> _visitedFunctionTypeVariables = {};
final void Function(ClassEntity entity, {TypeVisitorState state}) onClass;
final void Function(TypeVariableEntity entity, {TypeVisitorState state})
@@ -1061,7 +1058,7 @@
@override
String toString() {
- List<String> properties = <String>[];
+ List<String> properties = [];
if (instance) {
properties.add('instance');
}
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart b/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
index 5ccf8c3..f549a6a 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types_codegen.dart
@@ -47,10 +47,10 @@
final ClassFunctionType functionType;
- ClassChecks(this.functionType) : _map = <ClassEntity, TypeCheck>{};
+ ClassChecks(this.functionType) : _map = {};
const ClassChecks.empty()
- : _map = const <ClassEntity, TypeCheck>{},
+ : _map = const {},
functionType = null;
void add(TypeCheck check) {
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart b/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
index efc3f30..11e86e2 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart
@@ -27,7 +27,7 @@
int _testState = 0;
int _literalState = 0;
- Iterable<RtiNode> get dependencies => _dependencies ?? const <RtiNode>[];
+ Iterable<RtiNode> get dependencies => _dependencies ?? const [];
bool get hasDirectTest => _testState & 1 != 0;
bool get hasIndirectTest => _testState & 2 != 0;
@@ -48,7 +48,7 @@
// [entity]!
return false;
}
- _dependencies ??= Set<RtiNode>();
+ _dependencies ??= {};
return _dependencies.add(node);
}
@@ -214,7 +214,7 @@
final Set<DartType> explicitIsChecks;
/// All implicit is-tests.
- final Set<DartType> implicitIsChecks = Set<DartType>();
+ final Set<DartType> implicitIsChecks = {};
TypeVariableTests(this._elementEnvironment, this._commonElements, this._world,
this._genericInstantiations,
@@ -316,7 +316,7 @@
} else {
dependencies = _methods[entity]?.dependencies;
}
- if (dependencies == null) return const <Entity>[];
+ if (dependencies == null) return const [];
return dependencies.map((n) => n.entity).toSet();
}
@@ -701,7 +701,7 @@
});
if (forRtiNeeds) {
- _appliedSelectorMap = <Selector, Set<Entity>>{};
+ _appliedSelectorMap = {};
}
_world.forEachDynamicTypeArgument(
@@ -1004,12 +1004,11 @@
class RuntimeTypesNeedBuilderImpl implements RuntimeTypesNeedBuilder {
final ElementEnvironment _elementEnvironment;
- final Set<ClassEntity> classesUsingTypeVariableLiterals = Set<ClassEntity>();
+ final Set<ClassEntity> classesUsingTypeVariableLiterals = {};
- final Set<FunctionEntity> methodsUsingTypeVariableLiterals =
- Set<FunctionEntity>();
+ final Set<FunctionEntity> methodsUsingTypeVariableLiterals = {};
- final Set<Local> localFunctionsUsingTypeVariableLiterals = Set<Local>();
+ final Set<Local> localFunctionsUsingTypeVariableLiterals = {};
Map<Selector, Set<Entity>> selectorsNeedingTypeArgumentsForTesting;
@@ -1019,8 +1018,7 @@
get instantiatedEntitiesNeedingTypeArgumentsForTesting =>
_instantiatedEntitiesNeedingTypeArgumentsForTesting ?? const {};
- final Set<GenericInstantiation> _genericInstantiations =
- Set<GenericInstantiation>();
+ final Set<GenericInstantiation> _genericInstantiations = {};
TypeVariableTests typeVariableTestsForTesting;
@@ -1054,12 +1052,12 @@
closedWorld.commonElements,
closedWorld,
_genericInstantiations);
- Set<ClassEntity> classesNeedingTypeArguments = Set<ClassEntity>();
- Set<FunctionEntity> methodsNeedingSignature = Set<FunctionEntity>();
- Set<FunctionEntity> methodsNeedingTypeArguments = Set<FunctionEntity>();
- Set<Local> localFunctionsNeedingSignature = Set<Local>();
- Set<Local> localFunctionsNeedingTypeArguments = Set<Local>();
- Set<Entity> processedEntities = Set<Entity>();
+ Set<ClassEntity> classesNeedingTypeArguments = {};
+ Set<FunctionEntity> methodsNeedingSignature = {};
+ Set<FunctionEntity> methodsNeedingTypeArguments = {};
+ Set<Local> localFunctionsNeedingSignature = {};
+ Set<Local> localFunctionsNeedingTypeArguments = {};
+ Set<Entity> processedEntities = {};
// Find the classes that need type arguments at runtime. Such
// classes are:
@@ -1139,14 +1137,14 @@
}
});
localFunctionsNeedingSignature.add(function);
- localFunctionsToRemove ??= Set<Local>();
+ localFunctionsToRemove ??= {};
localFunctionsToRemove.add(function);
}
}
for (FunctionEntity function in closurizedMembers) {
if (checkFunctionType(_elementEnvironment.getFunctionType(function))) {
methodsNeedingSignature.add(function);
- closurizedMembersToRemove ??= Set<FunctionEntity>();
+ closurizedMembersToRemove ??= {};
closurizedMembersToRemove.add(function);
}
}
@@ -1247,7 +1245,7 @@
/// Set to `true` if subclasses of `Function` need runtimeType.
bool neededOnFunctions = false;
- Set<ClassEntity> classesDirectlyNeedingRuntimeType = Set<ClassEntity>();
+ Set<ClassEntity> classesDirectlyNeedingRuntimeType = {};
Iterable<ClassEntity> impliedClasses(DartType type) {
type = type.withoutNullability;
@@ -1346,7 +1344,7 @@
.subclassesOf(commonElements.objectClass)
.toSet();
} else {
- allClassesNeedingRuntimeType = Set<ClassEntity>();
+ allClassesNeedingRuntimeType = {};
// TODO(johnniwinther): Support this operation directly in
// [ClosedWorld] using the [ClassSet]s.
for (ClassEntity cls in classesDirectlyNeedingRuntimeType) {
@@ -1379,7 +1377,7 @@
}
}
- Set<Selector> selectorsNeedingTypeArguments = Set<Selector>();
+ Set<Selector> selectorsNeedingTypeArguments = {};
typeVariableTests
.forEachAppliedSelector((Selector selector, Set<Entity> targets) {
for (Entity target in targets) {
@@ -1388,10 +1386,9 @@
localFunctionsNeedingTypeArguments.contains(target)) {
selectorsNeedingTypeArguments.add(selector);
if (retainDataForTesting) {
- selectorsNeedingTypeArgumentsForTesting ??=
- <Selector, Set<Entity>>{};
+ selectorsNeedingTypeArgumentsForTesting ??= {};
selectorsNeedingTypeArgumentsForTesting
- .putIfAbsent(selector, () => Set<Entity>())
+ .putIfAbsent(selector, () => {})
.add(target);
} else {
return;
@@ -1399,7 +1396,7 @@
}
}
});
- Set<int> instantiationsNeedingTypeArguments = Set<int>();
+ Set<int> instantiationsNeedingTypeArguments = {};
typeVariableTests.forEachInstantiatedEntity(
(Entity target, Set<GenericInstantiation> instantiations) {
if (methodsNeedingTypeArguments.contains(target) ||
diff --git a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
index 25cd71f..21e2959 100644
--- a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
@@ -73,13 +73,12 @@
}
}
- Map<jsAst.Name, jsAst.Expression> generatedStubs =
- <jsAst.Name, jsAst.Expression>{};
+ Map<jsAst.Name, jsAst.Expression> generatedStubs = {};
// Two selectors may match but differ only in type. To avoid generating
// identical stubs for each we track untyped selectors which already have
// stubs.
- Set<Selector> generatedSelectors = new Set<Selector>();
+ Set<Selector> generatedSelectors = {};
for (Selector selector in selectors.keys) {
if (generatedSelectors.contains(selector)) continue;
if (!selector.appliesUnnamed(member)) continue;
@@ -88,13 +87,13 @@
generatedSelectors.add(selector);
jsAst.Name invocationName = _namer.invocationName(selector);
- Selector callSelector = new Selector.callClosureFrom(selector);
+ Selector callSelector = Selector.callClosureFrom(selector);
jsAst.Name closureCallName = _namer.invocationName(callSelector);
- List<jsAst.Parameter> parameters = <jsAst.Parameter>[];
- List<jsAst.Expression> arguments = <jsAst.Expression>[];
+ List<jsAst.Parameter> parameters = [];
+ List<jsAst.Expression> arguments = [];
if (isInterceptedMethod) {
- parameters.add(new jsAst.Parameter(receiverArgumentName));
+ parameters.add(jsAst.Parameter(receiverArgumentName));
}
for (int i = 0; i < selector.argumentCount; i++) {
@@ -120,7 +119,7 @@
}
Map<jsAst.Name, Selector> computeSelectorsForNsmHandlers() {
- Map<jsAst.Name, Selector> jsNames = <jsAst.Name, Selector>{};
+ Map<jsAst.Name, Selector> jsNames = {};
// Do not generate no such method handlers if there is no class.
if (_codegenWorld.directlyInstantiatedClasses.isEmpty) {
@@ -158,8 +157,8 @@
// Values match JSInvocationMirror in js-helper library.
int type = selector.invocationMirrorKind;
List<String> parameterNames =
- new List.generate(selector.argumentCount, (i) => '\$$i') +
- new List.generate(selector.typeArgumentCount, (i) => '\$T${i + 1}');
+ List.generate(selector.argumentCount, (i) => '\$$i') +
+ List.generate(selector.typeArgumentCount, (i) => '\$T${i + 1}');
List<jsAst.Expression> argNames = selector.callStructure
.getOrderedNamedArguments()
@@ -186,9 +185,9 @@
js.quoteName(enableMinification ? internalName : methodName),
'internalName': js.quoteName(internalName),
'type': js.number(type),
- 'arguments': new jsAst.ArrayInitializer(
+ 'arguments': jsAst.ArrayInitializer(
parameterNames.map<jsAst.Expression>(js).toList()),
- 'namedArguments': new jsAst.ArrayInitializer(argNames),
+ 'namedArguments': jsAst.ArrayInitializer(argNames),
'typeArgumentCount': js.number(selector.typeArgumentCount)
});
@@ -199,7 +198,7 @@
} else {
function = js(r'function(#) { return # }', [parameterNames, expression]);
}
- return new StubMethod(name, function);
+ return StubMethod(name, function);
}
/// Generates a getter for the given [field].
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 2337b35..0beb130 100644
--- a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
+++ b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
@@ -15,8 +15,7 @@
import '../js_backend/backend.dart' show CodegenInputs;
import '../js_backend/inferred_data.dart';
import '../js_backend/namer.dart' show Namer;
-import '../js_backend/runtime_types.dart'
- show RuntimeTypesChecks;
+import '../js_backend/runtime_types.dart' show RuntimeTypesChecks;
import '../js_model/js_strategy.dart';
import '../options.dart';
import '../universe/codegen_world_builder.dart';
@@ -78,16 +77,17 @@
void _finalizeRti(CodegenInputs codegen, CodegenWorld codegenWorld) {
// Compute the required type checks to know which classes need a
// 'is$' method.
- _rtiChecks = _backendStrategy.rtiChecksBuilder.computeRequiredChecks(codegenWorld, options);
+ _rtiChecks = _backendStrategy.rtiChecksBuilder
+ .computeRequiredChecks(codegenWorld, options);
}
/// Creates the [Emitter] for this task.
void createEmitter(
Namer namer, CodegenInputs codegen, JClosedWorld closedWorld) {
measure(() {
- _nativeEmitter = new NativeEmitter(
+ _nativeEmitter = NativeEmitter(
this, closedWorld, _backendStrategy.nativeCodegenEnqueuer);
- _emitter = new startup_js_emitter.EmitterImpl(
+ _emitter = startup_js_emitter.EmitterImpl(
_compiler.options,
_compiler.reporter,
_compiler.outputProvider,
@@ -99,7 +99,7 @@
_backendStrategy.sourceInformationStrategy,
this,
_generateSourceMap);
- metadataCollector = new MetadataCollector(
+ metadataCollector = MetadataCollector(
_compiler.reporter, _emitter, codegen.rtiRecipeEncoder);
});
}
diff --git a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
index 9d4c41a..31050bd 100644
--- a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
+++ b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
@@ -22,7 +22,7 @@
final Sorter _sorter;
_DartTypeOrdering _dartTypeOrdering;
_ConstantOrdering(this._sorter) {
- _dartTypeOrdering = new _DartTypeOrdering(this);
+ _dartTypeOrdering = _DartTypeOrdering(this);
}
@override
@@ -269,13 +269,13 @@
@override
int visitVoidType(covariant VoidType type, covariant VoidType other) {
- throw new UnsupportedError('Unreachable');
+ throw UnsupportedError('Unreachable');
}
@override
int visitTypeVariableType(
covariant TypeVariableType type, covariant TypeVariableType other) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Type variables are not expected in constants: '$type' in '$_root'");
}
@@ -330,7 +330,7 @@
@override
int visitDynamicType(
covariant DynamicType type, covariant DynamicType other) {
- throw new UnsupportedError('Unreachable');
+ throw UnsupportedError('Unreachable');
}
@override
diff --git a/pkg/compiler/lib/src/js_emitter/headers.dart b/pkg/compiler/lib/src/js_emitter/headers.dart
index 9953606..90e4098 100644
--- a/pkg/compiler/lib/src/js_emitter/headers.dart
+++ b/pkg/compiler/lib/src/js_emitter/headers.dart
@@ -6,7 +6,7 @@
import '../options.dart';
-String generatedBy(CompilerOptions options, {String flavor: ""}) {
+String generatedBy(CompilerOptions options, {String flavor = ""}) {
String suffix = '';
if (options.hasBuildId) {
suffix = ' version: ${options.buildId}';
diff --git a/pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart
index 8417cc4..627dbe5 100644
--- a/pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart
@@ -69,13 +69,13 @@
// }
// ```
- List<jsAst.Parameter> parameters = <jsAst.Parameter>[];
- List<jsAst.Expression> arguments = <jsAst.Expression>[];
+ List<jsAst.Parameter> parameters = [];
+ List<jsAst.Expression> arguments = [];
for (int i = 0; i < callSelector.argumentCount; i++) {
String jsName = 'a$i';
arguments.add(js('#', jsName));
- parameters.add(new jsAst.Parameter(jsName));
+ parameters.add(jsAst.Parameter(jsName));
}
for (int i = 0; i < targetSelector.typeArgumentCount; i++) {
@@ -95,7 +95,7 @@
// TODO(sra): .withSourceInformation(sourceInformation);
jsAst.Name name = _namer.invocationName(callSelector);
- return new ParameterStubMethod(name, null, function);
+ return ParameterStubMethod(name, null, function);
}
/// Generates a stub for a 'signature' selector. The stub calls the underlying
@@ -118,7 +118,7 @@
// TODO(sra): Generate source information for stub that has no member.
// TODO(sra): .withSourceInformation(sourceInformation);
- return new ParameterStubMethod(operatorSignature, null, function);
+ return ParameterStubMethod(operatorSignature, null, function);
}
jsAst.Fun _generateSignatureNewRti(FieldEntity functionField) =>
@@ -156,8 +156,7 @@
_codegenWorld.invocationsByName(call);
Set<ParameterStructure> computeLiveParameterStructures() {
- Set<ParameterStructure> parameterStructures =
- new Set<ParameterStructure>();
+ Set<ParameterStructure> parameterStructures = {};
void process(FunctionEntity function) {
if (function.parameterStructure.typeParameters == typeArgumentCount) {
@@ -172,7 +171,7 @@
return parameterStructures;
}
- List<StubMethod> stubs = <StubMethod>[];
+ List<StubMethod> stubs = [];
// For every call-selector generate a stub to the corresponding selector
// with filled-in type arguments.
@@ -188,7 +187,7 @@
for (ParameterStructure parameterStructure in parameterStructures) {
if (genericCallStructure.signatureApplies(parameterStructure)) {
Selector genericSelector =
- new Selector.call(selector.memberName, genericCallStructure);
+ Selector.call(selector.memberName, genericCallStructure);
stubs.add(_generateStub(
instantiationClass, functionField, selector, genericSelector));
break;
diff --git a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
index 13e4a5e..b96d0e8 100644
--- a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
@@ -133,7 +133,7 @@
hasNative = anyNativeClasses;
}
- List<jsAst.Statement> statements = <jsAst.Statement>[];
+ List<jsAst.Statement> statements = [];
if (hasNumber) {
jsAst.Statement whenNumber;
@@ -206,7 +206,7 @@
statements.add(js.statement('return receiver'));
}
- return js('''function(receiver) { #; }''', new jsAst.Block(statements));
+ return js('''function(receiver) { #; }''', jsAst.Block(statements));
}
jsAst.Call _generateIsJsIndexableCall(
@@ -218,13 +218,12 @@
// We pass the dispatch property record to the isJsIndexable
// helper rather than reading it inside the helper to increase the
// chance of making the dispatch record access monomorphic.
- jsAst.PropertyAccess record =
- new jsAst.PropertyAccess(use2, dispatchProperty);
+ jsAst.PropertyAccess record = jsAst.PropertyAccess(use2, dispatchProperty);
- List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record];
+ List<jsAst.Expression> arguments = [use1, record];
FunctionEntity helper = _commonElements.isJsIndexable;
jsAst.Expression helperExpression = _emitter.staticFunctionAccess(helper);
- return new jsAst.Call(helperExpression, arguments);
+ return jsAst.Call(helperExpression, arguments);
}
// Returns a statement that takes care of performance critical
@@ -383,7 +382,7 @@
Set<ClassEntity> classes = interceptor.classes;
jsAst.Name getInterceptorName = _namer.nameForGetInterceptor(classes);
- List<String> parameterNames = <String>[];
+ List<String> parameterNames = [];
parameterNames.add('receiver');
if (selector.isSetter) {
@@ -402,7 +401,7 @@
jsAst.Statement optimizedPath =
_fastPathForOneShotInterceptor(selector, classes);
- if (optimizedPath == null) optimizedPath = js.statement(';');
+ optimizedPath ??= js.statement(';');
return js('function(#) { #; return #.#(receiver).#(#) }', [
parameterNames,
@@ -419,7 +418,7 @@
CustomElementsCodegenAnalysis analysis = _customElementsCodegenAnalysis;
if (!analysis.needsTable) return null;
- List<jsAst.Expression> elements = <jsAst.Expression>[];
+ List<jsAst.Expression> elements = [];
Iterable<ConstantValue> constants =
_codegenWorld.getConstantsForEmission(_emitter.compareConstants);
for (ConstantValue constant in constants) {
@@ -449,15 +448,15 @@
// We expect most of the time the map will be a singleton.
var properties = <jsAst.Property>[];
for (ConstructorEntity member in analysis.constructors(classElement)) {
- properties.add(new jsAst.Property(
+ properties.add(jsAst.Property(
js.string(member.name), _emitter.staticFunctionAccess(member)));
}
- var map = new jsAst.ObjectInitializer(properties);
+ var map = jsAst.ObjectInitializer(properties);
elements.add(map);
}
}
- return new jsAst.ArrayInitializer(elements);
+ return jsAst.ArrayInitializer(elements);
}
}
diff --git a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
index fafbbc7..5023420 100644
--- a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
+++ b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
@@ -111,7 +111,7 @@
MetadataCollector(this.reporter, this._emitter, this._rtiRecipeEncoder);
jsAst.Expression getTypesForOutputUnit(OutputUnit outputUnit) {
- return _typesTokens.putIfAbsent(outputUnit, () => new _MetadataList());
+ return _typesTokens.putIfAbsent(outputUnit, () => _MetadataList());
}
void mergeOutputUnitMetadata(OutputUnit target, OutputUnit source) {
@@ -120,8 +120,7 @@
// Merge _metadataMap
var sourceMetadataMap = _metadataMap[source];
if (sourceMetadataMap != null) {
- var targetMetadataMap =
- _metadataMap[target] ??= Map<String, List<BoundMetadataEntry>>();
+ var targetMetadataMap = _metadataMap[target] ??= {};
_metadataMap.remove(source);
sourceMetadataMap.forEach((str, entries) {
var targetMetadataMapList = targetMetadataMap[str] ??= [];
@@ -132,8 +131,7 @@
// Merge _typesMap
var sourceTypesMap = _typesMap[source];
if (sourceTypesMap != null) {
- var targetTypesMap =
- _typesMap[target] ??= Map<DartType, List<BoundMetadataEntry>>();
+ var targetTypesMap = _typesMap[target] ??= {};
_typesMap.remove(source);
sourceTypesMap.forEach((type, entries) {
var targetTypesMapList = targetTypesMap[type] ??= [];
@@ -152,7 +150,7 @@
}
jsAst.Expression _addTypeInOutputUnit(DartType type, OutputUnit outputUnit) {
- _typesMap[outputUnit] ??= Map<DartType, List<BoundMetadataEntry>>();
+ _typesMap[outputUnit] ??= {};
BoundMetadataEntry metadataEntry;
if (_typesMap[outputUnit].containsKey(type)) {
@@ -170,7 +168,7 @@
@override
void finalizeTokens() {
void countTokensInTypes(Iterable<BoundMetadataEntry> entries) {
- jsAst.TokenCounter counter = new jsAst.TokenCounter();
+ jsAst.TokenCounter counter = jsAst.TokenCounter();
entries
.where((BoundMetadataEntry e) => e._rc > 0)
.map((BoundMetadataEntry e) => e.entry)
@@ -196,7 +194,7 @@
List<jsAst.Node> values =
entries.map((BoundMetadataEntry e) => e.entry).toList();
- return new jsAst.ArrayInitializer(values);
+ return jsAst.ArrayInitializer(values);
}
_typesTokens.forEach((OutputUnit outputUnit, _MetadataList token) {
@@ -205,7 +203,7 @@
typesMap.values.forEach(countTokensInTypes);
token.setExpression(finalizeMap(typesMap));
} else {
- token.setExpression(new jsAst.ArrayInitializer([]));
+ token.setExpression(jsAst.ArrayInitializer([]));
}
});
}
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index 19617a0..706385f 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -187,8 +187,8 @@
StaticField(this.element, this.name, this.getterName, this.code,
{this.isFinal,
this.isLazy,
- this.isInitializedByConstant: false,
- this.usesNonNullableInitialization: false});
+ this.isInitializedByConstant = false,
+ this.usesNonNullableInitialization = false});
@override
String toString() {
@@ -309,7 +309,7 @@
_mixinClass = mixinClass;
}
- js.Name get superclassName => superclass == null ? null : superclass.name;
+ js.Name get superclassName => superclass?.name;
@override
String toString() => 'Class(name=${name.key},element=$element)';
diff --git a/pkg/compiler/lib/src/js_emitter/native_emitter.dart b/pkg/compiler/lib/src/js_emitter/native_emitter.dart
index 9223c96..a3137e7 100644
--- a/pkg/compiler/lib/src/js_emitter/native_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/native_emitter.dart
@@ -27,15 +27,13 @@
bool hasNativeClasses = false;
// Caches the native subtypes of a native class.
- Map<ClassEntity, List<ClassEntity>> subtypes =
- <ClassEntity, List<ClassEntity>>{};
+ Map<ClassEntity, List<ClassEntity>> subtypes = {};
// Caches the direct native subtypes of a native class.
- Map<ClassEntity, List<ClassEntity>> directSubtypes =
- <ClassEntity, List<ClassEntity>>{};
+ Map<ClassEntity, List<ClassEntity>> directSubtypes = {};
// Caches the methods that have a native body.
- Set<FunctionEntity> nativeMethods = new Set<FunctionEntity>();
+ Set<FunctionEntity> nativeMethods = {};
// Type metadata redirections, where the key is the class type data being
// redirected to and the value is the list of class type data being
@@ -91,8 +89,8 @@
// Compute a pre-order traversal of the subclass forest. We actually want a
// post-order traversal but it is easier to compute the pre-order and use it
// in reverse.
- List<Class> preOrder = <Class>[];
- Set<Class> seen = new Set<Class>();
+ List<Class> preOrder = [];
+ Set<Class> seen = {};
Class objectClass = null;
Class jsInterceptorClass = null;
@@ -119,8 +117,8 @@
// needed class.
// We may still need to include type metadata for some unneeded classes.
- Set<Class> neededClasses = new Set<Class>();
- Set<Class> nonLeafClasses = new Set<Class>();
+ Set<Class> neededClasses = {};
+ Set<Class> nonLeafClasses = {};
Map<Class, List<Class>> extensionPoints = computeExtensionPoints(preOrder);
@@ -177,8 +175,8 @@
// Collect all the tags that map to each native class.
- Map<Class, Set<String>> leafTags = new Map<Class, Set<String>>();
- Map<Class, Set<String>> nonleafTags = new Map<Class, Set<String>>();
+ Map<Class, Set<String>> leafTags = {};
+ Map<Class, Set<String>> nonleafTags = {};
for (Class cls in classes) {
if (!cls.isNative) continue;
@@ -187,9 +185,7 @@
List<String> nativeTags = _nativeData.getNativeTagsOfClass(cls.element);
if (nonLeafClasses.contains(cls) || extensionPoints.containsKey(cls)) {
- nonleafTags
- .putIfAbsent(cls, () => new Set<String>())
- .addAll(nativeTags);
+ nonleafTags.putIfAbsent(cls, () => {}).addAll(nativeTags);
} else {
Class sufficingInterceptor = cls;
while (!neededClasses.contains(sufficingInterceptor)) {
@@ -198,9 +194,7 @@
if (sufficingInterceptor == objectClass) {
sufficingInterceptor = jsInterceptorClass;
}
- leafTags
- .putIfAbsent(sufficingInterceptor, () => new Set<String>())
- .addAll(nativeTags);
+ leafTags.putIfAbsent(sufficingInterceptor, () => {}).addAll(nativeTags);
}
}
@@ -252,13 +246,13 @@
return nativeSuperclassOf(cls.superclass);
}
- Map<Class, List<Class>> map = new Map<Class, List<Class>>();
+ Map<Class, List<Class>> map = {};
for (Class cls in classes) {
if (cls.isNative) continue;
Class nativeAncestor = nativeAncestorOf(cls);
if (nativeAncestor != null) {
- map.putIfAbsent(nativeAncestor, () => <Class>[]).add(cls);
+ map.putIfAbsent(nativeAncestor, () => []).add(cls);
}
}
return map;
@@ -321,7 +315,7 @@
// must be turned into a JS call to:
// foo(null, y).
- List<jsAst.Statement> statements = <jsAst.Statement>[];
+ List<jsAst.Statement> statements = [];
potentiallyConvertDartClosuresToJs(statements, member, stubParameters);
String target;
diff --git a/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
index 819b321..022cd5a 100644
--- a/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
@@ -28,7 +28,7 @@
import 'native_emitter.dart';
class ParameterStubGenerator {
- static final Set<Selector> emptySelectorSet = new Set<Selector>();
+ static final Set<Selector> emptySelectorSet = {};
final Emitter _emitter;
final NativeEmitter _nativeEmitter;
@@ -112,13 +112,13 @@
String receiverArgumentName = r'$receiver';
// The parameters that this stub takes.
- List<jsAst.Parameter> stubParameters = new List<jsAst.Parameter>.filled(
+ List<jsAst.Parameter> stubParameters = List<jsAst.Parameter>.filled(
extraArgumentCount +
selector.argumentCount +
selector.typeArgumentCount,
null);
// The arguments that will be passed to the real method.
- List<jsAst.Expression> targetArguments = new List<jsAst.Expression>.filled(
+ List<jsAst.Expression> targetArguments = List<jsAst.Expression>.filled(
extraArgumentCount +
parameterStructure.totalParameters +
parameterStructure.typeParameters,
@@ -127,7 +127,7 @@
int count = 0;
if (isInterceptedMethod) {
count++;
- stubParameters[0] = new jsAst.Parameter(receiverArgumentName);
+ stubParameters[0] = jsAst.Parameter(receiverArgumentName);
targetArguments[0] = js('#', receiverArgumentName);
}
@@ -140,7 +140,7 @@
String jsName = _namer.safeVariableName(name);
assert(jsName != receiverArgumentName);
if (count < optionalParameterStart) {
- stubParameters[count] = new jsAst.Parameter(jsName);
+ stubParameters[count] = jsAst.Parameter(jsName);
targetArguments[count] = js('#', jsName);
} else {
int index = names.indexOf(name);
@@ -150,11 +150,11 @@
// one in the real method (which is in Dart source order).
targetArguments[count] = js('#', jsName);
stubParameters[optionalParameterStart + index] =
- new jsAst.Parameter(jsName);
+ jsAst.Parameter(jsName);
} else {
if (value == null) {
targetArguments[count] =
- _emitter.constantReference(new NullConstantValue());
+ _emitter.constantReference(NullConstantValue());
} else {
if (!value.isNull) {
// If the value is the null constant, we should not pass it
@@ -181,7 +181,7 @@
TypeReference(TypeExpressionRecipe(defaultType));
} else {
String jsName = '\$${typeVariable.element.name}';
- stubParameters[parameterIndex++] = new jsAst.Parameter(jsName);
+ stubParameters[parameterIndex++] = jsAst.Parameter(jsName);
targetArguments[count++] = js('#', jsName);
}
}
@@ -229,7 +229,7 @@
jsAst.Name name = member.isStatic ? null : _namer.invocationName(selector);
jsAst.Name callName =
(callSelector != null) ? _namer.invocationName(callSelector) : null;
- return new ParameterStubMethod(name, callName, function, element: member);
+ return ParameterStubMethod(name, callName, function, element: member);
}
DartType _eraseTypeVariablesToAny(DartType type) {
@@ -301,10 +301,10 @@
}
assert(emptySelectorSet.isEmpty);
- liveSelectors ??= const <Selector, SelectorConstraints>{};
- callSelectors ??= const <Selector, SelectorConstraints>{};
+ liveSelectors ??= const {};
+ callSelectors ??= const {};
- List<ParameterStubMethod> stubs = <ParameterStubMethod>[];
+ List<ParameterStubMethod> stubs = [];
if (liveSelectors.isEmpty &&
callSelectors.isEmpty &&
@@ -318,9 +318,9 @@
//
// For example, for the call-selector `call(x, y)` the renamed selector
// for member `foo` would be `foo(x, y)`.
- Set<Selector> renamedCallSelectors = new Set<Selector>();
+ Set<Selector> renamedCallSelectors = {};
- Set<Selector> stubSelectors = new Set<Selector>();
+ Set<Selector> stubSelectors = {};
// Start with closure-call selectors, since since they imply the generation
// of the non-call version.
@@ -341,7 +341,7 @@
for (Selector selector in callSelectors.keys) {
Selector renamedSelector =
- new Selector.call(member.memberName, selector.callStructure);
+ Selector.call(member.memberName, selector.callStructure);
renamedCallSelectors.add(renamedSelector);
if (!renamedSelector.appliesUnnamed(member)) {
@@ -364,7 +364,7 @@
// This is basically the same logic as above, but with type arguments.
if (selector.callStructure.typeArgumentCount == 0) {
if (memberTypeParameters > 0) {
- Selector renamedSelectorWithTypeArguments = new Selector.call(
+ Selector renamedSelectorWithTypeArguments = Selector.call(
member.memberName,
selector.callStructure
.withTypeArgumentCount(memberTypeParameters));
@@ -372,7 +372,7 @@
if (stubSelectors.add(renamedSelectorWithTypeArguments)) {
Selector closureSelector =
- new Selector.callClosureFrom(renamedSelectorWithTypeArguments);
+ Selector.callClosureFrom(renamedSelectorWithTypeArguments);
ParameterStubMethod stub = generateParameterStub(
member, renamedSelectorWithTypeArguments, closureSelector);
if (stub != null) {
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart b/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
index a3ad826..af94f35 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
@@ -16,8 +16,8 @@
/// [needsCheckedSetter] indicates that a checked getter is needed, and in this
/// case, [needsSetter] is always false. [needsCheckedSetter] is only true when
/// type assertions are enabled (checked mode).
-typedef void AcceptField(FieldEntity member, js.Name name, bool needsGetter,
- bool needsSetter, bool needsCheckedSetter);
+typedef AcceptField = void Function(FieldEntity member, js.Name name,
+ bool needsGetter, bool needsSetter, bool needsCheckedSetter);
class FieldVisitor {
final JElementEnvironment _elementEnvironment;
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index d993bf2..7e64084 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -130,7 +130,7 @@
this._sorter,
this._rtiNeededClasses,
this._mainFunction)
- : this.collector = new Collector(
+ : this.collector = Collector(
_commonElements,
_elementEnvironment,
_outputUnitData,
@@ -143,11 +143,11 @@
_rtiNeededClasses,
_generatedCode,
_sorter),
- this._registry = new Registry(_outputUnitData.mainOutputUnit, _sorter);
+ this._registry = Registry(_outputUnitData.mainOutputUnit, _sorter);
/// Mapping from [ClassEntity] to constructed [Class]. We need this to
/// update the superclass in the [Class].
- final Map<ClassEntity, Class> _classes = <ClassEntity, Class>{};
+ final Map<ClassEntity, Class> _classes = {};
/// Mapping from [ClassEntity] to constructed [ClassTypeData] object. Used to build
/// libraries.
@@ -155,11 +155,11 @@
/// Mapping from [OutputUnit] to constructed [Fragment]. We need this to
/// generate the deferredLoadingMap (to know which hunks to load).
- final Map<OutputUnit, Fragment> _outputs = <OutputUnit, Fragment>{};
+ final Map<OutputUnit, Fragment> _outputs = {};
/// Mapping from [ConstantValue] to constructed [Constant]. We need this to
/// update field-initializers to point to the ConstantModel.
- final Map<ConstantValue, Constant> _constants = <ConstantValue, Constant>{};
+ final Map<ConstantValue, Constant> _constants = {};
Set<Class> _unneededNativeClasses;
@@ -168,7 +168,7 @@
List<StubMethod> _jsInteropIsChecks = [];
final Set<TypeCheck> _jsInteropTypeChecks = {};
- Program buildProgram({bool storeFunctionTypesInMetadata: false}) {
+ Program buildProgram({bool storeFunctionTypesInMetadata = false}) {
collector.collect();
this._storeFunctionTypesInMetadata = storeFunctionTypesInMetadata;
@@ -237,7 +237,7 @@
_registry.deferredLibrariesMap.map(_buildDeferredFragment);
List<Fragment> fragments =
- new List<Fragment>.filled(_registry.librariesMapCount, null);
+ List<Fragment>.filled(_registry.librariesMapCount, null);
fragments[0] = mainFragment;
fragments.setAll(1, deferredFragments);
@@ -257,7 +257,7 @@
finalizers.add(namingFinalizer as js.TokenFinalizer);
}
- return new Program(fragments, _buildTypeToInterceptorMap(),
+ return Program(fragments, _buildTypeToInterceptorMap(),
_task.metadataCollector, finalizers,
needsNativeSupport: needsNativeSupport,
outputContainsConstantList: collector.outputContainsConstantList);
@@ -268,7 +268,7 @@
}
js.Expression _buildTypeToInterceptorMap() {
- InterceptorStubGenerator stubGenerator = new InterceptorStubGenerator(
+ InterceptorStubGenerator stubGenerator = InterceptorStubGenerator(
_commonElements,
_task.emitter,
_nativeCodegenEnqueuer,
@@ -281,7 +281,7 @@
MainFragment _buildMainFragment(LibrariesMap librariesMap) {
// Construct the main output from the libraries and the registered holders.
- MainFragment result = new MainFragment(
+ MainFragment result = MainFragment(
librariesMap.outputUnit,
"", // The empty string is the name for the main output file.
_buildInvokeMain(),
@@ -299,7 +299,7 @@
}
DeferredFragment _buildDeferredFragment(LibrariesMap librariesMap) {
- DeferredFragment result = new DeferredFragment(
+ DeferredFragment result = DeferredFragment(
librariesMap.outputUnit,
deferredPartFileName(_options, librariesMap.name, addExtension: false),
librariesMap.name,
@@ -314,7 +314,7 @@
List<Constant> _buildConstants(LibrariesMap librariesMap) {
List<ConstantValue> constantValues =
collector.outputConstantLists[librariesMap.outputUnit];
- if (constantValues == null) return const <Constant>[];
+ if (constantValues == null) return const [];
return constantValues
.map((ConstantValue value) => _constants[value])
.toList(growable: false);
@@ -323,7 +323,7 @@
List<StaticField> _buildStaticNonFinalFields(LibrariesMap librariesMap) {
List<FieldEntity> staticNonFinalFields =
collector.outputStaticNonFinalFieldLists[librariesMap.outputUnit];
- if (staticNonFinalFields == null) return const <StaticField>[];
+ if (staticNonFinalFields == null) return const [];
return staticNonFinalFields.map(_buildStaticField).toList(growable: false);
}
@@ -344,7 +344,7 @@
// building a static field. (Note that the static-state holder was
// already registered earlier, and that we just call the register to get
// the holder-instance.
- return new StaticField(element, name, null, code,
+ return StaticField(element, name, null, code,
isFinal: false,
isLazy: false,
isInitializedByConstant: initialValue != null,
@@ -375,15 +375,14 @@
// building a static field. (Note that the static-state holder was
// already registered earlier, and that we just call the register to get
// the holder-instance.
- return new StaticField(element, name, getterName, code,
+ return StaticField(element, name, getterName, code,
isFinal: !element.isAssignable,
isLazy: true,
usesNonNullableInitialization: element.library.isNonNullableByDefault);
}
List<Library> _buildLibraries(LibrariesMap librariesMap) {
- List<Library> libraries =
- new List<Library>.filled(librariesMap.length, null);
+ List<Library> libraries = List<Library>.filled(librariesMap.length, null);
int count = 0;
librariesMap.forEach((LibraryEntity library, List<ClassEntity> classes,
List<MemberEntity> members, List<ClassEntity> classTypeElements) {
@@ -399,7 +398,7 @@
// TODO(jacobr): register toString as used so that it is always accessible
// from JavaScript.
_classes[_commonElements.objectClass].callStubs.add(_buildStubMethod(
- new StringBackedName("toString"),
+ StringBackedName("toString"),
js.js('function() { return this.#(this) }', toStringInvocation)));
}
@@ -491,7 +490,7 @@
var stubName = _namer.invocationName(selector);
if (!stubNames.add(stubName.key)) continue;
var parameters =
- new List<String>.generate(argumentCount, (i) => 'p$i');
+ List<String>.generate(argumentCount, (i) => 'p$i');
// We intentionally generate the same stub method for direct
// calls and call-throughs of getters so that calling a
@@ -573,10 +572,10 @@
List<Method> methods = [];
List<StubMethod> callStubs = [];
- ClassStubGenerator classStubGenerator = new ClassStubGenerator(
+ ClassStubGenerator classStubGenerator = ClassStubGenerator(
_task.emitter, _commonElements, _namer, _codegenWorld, _closedWorld,
enableMinification: _options.enableMinification);
- RuntimeTypeGenerator runtimeTypeGenerator = new RuntimeTypeGenerator(
+ RuntimeTypeGenerator runtimeTypeGenerator = RuntimeTypeGenerator(
_commonElements, _outputUnitData, _task, _namer, _rtiChecks);
void visitInstanceMember(MemberEntity member) {
@@ -605,7 +604,7 @@
}
}
- List<StubMethod> noSuchMethodStubs = <StubMethod>[];
+ List<StubMethod> noSuchMethodStubs = [];
if (_backendUsage.isNoSuchMethodUsed &&
cls == _commonElements.objectClass) {
@@ -636,7 +635,7 @@
bool isMixinApplicationWithMembers = false;
if (!onlyForConstructorOrRti) {
if (_elementEnvironment.isMixinApplicationWithMembers(cls)) {
- List<MemberEntity> members = <MemberEntity>[];
+ List<MemberEntity> members = [];
void add(MemberEntity member) {
if (member.enclosingClass == cls) {
members.add(member);
@@ -651,7 +650,7 @@
_sorter.sortMembers(members).forEach(visitMember);
}
} else if (!_elementEnvironment.isMixinApplication(cls)) {
- List<MemberEntity> members = <MemberEntity>[];
+ List<MemberEntity> members = [];
_elementEnvironment.forEachLocalClassMember(cls, members.add);
_elementEnvironment.forEachInjectedClassMember(cls, members.add);
_elementEnvironment.forEachConstructorBody(cls, members.add);
@@ -677,8 +676,8 @@
cls, _generatedCode,
storeFunctionTypeInMetadata: _storeFunctionTypesInMetadata);
- List<StubMethod> checkedSetters = <StubMethod>[];
- List<StubMethod> isChecks = <StubMethod>[];
+ List<StubMethod> checkedSetters = [];
+ List<StubMethod> isChecks = [];
if (_nativeData.isJsInteropClass(cls)) {
// TODO(johnniwinther): Instead of generating all stubs for each
// js-interop class we should generate a stub for each implemented class.
@@ -794,7 +793,7 @@
var /* Map | List */ optionalParameterDefaultValues;
ParameterStructure parameterStructure = method.parameterStructure;
if (parameterStructure.namedParameters.isNotEmpty) {
- optionalParameterDefaultValues = new Map<String, ConstantValue>();
+ optionalParameterDefaultValues = Map<String, ConstantValue>();
_elementEnvironment.forEachParameter(method,
(DartType type, String name, ConstantValue defaultValue) {
if (parameterStructure.namedParameters.contains(name)) {
@@ -874,8 +873,7 @@
js.Name callName = null;
if (canTearOff) {
- Selector callSelector =
- new Selector.fromElement(element).toCallSelector();
+ Selector callSelector = Selector.fromElement(element).toCallSelector();
callName = _namer.invocationName(callSelector);
}
@@ -900,7 +898,7 @@
}
}
- return new InstanceMethod(element, name, code,
+ return InstanceMethod(element, name, code,
_generateParameterStubs(element, canTearOff, canBeApplied), callName,
needsTearOff: canTearOff,
tearOffName: tearOffName,
@@ -950,7 +948,7 @@
List<ParameterStubMethod> _generateParameterStubs(
FunctionEntity element, bool canTearOff, bool canBeApplied) {
- if (!_methodNeedsStubs(element)) return const <ParameterStubMethod>[];
+ if (!_methodNeedsStubs(element)) return const [];
ParameterStubGenerator generator = ParameterStubGenerator(
_task.emitter,
@@ -966,7 +964,7 @@
}
List<StubMethod> _generateInstantiationStubs(ClassEntity instantiationClass) {
- InstantiationStubGenerator generator = new InstantiationStubGenerator(
+ InstantiationStubGenerator generator = InstantiationStubGenerator(
_task, _namer, _closedWorld, _codegenWorld, _sourceInformationStrategy);
return generator.generateStubs(instantiationClass, null);
}
@@ -977,7 +975,7 @@
/// attribution.
Method _buildStubMethod(js.Name name, js.Expression code,
{MemberEntity element}) {
- return new StubMethod(name, code, element: element);
+ return StubMethod(name, code, element: element);
}
// The getInterceptor methods directly access the prototype of classes.
@@ -995,7 +993,7 @@
}
Iterable<StaticStubMethod> _generateGetInterceptorMethods() {
- InterceptorStubGenerator stubGenerator = new InterceptorStubGenerator(
+ InterceptorStubGenerator stubGenerator = InterceptorStubGenerator(
_commonElements,
_task.emitter,
_nativeCodegenEnqueuer,
@@ -1021,14 +1019,13 @@
SpecializedGetInterceptor interceptor = interceptorMap[name];
js.Expression code =
stubGenerator.generateGetInterceptorMethod(interceptor);
- return new StaticStubMethod(
- _commonElements.interceptorsLibrary, name, code);
+ return StaticStubMethod(_commonElements.interceptorsLibrary, name, code);
});
}
List<Field> _buildFields(
- {bool isHolderInterceptedClass: false, ClassEntity cls}) {
- List<Field> fields = <Field>[];
+ {bool isHolderInterceptedClass = false, ClassEntity cls}) {
+ List<Field> fields = [];
void visitField(FieldEntity field, js.Name name, bool needsGetter,
bool needsSetter, bool needsCheckedSetter) {
@@ -1091,7 +1088,7 @@
}
Iterable<StaticStubMethod> _generateOneShotInterceptors() {
- InterceptorStubGenerator stubGenerator = new InterceptorStubGenerator(
+ InterceptorStubGenerator stubGenerator = InterceptorStubGenerator(
_commonElements,
_task.emitter,
_nativeCodegenEnqueuer,
@@ -1118,8 +1115,7 @@
OneShotInterceptor interceptor = interceptorMap[name];
js.Expression code =
stubGenerator.generateOneShotInterceptor(interceptor);
- return new StaticStubMethod(
- _commonElements.interceptorsLibrary, name, code);
+ return StaticStubMethod(_commonElements.interceptorsLibrary, name, code);
});
}
@@ -1139,8 +1135,7 @@
js.Name callName = null;
if (needsTearOff) {
- Selector callSelector =
- new Selector.fromElement(element).toCallSelector();
+ Selector callSelector = Selector.fromElement(element).toCallSelector();
callName = _namer.invocationName(callSelector);
}
js.Expression functionType;
@@ -1163,7 +1158,7 @@
}
}
- return new StaticDartMethod(element, name, code,
+ return StaticDartMethod(element, name, code,
_generateParameterStubs(element, needsTearOff, canBeApplied), callName,
needsTearOff: needsTearOff,
tearOffName: tearOffName,
@@ -1182,7 +1177,7 @@
_registry.registerConstant(outputUnit, constantValue);
assert(!_constants.containsKey(constantValue));
js.Name name = _namer.constantName(constantValue);
- Constant constant = new Constant(name, constantValue);
+ Constant constant = Constant(name, constantValue);
_constants[constantValue] = constant;
}
}
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/registry.dart b/pkg/compiler/lib/src/js_emitter/program_builder/registry.dart
index 2e28a01..78e6cd2 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/registry.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/registry.dart
@@ -20,8 +20,7 @@
///
/// There exists exactly one instance per [OutputUnit].
class LibrariesMap {
- final Map<LibraryEntity, LibraryContents> _mapping =
- <LibraryEntity, LibraryContents>{};
+ final Map<LibraryEntity, LibraryContents> _mapping = {};
// It is very common to access the same library multiple times in a row, so
// we cache the last access.
@@ -41,7 +40,7 @@
LibraryContents _getMapping(LibraryEntity library) {
if (_lastLibrary != library) {
_lastLibrary = library;
- _lastMapping = _mapping.putIfAbsent(library, () => new LibraryContents());
+ _lastMapping = _mapping.putIfAbsent(library, () => LibraryContents());
}
return _lastMapping;
}
@@ -78,8 +77,7 @@
class Registry {
final OutputUnit _mainOutputUnit;
final Sorter _sorter;
- final Map<OutputUnit, LibrariesMap> _deferredLibrariesMap =
- <OutputUnit, LibrariesMap>{};
+ final Map<OutputUnit, LibrariesMap> _deferredLibrariesMap = {};
/// Cache for the last seen output unit.
OutputUnit _lastOutputUnit;
@@ -111,12 +109,12 @@
void registerOutputUnit(OutputUnit outputUnit) {
if (outputUnit == _mainOutputUnit) {
assert(mainLibrariesMap == null);
- mainLibrariesMap = new LibrariesMap.main(_mainOutputUnit);
+ mainLibrariesMap = LibrariesMap.main(_mainOutputUnit);
} else {
assert(!_deferredLibrariesMap.containsKey(outputUnit));
String name = outputUnit.name;
_deferredLibrariesMap[outputUnit] =
- new LibrariesMap.deferred(outputUnit, name);
+ LibrariesMap.deferred(outputUnit, name);
}
}
diff --git a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
index d8a9417..ca7d511 100644
--- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
@@ -20,7 +20,8 @@
import 'code_emitter_task.dart' show CodeEmitterTask;
// Function signatures used in the generation of runtime type information.
-typedef void FunctionTypeSignatureEmitter(ClassFunctionType classFunctionType);
+typedef FunctionTypeSignatureEmitter = void Function(
+ ClassFunctionType classFunctionType);
class TypeTest {
final jsAst.Name name;
@@ -48,22 +49,22 @@
/// The properties that must be installed on the prototype of the
/// JS constructor of the [ClassEntity] for which the is checks were
/// generated.
- final Map<ClassEntity, TypeTests> _properties = <ClassEntity, TypeTests>{};
+ final Map<ClassEntity, TypeTests> _properties = {};
void addIsTest(ClassEntity cls, jsAst.Name name, jsAst.Node expression) {
- TypeTests typeTests = _properties.putIfAbsent(cls, () => new TypeTests());
- typeTests.isTest = new TypeTest(name, expression);
+ TypeTests typeTests = _properties.putIfAbsent(cls, () => TypeTests());
+ typeTests.isTest = TypeTest(name, expression);
}
void addSubstitution(
ClassEntity cls, jsAst.Name name, jsAst.Node expression) {
- TypeTests typeTests = _properties.putIfAbsent(cls, () => new TypeTests());
- typeTests.substitution = new TypeTest(name, expression);
+ TypeTests typeTests = _properties.putIfAbsent(cls, () => TypeTests());
+ typeTests.substitution = TypeTest(name, expression);
}
void addSignature(ClassEntity cls, jsAst.Name name, jsAst.Node expression) {
- TypeTests typeTests = _properties.putIfAbsent(cls, () => new TypeTests());
- typeTests.signature = new TypeTest(name, expression);
+ TypeTests typeTests = _properties.putIfAbsent(cls, () => TypeTests());
+ typeTests.signature = TypeTest(name, expression);
}
void forEachProperty(
@@ -91,8 +92,8 @@
RuntimeTypeGenerator(CommonElements _commonElements, this._outputUnitData,
this.emitterTask, this._namer, this._rtiChecks)
- : _outputUnitVisitor = new _TypeContainedInOutputUnitVisitor(
- _commonElements, _outputUnitData);
+ : _outputUnitVisitor =
+ _TypeContainedInOutputUnitVisitor(_commonElements, _outputUnitData);
/// Generate "is tests" for [cls] itself, and the "is tests" for the
/// classes it implements and type argument substitution functions for these
@@ -112,8 +113,8 @@
/// type variables.
TypeTestProperties generateIsTests(ClassEntity classElement,
Map<MemberEntity, jsAst.Expression> generatedCode,
- {bool storeFunctionTypeInMetadata: true}) {
- TypeTestProperties result = new TypeTestProperties();
+ {bool storeFunctionTypeInMetadata = true}) {
+ TypeTestProperties result = TypeTestProperties();
// TODO(johnniwinther): Include function signatures in [ClassChecks].
void generateFunctionTypeSignature(ClassFunctionType classFunctionType) {
@@ -154,10 +155,8 @@
if (isDeferred) {
// The function type index must be offset by the number of types
// already loaded.
- encoding = new jsAst.Binary(
- '+',
- new jsAst.VariableUse(_namer.typesOffsetName),
- functionTypeIndex);
+ encoding = jsAst.Binary('+',
+ jsAst.VariableUse(_namer.typesOffsetName), functionTypeIndex);
} else {
encoding = functionTypeIndex;
}
@@ -188,7 +187,7 @@
ClassEntity cls,
FunctionTypeSignatureEmitter generateFunctionTypeSignature,
void emitTypeCheck(TypeCheck check)) {
- Setlet<ClassEntity> generated = new Setlet<ClassEntity>();
+ Setlet<ClassEntity> generated = Setlet();
// Precomputed is checks.
ClassChecks classChecks = _rtiChecks.requiredChecks[cls];
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 841e2a1..1f60860 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
@@ -34,14 +34,14 @@
js.PropertyAccess globalPropertyAccessForClass(ClassEntity element) {
js.Name name = _namer.globalPropertyNameForClass(element);
js.PropertyAccess pa =
- new js.PropertyAccess(_namer.readGlobalObjectForClass(element), name);
+ js.PropertyAccess(_namer.readGlobalObjectForClass(element), name);
return pa;
}
js.PropertyAccess globalPropertyAccessForMember(MemberEntity element) {
js.Name name = _namer.globalPropertyNameForMember(element);
js.PropertyAccess pa =
- new js.PropertyAccess(_namer.readGlobalObjectForMember(element), name);
+ js.PropertyAccess(_namer.readGlobalObjectForMember(element), name);
return pa;
}
@@ -52,7 +52,7 @@
@override
js.Expression isolateLazyInitializerAccess(FieldEntity element) {
- return new js.PropertyAccess(_namer.readGlobalObjectForMember(element),
+ return js.PropertyAccess(_namer.readGlobalObjectForMember(element),
_namer.lazyInitializerName(element));
}
@@ -84,8 +84,8 @@
@override
js.Expression staticClosureAccess(FunctionEntity element) {
- return new js.Call(
- new js.PropertyAccess(_namer.readGlobalObjectForMember(element),
+ return js.Call(
+ js.PropertyAccess(_namer.readGlobalObjectForMember(element),
_namer.staticClosureName(element)),
const []);
}
@@ -103,7 +103,7 @@
ModularEmitterImpl(
ModularNamer namer, this._registry, CompilerOptions options)
- : _constantEmitter = new ModularConstantEmitter(options, namer),
+ : _constantEmitter = ModularConstantEmitter(options, namer),
super(namer);
@override
@@ -116,16 +116,15 @@
if (expression != null) {
return expression;
}
- expression =
- new ModularExpression(ModularExpressionKind.constant, constant);
+ expression = ModularExpression(ModularExpressionKind.constant, constant);
_registry.registerModularExpression(expression);
return expression;
}
@override
js.Expression generateEmbeddedGlobalAccess(String global) {
- js.Expression expression = new ModularExpression(
- ModularExpressionKind.embeddedGlobalAccess, global);
+ js.Expression expression =
+ ModularExpression(ModularExpressionKind.embeddedGlobalAccess, global);
_registry.registerModularExpression(expression);
return expression;
}
@@ -167,7 +166,7 @@
this._task,
bool shouldGenerateSourceMap)
: super(namer) {
- _emitter = new ModelEmitter(
+ _emitter = ModelEmitter(
options,
_reporter,
outputProvider,
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 66717cc..6bf7046 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
@@ -719,7 +719,7 @@
'throwLateFieldADI': _emitter
.staticFunctionAccess(_closedWorld.commonElements.throwLateFieldADI),
'operatorIsPrefix': js.string(_namer.fixedNames.operatorIsPrefix),
- 'tearOffCode': new js.Block(
+ 'tearOffCode': js.Block(
buildTearOffCode(_options, _emitter, _closedWorld.commonElements)),
'embeddedTypes': generateEmbeddedGlobalAccess(TYPES),
'embeddedInterceptorTags':
@@ -772,7 +772,7 @@
'nativeSupport': emitNativeSupport(fragment),
'jsInteropSupport': jsInteropAnalysis.buildJsInteropBootstrap(
_codegenWorld, _closedWorld.nativeData, _namer) ??
- new js.EmptyStatement(),
+ js.EmptyStatement(),
'invokeMain': fragment.invokeMain,
'call0selector': js.quoteName(call0Name),
@@ -808,7 +808,7 @@
holderCode);
js.Expression code = js.js(_deferredBoilerplate, {
// TODO(floitsch): don't just reference 'init'.
- 'embeddedGlobalsObject': new js.Parameter('init'),
+ 'embeddedGlobalsObject': js.Parameter('init'),
'staticState': DeferredHolderParameter(),
'updateHolders': updateHolders,
'prototypes': fragment.classPrototypes,
@@ -850,7 +850,7 @@
/// Finalizing holders must be the last step of the emitter.
void finalizeCode(String resourceName, js.Node code,
Map<Entity, List<js.Property>> holderCode,
- {bool finalizeHolders: false}) {
+ {bool finalizeHolders = false}) {
StringReferenceFinalizer stringFinalizer =
StringReferenceFinalizerImpl(_options.enableMinification);
addCodeToFinalizer(stringFinalizer.addCode, code, holderCode);
@@ -904,7 +904,7 @@
}
for (Class cls in library.classes) {
js.Expression constructor = emitConstructor(cls);
- var property = new js.Property(js.quoteName(cls.name), constructor);
+ var property = js.Property(js.quoteName(cls.name), constructor);
(holderCode[cls.element] ??= []).add(property);
registerEntityAst(cls.element, property, library: library.element);
}
@@ -961,7 +961,7 @@
// Parameters are named t0, t1, etc, so '_' will not conflict. Forcing '_'
// in minified mode works because no parameter or local also minifies to
// '_' (the minifier doesn't know '_' is available).
- js.Name underscore = new StringBackedName('_');
+ js.Name underscore = StringBackedName('_');
statements.add(js.js.statement('var # = this;', underscore));
thisRef = underscore;
} else {
@@ -1000,7 +1000,7 @@
previousConstant = constant;
} else {
flushAssignment();
- js.Parameter parameter = new js.Parameter('t${parameters.length}');
+ js.Parameter parameter = js.Parameter('t${parameters.length}');
parameters.add(parameter);
statements.add(
js.js.statement('#.# = #', [thisRef, field.name, parameter.name]));
@@ -1009,7 +1009,7 @@
flushAssignment();
if (cls.hasRtiField) {
- js.Parameter parameter = new js.Parameter('t${parameters.length}');
+ js.Parameter parameter = js.Parameter('t${parameters.length}');
parameters.add(parameter);
statements.add(js.js.statement(
'#.# = #', [thisRef, _namer.rtiFieldJsName, parameter.name]));
@@ -1044,7 +1044,7 @@
return proto;
}).toList(growable: false);
- return new js.Block(assignments);
+ return js.Block(assignments);
}
/// Emits the prototype of the given class [cls].
@@ -1125,7 +1125,7 @@
js.string(_namer.fixedNames.defaultValuesField), js.LiteralNull()));
}
- return new js.ObjectInitializer(properties);
+ return js.ObjectInitializer(properties);
}
/// Emits the given instance [method].
@@ -1201,7 +1201,7 @@
collect(superclass);
}
- subclasses.putIfAbsent(superclass, () => <Class>[]).add(cls);
+ subclasses.putIfAbsent(superclass, () => []).add(cls);
seen.add(cls);
}
@@ -1223,9 +1223,8 @@
for (Class superclass in subclasses.keys) {
List<Class> list = subclasses[superclass];
- js.Expression superclassReference = (superclass == null)
- ? new js.LiteralNull()
- : classReference(superclass);
+ js.Expression superclassReference =
+ (superclass == null) ? js.LiteralNull() : classReference(superclass);
if (list.length == 1) {
Class cls = list.single;
var statement = js.js.statement('#(#, #)', [
@@ -1305,12 +1304,12 @@
if (method.optionalParameterDefaultValues is List) {
List<ConstantValue> defaultValues = method.optionalParameterDefaultValues;
if (defaultValues.isEmpty) {
- return new js.LiteralNull();
+ return js.LiteralNull();
}
Iterable<js.Expression> elements =
defaultValues.map(generateConstantReference);
- return js.js('function() { return #; }',
- new js.ArrayInitializer(elements.toList()));
+ return js.js(
+ 'function() { return #; }', js.ArrayInitializer(elements.toList()));
} else {
Map<String, ConstantValue> defaultValues =
method.optionalParameterDefaultValues;
@@ -1323,10 +1322,10 @@
for (String name in names) {
ConstantValue value = defaultValues[name];
properties.add(
- new js.Property(js.string(name), generateConstantReference(value)));
+ js.Property(js.string(name), generateConstantReference(value)));
}
return js.js(
- 'function() { return #; }', new js.ObjectInitializer(properties));
+ 'function() { return #; }', js.ObjectInitializer(properties));
}
}
@@ -1334,7 +1333,7 @@
/// profiles.
// TODO(sra): Should this be conditional?
js.Statement wrapPhase(String name, List<js.Statement> statements) {
- js.Block block = new js.Block(statements);
+ js.Block block = js.Block(statements);
if (statements.isEmpty) return block;
return js.js.statement('(function #(){#})();', [name, block]);
}
@@ -1668,21 +1667,20 @@
DeferredLoadingState deferredLoadingState) {
List<js.Property> globals = [];
- globals.add(new js.Property(
+ globals.add(js.Property(
js.string(DEFERRED_INITIALIZED), js.js("Object.create(null)")));
String deferredGlobal = ModelEmitter.deferredInitializersGlobal;
js.Expression isHunkLoadedFunction =
js.js("function(hash) { return !!$deferredGlobal[hash]; }");
- globals
- .add(new js.Property(js.string(IS_HUNK_LOADED), isHunkLoadedFunction));
+ globals.add(js.Property(js.string(IS_HUNK_LOADED), isHunkLoadedFunction));
js.Expression isHunkInitializedFunction = js.js(
"function(hash) { return !!#deferredInitialized[hash]; }", {
'deferredInitialized': generateEmbeddedGlobalAccess(DEFERRED_INITIALIZED)
});
- globals.add(new js.Property(
- js.string(IS_HUNK_INITIALIZED), isHunkInitializedFunction));
+ globals.add(
+ js.Property(js.string(IS_HUNK_INITIALIZED), isHunkInitializedFunction));
/// See [finalizeDeferredLoadingData] for the format of the deferred hunk.
js.Expression initializeLoadedHunkFunction = js.js("""
@@ -1698,14 +1696,14 @@
'deferredInitialized': generateEmbeddedGlobalAccess(DEFERRED_INITIALIZED)
});
- globals.add(new js.Property(
+ globals.add(js.Property(
js.string(INITIALIZE_LOADED_HUNK), initializeLoadedHunkFunction));
- globals.add(new js.Property(js.string(DEFERRED_LIBRARY_PARTS),
+ globals.add(js.Property(js.string(DEFERRED_LIBRARY_PARTS),
deferredLoadingState.deferredLibraryParts));
- globals.add(new js.Property(
+ globals.add(js.Property(
js.string(DEFERRED_PART_URIS), deferredLoadingState.deferredPartUris));
- globals.add(new js.Property(js.string(DEFERRED_PART_HASHES),
+ globals.add(js.Property(js.string(DEFERRED_PART_HASHES),
deferredLoadingState.deferredPartHashes));
return globals;
@@ -1783,12 +1781,12 @@
];
// TODO(floitsch): this should probably be on a per-fragment basis.
nativeClassesNeedingUnmangledName.forEach((element) {
- names.add(new js.Property(
+ names.add(js.Property(
js.quoteName(_namer.className(element)), js.string(element.name)));
});
- return new js.Property(
- js.string(MANGLED_GLOBAL_NAMES), new js.ObjectInitializer(names));
+ return js.Property(
+ js.string(MANGLED_GLOBAL_NAMES), js.ObjectInitializer(names));
}
/// Emits the [METADATA] embedded global.
@@ -1799,7 +1797,7 @@
List<js.Property> metadataGlobals = [];
js.Property createGlobal(js.Expression metadata, String global) {
- return new js.Property(js.string(global), metadata);
+ return js.Property(js.string(global), metadata);
}
var mainUnit = program.mainFragment.outputUnit;
@@ -1837,8 +1835,8 @@
// therefore unused in this emitter.
// TODO(johnniwinther): Remove the need for adding an empty list of
// mangled names.
- globals.add(js.Property(
- js.string(MANGLED_NAMES), js.ObjectInitializer(<js.Property>[])));
+ globals
+ .add(js.Property(js.string(MANGLED_NAMES), js.ObjectInitializer([])));
globals.addAll(emitMetadata(program));
@@ -2045,13 +2043,13 @@
if (cls.nativeLeafTags != null) {
for (String tag in cls.nativeLeafTags) {
interceptorsByTag[tag] = classReference(cls);
- leafTags[tag] = new js.LiteralBool(true);
+ leafTags[tag] = js.LiteralBool(true);
}
}
if (cls.nativeNonLeafTags != null) {
for (String tag in cls.nativeNonLeafTags) {
interceptorsByTag[tag] = classReference(cls);
- leafTags[tag] = new js.LiteralBool(false);
+ leafTags[tag] = js.LiteralBool(false);
}
if (cls.nativeExtensions != null) {
List<Class> subclasses = cls.nativeExtensions;
@@ -2110,9 +2108,9 @@
}
class DeferredLoadingState {
- final deferredLibraryParts = new DeferredPrimaryExpression();
- final deferredPartUris = new DeferredPrimaryExpression();
- final deferredPartHashes = new DeferredPrimaryExpression();
+ final deferredLibraryParts = DeferredPrimaryExpression();
+ final deferredPartUris = DeferredPrimaryExpression();
+ final deferredPartHashes = DeferredPrimaryExpression();
}
class DeferredPrimaryExpression extends js.DeferredExpression {
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
index 9f05395..009853e 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
@@ -157,10 +157,10 @@
this._sourceInformationStrategy,
RecipeEncoder rtiRecipeEncoder,
this._shouldGenerateSourceMap)
- : _constantOrdering = new ConstantOrdering(_closedWorld.sorter),
+ : _constantOrdering = ConstantOrdering(_closedWorld.sorter),
fragmentMerger = FragmentMerger(_options,
_closedWorld.elementEnvironment, _closedWorld.outputUnitData) {
- this.constantEmitter = new ConstantEmitter(
+ this.constantEmitter = ConstantEmitter(
_options,
_namer,
_closedWorld.commonElements,
@@ -229,9 +229,9 @@
int emitProgram(Program program, CodegenWorld codegenWorld) {
MainFragment mainFragment = program.fragments.first;
List<DeferredFragment> deferredFragments =
- new List<DeferredFragment>.from(program.deferredFragments);
+ List<DeferredFragment>.from(program.deferredFragments);
- FragmentEmitter fragmentEmitter = new FragmentEmitter(
+ FragmentEmitter fragmentEmitter = FragmentEmitter(
_options,
_dumpInfoTask,
_namer,
@@ -305,12 +305,12 @@
finalizedFragmentsToLoad);
// Emit main Fragment.
- var deferredLoadingState = new DeferredLoadingState();
+ var deferredLoadingState = DeferredLoadingState();
js.Statement mainCode = fragmentEmitter.emitMainFragment(
program, finalizedFragmentsToLoad, deferredLoadingState);
// Count tokens and run finalizers.
- js.TokenCounter counter = new js.TokenCounter();
+ js.TokenCounter counter = js.TokenCounter();
for (var emittedFragments in deferredFragmentsCode.values) {
for (var emittedFragment in emittedFragments) {
counter.countTokens(emittedFragment.code);
@@ -411,7 +411,7 @@
if (_shouldGenerateSourceMap) {
_task.measureSubtask('source-maps', () {
locationCollector = LocationCollector();
- codeOutputListeners = <CodeOutputListener>[locationCollector];
+ codeOutputListeners = [locationCollector];
});
}
@@ -481,7 +481,7 @@
LocationCollector locationCollector;
if (_shouldGenerateSourceMap) {
_task.measureSubtask('source-maps', () {
- locationCollector = new LocationCollector();
+ locationCollector = LocationCollector();
outputListeners.add(locationCollector);
});
}
@@ -556,13 +556,13 @@
// deferredInitializer.current = <pretty-printed code>;
// deferredInitializer[<hash>] = deferredInitializer.current;
- js.Program program = new js.Program([
+ js.Program program = js.Program([
if (isFirst) buildGeneratedBy(),
if (isFirst) buildDeferredInitializerGlobal(),
js.js.statement('$deferredInitializersGlobal.current = #', code)
]);
- Hasher hasher = new Hasher();
+ Hasher hasher = Hasher();
CodeBuffer buffer = js.createCodeBuffer(
program, _options, _sourceInformationStrategy,
monitor: _dumpInfoTask, listeners: [hasher]);
diff --git a/pkg/compiler/lib/src/js_model/closure.dart b/pkg/compiler/lib/src/js_model/closure.dart
index 216f25e..353d586 100644
--- a/pkg/compiler/lib/src/js_model/closure.dart
+++ b/pkg/compiler/lib/src/js_model/closure.dart
@@ -55,19 +55,19 @@
source.begin(tag);
// TODO(johnniwinther): Support shared [ScopeInfo].
Map<MemberEntity, ScopeInfo> scopeMap = source.readMemberMap(
- (MemberEntity member) => new ScopeInfo.readFromDataSource(source));
- Map<ir.TreeNode, CapturedScope> capturedScopesMap = source
- .readTreeNodeMap(() => new CapturedScope.readFromDataSource(source));
+ (MemberEntity member) => ScopeInfo.readFromDataSource(source));
+ Map<ir.TreeNode, CapturedScope> capturedScopesMap =
+ source.readTreeNodeMap(() => CapturedScope.readFromDataSource(source));
Map<MemberEntity, CapturedScope> capturedScopeForSignatureMap =
- source.readMemberMap((MemberEntity member) =>
- new CapturedScope.readFromDataSource(source));
+ source.readMemberMap(
+ (MemberEntity member) => CapturedScope.readFromDataSource(source));
Map<ir.LocalFunction, ClosureRepresentationInfo>
localClosureRepresentationMap = source.readTreeNodeMap(
- () => new ClosureRepresentationInfo.readFromDataSource(source));
+ () => ClosureRepresentationInfo.readFromDataSource(source));
Map<MemberEntity, MemberEntity> enclosingMembers =
source.readMemberMap((member) => source.readMember());
source.end(tag);
- return new ClosureDataImpl(
+ return ClosureDataImpl(
elementMap,
scopeMap,
capturedScopesMap,
@@ -326,7 +326,7 @@
closureModels.forEach((MemberEntity member, ClosureScopeModel model) {
Map<ir.VariableDeclaration, JRecordField> allBoxedVariables =
_elementMap.makeRecordContainer(model.scopeInfo, member);
- _scopeMap[member] = new JsScopeInfo.from(
+ _scopeMap[member] = JsScopeInfo.from(
allBoxedVariables, model.scopeInfo, member.enclosingClass);
model.capturedScopesMap
@@ -336,10 +336,10 @@
_updateScopeBasedOnRtiNeed(scope, rtiNeed, member);
if (scope is KernelCapturedLoopScope) {
- _capturedScopesMap[node] = new JsCapturedLoopScope.from(
+ _capturedScopesMap[node] = JsCapturedLoopScope.from(
boxedVariables, scope, member.enclosingClass);
} else {
- _capturedScopesMap[node] = new JsCapturedScope.from(
+ _capturedScopesMap[node] = JsCapturedScope.from(
boxedVariables, scope, member.enclosingClass);
}
allBoxedVariables.addAll(boxedVariables);
@@ -372,17 +372,17 @@
model.capturedScopesMap[functionNode];
assert(capturedScope is! KernelCapturedLoopScope);
KernelCapturedScope signatureCapturedScope =
- new KernelCapturedScope.forSignature(capturedScope);
+ KernelCapturedScope.forSignature(capturedScope);
_updateScopeBasedOnRtiNeed(signatureCapturedScope, rtiNeed, member);
_capturedScopeForSignatureMap[closureClassInfo.signatureMethod] =
- new JsCapturedScope.from(
+ JsCapturedScope.from(
{}, signatureCapturedScope, member.enclosingClass);
}
}
callMethods.add(closureClassInfo.callMethod);
}
});
- return new ClosureDataImpl(
+ return ClosureDataImpl(
_elementMap,
_scopeMap,
_capturedScopesMap,
@@ -447,8 +447,7 @@
JsScopeInfo.from(
this._boxedVariables, KernelScopeInfo info, ClassEntity enclosingClass)
- : this.thisLocal =
- info.hasThisLocal ? new ThisLocal(enclosingClass) : null,
+ : this.thisLocal = info.hasThisLocal ? ThisLocal(enclosingClass) : null,
this._localsUsedInTryOrSync = info.localsUsedInTryOrSync;
void _ensureBoxedVariableCache(KernelToLocalsMap localsMap) {
@@ -489,7 +488,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('this=$thisLocal,');
sb.write('localsUsedInTryOrSync={${_localsUsedInTryOrSync.join(', ')}}');
return sb.toString();
@@ -560,7 +559,7 @@
() => source.readMember());
Local context = source.readLocalOrNull();
source.end(tag);
- return new JsCapturedScope.internal(
+ return JsCapturedScope.internal(
localsUsedInTryOrSync, thisLocal, boxedVariables, context);
}
@@ -614,7 +613,7 @@
List<ir.VariableDeclaration> boxedLoopVariables =
source.readTreeNodes<ir.VariableDeclaration>();
source.end(tag);
- return new JsCapturedLoopScope.internal(localsUsedInTryOrSync, thisLocal,
+ return JsCapturedLoopScope.internal(localsUsedInTryOrSync, thisLocal,
boxedVariables, context, boxedLoopVariables);
}
@@ -854,7 +853,7 @@
JLibrary library = source.readLibrary();
String name = source.readString();
source.end(tag);
- return new JClosureClass(library, name);
+ return JClosureClass(library, name);
}
@override
@@ -910,7 +909,7 @@
: this.internal(
containingClass.closureClassEntity.library,
containingClass.closureClassEntity,
- new Name(name, containingClass.closureClassEntity.library),
+ Name(name, containingClass.closureClassEntity.library),
declaredName,
isAssignable: isAssignable,
isConst: isConst);
@@ -928,8 +927,8 @@
bool isConst = source.readBool();
bool isAssignable = source.readBool();
source.end(tag);
- return new JClosureField.internal(
- cls.library, cls, new Name(name, cls.library), declaredName,
+ return JClosureField.internal(
+ cls.library, cls, Name(name, cls.library), declaredName,
isAssignable: isAssignable, isConst: isConst);
}
@@ -971,13 +970,12 @@
factory RecordClassData.readFromDataSource(DataSource source) {
source.begin(tag);
- ClassDefinition definition = new ClassDefinition.readFromDataSource(source);
+ ClassDefinition definition = ClassDefinition.readFromDataSource(source);
InterfaceType thisType = source.readDartType();
InterfaceType supertype = source.readDartType();
- OrderedTypeSet orderedTypeSet =
- new OrderedTypeSet.readFromDataSource(source);
+ OrderedTypeSet orderedTypeSet = OrderedTypeSet.readFromDataSource(source);
source.end(tag);
- return new RecordClassData(definition, thisType, supertype, orderedTypeSet);
+ return RecordClassData(definition, thisType, supertype, orderedTypeSet);
}
@override
@@ -1036,7 +1034,7 @@
JLibrary library = source.readLibrary();
String name = source.readString();
source.end(tag);
- return new JRecord(library, name);
+ return JRecord(library, name);
}
@override
@@ -1067,7 +1065,7 @@
JRecordField(String name, this.box, {bool isConst})
: super(box.container.library, box.container,
- new Name(name, box.container.library),
+ Name(name, box.container.library),
isStatic: false, isAssignable: true, isConst: isConst);
factory JRecordField.readFromDataSource(DataSource source) {
@@ -1076,8 +1074,7 @@
JClass enclosingClass = source.readClass();
bool isConst = source.readBool();
source.end(tag);
- return new JRecordField(name, new BoxLocal(enclosingClass),
- isConst: isConst);
+ return JRecordField(name, BoxLocal(enclosingClass), isConst: isConst);
}
@override
@@ -1116,14 +1113,13 @@
factory ClosureClassData.readFromDataSource(DataSource source) {
source.begin(tag);
- ClassDefinition definition = new ClassDefinition.readFromDataSource(source);
+ ClassDefinition definition = ClassDefinition.readFromDataSource(source);
InterfaceType thisType = source.readDartType();
InterfaceType supertype = source.readDartType();
- OrderedTypeSet orderedTypeSet =
- new OrderedTypeSet.readFromDataSource(source);
+ OrderedTypeSet orderedTypeSet = OrderedTypeSet.readFromDataSource(source);
FunctionType callType = source.readDartType();
source.end(tag);
- return new ClosureClassData(definition, thisType, supertype, orderedTypeSet)
+ return ClosureClassData(definition, thisType, supertype, orderedTypeSet)
..callType = callType;
}
@@ -1154,7 +1150,7 @@
source.begin(tag);
SourceSpan location = source.readSourceSpan();
source.end(tag);
- return new ClosureClassDefinition(location);
+ return ClosureClassDefinition(location);
}
@override
@@ -1170,7 +1166,7 @@
@override
ir.Node get node =>
- throw new UnsupportedError('ClosureClassDefinition.node for $location');
+ throw UnsupportedError('ClosureClassDefinition.node for $location');
@override
String toString() => 'ClosureClassDefinition(kind:$kind,location:$location)';
@@ -1186,7 +1182,7 @@
@override
StaticTypeCache get staticTypes {
// The cached types are stored in the data for enclosing member.
- throw new UnsupportedError("ClosureMemberData.staticTypes");
+ throw UnsupportedError("ClosureMemberData.staticTypes");
}
@override
@@ -1221,14 +1217,14 @@
factory ClosureFunctionData.readFromDataSource(DataSource source) {
source.begin(tag);
ClosureMemberDefinition definition =
- new MemberDefinition.readFromDataSource(source);
+ MemberDefinition.readFromDataSource(source);
InterfaceType memberThisType = source.readDartType(allowNull: true);
FunctionType functionType = source.readDartType();
ir.FunctionNode functionNode = source.readTreeNode();
ClassTypeVariableAccess classTypeVariableAccess =
source.readEnum(ClassTypeVariableAccess.values);
source.end(tag);
- return new ClosureFunctionData(definition, memberThisType, functionType,
+ return ClosureFunctionData(definition, memberThisType, functionType,
functionNode, classTypeVariableAccess);
}
@@ -1274,11 +1270,10 @@
factory ClosureFieldData.readFromDataSource(DataSource source) {
source.begin(tag);
- MemberDefinition definition =
- new MemberDefinition.readFromDataSource(source);
+ MemberDefinition definition = MemberDefinition.readFromDataSource(source);
InterfaceType memberThisType = source.readDartType(allowNull: true);
source.end(tag);
- return new ClosureFieldData(definition, memberThisType);
+ return ClosureFieldData(definition, memberThisType);
}
@override
@@ -1344,7 +1339,7 @@
SourceSpan location = source.readSourceSpan();
ir.TreeNode node = source.readTreeNode();
source.end(tag);
- return new ClosureMemberDefinition(location, kind, node);
+ return ClosureMemberDefinition(location, kind, node);
}
@override
@@ -1374,7 +1369,7 @@
source.begin(tag);
SourceSpan location = source.readSourceSpan();
source.end(tag);
- return new RecordContainerDefinition(location);
+ return RecordContainerDefinition(location);
}
@override
@@ -1389,8 +1384,8 @@
ClassKind get kind => ClassKind.record;
@override
- ir.Node get node => throw new UnsupportedError(
- 'RecordContainerDefinition.node for $location');
+ ir.Node get node =>
+ throw UnsupportedError('RecordContainerDefinition.node for $location');
@override
String toString() =>
diff --git a/pkg/compiler/lib/src/js_model/element_map.dart b/pkg/compiler/lib/src/js_model/element_map.dart
index d63ee32..a7526f4 100644
--- a/pkg/compiler/lib/src/js_model/element_map.dart
+++ b/pkg/compiler/lib/src/js_model/element_map.dart
@@ -98,7 +98,7 @@
// constant expressions during resolution.
ConstantValue getConstantValue(
ir.Member memberContext, ir.Expression expression,
- {bool requireConstant: true, bool implicitNull: false});
+ {bool requireConstant = true, bool implicitNull = false});
/// Returns the [ConstantValue] for the sentinel used to indicate that a
/// parameter is required.
@@ -342,17 +342,17 @@
MemberKind kind = source.readEnum(MemberKind.values);
switch (kind) {
case MemberKind.regular:
- return new RegularMemberDefinition.readFromDataSource(source);
+ return RegularMemberDefinition.readFromDataSource(source);
case MemberKind.constructor:
case MemberKind.constructorBody:
case MemberKind.signature:
case MemberKind.generatorBody:
- return new SpecialMemberDefinition.readFromDataSource(source, kind);
+ return SpecialMemberDefinition.readFromDataSource(source, kind);
case MemberKind.closureCall:
case MemberKind.closureField:
- return new ClosureMemberDefinition.readFromDataSource(source, kind);
+ return ClosureMemberDefinition.readFromDataSource(source, kind);
}
- throw new UnsupportedError("Unexpected MemberKind $kind");
+ throw UnsupportedError("Unexpected MemberKind $kind");
}
/// Serializes this [MemberDefinition] to [sink].
@@ -382,7 +382,7 @@
source.begin(tag);
ir.Member node = source.readMemberNode();
source.end(tag);
- return new RegularMemberDefinition(node);
+ return RegularMemberDefinition(node);
}
@override
@@ -422,7 +422,7 @@
source.begin(tag);
ir.TreeNode node = source.readTreeNode();
source.end(tag);
- return new SpecialMemberDefinition(node, kind);
+ return SpecialMemberDefinition(node, kind);
}
@override
@@ -458,13 +458,13 @@
ClassKind kind = source.readEnum(ClassKind.values);
switch (kind) {
case ClassKind.regular:
- return new RegularClassDefinition.readFromDataSource(source);
+ return RegularClassDefinition.readFromDataSource(source);
case ClassKind.closure:
- return new ClosureClassDefinition.readFromDataSource(source);
+ return ClosureClassDefinition.readFromDataSource(source);
case ClassKind.record:
- return new RecordContainerDefinition.readFromDataSource(source);
+ return RecordContainerDefinition.readFromDataSource(source);
}
- throw new UnsupportedError("Unexpected ClassKind $kind");
+ throw UnsupportedError("Unexpected ClassKind $kind");
}
/// Serializes this [ClassDefinition] to [sink].
@@ -486,7 +486,7 @@
source.begin(tag);
ir.Class node = source.readClassNode();
source.end(tag);
- return new RegularClassDefinition(node);
+ return RegularClassDefinition(node);
}
@override
@@ -527,7 +527,7 @@
ir.FunctionNode node,
ParameterStructure parameterStructure,
void f(ir.VariableDeclaration parameter, {bool isOptional, bool isElided}),
- {bool useNativeOrdering: false}) {
+ {bool useNativeOrdering = false}) {
for (int position = 0;
position < node.positionalParameters.length;
position++) {
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 364ce65..7a87248 100644
--- a/pkg/compiler/lib/src/js_model/element_map_impl.dart
+++ b/pkg/compiler/lib/src/js_model/element_map_impl.dart
@@ -90,13 +90,13 @@
JProgramEnv programEnv;
final EntityDataEnvMap<IndexedLibrary, JLibraryData, JLibraryEnv> libraries =
- new EntityDataEnvMap<IndexedLibrary, JLibraryData, JLibraryEnv>();
+ EntityDataEnvMap<IndexedLibrary, JLibraryData, JLibraryEnv>();
final EntityDataEnvMap<IndexedClass, JClassData, JClassEnv> classes =
- new EntityDataEnvMap<IndexedClass, JClassData, JClassEnv>();
+ EntityDataEnvMap<IndexedClass, JClassData, JClassEnv>();
final EntityDataMap<IndexedMember, JMemberData> members =
- new EntityDataMap<IndexedMember, JMemberData>();
+ EntityDataMap<IndexedMember, JMemberData>();
final EntityDataMap<IndexedTypeVariable, JTypeVariableData> typeVariables =
- new EntityDataMap<IndexedTypeVariable, JTypeVariableData>();
+ EntityDataMap<IndexedTypeVariable, JTypeVariableData>();
final Map<ir.Library, IndexedLibrary> libraryMap = {};
final Map<ir.Class, IndexedClass> classMap = {};
@@ -134,11 +134,11 @@
Map<MemberEntity, MemberUsage> liveMemberUsage,
AnnotationsData annotations)
: this.options = _elementMap.options {
- _elementEnvironment = new JsElementEnvironment(this);
- _typeConverter = new DartTypeConverter(this);
- _types = new KernelDartTypes(this, options);
- _commonElements = new CommonElementsImpl(_types, _elementEnvironment);
- _constantValuefier = new ConstantValuefier(this);
+ _elementEnvironment = JsElementEnvironment(this);
+ _typeConverter = DartTypeConverter(this);
+ _types = KernelDartTypes(this, options);
+ _commonElements = CommonElementsImpl(_types, _elementEnvironment);
+ _constantValuefier = ConstantValuefier(this);
programEnv = _elementMap.env.convert();
for (int libraryIndex = 0;
@@ -147,7 +147,7 @@
IndexedLibrary oldLibrary = _elementMap.libraries.getEntity(libraryIndex);
KLibraryEnv oldEnv = _elementMap.libraries.getEnv(oldLibrary);
KLibraryData data = _elementMap.libraries.getData(oldLibrary);
- IndexedLibrary newLibrary = new JLibrary(oldLibrary.name,
+ IndexedLibrary newLibrary = JLibrary(oldLibrary.name,
oldLibrary.canonicalUri, oldLibrary.isNonNullableByDefault);
JLibraryEnv newEnv = oldEnv.convert(_elementMap, liveMemberUsage);
libraryMap[oldEnv.library] =
@@ -165,8 +165,8 @@
KClassData data = _elementMap.classes.getData(oldClass);
IndexedLibrary oldLibrary = oldClass.library;
LibraryEntity newLibrary = libraries.getEntity(oldLibrary.libraryIndex);
- IndexedClass newClass = new JClass(newLibrary, oldClass.name,
- isAbstract: oldClass.isAbstract);
+ IndexedClass newClass =
+ JClass(newLibrary, oldClass.name, isAbstract: oldClass.isAbstract);
JClassEnv newEnv = env.convert(_elementMap, liveMemberUsage);
classMap[env.cls] = classes.register(newClass, data.convert(), newEnv);
assert(newClass.classIndex == oldClass.classIndex);
@@ -189,11 +189,11 @@
ClassEntity newClass =
oldClass != null ? classes.getEntity(oldClass.classIndex) : null;
IndexedMember newMember;
- Name memberName = new Name(oldMember.memberName.text, newLibrary,
+ Name memberName = Name(oldMember.memberName.text, newLibrary,
isSetter: oldMember.memberName.isSetter);
if (oldMember.isField) {
IndexedField field = oldMember;
- newMember = new JField(newLibrary, newClass, memberName,
+ newMember = JField(newLibrary, newClass, memberName,
isStatic: field.isStatic,
isAssignable: field.isAssignable,
isConst: field.isConst);
@@ -205,27 +205,27 @@
: memberUsage.invokedParameters;
if (constructor.isFactoryConstructor) {
// TODO(redemption): This should be a JFunction.
- newMember = new JFactoryConstructor(
+ newMember = JFactoryConstructor(
newClass, memberName, parameterStructure,
isExternal: constructor.isExternal,
isConst: constructor.isConst,
isFromEnvironmentConstructor:
constructor.isFromEnvironmentConstructor);
} else {
- newMember = new JGenerativeConstructor(
+ newMember = JGenerativeConstructor(
newClass, memberName, parameterStructure,
isExternal: constructor.isExternal, isConst: constructor.isConst);
}
} else if (oldMember.isGetter) {
IndexedFunction getter = oldMember;
- newMember = new JGetter(
+ newMember = JGetter(
newLibrary, newClass, memberName, getter.asyncMarker,
isStatic: getter.isStatic,
isExternal: getter.isExternal,
isAbstract: getter.isAbstract);
} else if (oldMember.isSetter) {
IndexedFunction setter = oldMember;
- newMember = new JSetter(newLibrary, newClass, memberName,
+ newMember = JSetter(newLibrary, newClass, memberName,
isStatic: setter.isStatic,
isExternal: setter.isExternal,
isAbstract: setter.isAbstract);
@@ -235,7 +235,7 @@
annotations.hasNoElision(function)
? function.parameterStructure
: memberUsage.invokedParameters;
- newMember = new JMethod(newLibrary, newClass, memberName,
+ newMember = JMethod(newLibrary, newClass, memberName,
parameterStructure, function.asyncMarker,
isStatic: function.isStatic,
isExternal: function.isExternal,
@@ -294,14 +294,14 @@
JsKernelToElementMap.readFromDataSource(this.options, this.reporter,
this._environment, ir.Component component, DataSource source) {
- _elementEnvironment = new JsElementEnvironment(this);
- _typeConverter = new DartTypeConverter(this);
- _types = new KernelDartTypes(this, options);
- _commonElements = new CommonElementsImpl(_types, _elementEnvironment);
- _constantValuefier = new ConstantValuefier(this);
+ _elementEnvironment = JsElementEnvironment(this);
+ _typeConverter = DartTypeConverter(this);
+ _types = KernelDartTypes(this, options);
+ _commonElements = CommonElementsImpl(_types, _elementEnvironment);
+ _constantValuefier = ConstantValuefier(this);
- source.registerComponentLookup(new ComponentLookup(component));
- _EntityLookup entityLookup = new _EntityLookup();
+ source.registerComponentLookup(ComponentLookup(component));
+ _EntityLookup entityLookup = _EntityLookup();
source.registerEntityLookup(entityLookup);
source.begin(tag);
@@ -309,7 +309,7 @@
int libraryCount = source.readInt();
for (int i = 0; i < libraryCount; i++) {
int index = source.readInt();
- JLibrary library = new JLibrary.readFromDataSource(source);
+ JLibrary library = JLibrary.readFromDataSource(source);
entityLookup.registerLibrary(index, library);
}
source.end(libraryTag);
@@ -318,7 +318,7 @@
int classCount = source.readInt();
for (int i = 0; i < classCount; i++) {
int index = source.readInt();
- JClass cls = new JClass.readFromDataSource(source);
+ JClass cls = JClass.readFromDataSource(source);
entityLookup.registerClass(index, cls);
}
source.end(classTag);
@@ -327,7 +327,7 @@
int memberCount = source.readInt();
for (int i = 0; i < memberCount; i++) {
int index = source.readInt();
- JMember member = new JMember.readFromDataSource(source);
+ JMember member = JMember.readFromDataSource(source);
entityLookup.registerMember(index, member);
}
source.end(memberTag);
@@ -336,16 +336,16 @@
int typeVariableCount = source.readInt();
for (int i = 0; i < typeVariableCount; i++) {
int index = source.readInt();
- JTypeVariable typeVariable = new JTypeVariable.readFromDataSource(source);
+ JTypeVariable typeVariable = JTypeVariable.readFromDataSource(source);
entityLookup.registerTypeVariable(index, typeVariable);
}
source.end(typeVariableTag);
- programEnv = new JProgramEnv([component]);
+ programEnv = JProgramEnv([component]);
source.begin(libraryDataTag);
entityLookup.forEachLibrary((int index, JLibrary library) {
- JLibraryEnv env = new JLibraryEnv.readFromDataSource(source);
- JLibraryData data = new JLibraryData.readFromDataSource(source);
+ JLibraryEnv env = JLibraryEnv.readFromDataSource(source);
+ JLibraryData data = JLibraryData.readFromDataSource(source);
libraryMap[env.library] =
libraries.registerByIndex(index, library, data, env);
programEnv.registerLibrary(env);
@@ -355,8 +355,8 @@
source.begin(classDataTag);
entityLookup.forEachClass((int index, JClass cls) {
- JClassEnv env = new JClassEnv.readFromDataSource(source);
- JClassData data = new JClassData.readFromDataSource(source);
+ JClassEnv env = JClassEnv.readFromDataSource(source);
+ JClassData data = JClassData.readFromDataSource(source);
classMap[env.cls] = classes.registerByIndex(index, cls, data, env);
if (cls is! JRecord && cls is! JClosureClass) {
// Synthesized classes are not part of the library environment.
@@ -368,7 +368,7 @@
source.begin(memberDataTag);
entityLookup.forEachMember((int index, IndexedMember member) {
- JMemberData data = new JMemberData.readFromDataSource(source);
+ JMemberData data = JMemberData.readFromDataSource(source);
members.registerByIndex(index, member, data);
switch (data.definition.kind) {
case MemberKind.regular:
@@ -390,7 +390,7 @@
source.begin(typeVariableDataTag);
entityLookup.forEachTypeVariable((int index, JTypeVariable typeVariable) {
- JTypeVariableData data = new JTypeVariableData.readFromDataSource(source);
+ JTypeVariableData data = JTypeVariableData.readFromDataSource(source);
typeVariableMap[data.node] =
typeVariables.registerByIndex(index, typeVariable, data);
assert(index == typeVariable.typeVariableIndex);
@@ -564,7 +564,7 @@
}
MemberEntity lookupLibraryMember(IndexedLibrary library, String name,
- {bool setter: false}) {
+ {bool setter = false}) {
assert(checkFamily(library));
JLibraryEnv libraryEnv = libraries.getEnv(library);
ir.Member member = libraryEnv.lookupMember(name, setter: setter);
@@ -601,7 +601,7 @@
}
MemberEntity lookupClassMember(IndexedClass cls, String name,
- {bool setter: false}) {
+ {bool setter = false}) {
assert(checkFamily(cls));
JClassEnv classEnv = classes.getEnv(cls);
return classEnv.lookupMember(this, name, setter: setter);
@@ -657,14 +657,13 @@
} else {
data.thisType = types.interfaceType(
cls,
- new List<DartType>.generate(node.typeParameters.length,
- (int index) {
+ List<DartType>.generate(node.typeParameters.length, (int index) {
return types.typeVariableType(
getTypeVariableInternal(node.typeParameters[index]));
}));
data.rawType = types.interfaceType(
cls,
- new List<DartType>.filled(
+ List<DartType>.filled(
node.typeParameters.length, types.dynamicType()));
}
}
@@ -712,7 +711,7 @@
ir.Class node = data.cls;
if (node.supertype == null) {
- data.orderedTypeSet = new OrderedTypeSet.singleton(data.thisType);
+ data.orderedTypeSet = OrderedTypeSet.singleton(data.thisType);
data.isMixinApplication = false;
data.interfaces = const <InterfaceType>[];
} else {
@@ -721,7 +720,7 @@
// This is necessary to support when a class implements the same
// supertype in multiple non-conflicting ways, like implementing A<int*>
// and A<int?> or B<Object?> and B<dynamic>.
- Set<InterfaceType> canonicalSupertypes = <InterfaceType>{};
+ Set<InterfaceType> canonicalSupertypes = {};
InterfaceType processSupertype(ir.Supertype supertypeNode) {
supertypeNode = classHierarchy.getClassAsInstanceOf(
@@ -795,7 +794,7 @@
interfaces.add(processSupertype(supertype));
});
OrderedTypeSetBuilder setBuilder =
- new KernelOrderedTypeSetBuilder(this, cls);
+ KernelOrderedTypeSetBuilder(this, cls);
data.orderedTypeSet =
setBuilder.createOrderedTypeSet(canonicalSupertypes);
data.interfaces = interfaces;
@@ -816,7 +815,7 @@
return getMethodInternal(node);
}
}
- throw new UnsupportedError("Unexpected member: $node");
+ throw UnsupportedError("Unexpected member: $node");
}
@override
@@ -899,7 +898,7 @@
}
var namedParameters = <String>[];
var requiredNamedParameters = <String>{};
- List<DartType> namedParameterTypes = <DartType>[];
+ List<DartType> namedParameterTypes = [];
List<ir.VariableDeclaration> sortedNamedParameters =
node.namedParameters.toList()..sort((a, b) => a.name.compareTo(b.name));
for (ir.VariableDeclaration variable in sortedNamedParameters) {
@@ -913,10 +912,10 @@
if (node.typeParameters.isNotEmpty) {
List<DartType> typeParameters = <DartType>[];
for (ir.TypeParameter typeParameter in node.typeParameters) {
- typeParameters.add(getDartType(new ir.TypeParameterType(
- typeParameter, ir.Nullability.nonNullable)));
+ typeParameters.add(getDartType(
+ ir.TypeParameterType(typeParameter, ir.Nullability.nonNullable)));
}
- typeVariables = new List<FunctionTypeVariable>.generate(
+ typeVariables = List<FunctionTypeVariable>.generate(
node.typeParameters.length,
(int index) => types.functionTypeVariable(index));
@@ -1161,11 +1160,11 @@
ir.StaticTypeContext getStaticTypeContext(ir.Member node) {
// TODO(johnniwinther): Cache the static type context.
- return new ir.StaticTypeContext(node, typeEnvironment);
+ return ir.StaticTypeContext(node, typeEnvironment);
}
Dart2jsConstantEvaluator get constantEvaluator {
- return _constantEvaluator ??= new Dart2jsConstantEvaluator(typeEnvironment,
+ return _constantEvaluator ??= Dart2jsConstantEvaluator(typeEnvironment,
(ir.LocatedMessage message, List<ir.LocatedMessage> context) {
reportLocatedMessage(reporter, message, context);
},
@@ -1214,7 +1213,7 @@
// Closure field may use class nodes or type parameter nodes as
// the definition node.
staticTypeContext =
- new ir.StaticTypeContext.forAnnotations(node, typeEnvironment);
+ ir.StaticTypeContext.forAnnotations(node, typeEnvironment);
}
node = node.parent;
}
@@ -1222,22 +1221,20 @@
}
assert(cachedStaticTypes != null, "No static types cached for $member.");
assert(staticTypeContext != null, "No static types context for $member.");
- return new CachedStaticType(staticTypeContext, cachedStaticTypes,
- new ThisInterfaceType.from(staticTypeContext.thisType));
+ return CachedStaticType(staticTypeContext, cachedStaticTypes,
+ ThisInterfaceType.from(staticTypeContext.thisType));
}
@override
Name getName(ir.Name name) {
- return new Name(
- name.text, name.isPrivate ? getLibrary(name.library) : null);
+ return Name(name.text, 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();
- return new CallStructure(
- argumentCount, namedArguments, arguments.types.length);
+ return CallStructure(argumentCount, namedArguments, arguments.types.length);
}
@override
@@ -1292,25 +1289,25 @@
}
CallStructure callStructure = getCallStructure(invocation.arguments);
- return new Selector(kind, name, callStructure);
+ return Selector(kind, name, callStructure);
}
Selector getGetterSelector(ir.Name irName) {
- Name name = new Name(
- irName.text, irName.isPrivate ? getLibrary(irName.library) : null);
- return new Selector.getter(name);
+ Name name =
+ Name(irName.text, irName.isPrivate ? getLibrary(irName.library) : null);
+ return Selector.getter(name);
}
Selector getSetterSelector(ir.Name irName) {
- Name name = new Name(
- irName.text, irName.isPrivate ? getLibrary(irName.library) : null);
- return new Selector.setter(name);
+ Name name =
+ Name(irName.text, irName.isPrivate ? getLibrary(irName.library) : null);
+ return Selector.setter(name);
}
/// Looks up [typeName] for use in the spec-string of a `JS` call.
// TODO(johnniwinther): Use this in [native.NativeBehavior] instead of calling
// the `ForeignResolver`.
- TypeLookup typeLookup({bool resolveAsRaw: true}) {
+ TypeLookup typeLookup({bool resolveAsRaw = true}) {
return resolveAsRaw
? (_cachedTypeLookupRaw ??= _typeLookup(resolveAsRaw: true))
: (_cachedTypeLookupFull ??= _typeLookup(resolveAsRaw: false));
@@ -1319,7 +1316,7 @@
TypeLookup _cachedTypeLookupRaw;
TypeLookup _cachedTypeLookupFull;
- TypeLookup _typeLookup({bool resolveAsRaw: true}) {
+ TypeLookup _typeLookup({bool resolveAsRaw = true}) {
bool cachedMayLookupInMain;
DartType lookup(String typeName, {bool required}) {
@@ -1378,7 +1375,7 @@
}
String _getStringArgument(ir.StaticInvocation node, int index) {
- return node.arguments.positional[index].accept(new Stringifier());
+ return node.arguments.positional[index].accept(Stringifier());
}
// TODO(johnniwinther): Cache this for later use.
@@ -1388,20 +1385,20 @@
node.arguments.named.isNotEmpty) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS);
- return new NativeBehavior();
+ return NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS_FIRST);
- return new NativeBehavior();
+ return NativeBehavior();
}
String codeString = _getStringArgument(node, 1);
if (codeString == null) {
reporter.reportErrorMessage(
CURRENT_ELEMENT_SPANNABLE, MessageKind.WRONG_ARGUMENT_FOR_JS_SECOND);
- return new NativeBehavior();
+ return NativeBehavior();
}
return NativeBehavior.ofJsCall(
@@ -1419,18 +1416,18 @@
if (node.arguments.positional.length < 1) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS builtin expression has no type.");
- return new NativeBehavior();
+ return NativeBehavior();
}
if (node.arguments.positional.length < 2) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS builtin is missing name.");
- return new NativeBehavior();
+ return NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "Unexpected first argument.");
- return new NativeBehavior();
+ return NativeBehavior();
}
return NativeBehavior.ofJsBuiltinCall(
specString,
@@ -1447,24 +1444,24 @@
if (node.arguments.positional.length < 1) {
reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
"JS embedded global expression has no type.");
- return new NativeBehavior();
+ return NativeBehavior();
}
if (node.arguments.positional.length < 2) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "JS embedded global is missing name.");
- return new NativeBehavior();
+ return NativeBehavior();
}
if (node.arguments.positional.length > 2 ||
node.arguments.named.isNotEmpty) {
reporter.internalError(CURRENT_ELEMENT_SPANNABLE,
"JS embedded global has more than 2 arguments.");
- return new NativeBehavior();
+ return NativeBehavior();
}
String specString = _getStringArgument(node, 0);
if (specString == null) {
reporter.internalError(
CURRENT_ELEMENT_SPANNABLE, "Unexpected first argument.");
- return new NativeBehavior();
+ return NativeBehavior();
}
return NativeBehavior.ofJsEmbeddedGlobalCall(
specString,
@@ -1476,13 +1473,13 @@
@override
ConstantValue getConstantValue(ir.Member memberContext, ir.Expression node,
- {bool requireConstant: true, bool implicitNull: false}) {
+ {bool requireConstant = true, bool implicitNull = false}) {
if (node == null) {
if (!implicitNull) {
throw failedAt(
CURRENT_ELEMENT_SPANNABLE, 'No expression for constant.');
}
- return new NullConstantValue();
+ return NullConstantValue();
} else if (node is ir.ConstantExpression) {
return _constantValuefier.visitConstant(node.constant);
} else {
@@ -1495,7 +1492,7 @@
requireConstant: requireConstant);
if (constant == null) {
if (requireConstant) {
- throw new UnsupportedError(
+ throw UnsupportedError(
'No constant for ${DebugPrinter.prettyPrint(node)}');
}
} else {
@@ -1511,8 +1508,7 @@
@override
ConstantValue getRequiredSentinelConstantValue() {
- return new ConstructedConstantValue(
- _commonElements.requiredSentinelType, <FieldEntity, ConstantValue>{});
+ return ConstructedConstantValue(_commonElements.requiredSentinelType, {});
}
@override
@@ -1542,17 +1538,17 @@
TypeVariableEntity createTypeVariable(
Entity typeDeclaration, String name, int index) {
- return new JTypeVariable(typeDeclaration, name, index);
+ return JTypeVariable(typeDeclaration, name, index);
}
JConstructorBody createConstructorBody(
ConstructorEntity constructor, ParameterStructure parameterStructure) {
- return new JConstructorBody(constructor, parameterStructure);
+ return JConstructorBody(constructor, parameterStructure);
}
JGeneratorBody createGeneratorBody(
FunctionEntity function, DartType elementType) {
- return new JGeneratorBody(function, elementType);
+ return JGeneratorBody(function, elementType);
}
void forEachNestedClosure(
@@ -1671,11 +1667,10 @@
createConstructorBody(constructor, parameterStructure);
members.register<IndexedFunction, FunctionData>(
constructorBody,
- new ConstructorBodyDataImpl(
+ ConstructorBodyDataImpl(
data.node,
data.node.function,
- new SpecialMemberDefinition(
- data.node, MemberKind.constructorBody),
+ SpecialMemberDefinition(data.node, MemberKind.constructorBody),
data.staticTypes));
IndexedClass cls = constructor.enclosingClass;
JClassEnvImpl classEnv = classes.getEnv(cls);
@@ -1718,7 +1713,7 @@
case MemberKind.generatorBody:
return getParentMember(definition.node);
}
- throw new UnsupportedError('Unexpected member kind ${definition}');
+ throw UnsupportedError('Unexpected member kind ${definition}');
}
@override
@@ -1730,7 +1725,7 @@
/// the parameter and the [defaultValue] if the parameter is optional.
void forEachParameter(covariant IndexedFunction function,
void f(DartType type, String name, ConstantValue defaultValue),
- {bool isNative: false}) {
+ {bool isNative = false}) {
FunctionData data = members.getData(function);
data.forEachParameter(this, function.parameterStructure, f,
isNative: isNative);
@@ -1753,11 +1748,11 @@
BoxLocal boxLocal,
Map<String, MemberEntity> memberMap) {
JRecordField boxedField =
- new JRecordField(variable.name, boxLocal, isConst: variable.isConst);
+ JRecordField(variable.name, boxLocal, isConst: variable.isConst);
members.register(
boxedField,
- new ClosureFieldData(
- new ClosureMemberDefinition(computeSourceSpanFromTreeNode(variable),
+ ClosureFieldData(
+ ClosureMemberDefinition(computeSourceSpanFromTreeNode(variable),
MemberKind.closureField, variable),
memberThisType));
memberMap[boxedField.name] = boxedField;
@@ -1775,18 +1770,18 @@
if (info.boxedVariables.isNotEmpty) {
NodeBox box = info.capturedVariablesAccessor;
- Map<String, IndexedMember> memberMap = <String, IndexedMember>{};
- JRecord container = new JRecord(member.library, box.name);
- BoxLocal boxLocal = new BoxLocal(container);
+ Map<String, IndexedMember> memberMap = {};
+ JRecord container = JRecord(member.library, box.name);
+ BoxLocal boxLocal = BoxLocal(container);
InterfaceType thisType =
types.interfaceType(container, const <DartType>[]);
InterfaceType supertype = commonElements.objectType;
- JClassData containerData = new RecordClassData(
- new RecordContainerDefinition(getMemberDefinition(member).location),
+ JClassData containerData = RecordClassData(
+ RecordContainerDefinition(getMemberDefinition(member).location),
thisType,
supertype,
getOrderedTypeSet(supertype.element).extendClass(types, thisType));
- classes.register(container, containerData, new RecordEnv(memberMap));
+ classes.register(container, containerData, RecordEnv(memberMap));
InterfaceType memberThisType = member.enclosingClass != null
? elementEnvironment.getThisType(member.enclosingClass)
@@ -1813,7 +1808,7 @@
requiredNamedParameters.add(p.name);
}
}
- return new ParameterStructure(
+ return ParameterStructure(
requiredPositionalParameters,
positionalParameters,
namedParameters,
@@ -1842,19 +1837,19 @@
}
String name = _computeClosureName(node);
SourceSpan location = computeSourceSpanFromTreeNode(node);
- Map<String, IndexedMember> memberMap = <String, IndexedMember>{};
+ Map<String, IndexedMember> memberMap = {};
- JClass classEntity = new JClosureClass(enclosingLibrary, name);
+ JClass classEntity = JClosureClass(enclosingLibrary, name);
// Create a classData and set up the interfaces and subclass
// relationships that _ensureSupertypes and _ensureThisAndRawType are doing
InterfaceType thisType =
types.interfaceType(classEntity, const <DartType>[]);
- ClosureClassData closureData = new ClosureClassData(
- new ClosureClassDefinition(location),
+ ClosureClassData closureData = ClosureClassData(
+ ClosureClassDefinition(location),
thisType,
supertype,
getOrderedTypeSet(supertype.element).extendClass(types, thisType));
- classes.register(classEntity, closureData, new ClosureClassEnv(memberMap));
+ classes.register(classEntity, closureData, ClosureClassEnv(memberMap));
Local closureEntity;
ir.VariableDeclaration closureEntityNode;
@@ -1862,10 +1857,10 @@
ir.FunctionDeclaration parent = node.parent;
closureEntityNode = parent.variable;
} else if (node.parent is ir.FunctionExpression) {
- closureEntity = new AnonymousClosureLocal(classEntity);
+ closureEntity = AnonymousClosureLocal(classEntity);
}
- IndexedFunction callMethod = new JClosureCallMethod(classEntity,
+ IndexedFunction callMethod = JClosureCallMethod(classEntity,
_getParameterStructureFromFunctionNode(node), getAsyncMarker(node));
_nestedClosureMap
.putIfAbsent(member, () => <IndexedFunction>[])
@@ -1877,11 +1872,11 @@
for (ir.TypeParameter typeParameter in node.typeParameters) {
typeVariableMap[typeParameter] = typeVariables.register(
createTypeVariable(callMethod, typeParameter.name, index),
- new JTypeVariableData(typeParameter));
+ JTypeVariableData(typeParameter));
index++;
}
- JsClosureClassInfo closureClassInfo = new JsClosureClassInfo.fromScopeInfo(
+ JsClosureClassInfo closureClassInfo = JsClosureClassInfo.fromScopeInfo(
classEntity,
node,
<ir.VariableDeclaration, JRecordField>{},
@@ -1889,7 +1884,7 @@
member.enclosingClass,
closureEntity,
closureEntityNode,
- info.hasThisLocal ? new ThisLocal(member.enclosingClass) : null);
+ info.hasThisLocal ? ThisLocal(member.enclosingClass) : null);
_buildClosureClassFields(closureClassInfo, member, memberThisType, info,
recordFieldsVisibleInScope, memberMap);
@@ -1902,8 +1897,8 @@
members.register<IndexedFunction, FunctionData>(
callMethod,
- new ClosureFunctionData(
- new ClosureMemberDefinition(
+ ClosureFunctionData(
+ ClosureMemberDefinition(
location, MemberKind.closureCall, node.parent),
memberThisType,
closureData.callType,
@@ -2002,7 +1997,7 @@
fieldNumber));
fieldNumber++;
} else {
- throw new UnsupportedError("Unexpected field node type: $variable");
+ throw UnsupportedError("Unexpected field node type: $variable");
}
}
}
@@ -2032,17 +2027,15 @@
return false;
}
- FieldEntity closureField = new JClosureField(
+ FieldEntity closureField = JClosureField(
'_box_$fieldNumber', closureClassInfo, recordField.box.name,
isConst: true, isAssignable: false);
members.register<IndexedField, JFieldData>(
closureField,
- new ClosureFieldData(
- new ClosureMemberDefinition(
- computeSourceSpanFromTreeNode(sourceNode),
- MemberKind.closureField,
- sourceNode),
+ ClosureFieldData(
+ ClosureMemberDefinition(computeSourceSpanFromTreeNode(sourceNode),
+ MemberKind.closureField, sourceNode),
memberThisType));
memberMap[closureField.name] = closureField;
closureClassInfo.registerFieldForLocal(recordField.box, closureField);
@@ -2058,11 +2051,11 @@
SourceSpan location,
ClassTypeVariableAccess typeVariableAccess) {
FunctionEntity signatureMethod =
- new JSignatureMethod(closureClassInfo.closureClassEntity);
+ JSignatureMethod(closureClassInfo.closureClassEntity);
members.register<IndexedFunction, FunctionData>(
signatureMethod,
- new SignatureFunctionData(
- new SpecialMemberDefinition(
+ SignatureFunctionData(
+ SpecialMemberDefinition(
closureSourceNode.parent, MemberKind.signature),
memberThisType,
closureSourceNode.typeParameters,
@@ -2080,17 +2073,15 @@
bool isConst,
bool isAssignable,
int fieldNumber) {
- JField closureField = new JClosureField(
+ JField closureField = JClosureField(
_getClosureVariableName(name, fieldNumber), closureClassInfo, name,
isConst: isConst, isAssignable: isAssignable);
members.register<IndexedField, JFieldData>(
closureField,
- new ClosureFieldData(
- new ClosureMemberDefinition(
- computeSourceSpanFromTreeNode(sourceNode),
- MemberKind.closureField,
- sourceNode),
+ ClosureFieldData(
+ ClosureMemberDefinition(computeSourceSpanFromTreeNode(sourceNode),
+ MemberKind.closureField, sourceNode),
memberThisType));
memberMap[closureField.name] = closureField;
return closureField;
@@ -2167,8 +2158,8 @@
generatorBody = createGeneratorBody(function, elementType);
members.register<IndexedFunction, FunctionData>(
generatorBody,
- new GeneratorBodyFunctionData(functionData,
- new SpecialMemberDefinition(node, MemberKind.generatorBody)));
+ GeneratorBodyFunctionData(functionData,
+ SpecialMemberDefinition(node, MemberKind.generatorBody)));
if (function.enclosingClass != null) {
// TODO(sra): Integrate this with ClassEnvImpl.addConstructorBody ?
@@ -2343,7 +2334,7 @@
@override
ConstructorEntity lookupConstructor(ClassEntity cls, String name,
- {bool required: false}) {
+ {bool required = false}) {
ConstructorEntity constructor = elementMap.lookupConstructor(cls, name);
if (constructor == null && required) {
throw failedAt(
@@ -2356,7 +2347,7 @@
@override
MemberEntity lookupLocalClassMember(ClassEntity cls, String name,
- {bool setter: false, bool required: false}) {
+ {bool setter = false, bool required = false}) {
MemberEntity member =
elementMap.lookupClassMember(cls, name, setter: setter);
if (member == null && required) {
@@ -2368,7 +2359,7 @@
@override
ClassEntity getSuperClass(ClassEntity cls,
- {bool skipUnnamedMixinApplications: false}) {
+ {bool skipUnnamedMixinApplications = false}) {
assert(elementMap.checkFamily(cls));
ClassEntity superclass = elementMap.getSuperType(cls)?.element;
if (skipUnnamedMixinApplications) {
@@ -2428,7 +2419,7 @@
@override
MemberEntity lookupLibraryMember(LibraryEntity library, String name,
- {bool setter: false, bool required: false}) {
+ {bool setter = false, bool required = false}) {
MemberEntity member =
elementMap.lookupLibraryMember(library, name, setter: setter);
if (member == null && required) {
@@ -2440,7 +2431,7 @@
@override
ClassEntity lookupClass(LibraryEntity library, String name,
- {bool required: false}) {
+ {bool required = false}) {
ClassEntity cls = elementMap.lookupClass(library, name);
if (cls == null && required) {
failedAt(CURRENT_ELEMENT_SPANNABLE,
@@ -2455,7 +2446,7 @@
}
@override
- LibraryEntity lookupLibrary(Uri uri, {bool required: false}) {
+ LibraryEntity lookupLibrary(Uri uri, {bool required = false}) {
LibraryEntity library = elementMap.lookupLibrary(uri);
if (library == null && required) {
failedAt(CURRENT_ELEMENT_SPANNABLE, "The library '$uri' was not found.");
@@ -2658,7 +2649,7 @@
IndexedFunction function = source.readMember();
return _elementMap.getGeneratorBody(function);
}
- throw new UnsupportedError("Unexpected late member kind: $kind.");
+ throw UnsupportedError("Unexpected late member kind: $kind.");
}
}
@@ -2690,7 +2681,7 @@
sink.writeEnum(LateMemberKind.generatorBody);
sink.writeMember(value.function);
} else {
- throw new UnsupportedError("Unexpected late member $value.");
+ throw UnsupportedError("Unexpected late member $value.");
}
}
}
diff --git a/pkg/compiler/lib/src/js_model/elements.dart b/pkg/compiler/lib/src/js_model/elements.dart
index 38337b4..62b7315 100644
--- a/pkg/compiler/lib/src/js_model/elements.dart
+++ b/pkg/compiler/lib/src/js_model/elements.dart
@@ -36,7 +36,7 @@
Uri canonicalUri = source.readUri();
bool isNonNullableByDefault = source.readBool();
source.end(tag);
- return new JLibrary(name, canonicalUri, isNonNullableByDefault);
+ return JLibrary(name, canonicalUri, isNonNullableByDefault);
}
/// Serializes this [JLibrary] to [sink].
@@ -80,13 +80,13 @@
String name = source.readString();
bool isAbstract = source.readBool();
source.end(tag);
- return new JClass(library, name, isAbstract: isAbstract);
+ return JClass(library, name, isAbstract: isAbstract);
case JClassKind.closure:
- return new JClosureClass.readFromDataSource(source);
+ return JClosureClass.readFromDataSource(source);
case JClassKind.record:
- return new JRecord.readFromDataSource(source);
+ return JRecord.readFromDataSource(source);
}
- throw new UnsupportedError("Unexpected ClassKind $kind");
+ throw UnsupportedError("Unexpected ClassKind $kind");
}
/// Serializes this [JClass] to [sink].
@@ -130,7 +130,8 @@
final Name _name;
final bool _isStatic;
- JMember(this.library, this.enclosingClass, this._name, {bool isStatic: false})
+ JMember(this.library, this.enclosingClass, this._name,
+ {bool isStatic = false})
: _isStatic = isStatic;
/// Deserializes a [JMember] object from [source].
@@ -138,31 +139,31 @@
JMemberKind kind = source.readEnum(JMemberKind.values);
switch (kind) {
case JMemberKind.generativeConstructor:
- return new JGenerativeConstructor.readFromDataSource(source);
+ return JGenerativeConstructor.readFromDataSource(source);
case JMemberKind.factoryConstructor:
- return new JFactoryConstructor.readFromDataSource(source);
+ return JFactoryConstructor.readFromDataSource(source);
case JMemberKind.constructorBody:
- return new JConstructorBody.readFromDataSource(source);
+ return JConstructorBody.readFromDataSource(source);
case JMemberKind.field:
- return new JField.readFromDataSource(source);
+ return JField.readFromDataSource(source);
case JMemberKind.getter:
- return new JGetter.readFromDataSource(source);
+ return JGetter.readFromDataSource(source);
case JMemberKind.setter:
- return new JSetter.readFromDataSource(source);
+ return JSetter.readFromDataSource(source);
case JMemberKind.method:
- return new JMethod.readFromDataSource(source);
+ return JMethod.readFromDataSource(source);
case JMemberKind.closureField:
- return new JClosureField.readFromDataSource(source);
+ return JClosureField.readFromDataSource(source);
case JMemberKind.closureCallMethod:
- return new JClosureCallMethod.readFromDataSource(source);
+ return JClosureCallMethod.readFromDataSource(source);
case JMemberKind.generatorBody:
- return new JGeneratorBody.readFromDataSource(source);
+ return JGeneratorBody.readFromDataSource(source);
case JMemberKind.signatureMethod:
- return new JSignatureMethod.readFromDataSource(source);
+ return JSignatureMethod.readFromDataSource(source);
case JMemberKind.recordField:
- return new JRecordField.readFromDataSource(source);
+ return JRecordField.readFromDataSource(source);
}
- throw new UnsupportedError("Unexpected JMemberKind $kind");
+ throw UnsupportedError("Unexpected JMemberKind $kind");
}
/// Serializes this [JMember] to [sink].
@@ -225,7 +226,7 @@
JFunction(JLibrary library, JClass enclosingClass, Name name,
this.parameterStructure, this.asyncMarker,
- {bool isStatic: false, this.isExternal: false})
+ {bool isStatic = false, this.isExternal = false})
: super(library, enclosingClass, name, isStatic: isStatic);
}
@@ -276,12 +277,12 @@
JClass enclosingClass = source.readClass();
String name = source.readString();
ParameterStructure parameterStructure =
- new ParameterStructure.readFromDataSource(source);
+ ParameterStructure.readFromDataSource(source);
bool isExternal = source.readBool();
bool isConst = source.readBool();
source.end(tag);
- return new JGenerativeConstructor(enclosingClass,
- new Name(name, enclosingClass.library), parameterStructure,
+ return JGenerativeConstructor(
+ enclosingClass, Name(name, enclosingClass.library), parameterStructure,
isExternal: isExternal, isConst: isConst);
}
@@ -323,13 +324,13 @@
JClass enclosingClass = source.readClass();
String name = source.readString();
ParameterStructure parameterStructure =
- new ParameterStructure.readFromDataSource(source);
+ ParameterStructure.readFromDataSource(source);
bool isExternal = source.readBool();
bool isConst = source.readBool();
bool isFromEnvironmentConstructor = source.readBool();
source.end(tag);
- return new JFactoryConstructor(enclosingClass,
- new Name(name, enclosingClass.library), parameterStructure,
+ return JFactoryConstructor(
+ enclosingClass, Name(name, enclosingClass.library), parameterStructure,
isExternal: isExternal,
isConst: isConst,
isFromEnvironmentConstructor: isFromEnvironmentConstructor);
@@ -372,9 +373,9 @@
source.begin(tag);
JConstructor constructor = source.readMember();
ParameterStructure parameterStructure =
- new ParameterStructure.readFromDataSource(source);
+ ParameterStructure.readFromDataSource(source);
source.end(tag);
- return new JConstructorBody(constructor, parameterStructure);
+ return JConstructorBody(constructor, parameterStructure);
}
@override
@@ -420,13 +421,13 @@
}
String name = source.readString();
ParameterStructure parameterStructure =
- new ParameterStructure.readFromDataSource(source);
+ ParameterStructure.readFromDataSource(source);
AsyncMarker asyncMarker = source.readEnum(AsyncMarker.values);
bool isStatic = source.readBool();
bool isExternal = source.readBool();
bool isAbstract = source.readBool();
source.end(tag);
- return new JMethod(library, enclosingClass, new Name(name, library),
+ return JMethod(library, enclosingClass, Name(name, library),
parameterStructure, asyncMarker,
isStatic: isStatic, isExternal: isExternal, isAbstract: isAbstract);
}
@@ -479,7 +480,7 @@
JFunction function = source.readMember();
DartType elementType = source.readDartType();
source.end(tag);
- return new JGeneratorBody(function, elementType);
+ return JGeneratorBody(function, elementType);
}
@override
@@ -530,8 +531,7 @@
bool isExternal = source.readBool();
bool isAbstract = source.readBool();
source.end(tag);
- return new JGetter(
- library, enclosingClass, new Name(name, library), asyncMarker,
+ return JGetter(library, enclosingClass, Name(name, library), asyncMarker,
isStatic: isStatic, isExternal: isExternal, isAbstract: isAbstract);
}
@@ -594,8 +594,7 @@
bool isExternal = source.readBool();
bool isAbstract = source.readBool();
source.end(tag);
- return new JSetter(
- library, enclosingClass, new Name(name, library, isSetter: true),
+ return JSetter(library, enclosingClass, Name(name, library, isSetter: true),
isStatic: isStatic, isExternal: isExternal, isAbstract: isAbstract);
}
@@ -660,7 +659,7 @@
bool isAssignable = source.readBool();
bool isConst = source.readBool();
source.end(tag);
- return new JField(library, enclosingClass, new Name(name, library),
+ return JField(library, enclosingClass, Name(name, library),
isStatic: isStatic, isAssignable: isAssignable, isConst: isConst);
}
@@ -704,11 +703,10 @@
source.begin(tag);
JClass enclosingClass = source.readClass();
ParameterStructure parameterStructure =
- new ParameterStructure.readFromDataSource(source);
+ ParameterStructure.readFromDataSource(source);
AsyncMarker asyncMarker = source.readEnum(AsyncMarker.values);
source.end(tag);
- return new JClosureCallMethod(
- enclosingClass, parameterStructure, asyncMarker);
+ return JClosureCallMethod(enclosingClass, parameterStructure, asyncMarker);
}
@override
@@ -741,7 +739,7 @@
source.begin(tag);
JClass cls = source.readClass();
source.end(tag);
- return new JSignatureMethod(cls);
+ return JSignatureMethod(cls);
}
@override
@@ -795,7 +793,7 @@
String name = source.readString();
int index = source.readInt();
source.end(tag);
- return new JTypeVariable(typeDeclaration, name, index);
+ return JTypeVariable(typeDeclaration, name, index);
}
/// Serializes this [JTypeVariable] to [sink].
@@ -812,7 +810,7 @@
} else if (typeDeclaration == null) {
sink.writeEnum(JTypeVariableKind.local);
} else {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unexpected type variable declarer $typeDeclaration.");
}
sink.writeString(name);
diff --git a/pkg/compiler/lib/src/js_model/env.dart b/pkg/compiler/lib/src/js_model/env.dart
index 2dd5c12..c0bcc93 100644
--- a/pkg/compiler/lib/src/js_model/env.dart
+++ b/pkg/compiler/lib/src/js_model/env.dart
@@ -13,7 +13,6 @@
import '../ir/element_map.dart';
import '../ir/static_type_cache.dart';
import '../ir/util.dart';
-import '../js_model/element_map.dart';
import '../ordered_typeset.dart';
import '../serialization/serialization.dart';
import '../ssa/type_builder.dart';
@@ -76,7 +75,7 @@
Map<String, ir.Member> setterMap =
source.readStringMap(source.readMemberNode);
source.end(tag);
- return new JLibraryEnv(library, memberMap, setterMap);
+ return JLibraryEnv(library, memberMap, setterMap);
}
/// Serializes this [JLibraryEnv] to [sink].
@@ -103,7 +102,7 @@
}
/// Return the [ir.Member] for the member [name] in [library].
- ir.Member lookupMember(String name, {bool setter: false}) {
+ ir.Member lookupMember(String name, {bool setter = false}) {
return setter ? _setterMap[name] : _memberMap[name];
}
@@ -145,7 +144,7 @@
}
}
source.end(tag);
- return new JLibraryData(library, imports);
+ return JLibraryData(library, imports);
}
void writeToDataSink(DataSink sink) {
@@ -179,13 +178,13 @@
JClassEnvKind kind = source.readEnum(JClassEnvKind.values);
switch (kind) {
case JClassEnvKind.node:
- return new JClassEnvImpl.readFromDataSource(source);
+ return JClassEnvImpl.readFromDataSource(source);
case JClassEnvKind.closure:
- return new ClosureClassEnv.readFromDataSource(source);
+ return ClosureClassEnv.readFromDataSource(source);
case JClassEnvKind.record:
- return new RecordEnv.readFromDataSource(source);
+ return RecordEnv.readFromDataSource(source);
}
- throw new UnsupportedError("Unsupported JClassEnvKind $kind");
+ throw UnsupportedError("Unsupported JClassEnvKind $kind");
}
/// Serializes this [JClassEnv] to [sink].
@@ -207,7 +206,7 @@
/// is `true`, the setter or assignable field corresponding to [name] is
/// returned.
MemberEntity lookupMember(IrToElementMap elementMap, String name,
- {bool setter: false});
+ {bool setter = false});
/// Calls [f] for each member of [cls].
void forEachMember(IrToElementMap elementMap, void f(MemberEntity member));
@@ -257,7 +256,7 @@
List<ir.Member> members = source.readMemberNodes();
bool isSuperMixinApplication = source.readBool();
source.end(tag);
- return new JClassEnvImpl(cls, constructorMap, memberMap, setterMap, members,
+ return JClassEnvImpl(cls, constructorMap, memberMap, setterMap, members,
isSuperMixinApplication);
}
@@ -279,7 +278,7 @@
@override
MemberEntity lookupMember(IrToElementMap elementMap, String name,
- {bool setter: false}) {
+ {bool setter = false}) {
ir.Member member = setter ? _setterMap[name] : _memberMap[name];
return member != null ? elementMap.getMember(member) : null;
}
@@ -330,7 +329,7 @@
Map<String, IndexedMember> _memberMap =
source.readStringMap(() => source.readMember());
source.end(tag);
- return new RecordEnv(_memberMap);
+ return RecordEnv(_memberMap);
}
@override
@@ -366,7 +365,7 @@
@override
MemberEntity lookupMember(IrToElementMap elementMap, String name,
- {bool setter: false}) {
+ {bool setter = false}) {
return _memberMap[name];
}
@@ -392,7 +391,7 @@
Map<String, IndexedMember> _memberMap =
source.readStringMap(() => source.readMember());
source.end(tag);
- return new ClosureClassEnv(_memberMap);
+ return ClosureClassEnv(_memberMap);
}
@override
@@ -406,7 +405,7 @@
@override
MemberEntity lookupMember(IrToElementMap elementMap, String name,
- {bool setter: false}) {
+ {bool setter = false}) {
if (setter) {
// All closure fields are final.
return null;
@@ -424,13 +423,13 @@
JClassDataKind kind = source.readEnum(JClassDataKind.values);
switch (kind) {
case JClassDataKind.node:
- return new JClassDataImpl.readFromDataSource(source);
+ return JClassDataImpl.readFromDataSource(source);
case JClassDataKind.closure:
- return new ClosureClassData.readFromDataSource(source);
+ return ClosureClassData.readFromDataSource(source);
case JClassDataKind.record:
- return new RecordClassData.readFromDataSource(source);
+ return RecordClassData.readFromDataSource(source);
}
- throw new UnsupportedError("Unexpected JClassDataKind $kind");
+ throw UnsupportedError("Unexpected JClassDataKind $kind");
}
/// Serializes this [JClassData] to [sink].
@@ -489,9 +488,9 @@
factory JClassDataImpl.readFromDataSource(DataSource source) {
source.begin(tag);
ir.Class cls = source.readClassNode();
- ClassDefinition definition = new ClassDefinition.readFromDataSource(source);
+ ClassDefinition definition = ClassDefinition.readFromDataSource(source);
source.end(tag);
- return new JClassDataImpl(cls, definition);
+ return JClassDataImpl(cls, definition);
}
@override
@@ -543,23 +542,23 @@
JMemberDataKind kind = source.readEnum(JMemberDataKind.values);
switch (kind) {
case JMemberDataKind.function:
- return new FunctionDataImpl.readFromDataSource(source);
+ return FunctionDataImpl.readFromDataSource(source);
case JMemberDataKind.field:
- return new JFieldDataImpl.readFromDataSource(source);
+ return JFieldDataImpl.readFromDataSource(source);
case JMemberDataKind.constructor:
- return new JConstructorDataImpl.readFromDataSource(source);
+ return JConstructorDataImpl.readFromDataSource(source);
case JMemberDataKind.constructorBody:
- return new ConstructorBodyDataImpl.readFromDataSource(source);
+ return ConstructorBodyDataImpl.readFromDataSource(source);
case JMemberDataKind.signature:
- return new SignatureFunctionData.readFromDataSource(source);
+ return SignatureFunctionData.readFromDataSource(source);
case JMemberDataKind.generatorBody:
- return new GeneratorBodyFunctionData.readFromDataSource(source);
+ return GeneratorBodyFunctionData.readFromDataSource(source);
case JMemberDataKind.closureFunction:
- return new ClosureFunctionData.readFromDataSource(source);
+ return ClosureFunctionData.readFromDataSource(source);
case JMemberDataKind.closureField:
- return new ClosureFieldData.readFromDataSource(source);
+ return ClosureFieldData.readFromDataSource(source);
}
- throw new UnsupportedError("Unexpected JMemberDataKind $kind");
+ throw UnsupportedError("Unexpected JMemberDataKind $kind");
}
/// Serializes this [JMemberData] to [sink].
@@ -597,7 +596,7 @@
JsToElementMap elementMap,
ParameterStructure parameterStructure,
void f(DartType type, String name, ConstantValue defaultValue),
- {bool isNative: false});
+ {bool isNative = false});
}
abstract class FunctionDataTypeVariablesMixin implements FunctionData {
@@ -620,7 +619,7 @@
_typeVariables = functionNode.typeParameters
.map<TypeVariableType>((ir.TypeParameter typeParameter) {
return elementMap
- .getDartType(new ir.TypeParameterType(
+ .getDartType(ir.TypeParameterType(
typeParameter, ir.Nullability.nonNullable))
.withoutNullability;
}).toList();
@@ -643,9 +642,9 @@
JsToElementMap elementMap,
ParameterStructure parameterStructure,
void f(DartType type, String name, ConstantValue defaultValue),
- {bool isNative: false}) {
+ {bool isNative = false}) {
void handleParameter(ir.VariableDeclaration parameter,
- {bool isOptional: true}) {
+ {bool isOptional = true}) {
DartType type = elementMap.getDartType(parameter.type);
String name = parameter.name;
ConstantValue defaultValue;
@@ -699,15 +698,14 @@
} else if (node is ir.Constructor) {
functionNode = node.function;
} else {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unexpected member node $node (${node.runtimeType}).");
}
- MemberDefinition definition =
- new MemberDefinition.readFromDataSource(source);
+ MemberDefinition definition = MemberDefinition.readFromDataSource(source);
StaticTypeCache staticTypes =
- new StaticTypeCache.readFromDataSource(source, node);
+ StaticTypeCache.readFromDataSource(source, node);
source.end(tag);
- return new FunctionDataImpl(node, functionNode, definition, staticTypes);
+ return FunctionDataImpl(node, functionNode, definition, staticTypes);
}
@override
@@ -752,14 +750,13 @@
factory SignatureFunctionData.readFromDataSource(DataSource source) {
source.begin(tag);
- MemberDefinition definition =
- new MemberDefinition.readFromDataSource(source);
+ MemberDefinition definition = MemberDefinition.readFromDataSource(source);
InterfaceType memberThisType = source.readDartType(allowNull: true);
List<ir.TypeParameter> typeParameters = source.readTypeParameterNodes();
ClassTypeVariableAccess classTypeVariableAccess =
source.readEnum(ClassTypeVariableAccess.values);
source.end(tag);
- return new SignatureFunctionData(
+ return SignatureFunctionData(
definition, memberThisType, typeParameters, classTypeVariableAccess);
}
@@ -779,7 +776,7 @@
@override
FunctionType getFunctionType(covariant JsKernelToElementMap elementMap) {
- throw new UnsupportedError("SignatureFunctionData.getFunctionType");
+ throw UnsupportedError("SignatureFunctionData.getFunctionType");
}
@override
@@ -787,8 +784,8 @@
return typeParameters
.map<TypeVariableType>((ir.TypeParameter typeParameter) {
return elementMap
- .getDartType(new ir.TypeParameterType(
- typeParameter, ir.Nullability.nonNullable))
+ .getDartType(
+ ir.TypeParameterType(typeParameter, ir.Nullability.nonNullable))
.withoutNullability;
}).toList();
}
@@ -798,8 +795,8 @@
JsToElementMap elementMap,
ParameterStructure parameterStructure,
void f(DartType type, String name, ConstantValue defaultValue),
- {bool isNative: false}) {
- throw new UnimplementedError('SignatureData.forEachParameter');
+ {bool isNative = false}) {
+ throw UnimplementedError('SignatureData.forEachParameter');
}
@override
@@ -828,7 +825,7 @@
JsToElementMap elementMap,
ParameterStructure parameterStructure,
void f(DartType type, String name, ConstantValue defaultValue),
- {bool isNative: false}) {
+ {bool isNative = false}) {
return baseData.forEachParameter(elementMap, parameterStructure, f,
isNative: isNative);
}
@@ -857,11 +854,10 @@
factory GeneratorBodyFunctionData.readFromDataSource(DataSource source) {
source.begin(tag);
// TODO(johnniwinther): Share the original base data on deserialization.
- FunctionData baseData = new JMemberData.readFromDataSource(source);
- MemberDefinition definition =
- new MemberDefinition.readFromDataSource(source);
+ FunctionData baseData = JMemberData.readFromDataSource(source);
+ MemberDefinition definition = MemberDefinition.readFromDataSource(source);
source.end(tag);
- return new GeneratorBodyFunctionData(baseData, definition);
+ return GeneratorBodyFunctionData(baseData, definition);
}
@override
@@ -900,16 +896,14 @@
} else if (node is ir.Constructor) {
functionNode = node.function;
} else {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unexpected member node $node (${node.runtimeType}).");
}
- MemberDefinition definition =
- new MemberDefinition.readFromDataSource(source);
+ MemberDefinition definition = MemberDefinition.readFromDataSource(source);
StaticTypeCache staticTypes =
- new StaticTypeCache.readFromDataSource(source, node);
+ StaticTypeCache.readFromDataSource(source, node);
source.end(tag);
- return new JConstructorDataImpl(
- node, functionNode, definition, staticTypes);
+ return JConstructorDataImpl(node, functionNode, definition, staticTypes);
}
@override
@@ -946,16 +940,14 @@
} else if (node is ir.Constructor) {
functionNode = node.function;
} else {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unexpected member node $node (${node.runtimeType}).");
}
- MemberDefinition definition =
- new MemberDefinition.readFromDataSource(source);
+ MemberDefinition definition = MemberDefinition.readFromDataSource(source);
StaticTypeCache staticTypes =
- new StaticTypeCache.readFromDataSource(source, node);
+ StaticTypeCache.readFromDataSource(source, node);
source.end(tag);
- return new ConstructorBodyDataImpl(
- node, functionNode, definition, staticTypes);
+ return ConstructorBodyDataImpl(node, functionNode, definition, staticTypes);
}
@override
@@ -993,12 +985,11 @@
factory JFieldDataImpl.readFromDataSource(DataSource source) {
source.begin(tag);
ir.Member node = source.readMemberNode();
- MemberDefinition definition =
- new MemberDefinition.readFromDataSource(source);
+ MemberDefinition definition = MemberDefinition.readFromDataSource(source);
StaticTypeCache staticTypes =
- new StaticTypeCache.readFromDataSource(source, node);
+ StaticTypeCache.readFromDataSource(source, node);
source.end(tag);
- return new JFieldDataImpl(node, definition, staticTypes);
+ return JFieldDataImpl(node, definition, staticTypes);
}
@override
@@ -1041,7 +1032,7 @@
source.begin(tag);
ir.TypeParameter node = source.readTypeParameterNode();
source.end(tag);
- return new JTypeVariableData(node);
+ return JTypeVariableData(node);
}
void writeToDataSink(DataSink sink) {
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 0e57dd9..c6f42f1 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -84,18 +84,17 @@
SourceInformationStrategy sourceInformationStrategy;
/// The generated code as a js AST for compiled methods.
- final Map<MemberEntity, js.Expression> generatedCode =
- <MemberEntity, js.Expression>{};
+ final Map<MemberEntity, js.Expression> generatedCode = {};
JsBackendStrategy(this._compiler) {
bool generateSourceMap = _compiler.options.generateSourceMap;
if (!generateSourceMap) {
sourceInformationStrategy = const JavaScriptSourceInformationStrategy();
} else {
- sourceInformationStrategy = new KernelSourceInformationStrategy(this);
+ sourceInformationStrategy = KernelSourceInformationStrategy(this);
}
- _emitterTask = new CodeEmitterTask(_compiler, generateSourceMap);
- _functionCompiler = new SsaFunctionCompiler(
+ _emitterTask = CodeEmitterTask(_compiler, generateSourceMap);
+ _functionCompiler = SsaFunctionCompiler(
_compiler.options,
_compiler.reporter,
this,
@@ -163,23 +162,20 @@
JClosedWorld createJClosedWorld(
KClosedWorld closedWorld, OutputUnitData outputUnitData) {
KernelFrontendStrategy strategy = _compiler.frontendStrategy;
- _elementMap = new JsKernelToElementMap(
+ _elementMap = JsKernelToElementMap(
_compiler.reporter,
_compiler.environment,
strategy.elementMap,
closedWorld.liveMemberUsage,
closedWorld.annotationsData);
ClosureDataBuilder closureDataBuilder =
- new ClosureDataBuilder(_elementMap, closedWorld.annotationsData);
- JsClosedWorldBuilder closedWorldBuilder = new JsClosedWorldBuilder(
- _elementMap,
- closureDataBuilder,
- _compiler.options,
- _compiler.abstractValueStrategy);
+ ClosureDataBuilder(_elementMap, closedWorld.annotationsData);
+ JsClosedWorldBuilder closedWorldBuilder = JsClosedWorldBuilder(_elementMap,
+ closureDataBuilder, _compiler.options, _compiler.abstractValueStrategy);
JClosedWorld jClosedWorld = closedWorldBuilder.convertClosedWorld(
closedWorld, strategy.closureModels, outputUnitData);
_elementMap.lateOutputUnitDataBuilder =
- new LateOutputUnitDataBuilder(jClosedWorld.outputUnitData);
+ LateOutputUnitDataBuilder(jClosedWorld.outputUnitData);
return jClosedWorld;
}
@@ -197,23 +193,23 @@
: const FixedNames();
Tracer tracer =
- new Tracer(closedWorld, _compiler.options, _compiler.outputProvider);
+ Tracer(closedWorld, _compiler.options, _compiler.outputProvider);
RuntimeTypesSubstitutions rtiSubstitutions;
if (_compiler.options.disableRtiOptimization) {
- rtiSubstitutions = new TrivialRuntimeTypesSubstitutions(closedWorld);
+ rtiSubstitutions = TrivialRuntimeTypesSubstitutions(closedWorld);
_rtiChecksBuilder =
- new TrivialRuntimeTypesChecksBuilder(closedWorld, rtiSubstitutions);
+ TrivialRuntimeTypesChecksBuilder(closedWorld, rtiSubstitutions);
} else {
- RuntimeTypesImpl runtimeTypesImpl = new RuntimeTypesImpl(closedWorld);
+ RuntimeTypesImpl runtimeTypesImpl = RuntimeTypesImpl(closedWorld);
_rtiChecksBuilder = runtimeTypesImpl;
rtiSubstitutions = runtimeTypesImpl;
}
- RecipeEncoder rtiRecipeEncoder = new RecipeEncoderImpl(closedWorld,
+ RecipeEncoder rtiRecipeEncoder = RecipeEncoderImpl(closedWorld,
rtiSubstitutions, closedWorld.nativeData, closedWorld.commonElements);
- CodegenInputs codegen = new CodegenInputsImpl(
+ CodegenInputs codegen = CodegenInputsImpl(
rtiSubstitutions, rtiRecipeEncoder, tracer, fixedNames);
functionCompiler.initialize(globalTypeInferenceResults, codegen);
@@ -229,7 +225,7 @@
CodegenResults codegenResults) {
assert(_elementMap != null,
"JsBackendStrategy.elementMap has not been created yet.");
- OneShotInterceptorData oneShotInterceptorData = new OneShotInterceptorData(
+ OneShotInterceptorData oneShotInterceptorData = OneShotInterceptorData(
closedWorld.interceptorData,
closedWorld.commonElements,
closedWorld.nativeData);
@@ -237,26 +233,25 @@
globalInferenceResults, codegen, oneShotInterceptorData);
ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
CommonElements commonElements = closedWorld.commonElements;
- BackendImpacts impacts =
- new BackendImpacts(commonElements, _compiler.options);
- _customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis(
+ BackendImpacts impacts = BackendImpacts(commonElements, _compiler.options);
+ _customElementsCodegenAnalysis = CustomElementsCodegenAnalysis(
commonElements, elementEnvironment, closedWorld.nativeData);
- return new CodegenEnqueuer(
+ return CodegenEnqueuer(
task,
- new CodegenWorldBuilderImpl(
+ CodegenWorldBuilderImpl(
closedWorld,
_compiler.abstractValueStrategy.createSelectorStrategy(),
oneShotInterceptorData),
- new KernelCodegenWorkItemBuilder(
+ KernelCodegenWorkItemBuilder(
this,
closedWorld,
codegenResults,
- new ClosedEntityLookup(_elementMap),
+ ClosedEntityLookup(_elementMap),
// TODO(johnniwinther): Avoid the need for a [ComponentLookup]. This
// is caused by some type masks holding a kernel node for using in
// tracing.
- new ComponentLookup(_elementMap.programEnv.mainComponent)),
- new CodegenEnqueuerListener(
+ ComponentLookup(_elementMap.programEnv.mainComponent)),
+ CodegenEnqueuerListener(
_compiler.options,
elementEnvironment,
commonElements,
@@ -277,10 +272,10 @@
FixedNames fixedNames = codegen.fixedNames;
_namer = _compiler.options.enableMinification
? _compiler.options.useFrequencyNamer
- ? new FrequencyBasedNamer(closedWorld, fixedNames)
- : new MinifyNamer(closedWorld, fixedNames)
- : new Namer(closedWorld, fixedNames);
- _nativeCodegenEnqueuer = new NativeCodegenEnqueuer(
+ ? FrequencyBasedNamer(closedWorld, fixedNames)
+ : MinifyNamer(closedWorld, fixedNames)
+ : Namer(closedWorld, fixedNames);
+ _nativeCodegenEnqueuer = NativeCodegenEnqueuer(
_compiler.options,
closedWorld.elementEnvironment,
closedWorld.commonElements,
@@ -292,9 +287,9 @@
// TODO(johnniwinther): Share the impact object created in
// createCodegenEnqueuer.
BackendImpacts impacts =
- new BackendImpacts(closedWorld.commonElements, _compiler.options);
+ BackendImpacts(closedWorld.commonElements, _compiler.options);
- _codegenImpactTransformer = new CodegenImpactTransformer(
+ _codegenImpactTransformer = CodegenImpactTransformer(
closedWorld,
closedWorld.elementEnvironment,
impacts,
@@ -319,14 +314,14 @@
if (_compiler.options.testMode) {
bool useDataKinds = true;
List<Object> data = [];
- DataSink sink = new ObjectSink(data, useDataKinds: useDataKinds);
- sink.registerCodegenWriter(new CodegenWriterImpl(closedWorld));
+ DataSink sink = ObjectSink(data, useDataKinds: useDataKinds);
+ sink.registerCodegenWriter(CodegenWriterImpl(closedWorld));
result.writeToDataSink(sink);
- DataSource source = new ObjectSource(data, useDataKinds: useDataKinds);
+ DataSource source = ObjectSource(data, useDataKinds: useDataKinds);
List<ModularName> modularNames = [];
List<ModularExpression> modularExpression = [];
source.registerCodegenReader(
- new CodegenReaderImpl(closedWorld, modularNames, modularExpression));
+ CodegenReaderImpl(closedWorld, modularNames, modularExpression));
source.registerEntityLookup(entityLookup);
source.registerComponentLookup(componentLookup);
result = CodegenResult.readFromDataSource(
@@ -336,7 +331,7 @@
generatedCode[member] = result.code;
}
if (retainDataForTesting) {
- codegenImpactsForTesting ??= <MemberEntity, WorldImpact>{};
+ codegenImpactsForTesting ??= {};
codegenImpactsForTesting[member] = result.impact;
}
WorldImpact worldImpact =
@@ -364,7 +359,7 @@
@override
SsaBuilder createSsaBuilder(
CompilerTask task, SourceInformationStrategy sourceInformationStrategy) {
- return new KernelSsaBuilder(
+ return KernelSsaBuilder(
task,
_compiler.options,
_compiler.reporter,
@@ -384,23 +379,22 @@
JClosedWorld closedWorld,
GlobalLocalsMap globalLocalsMap,
InferredDataBuilder inferredDataBuilder) {
- return new TypeGraphInferrer(
+ return TypeGraphInferrer(
_compiler, closedWorld, globalLocalsMap, inferredDataBuilder);
}
@override
void prepareCodegenReader(DataSource source) {
- source.registerEntityReader(new ClosedEntityReader(_elementMap));
- source.registerEntityLookup(new ClosedEntityLookup(_elementMap));
+ source.registerEntityReader(ClosedEntityReader(_elementMap));
+ source.registerEntityLookup(ClosedEntityLookup(_elementMap));
source.registerComponentLookup(
- new ComponentLookup(_elementMap.programEnv.mainComponent));
+ ComponentLookup(_elementMap.programEnv.mainComponent));
}
@override
EntityWriter forEachCodegenMember(void Function(MemberEntity member) f) {
int earlyMemberIndexLimit = _elementMap.prepareForCodegenSerialization();
- ClosedEntityWriter entityWriter =
- new ClosedEntityWriter(earlyMemberIndexLimit);
+ ClosedEntityWriter entityWriter = ClosedEntityWriter(earlyMemberIndexLimit);
for (int memberIndex = 0;
memberIndex < _elementMap.members.length;
memberIndex++) {
@@ -425,7 +419,7 @@
@override
WorkItem createWorkItem(MemberEntity entity) {
if (entity.isAbstract) return null;
- return new KernelCodegenWorkItem(_backendStrategy, _closedWorld,
+ return KernelCodegenWorkItem(_backendStrategy, _closedWorld,
_codegenResults, _entityLookup, _componentLookup, entity);
}
}
@@ -478,12 +472,12 @@
CodegenRegistry registry,
ModularNamer namer,
ModularEmitter emitter) {
- _inlineCache ??= new FunctionInlineCache(closedWorld.annotationsData);
- _inlineDataCache ??= new InlineDataCache(
+ _inlineCache ??= FunctionInlineCache(closedWorld.annotationsData);
+ _inlineDataCache ??= InlineDataCache(
enableUserAssertions: _options.enableUserAssertions,
omitImplicitCasts: _options.omitImplicitChecks);
return _task.measure(() {
- KernelSsaGraphBuilder builder = new KernelSsaGraphBuilder(
+ KernelSsaGraphBuilder builder = KernelSsaGraphBuilder(
_options,
_reporter,
member,
@@ -574,7 +568,7 @@
@override
AbstractValue inferredIndexType(ir.ForInStatement node) {
return AbstractValueFactory.inferredResultTypeForSelector(
- new Selector.index(), typeOfIterator(node), _globalInferenceResults);
+ Selector.index(), typeOfIterator(node), _globalInferenceResults);
}
@override
diff --git a/pkg/compiler/lib/src/js_model/js_world.dart b/pkg/compiler/lib/src/js_model/js_world.dart
index e5956fd..1e469ff 100644
--- a/pkg/compiler/lib/src/js_model/js_world.dart
+++ b/pkg/compiler/lib/src/js_model/js_world.dart
@@ -24,7 +24,6 @@
import '../js_backend/native_data.dart';
import '../js_backend/no_such_method_registry.dart';
import '../js_backend/runtime_types_resolution.dart';
-import '../js_model/locals.dart';
import '../ordered_typeset.dart';
import '../options.dart';
import '../serialization/serialization.dart';
@@ -57,8 +56,7 @@
final Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses;
- final Map<ClassEntity, Map<ClassEntity, bool>> _subtypeCoveredByCache =
- <ClassEntity, Map<ClassEntity, bool>>{};
+ final Map<ClassEntity, Map<ClassEntity, bool>> _subtypeCoveredByCache = {};
// TODO(johnniwinther): Can this be derived from [ClassSet]s?
final Set<ClassEntity> implementedClasses;
@@ -131,23 +129,22 @@
DataSource source) {
source.begin(tag);
- JsKernelToElementMap elementMap =
- new JsKernelToElementMap.readFromDataSource(
- options, reporter, environment, component, source);
- ClassHierarchy classHierarchy = new ClassHierarchy.readFromDataSource(
- source, elementMap.commonElements);
- NativeData nativeData = new NativeData.readFromDataSource(
- source, elementMap.elementEnvironment);
+ JsKernelToElementMap elementMap = JsKernelToElementMap.readFromDataSource(
+ options, reporter, environment, component, source);
+ ClassHierarchy classHierarchy =
+ ClassHierarchy.readFromDataSource(source, elementMap.commonElements);
+ NativeData nativeData =
+ NativeData.readFromDataSource(source, elementMap.elementEnvironment);
elementMap.nativeData = nativeData;
- InterceptorData interceptorData = new InterceptorData.readFromDataSource(
+ InterceptorData interceptorData = InterceptorData.readFromDataSource(
source, nativeData, elementMap.commonElements);
- BackendUsage backendUsage = new BackendUsage.readFromDataSource(source);
- RuntimeTypesNeed rtiNeed = new RuntimeTypesNeed.readFromDataSource(
+ BackendUsage backendUsage = BackendUsage.readFromDataSource(source);
+ RuntimeTypesNeed rtiNeed = RuntimeTypesNeed.readFromDataSource(
source, elementMap.elementEnvironment);
JFieldAnalysis allocatorAnalysis =
- new JFieldAnalysis.readFromDataSource(source, options);
+ JFieldAnalysis.readFromDataSource(source, options);
NoSuchMethodData noSuchMethodData =
- new NoSuchMethodData.readFromDataSource(source);
+ NoSuchMethodData.readFromDataSource(source);
Set<ClassEntity> implementedClasses = source.readClasses().toSet();
Set<ClassEntity> liveNativeClasses = source.readClasses().toSet();
@@ -162,22 +159,21 @@
source.readClassMap(() => source.readClasses().toSet());
AnnotationsData annotationsData =
- new AnnotationsData.readFromDataSource(options, source);
+ AnnotationsData.readFromDataSource(options, source);
ClosureData closureData =
- new ClosureData.readFromDataSource(elementMap, source);
+ ClosureData.readFromDataSource(elementMap, source);
- OutputUnitData outputUnitData =
- new OutputUnitData.readFromDataSource(source);
+ OutputUnitData outputUnitData = OutputUnitData.readFromDataSource(source);
elementMap.lateOutputUnitDataBuilder =
- new LateOutputUnitDataBuilder(outputUnitData);
+ LateOutputUnitDataBuilder(outputUnitData);
Map<MemberEntity, MemberAccess> memberAccess = source.readMemberMap(
- (MemberEntity member) => new MemberAccess.readFromDataSource(source));
+ (MemberEntity member) => MemberAccess.readFromDataSource(source));
source.end(tag);
- return new JsClosedWorld(
+ return JsClosedWorld(
elementMap,
nativeData,
interceptorData,
@@ -280,8 +276,7 @@
@override
bool everySubtypeIsSubclassOfOrMixinUseOf(ClassEntity x, ClassEntity y) {
- Map<ClassEntity, bool> secondMap =
- _subtypeCoveredByCache[x] ??= <ClassEntity, bool>{};
+ Map<ClassEntity, bool> secondMap = _subtypeCoveredByCache[x] ??= {};
return secondMap[y] ??= classHierarchy.subtypesOf(x).every(
(ClassEntity cls) =>
classHierarchy.isSubclassOf(cls, y) ||
@@ -389,7 +384,7 @@
@override
Iterable<ClassEntity> mixinUsesOf(ClassEntity cls) {
if (_liveMixinUses == null) {
- _liveMixinUses = new Map<ClassEntity, List<ClassEntity>>();
+ _liveMixinUses = Map<ClassEntity, List<ClassEntity>>();
for (ClassEntity mixin in mixinUses.keys) {
List<ClassEntity> uses = <ClassEntity>[];
@@ -438,7 +433,7 @@
if (_allFunctions == null) {
// [FunctionSet] is created lazily because it is not used when we switch
// from a frontend to a backend model before inference.
- _allFunctions = new FunctionSet(liveInstanceMembers);
+ _allFunctions = FunctionSet(liveInstanceMembers);
}
}
@@ -535,7 +530,7 @@
@override
Sorter get sorter {
- return _sorter ??= new KernelSorter(elementMap);
+ return _sorter ??= KernelSorter(elementMap);
}
@override
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 a5ad110..45e38ba 100644
--- a/pkg/compiler/lib/src/js_model/js_world_builder.dart
+++ b/pkg/compiler/lib/src/js_model/js_world_builder.dart
@@ -40,7 +40,7 @@
class JsClosedWorldBuilder {
final JsKernelToElementMap _elementMap;
final Map<ClassEntity, ClassHierarchyNode> _classHierarchyNodes =
- new ClassHierarchyNodesMap();
+ ClassHierarchyNodesMap();
final Map<ClassEntity, ClassSet> _classSets = <ClassEntity, ClassSet>{};
final ClosureDataBuilder _closureDataBuilder;
final CompilerOptions _options;
@@ -57,14 +57,14 @@
KClosedWorld closedWorld,
Map<MemberEntity, ClosureScopeModel> closureModels,
OutputUnitData kOutputUnitData) {
- JsToFrontendMap map = new JsToFrontendMapImpl(_elementMap);
+ JsToFrontendMap map = JsToFrontendMapImpl(_elementMap);
NativeData nativeData = _convertNativeData(map, closedWorld.nativeData);
_elementMap.nativeData = nativeData;
InterceptorData interceptorData =
_convertInterceptorData(map, nativeData, closedWorld.interceptorData);
- Set<ClassEntity> implementedClasses = new Set<ClassEntity>();
+ Set<ClassEntity> implementedClasses = Set<ClassEntity>();
/// Converts [node] from the frontend world to the corresponding
/// [ClassHierarchyNode] for the backend world.
@@ -78,7 +78,7 @@
if (node.parentNode != null) {
parentNode = convertClassHierarchyNode(node.parentNode);
}
- return new ClassHierarchyNode(parentNode, cls, node.hierarchyDepth);
+ return ClassHierarchyNode(parentNode, cls, node.hierarchyDepth);
});
newNode.isAbstractlyInstantiated = node.isAbstractlyInstantiated;
newNode.isDirectlyInstantiated = node.isDirectlyInstantiated;
@@ -91,7 +91,7 @@
ClassEntity cls = map.toBackendClass(classSet.cls);
return _classSets.putIfAbsent(cls, () {
ClassHierarchyNode newNode = convertClassHierarchyNode(classSet.node);
- ClassSet newClassSet = new ClassSet(newNode);
+ ClassSet newClassSet = ClassSet(newNode);
for (ClassHierarchyNode subtype in classSet.subtypeNodes) {
ClassHierarchyNode newSubtype = convertClassHierarchyNode(subtype);
newClassSet.addSubtype(newSubtype);
@@ -133,7 +133,7 @@
List<FunctionEntity> callMethods = <FunctionEntity>[];
ClosureData closureData;
if (_options.disableRtiOptimization) {
- rtiNeed = new TrivialRuntimeTypesNeed(_elementMap.elementEnvironment);
+ rtiNeed = TrivialRuntimeTypesNeed(_elementMap.elementEnvironment);
closureData = _closureDataBuilder.createClosureEntities(
this,
map.toBackendMemberMap(closureModels, identity),
@@ -142,14 +142,14 @@
} else {
RuntimeTypesNeedImpl kernelRtiNeed = closedWorld.rtiNeed;
Set<ir.LocalFunction> localFunctionsNodesNeedingSignature =
- new Set<ir.LocalFunction>();
+ Set<ir.LocalFunction>();
for (KLocalFunction localFunction
in kernelRtiNeed.localFunctionsNeedingSignature) {
ir.LocalFunction node = localFunction.node;
localFunctionsNodesNeedingSignature.add(node);
}
Set<ir.LocalFunction> localFunctionsNodesNeedingTypeArguments =
- new Set<ir.LocalFunction>();
+ Set<ir.LocalFunction>();
for (KLocalFunction localFunction
in kernelRtiNeed.localFunctionsNeedingTypeArguments) {
ir.LocalFunction node = localFunction.node;
@@ -161,9 +161,7 @@
closureData = _closureDataBuilder.createClosureEntities(
this,
map.toBackendMemberMap(closureModels, identity),
- new JsClosureRtiNeed(
- jRtiNeed,
- localFunctionsNodesNeedingTypeArguments,
+ JsClosureRtiNeed(jRtiNeed, localFunctionsNodesNeedingTypeArguments,
localFunctionsNodesNeedingSignature),
callMethods);
@@ -190,7 +188,7 @@
_convertBackendUsage(map, closedWorld.backendUsage);
NoSuchMethodDataImpl oldNoSuchMethodData = closedWorld.noSuchMethodData;
- NoSuchMethodData noSuchMethodData = new NoSuchMethodDataImpl(
+ NoSuchMethodData noSuchMethodData = NoSuchMethodDataImpl(
map.toBackendFunctionSet(oldNoSuchMethodData.throwingImpls),
map.toBackendFunctionSet(oldNoSuchMethodData.otherImpls),
map.toBackendFunctionSet(oldNoSuchMethodData.forwardingSyntaxImpls));
@@ -199,7 +197,7 @@
JFieldAnalysis.from(closedWorld, map, _options);
AnnotationsDataImpl oldAnnotationsData = closedWorld.annotationsData;
- AnnotationsData annotationsData = new AnnotationsDataImpl(_options,
+ AnnotationsData annotationsData = AnnotationsDataImpl(_options,
map.toBackendMemberMap(oldAnnotationsData.pragmaAnnotations, identity));
OutputUnitData outputUnitData =
@@ -208,9 +206,9 @@
Map<MemberEntity, MemberAccess> memberAccess = map.toBackendMemberMap(
closedWorld.liveMemberUsage,
(MemberUsage usage) =>
- new MemberAccess(usage.reads, usage.writes, usage.invokes));
+ MemberAccess(usage.reads, usage.writes, usage.invokes));
- return new JsClosedWorld(
+ return JsClosedWorld(
_elementMap,
nativeData,
interceptorData,
@@ -229,7 +227,7 @@
extractTypeArgumentsInterfacesNewRti,
mixinUses,
typesImplementedBySubclasses,
- new ClassHierarchyImpl(
+ ClassHierarchyImpl(
_elementMap.commonElements, _classHierarchyNodes, _classSets),
_abstractValueStrategy,
annotationsData,
@@ -250,7 +248,7 @@
map.toBackendClassSet(backendUsage.helperClassesUsed);
Set<RuntimeTypeUse> runtimeTypeUses =
backendUsage.runtimeTypeUses.map((RuntimeTypeUse runtimeTypeUse) {
- return new RuntimeTypeUse(
+ return RuntimeTypeUse(
runtimeTypeUse.kind,
map.toBackendType(runtimeTypeUse.receiverType),
map.toBackendType(runtimeTypeUse.argumentType));
@@ -290,7 +288,7 @@
map.toBackendClassSet(nativeBasicData.anonymousJsInteropClasses);
Map<MemberEntity, String> jsInteropMembers =
map.toBackendMemberMap(nativeBasicData.jsInteropMembers, identity);
- return new NativeBasicDataImpl(
+ return NativeBasicDataImpl(
_elementEnvironment,
nativeBasicData.isAllowInteropUsed,
nativeClassTagInfo,
@@ -314,7 +312,7 @@
}
NativeBehavior convertNativeBehavior(NativeBehavior behavior) {
- NativeBehavior newBehavior = new NativeBehavior();
+ NativeBehavior newBehavior = NativeBehavior();
for (dynamic type in behavior.typesReturned) {
newBehavior.typesReturned.add(convertNativeBehaviorType(type));
@@ -353,7 +351,7 @@
Map<MemberEntity, NativeBehavior> nativeFieldStoreBehavior =
map.toBackendMemberMap(
nativeData.nativeFieldStoreBehavior, convertNativeBehavior);
- return new NativeDataImpl(
+ return NativeDataImpl(
nativeBasicData,
nativeMemberName,
nativeMethodBehavior,
@@ -369,7 +367,7 @@
.forEach((String name, Set<MemberEntity> members) {
interceptedMembers[name] = map.toBackendMemberSet(members);
});
- return new InterceptorDataImpl(
+ return InterceptorDataImpl(
nativeData,
_commonElements,
interceptedMembers,
@@ -389,16 +387,16 @@
Set<Selector> selectorsNeedingTypeArguments =
rtiNeed.selectorsNeedingTypeArguments.map((Selector selector) {
if (selector.memberName.isPrivate) {
- return new Selector(
+ return Selector(
selector.kind,
- new PrivateName(selector.memberName.text,
+ PrivateName(selector.memberName.text,
map.toBackendLibrary(selector.memberName.library),
isSetter: selector.memberName.isSetter),
selector.callStructure);
}
return selector;
}).toSet();
- return new RuntimeTypesNeedImpl(
+ return RuntimeTypesNeedImpl(
_elementEnvironment,
classesNeedingTypeArguments,
methodsNeedingSignature,
@@ -433,10 +431,10 @@
// Tell the hierarchy that this is the super class. then we can use
// .getSupertypes(class)
ClassHierarchyNode parentNode = _classHierarchyNodes[superclass];
- ClassHierarchyNode node = new ClassHierarchyNode(parentNode,
+ ClassHierarchyNode node = ClassHierarchyNode(parentNode,
closureClassInfo.closureClassEntity, parentNode.hierarchyDepth + 1);
_classHierarchyNodes[closureClassInfo.closureClassEntity] = node;
- _classSets[closureClassInfo.closureClassEntity] = new ClassSet(node);
+ _classSets[closureClassInfo.closureClassEntity] = ClassSet(node);
node.isDirectlyInstantiated = true;
return closureClassInfo;
@@ -512,7 +510,7 @@
return result;
}
- return new OutputUnitData.from(
+ return OutputUnitData.from(
data,
map.toBackendLibrary,
convertClassMap,
@@ -607,9 +605,10 @@
/// returned instead.
MemberEntity toBackendMember(MemberEntity member);
- DartType toBackendType(DartType type, {bool allowFreeVariables: false});
+ DartType toBackendType(DartType type, {bool allowFreeVariables = false});
- ConstantValue toBackendConstant(ConstantValue value, {bool allowNull: false});
+ ConstantValue toBackendConstant(ConstantValue value,
+ {bool allowNull = false});
/// Register [closureData] with this map.
///
@@ -635,7 +634,7 @@
}
Set<FieldEntity> toBackendFieldSet(Iterable<FieldEntity> set) {
- Set<FieldEntity> newSet = new Set<FieldEntity>();
+ Set<FieldEntity> newSet = Set<FieldEntity>();
for (FieldEntity element in set) {
FieldEntity backendField = toBackendMember(element);
if (backendField != null) {
@@ -647,7 +646,7 @@
}
Set<FunctionEntity> toBackendFunctionSet(Iterable<FunctionEntity> set) {
- Set<FunctionEntity> newSet = new Set<FunctionEntity>();
+ Set<FunctionEntity> newSet = Set<FunctionEntity>();
for (FunctionEntity element in set) {
FunctionEntity backendFunction = toBackendMember(element);
if (backendFunction != null) {
@@ -678,7 +677,7 @@
Map<K, V2> convertMap<K, V1, V2>(
Map<K, V1> map, K convertKey(K key), V2 convertValue(V1 value)) {
- Map<K, V2> newMap = <K, V2>{};
+ Map<K, V2> newMap = {};
map.forEach((K key, V1 value) {
K newKey = convertKey(key);
V2 newValue = convertValue(value);
@@ -697,10 +696,10 @@
JsToFrontendMapImpl(this._backend);
@override
- DartType toBackendType(DartType type, {bool allowFreeVariables: false}) =>
+ DartType toBackendType(DartType type, {bool allowFreeVariables = false}) =>
type == null
? null
- : new _TypeConverter(_backend.types,
+ : _TypeConverter(_backend.types,
allowFreeVariables: allowFreeVariables)
.visit(type, toBackendEntity);
@@ -754,28 +753,27 @@
@override
ConstantValue toBackendConstant(ConstantValue constant,
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (constant == null) {
if (!allowNull) {
- throw new UnsupportedError('Null not allowed as constant value.');
+ throw UnsupportedError('Null not allowed as constant value.');
}
return null;
}
return constant.accept(
- new _ConstantConverter(_backend.types, toBackendEntity), null);
+ _ConstantConverter(_backend.types, toBackendEntity), null);
}
}
-typedef Entity _EntityConverter(Entity cls);
+typedef _EntityConverter = Entity Function(Entity cls);
class _TypeConverter implements DartTypeVisitor<DartType, _EntityConverter> {
final DartTypes _dartTypes;
final bool allowFreeVariables;
- Map<FunctionTypeVariable, FunctionTypeVariable> _functionTypeVariables =
- <FunctionTypeVariable, FunctionTypeVariable>{};
+ Map<FunctionTypeVariable, FunctionTypeVariable> _functionTypeVariables = {};
- _TypeConverter(this._dartTypes, {this.allowFreeVariables: false});
+ _TypeConverter(this._dartTypes, {this.allowFreeVariables = false});
List<DartType> convertTypes(
List<DartType> types, _EntityConverter converter) =>
@@ -885,7 +883,7 @@
final _TypeConverter typeConverter;
_ConstantConverter(this._dartTypes, this.toBackendEntity)
- : typeConverter = new _TypeConverter(_dartTypes);
+ : typeConverter = _TypeConverter(_dartTypes);
@override
ConstantValue visitNull(NullConstantValue constant, _) => constant;
@@ -914,7 +912,7 @@
@override
ConstantValue visitFunction(FunctionConstantValue constant, _) {
- return new FunctionConstantValue(toBackendEntity(constant.element),
+ return FunctionConstantValue(toBackendEntity(constant.element),
typeConverter.visit(constant.type, toBackendEntity));
}
@@ -925,7 +923,7 @@
if (identical(entries, constant.entries) && type == constant.type) {
return constant;
}
- return new ListConstantValue(type, entries);
+ return ListConstantValue(type, entries);
}
@override
@@ -936,7 +934,7 @@
if (identical(entries, constant.entries) && type == constant.type) {
return constant;
}
- return new constant_system.JavaScriptSetConstant(type, entries);
+ return constant_system.JavaScriptSetConstant(type, entries);
}
@override
@@ -950,7 +948,7 @@
type == constant.type) {
return constant;
}
- return new constant_system.JavaScriptMapConstant(
+ return constant_system.JavaScriptMapConstant(
type, keys, values, constant.onlyStringKeys);
}
@@ -963,7 +961,7 @@
assert(backendField != null, "No backend field for $f.");
fields[backendField] = v.accept(this, null);
});
- return new ConstructedConstantValue(type, fields);
+ return ConstructedConstantValue(type, fields);
}
@override
@@ -974,20 +972,20 @@
if (type == constant.type && representedType == constant.representedType) {
return constant;
}
- return new TypeConstantValue(representedType, type);
+ return TypeConstantValue(representedType, type);
}
@override
ConstantValue visitInterceptor(InterceptorConstantValue constant, _) {
// Interceptor constants are only created in the SSA graph builder.
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unexpected visitInterceptor ${constant.toStructuredText(_dartTypes)}");
}
@override
ConstantValue visitDeferredGlobal(DeferredGlobalConstantValue constant, _) {
// Deferred global constants are only created in the SSA graph builder.
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unexpected DeferredGlobalConstantValue ${constant.toStructuredText(_dartTypes)}");
}
@@ -996,7 +994,7 @@
ConstantValue function = constant.function.accept(this, null);
List<DartType> typeArguments =
typeConverter.convertTypes(constant.typeArguments, toBackendEntity);
- return new InstantiationConstantValue(typeArguments, function);
+ return InstantiationConstantValue(typeArguments, function);
}
List<ConstantValue> _handleValues(List<ConstantValue> values) {
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index 103c5a8..6f88356 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -44,14 +44,14 @@
int mapCount = source.readInt();
for (int i = 0; i < mapCount; i++) {
KernelToLocalsMap localsMap =
- new KernelToLocalsMapImpl.readFromDataSource(source);
+ KernelToLocalsMapImpl.readFromDataSource(source);
List<MemberEntity> members = source.readMembers();
for (MemberEntity member in members) {
_localsMaps[member] = localsMap;
}
}
source.end(tag);
- return new GlobalLocalsMap.internal(localMapKeyLookup, _localsMaps);
+ return GlobalLocalsMap.internal(localMapKeyLookup, _localsMaps);
}
/// Serializes this [GlobalLocalsMap] to [sink].
@@ -89,7 +89,7 @@
// constructor steps.
MemberEntity entity = key;
if (entity is ConstructorBodyEntity) key = entity.constructor;
- return _localsMaps.putIfAbsent(key, () => new KernelToLocalsMapImpl(key));
+ return _localsMaps.putIfAbsent(key, () => KernelToLocalsMapImpl(key));
}
}
@@ -303,7 +303,7 @@
JJumpTarget _getJumpTarget(ir.TreeNode node) {
return jumpTargetMap.putIfAbsent(node, () {
- return new JJumpTarget(member, jumpIndex++,
+ return JJumpTarget(member, jumpIndex++,
isSwitch: node is ir.SwitchStatement,
isSwitchCase: node is ir.SwitchCase);
});
@@ -469,10 +469,10 @@
bool isContinueTarget;
JJumpTarget(this.memberContext, this.nestingLevel,
- {this.isSwitch: false,
- this.isSwitchCase: false,
- this.isBreakTarget: false,
- this.isContinueTarget: false});
+ {this.isSwitch = false,
+ this.isSwitchCase = false,
+ this.isBreakTarget = false,
+ this.isContinueTarget = false});
/// Deserializes a [JJumpTarget] object from [source].
factory JJumpTarget.readFromDataSource(DataSource source) {
@@ -483,7 +483,7 @@
bool isSwitchCase = source.readBool();
bool isBreakTarget = source.readBool();
bool isContinueTarget = source.readBool();
- JJumpTarget target = new JJumpTarget(memberContext, nestingLevel,
+ JJumpTarget target = JJumpTarget(memberContext, nestingLevel,
isSwitch: isSwitch,
isSwitchCase: isSwitchCase,
isBreakTarget: isBreakTarget,
@@ -524,9 +524,9 @@
@override
LabelDefinition addLabel(String labelName,
- {bool isBreakTarget: false, bool isContinueTarget: false}) {
+ {bool isBreakTarget = false, bool isContinueTarget = false}) {
_labels ??= <LabelDefinition>[];
- LabelDefinition labelDefinition = new JLabelDefinition(this, labelName,
+ LabelDefinition labelDefinition = JLabelDefinition(this, labelName,
isBreakTarget: isBreakTarget, isContinueTarget: isContinueTarget);
_labels.add(labelDefinition);
return labelDefinition;
@@ -539,7 +539,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('JJumpTarget(');
sb.write('memberContext=');
sb.write(memberContext);
@@ -569,13 +569,13 @@
bool isContinueTarget;
JLabelDefinition(this.target, this.labelName,
- {this.isBreakTarget: false, this.isContinueTarget: false});
+ {this.isBreakTarget = false, this.isContinueTarget = false});
@override
String get name => labelName;
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('JLabelDefinition(');
sb.write(',labelName=');
sb.write(labelName);
@@ -596,7 +596,7 @@
/// True if this local represents a local parameter.
final bool isRegularParameter;
- JLocal(this.name, this.memberContext, {this.isRegularParameter: false}) {
+ JLocal(this.name, this.memberContext, {this.isRegularParameter = false}) {
assert(memberContext is! JGeneratorBody);
}
@@ -604,7 +604,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('$_kind(');
if (memberContext.enclosingClass != null) {
sb.write(memberContext.enclosingClass.name);
diff --git a/pkg/compiler/lib/src/serialization/abstract_sink.dart b/pkg/compiler/lib/src/serialization/abstract_sink.dart
index 8cf7074..2f6967b 100644
--- a/pkg/compiler/lib/src/serialization/abstract_sink.dart
+++ b/pkg/compiler/lib/src/serialization/abstract_sink.dart
@@ -51,7 +51,7 @@
}
AbstractDataSink(
- {this.useDataKinds: false, this.tagFrequencyMap, this.importedIndices}) {
+ {this.useDataKinds = false, this.tagFrequencyMap, this.importedIndices}) {
_dartTypeNodeWriter = DartTypeNodeWriter(this);
_stringIndex = _createSink<String>();
_uriIndex = _createSink<Uri>();
@@ -99,7 +99,7 @@
assert(_currentMemberContext != null,
"DataSink has no current member context.");
return _currentMemberData ??= _memberData[_currentMemberContext] ??=
- new _MemberData(_currentMemberContext);
+ _MemberData(_currentMemberContext);
}
@override
@@ -117,17 +117,17 @@
}
@override
- void writeDartType(DartType value, {bool allowNull: false}) {
+ void writeDartType(DartType value, {bool allowNull = false}) {
_writeDataKind(DataKind.dartType);
_writeDartType(value, [], allowNull: allowNull);
}
void _writeDartType(
DartType value, List<FunctionTypeVariable> functionTypeVariables,
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (value == null) {
if (!allowNull) {
- throw new UnsupportedError("Missing DartType is not allowed.");
+ throw UnsupportedError("Missing DartType is not allowed.");
}
writeEnum(DartTypeKind.none);
} else {
@@ -136,17 +136,17 @@
}
@override
- void writeDartTypeNode(ir.DartType value, {bool allowNull: false}) {
+ void writeDartTypeNode(ir.DartType value, {bool allowNull = false}) {
_writeDataKind(DataKind.dartTypeNode);
_writeDartTypeNode(value, [], allowNull: allowNull);
}
void _writeDartTypeNode(
ir.DartType value, List<ir.TypeParameter> functionTypeVariables,
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (value == null) {
if (!allowNull) {
- throw new UnsupportedError("Missing ir.DartType node is not allowed.");
+ throw UnsupportedError("Missing ir.DartType node is not allowed.");
}
writeEnum(DartTypeNodeKind.none);
} else {
@@ -275,7 +275,7 @@
@override
void writeTreeNodesInContext(Iterable<ir.TreeNode> values,
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -289,7 +289,7 @@
@override
void writeTreeNodeMapInContext<V>(Map<ir.TreeNode, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -306,13 +306,13 @@
ir.TreeNode member = node;
while (member is! ir.Member) {
if (member == null) {
- throw new UnsupportedError("No enclosing member of TreeNode "
+ throw UnsupportedError("No enclosing member of TreeNode "
"$node (${node.runtimeType})");
}
member = member.parent;
}
_writeMemberNode(member);
- return _memberData[member] ??= new _MemberData(member);
+ return _memberData[member] ??= _MemberData(member);
}
void _writeTreeNode(ir.TreeNode value, _MemberData memberData) {
@@ -366,7 +366,7 @@
_writeEnumInternal(_FunctionNodeKind.functionDeclaration);
_writeTreeNode(parent, memberData);
} else {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unsupported FunctionNode parent ${parent.runtimeType}");
}
}
@@ -388,7 +388,7 @@
_writeFunctionNode(parent, memberData);
_writeIntInternal(parent.typeParameters.indexOf(value));
} else {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unsupported TypeParameter parent ${parent.runtimeType}");
}
}
@@ -436,7 +436,7 @@
writeEnum(LocalKind.typeVariableLocal);
writeTypeVariable(local.typeVariable);
} else {
- throw new UnsupportedError("Unsupported local ${local.runtimeType}");
+ throw UnsupportedError("Unsupported local ${local.runtimeType}");
}
}
@@ -453,7 +453,7 @@
}
void _writeDoubleValue(double value) {
- ByteData data = new ByteData(8);
+ ByteData data = ByteData(8);
data.setFloat64(0, value);
writeInt(data.getUint16(0));
writeInt(data.getUint16(2));
@@ -464,7 +464,7 @@
@override
void writeIntegerValue(int value) {
_writeDataKind(DataKind.int);
- _writeBigInt(new BigInt.from(value));
+ _writeBigInt(BigInt.from(value));
}
void _writeBigInt(BigInt value) {
diff --git a/pkg/compiler/lib/src/serialization/abstract_source.dart b/pkg/compiler/lib/src/serialization/abstract_source.dart
index bda940e..27f29ff 100644
--- a/pkg/compiler/lib/src/serialization/abstract_source.dart
+++ b/pkg/compiler/lib/src/serialization/abstract_source.dart
@@ -39,7 +39,7 @@
}
}
- AbstractDataSource({this.useDataKinds: false, this.importedIndices}) {
+ AbstractDataSource({this.useDataKinds = false, this.importedIndices}) {
_stringIndex = _createSource<String>();
_uriIndex = _createSource<Uri>();
_memberNodeIndex = _createSource<_MemberData>();
@@ -175,7 +175,7 @@
List<ir.TypeParameter> functionTypeVariables) {
int count = readInt();
if (count == 0) return emptyListOfDartTypes;
- List<ir.DartType> types = new List<ir.DartType>.filled(count, null);
+ List<ir.DartType> types = List<ir.DartType>.filled(count, null);
for (int index = 0; index < count; index++) {
types[index] = _readDartTypeNode(functionTypeVariables);
}
@@ -188,11 +188,11 @@
Uri uri = _readUri();
int begin = _readIntInternal();
int end = _readIntInternal();
- return new SourceSpan(uri, begin, end);
+ return SourceSpan(uri, begin, end);
}
@override
- DartType readDartType({bool allowNull: false}) {
+ DartType readDartType({bool allowNull = false}) {
_checkDataKind(DataKind.dartType);
DartType type = DartType.readFromDataSource(this, []);
assert(type != null || allowNull);
@@ -200,7 +200,7 @@
}
@override
- ir.DartType readDartTypeNode({bool allowNull: false}) {
+ ir.DartType readDartTypeNode({bool allowNull = false}) {
_checkDataKind(DataKind.dartTypeNode);
ir.DartType type = _readDartTypeNode([]);
assert(type != null || allowNull);
@@ -226,7 +226,7 @@
ir.Nullability typeParameterTypeNullability =
readEnum(ir.Nullability.values);
ir.DartType promotedBound = _readDartTypeNode(functionTypeVariables);
- return new ir.TypeParameterType(
+ return ir.TypeParameterType(
typeParameter, typeParameterTypeNullability, promotedBound);
case DartTypeNodeKind.functionTypeVariable:
int index = readInt();
@@ -234,16 +234,15 @@
ir.Nullability typeParameterTypeNullability =
readEnum(ir.Nullability.values);
ir.DartType promotedBound = _readDartTypeNode(functionTypeVariables);
- return new ir.TypeParameterType(functionTypeVariables[index],
+ return ir.TypeParameterType(functionTypeVariables[index],
typeParameterTypeNullability, promotedBound);
case DartTypeNodeKind.functionType:
begin(functionTypeNodeTag);
int typeParameterCount = readInt();
- List<ir.TypeParameter> typeParameters =
- new List<ir.TypeParameter>.generate(
- typeParameterCount, (int index) => new ir.TypeParameter());
+ List<ir.TypeParameter> typeParameters = List<ir.TypeParameter>.generate(
+ typeParameterCount, (int index) => ir.TypeParameter());
functionTypeVariables =
- new List<ir.TypeParameter>.from(functionTypeVariables)
+ List<ir.TypeParameter>.from(functionTypeVariables)
..addAll(typeParameters);
for (int index = 0; index < typeParameterCount; index++) {
typeParameters[index].name = readString();
@@ -259,18 +258,17 @@
_readDartTypeNodes(functionTypeVariables);
int namedParameterCount = readInt();
List<ir.NamedType> namedParameters =
- new List<ir.NamedType>.filled(namedParameterCount, null);
+ List<ir.NamedType>.filled(namedParameterCount, null);
for (int index = 0; index < namedParameterCount; index++) {
String name = readString();
bool isRequired = readBool();
ir.DartType type = _readDartTypeNode(functionTypeVariables);
namedParameters[index] =
- new ir.NamedType(name, type, isRequired: isRequired);
+ ir.NamedType(name, type, isRequired: isRequired);
}
ir.TypedefType typedefType = _readDartTypeNode(functionTypeVariables);
end(functionTypeNodeTag);
- return new ir.FunctionType(
- positionalParameters, returnType, nullability,
+ return ir.FunctionType(positionalParameters, returnType, nullability,
namedParameters: namedParameters,
typeParameters: typeParameters,
requiredParameterCount: requiredParameterCount,
@@ -281,35 +279,35 @@
ir.Nullability nullability = readEnum(ir.Nullability.values);
List<ir.DartType> typeArguments =
_readDartTypeNodes(functionTypeVariables);
- return new ir.InterfaceType(cls, nullability, typeArguments);
+ return ir.InterfaceType(cls, nullability, typeArguments);
case DartTypeNodeKind.thisInterfaceType:
ir.Class cls = readClassNode();
ir.Nullability nullability = readEnum(ir.Nullability.values);
List<ir.DartType> typeArguments =
_readDartTypeNodes(functionTypeVariables);
- return new ThisInterfaceType(cls, nullability, typeArguments);
+ return ThisInterfaceType(cls, nullability, typeArguments);
case DartTypeNodeKind.exactInterfaceType:
ir.Class cls = readClassNode();
ir.Nullability nullability = readEnum(ir.Nullability.values);
List<ir.DartType> typeArguments =
_readDartTypeNodes(functionTypeVariables);
- return new ExactInterfaceType(cls, nullability, typeArguments);
+ return ExactInterfaceType(cls, nullability, typeArguments);
case DartTypeNodeKind.typedef:
ir.Typedef typedef = readTypedefNode();
ir.Nullability nullability = readEnum(ir.Nullability.values);
List<ir.DartType> typeArguments =
_readDartTypeNodes(functionTypeVariables);
- return new ir.TypedefType(typedef, nullability, typeArguments);
+ return ir.TypedefType(typedef, nullability, typeArguments);
case DartTypeNodeKind.dynamicType:
return const ir.DynamicType();
case DartTypeNodeKind.futureOrType:
ir.Nullability nullability = readEnum(ir.Nullability.values);
ir.DartType typeArgument = _readDartTypeNode(functionTypeVariables);
- return new ir.FutureOrType(typeArgument, nullability);
+ return ir.FutureOrType(typeArgument, nullability);
case DartTypeNodeKind.nullType:
return const ir.NullType();
}
- throw new UnsupportedError("Unexpected DartTypeKind $kind");
+ throw UnsupportedError("Unexpected DartTypeKind $kind");
}
_MemberData _readMemberData() {
@@ -328,7 +326,7 @@
String name = _readString();
return library.lookupMemberDataByName(name);
}
- throw new UnsupportedError("Unsupported _MemberKind $kind");
+ throw UnsupportedError("Unsupported _MemberKind $kind");
}
@override
@@ -454,10 +452,10 @@
@override
List<E> readTreeNodesInContext<E extends ir.TreeNode>(
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<E> list = new List<E>.filled(count, null);
+ List<E> list = List<E>.filled(count, null);
for (int i = 0; i < count; i++) {
ir.TreeNode node = readTreeNodeInContextInternal(currentMemberData);
list[i] = node;
@@ -467,7 +465,7 @@
@override
Map<K, V> readTreeNodeMapInContext<K extends ir.TreeNode, V>(V f(),
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -492,7 +490,7 @@
}
double _readDoubleValue() {
- ByteData data = new ByteData(8);
+ ByteData data = ByteData(8);
data.setUint16(0, readInt());
data.setUint16(2, readInt());
data.setUint16(4, readInt());
@@ -519,60 +517,60 @@
switch (kind) {
case ConstantValueKind.BOOL:
bool value = readBool();
- return new BoolConstantValue(value);
+ return BoolConstantValue(value);
case ConstantValueKind.INT:
BigInt value = _readBigInt();
- return new IntConstantValue(value);
+ return IntConstantValue(value);
case ConstantValueKind.DOUBLE:
double value = _readDoubleValue();
- return new DoubleConstantValue(value);
+ return DoubleConstantValue(value);
case ConstantValueKind.STRING:
String value = readString();
- return new StringConstantValue(value);
+ return StringConstantValue(value);
case ConstantValueKind.NULL:
return const NullConstantValue();
case ConstantValueKind.FUNCTION:
IndexedFunction function = readMember();
DartType type = readDartType();
- return new FunctionConstantValue(function, type);
+ return FunctionConstantValue(function, type);
case ConstantValueKind.LIST:
DartType type = readDartType();
List<ConstantValue> entries = readConstants();
- return new ListConstantValue(type, entries);
+ return ListConstantValue(type, entries);
case ConstantValueKind.SET:
DartType type = readDartType();
MapConstantValue entries = readConstant();
- return new constant_system.JavaScriptSetConstant(type, entries);
+ return constant_system.JavaScriptSetConstant(type, entries);
case ConstantValueKind.MAP:
DartType type = readDartType();
ListConstantValue keyList = readConstant();
List<ConstantValue> values = readConstants();
bool onlyStringKeys = readBool();
- return new constant_system.JavaScriptMapConstant(
+ return constant_system.JavaScriptMapConstant(
type, keyList, values, onlyStringKeys);
case ConstantValueKind.CONSTRUCTED:
InterfaceType type = readDartType();
Map<FieldEntity, ConstantValue> fields =
readMemberMap<FieldEntity, ConstantValue>(
(MemberEntity member) => readConstant());
- return new ConstructedConstantValue(type, fields);
+ return ConstructedConstantValue(type, fields);
case ConstantValueKind.TYPE:
DartType representedType = readDartType();
DartType type = readDartType();
- return new TypeConstantValue(representedType, type);
+ return TypeConstantValue(representedType, type);
case ConstantValueKind.INSTANTIATION:
List<DartType> typeArguments = readDartTypes();
ConstantValue function = readConstant();
- return new InstantiationConstantValue(typeArguments, function);
+ return InstantiationConstantValue(typeArguments, function);
case ConstantValueKind.NON_CONSTANT:
- return new NonConstantValue();
+ return NonConstantValue();
case ConstantValueKind.INTERCEPTOR:
ClassEntity cls = readClass();
- return new InterceptorConstantValue(cls);
+ return InterceptorConstantValue(cls);
case ConstantValueKind.DEFERRED_GLOBAL:
ConstantValue constant = readConstant();
OutputUnit unit = readOutputUnitReference();
- return new DeferredGlobalConstantValue(constant, unit);
+ return DeferredGlobalConstantValue(constant, unit);
case ConstantValueKind.DUMMY_INTERCEPTOR:
return DummyInterceptorConstantValue();
case ConstantValueKind.LATE_SENTINEL:
@@ -581,9 +579,9 @@
return UnreachableConstantValue();
case ConstantValueKind.JS_NAME:
js.LiteralString name = readJsNode();
- return new JsNameConstantValue(name);
+ return JsNameConstantValue(name);
}
- throw new UnsupportedError("Unexpexted constant value kind ${kind}.");
+ throw UnsupportedError("Unexpexted constant value kind ${kind}.");
}
ir.TreeNode _readTreeNode(_MemberData memberData) {
@@ -605,7 +603,7 @@
ir.ConstantExpression expression = _readTreeNode(memberData);
ir.Constant constant =
memberData.getConstantByIndex(expression, _readIntInternal());
- return new ConstantReference(expression, constant);
+ return ConstantReference(expression, constant);
case _TreeNodeKind.node:
memberData ??= _readMemberData();
int index = _readIntInternal();
@@ -616,7 +614,7 @@
"${memberData.node}.$_errorContext");
return treeNode;
}
- throw new UnsupportedError("Unexpected _TreeNodeKind $kind");
+ throw UnsupportedError("Unexpected _TreeNodeKind $kind");
}
ir.FunctionNode _readFunctionNode(_MemberData memberData) {
@@ -635,7 +633,7 @@
ir.FunctionDeclaration functionDeclaration = _readTreeNode(memberData);
return functionDeclaration.function;
}
- throw new UnsupportedError("Unexpected _FunctionNodeKind $kind");
+ throw UnsupportedError("Unexpected _FunctionNodeKind $kind");
}
@override
@@ -654,7 +652,7 @@
ir.FunctionNode functionNode = _readFunctionNode(memberData);
return functionNode.typeParameters[_readIntInternal()];
}
- throw new UnsupportedError("Unexpected _TypeParameterKind kind $kind");
+ throw UnsupportedError("Unexpected _TypeParameterKind kind $kind");
}
void _checkDataKind(DataKind expectedKind) {
@@ -676,18 +674,18 @@
return localLookup.getLocalByIndex(memberContext, localIndex);
case LocalKind.thisLocal:
ClassEntity cls = readClass();
- return new ThisLocal(cls);
+ return ThisLocal(cls);
case LocalKind.boxLocal:
ClassEntity cls = readClass();
- return new BoxLocal(cls);
+ return BoxLocal(cls);
case LocalKind.anonymousClosureLocal:
ClassEntity cls = readClass();
- return new AnonymousClosureLocal(cls);
+ return AnonymousClosureLocal(cls);
case LocalKind.typeVariableLocal:
TypeVariableEntity typeVariable = readTypeVariable();
- return new TypeVariableLocal(typeVariable);
+ return TypeVariableLocal(typeVariable);
}
- throw new UnsupportedError("Unexpected local kind $kind");
+ throw UnsupportedError("Unexpected local kind $kind");
}
@override
@@ -705,7 +703,7 @@
Uri uri = _readUri();
Uri enclosingLibraryUri = _readUri();
bool isDeferred = _readBool();
- return new ImportEntity(isDeferred, name, uri, enclosingLibraryUri);
+ return ImportEntity(isDeferred, name, uri, enclosingLibraryUri);
}
@override
diff --git a/pkg/compiler/lib/src/serialization/binary_sink.dart b/pkg/compiler/lib/src/serialization/binary_sink.dart
index 7394824..92a4d43 100644
--- a/pkg/compiler/lib/src/serialization/binary_sink.dart
+++ b/pkg/compiler/lib/src/serialization/binary_sink.dart
@@ -13,10 +13,10 @@
int _length = 0;
BinarySink(this.sink,
- {bool useDataKinds: false,
+ {bool useDataKinds = false,
Map<String, int> tagFrequencyMap,
DataSourceIndices importedIndices})
- : _bufferedSink = new BufferedSink(sink),
+ : _bufferedSink = BufferedSink(sink),
super(
useDataKinds: useDataKinds,
tagFrequencyMap: tagFrequencyMap,
diff --git a/pkg/compiler/lib/src/serialization/binary_source.dart b/pkg/compiler/lib/src/serialization/binary_source.dart
index 0bbe4d0..3844b35 100644
--- a/pkg/compiler/lib/src/serialization/binary_source.dart
+++ b/pkg/compiler/lib/src/serialization/binary_source.dart
@@ -13,7 +13,7 @@
final StringInterner _stringInterner;
BinarySourceImpl(this._bytes,
- {bool useDataKinds: false,
+ {bool useDataKinds = false,
StringInterner stringInterner,
DataSourceIndices importedIndices})
: _stringInterner = stringInterner,
@@ -29,7 +29,7 @@
@override
String _readStringInternal() {
int length = _readIntInternal();
- List<int> bytes = new Uint8List(length);
+ List<int> bytes = Uint8List(length);
bytes.setRange(0, bytes.length, _bytes, _byteOffset);
_byteOffset += bytes.length;
String string = utf8.decode(bytes);
diff --git a/pkg/compiler/lib/src/serialization/helpers.dart b/pkg/compiler/lib/src/serialization/helpers.dart
index 17a3eda..a0bd6d7 100644
--- a/pkg/compiler/lib/src/serialization/helpers.dart
+++ b/pkg/compiler/lib/src/serialization/helpers.dart
@@ -141,7 +141,7 @@
@override
void defaultDartType(
ir.DartType node, List<ir.TypeParameter> functionTypeVariables) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Unexpected ir.DartType $node (${node.runtimeType}).");
}
@@ -208,9 +208,8 @@
ir.FunctionType node, List<ir.TypeParameter> functionTypeVariables) {
_sink.writeEnum(DartTypeNodeKind.functionType);
_sink.begin(functionTypeNodeTag);
- functionTypeVariables =
- new List<ir.TypeParameter>.from(functionTypeVariables)
- ..addAll(node.typeParameters);
+ functionTypeVariables = List<ir.TypeParameter>.from(functionTypeVariables)
+ ..addAll(node.typeParameters);
_sink.writeInt(node.typeParameters.length);
for (ir.TypeParameter parameter in node.typeParameters) {
_sink.writeString(parameter.name);
diff --git a/pkg/compiler/lib/src/serialization/member_data.dart b/pkg/compiler/lib/src/serialization/member_data.dart
index df58f12..87db36b 100644
--- a/pkg/compiler/lib/src/serialization/member_data.dart
+++ b/pkg/compiler/lib/src/serialization/member_data.dart
@@ -18,7 +18,7 @@
if (_libraryMap == null) {
_libraryMap = {};
for (ir.Library library in _component.libraries) {
- _libraryMap[library.importUri] = new _LibraryData(library);
+ _libraryMap[library.importUri] = _LibraryData(library);
}
}
_LibraryData data = _libraryMap[canonicalUri];
@@ -80,7 +80,7 @@
!_classesByNode.containsKey(cls),
"Duplicate class '${cls.name}' in $_classesByNode "
"trying to add $cls.");
- _classesByNode[cls] = _classesByName[cls.name] = new _ClassData(cls);
+ _classesByNode[cls] = _classesByName[cls.name] = _ClassData(cls);
}
}
}
@@ -126,7 +126,7 @@
!_membersByNode.containsKey(member),
"Duplicate member '$name' in $_membersByNode "
"trying to add $member.");
- _membersByNode[member] = _membersByName[name] = new _MemberData(member);
+ _membersByNode[member] = _membersByName[name] = _MemberData(member);
}
}
}
@@ -174,7 +174,7 @@
!_membersByNode.containsKey(member),
"Duplicate member '$name' in $_membersByNode "
"trying to add $member.");
- _membersByNode[member] = _membersByName[name] = new _MemberData(member);
+ _membersByNode[member] = _membersByName[name] = _MemberData(member);
}
}
}
@@ -219,14 +219,13 @@
if (_indexToNodeMap == null) {
_indexToNodeMap = {};
_nodeToIndexMap = {};
- node.accept(
- new _TreeNodeIndexerVisitor(_indexToNodeMap, _nodeToIndexMap));
+ node.accept(_TreeNodeIndexerVisitor(_indexToNodeMap, _nodeToIndexMap));
}
}
_ConstantNodeIndexerVisitor _createConstantIndexer(
ir.ConstantExpression node) {
- _ConstantNodeIndexerVisitor indexer = new _ConstantNodeIndexerVisitor();
+ _ConstantNodeIndexerVisitor indexer = _ConstantNodeIndexerVisitor();
node.constant.accept(indexer);
return indexer;
}
diff --git a/pkg/compiler/lib/src/serialization/mixins.dart b/pkg/compiler/lib/src/serialization/mixins.dart
index 0b48464..8e2bfa3 100644
--- a/pkg/compiler/lib/src/serialization/mixins.dart
+++ b/pkg/compiler/lib/src/serialization/mixins.dart
@@ -16,10 +16,10 @@
}
@override
- List<E> readList<E>(E f(), {bool emptyAsNull: false}) {
+ List<E> readList<E>(E f(), {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<E> list = new List<E>.filled(count, null);
+ List<E> list = List<E>.filled(count, null);
for (int i = 0; i < count; i++) {
list[i] = f();
}
@@ -45,10 +45,10 @@
}
@override
- List<String> readStrings({bool emptyAsNull: false}) {
+ List<String> readStrings({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<String> list = new List<String>.filled(count, null);
+ List<String> list = List<String>.filled(count, null);
for (int i = 0; i < count; i++) {
list[i] = readString();
}
@@ -56,10 +56,10 @@
}
@override
- List<DartType> readDartTypes({bool emptyAsNull: false}) {
+ List<DartType> readDartTypes({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<DartType> list = new List<DartType>.filled(count, null);
+ List<DartType> list = List<DartType>.filled(count, null);
for (int i = 0; i < count; i++) {
list[i] = readDartType();
}
@@ -67,11 +67,10 @@
}
@override
- List<ir.TypeParameter> readTypeParameterNodes({bool emptyAsNull: false}) {
+ List<ir.TypeParameter> readTypeParameterNodes({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<ir.TypeParameter> list =
- new List<ir.TypeParameter>.filled(count, null);
+ List<ir.TypeParameter> list = List<ir.TypeParameter>.filled(count, null);
for (int i = 0; i < count; i++) {
list[i] = readTypeParameterNode();
}
@@ -79,10 +78,10 @@
}
@override
- List<E> readMembers<E extends MemberEntity>({bool emptyAsNull: false}) {
+ List<E> readMembers<E extends MemberEntity>({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<E> list = new List<E>.filled(count, null);
+ List<E> list = List<E>.filled(count, null);
for (int i = 0; i < count; i++) {
MemberEntity member = readMember();
list[i] = member;
@@ -91,10 +90,10 @@
}
@override
- List<E> readMemberNodes<E extends ir.Member>({bool emptyAsNull: false}) {
+ List<E> readMemberNodes<E extends ir.Member>({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<E> list = new List<E>.filled(count, null);
+ List<E> list = List<E>.filled(count, null);
for (int i = 0; i < count; i++) {
ir.Member value = readMemberNode();
list[i] = value;
@@ -103,10 +102,10 @@
}
@override
- List<E> readClasses<E extends ClassEntity>({bool emptyAsNull: false}) {
+ List<E> readClasses<E extends ClassEntity>({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<E> list = new List<E>.filled(count, null);
+ List<E> list = List<E>.filled(count, null);
for (int i = 0; i < count; i++) {
ClassEntity cls = readClass();
list[i] = cls;
@@ -116,7 +115,7 @@
@override
Map<K, V> readLibraryMap<K extends LibraryEntity, V>(V f(),
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -130,7 +129,7 @@
@override
Map<K, V> readClassMap<K extends ClassEntity, V>(V f(),
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -144,7 +143,7 @@
@override
Map<K, V> readMemberMap<K extends MemberEntity, V>(V f(MemberEntity member),
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -158,7 +157,7 @@
@override
Map<K, V> readMemberNodeMap<K extends ir.Member, V>(V f(),
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -172,7 +171,7 @@
@override
Map<K, V> readTreeNodeMap<K extends ir.TreeNode, V>(V f(),
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -186,7 +185,7 @@
@override
Map<K, V> readTypeVariableMap<K extends IndexedTypeVariable, V>(V f(),
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -199,10 +198,10 @@
}
@override
- List<E> readLocals<E extends Local>({bool emptyAsNull: false}) {
+ List<E> readLocals<E extends Local>({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<E> list = new List<E>.filled(count, null);
+ List<E> list = List<E>.filled(count, null);
for (int i = 0; i < count; i++) {
Local local = readLocal();
list[i] = local;
@@ -211,7 +210,8 @@
}
@override
- Map<K, V> readLocalMap<K extends Local, V>(V f(), {bool emptyAsNull: false}) {
+ Map<K, V> readLocalMap<K extends Local, V>(V f(),
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -224,10 +224,10 @@
}
@override
- List<E> readTreeNodes<E extends ir.TreeNode>({bool emptyAsNull: false}) {
+ List<E> readTreeNodes<E extends ir.TreeNode>({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<E> list = new List<E>.filled(count, null);
+ List<E> list = List<E>.filled(count, null);
for (int i = 0; i < count; i++) {
ir.TreeNode node = readTreeNode();
list[i] = node;
@@ -236,7 +236,7 @@
}
@override
- Map<String, V> readStringMap<V>(V f(), {bool emptyAsNull: false}) {
+ Map<String, V> readStringMap<V>(V f(), {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<String, V> map = {};
@@ -294,10 +294,10 @@
}
@override
- List<E> readConstants<E extends ConstantValue>({bool emptyAsNull: false}) {
+ List<E> readConstants<E extends ConstantValue>({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<E> list = new List<E>.filled(count, null);
+ List<E> list = List<E>.filled(count, null);
for (int i = 0; i < count; i++) {
ConstantValue value = readConstant();
list[i] = value;
@@ -307,7 +307,7 @@
@override
Map<K, V> readConstantMap<K extends ConstantValue, V>(V f(),
- {bool emptyAsNull: false}) {
+ {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<K, V> map = {};
@@ -338,10 +338,10 @@
}
@override
- List<ImportEntity> readImports({bool emptyAsNull: false}) {
+ List<ImportEntity> readImports({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<ImportEntity> list = new List<ImportEntity>.filled(count, null);
+ List<ImportEntity> list = List<ImportEntity>.filled(count, null);
for (int i = 0; i < count; i++) {
list[i] = readImport();
}
@@ -349,7 +349,7 @@
}
@override
- Map<ImportEntity, V> readImportMap<V>(V f(), {bool emptyAsNull: false}) {
+ Map<ImportEntity, V> readImportMap<V>(V f(), {bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
Map<ImportEntity, V> map = {};
@@ -362,10 +362,10 @@
}
@override
- List<ir.DartType> readDartTypeNodes({bool emptyAsNull: false}) {
+ List<ir.DartType> readDartTypeNodes({bool emptyAsNull = false}) {
int count = readInt();
if (count == 0 && emptyAsNull) return null;
- List<ir.DartType> list = new List<ir.DartType>.filled(count, null);
+ List<ir.DartType> list = List<ir.DartType>.filled(count, null);
for (int i = 0; i < count; i++) {
list[i] = readDartTypeNode();
}
@@ -376,7 +376,7 @@
ir.Name readName() {
String text = readString();
ir.Library library = readValueOrNull(readLibraryNode);
- return new ir.Name(text, library);
+ return ir.Name(text, library);
}
@override
@@ -436,7 +436,7 @@
}
@override
- void writeClasses(Iterable<ClassEntity> values, {bool allowNull: false}) {
+ void writeClasses(Iterable<ClassEntity> values, {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -449,7 +449,7 @@
}
@override
- void writeTreeNodes(Iterable<ir.TreeNode> values, {bool allowNull: false}) {
+ void writeTreeNodes(Iterable<ir.TreeNode> values, {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -462,7 +462,7 @@
}
@override
- void writeStrings(Iterable<String> values, {bool allowNull: false}) {
+ void writeStrings(Iterable<String> values, {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -475,7 +475,7 @@
}
@override
- void writeMemberNodes(Iterable<ir.Member> values, {bool allowNull: false}) {
+ void writeMemberNodes(Iterable<ir.Member> values, {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -488,7 +488,7 @@
}
@override
- void writeDartTypes(Iterable<DartType> values, {bool allowNull: false}) {
+ void writeDartTypes(Iterable<DartType> values, {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -502,7 +502,7 @@
@override
void writeLibraryMap<V>(Map<LibraryEntity, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -517,7 +517,7 @@
@override
void writeClassMap<V>(Map<ClassEntity, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -533,7 +533,7 @@
@override
void writeMemberMap<V>(
Map<MemberEntity, V> map, void f(MemberEntity member, V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -548,7 +548,7 @@
@override
void writeStringMap<V>(Map<String, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -562,7 +562,7 @@
}
@override
- void writeLocals(Iterable<Local> values, {bool allowNull: false}) {
+ void writeLocals(Iterable<Local> values, {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -576,7 +576,7 @@
@override
void writeLocalMap<V>(Map<Local, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -591,7 +591,7 @@
@override
void writeMemberNodeMap<V>(Map<ir.Member, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -606,7 +606,7 @@
@override
void writeTreeNodeMap<V>(Map<ir.TreeNode, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -621,7 +621,7 @@
@override
void writeTypeVariableMap<V>(Map<IndexedTypeVariable, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -636,7 +636,7 @@
@override
void writeList<E>(Iterable<E> values, void f(E value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -671,7 +671,7 @@
}
@override
- void writeMembers(Iterable<MemberEntity> values, {bool allowNull: false}) {
+ void writeMembers(Iterable<MemberEntity> values, {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -685,7 +685,7 @@
@override
void writeTypeParameterNodes(Iterable<ir.TypeParameter> values,
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -706,7 +706,8 @@
}
@override
- void writeConstants(Iterable<ConstantValue> values, {bool allowNull: false}) {
+ void writeConstants(Iterable<ConstantValue> values,
+ {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -720,7 +721,7 @@
@override
void writeConstantMap<V>(Map<ConstantValue, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -750,7 +751,7 @@
}
@override
- void writeImports(Iterable<ImportEntity> values, {bool allowNull: false}) {
+ void writeImports(Iterable<ImportEntity> values, {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
@@ -764,7 +765,7 @@
@override
void writeImportMap<V>(Map<ImportEntity, V> map, void f(V value),
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (map == null) {
assert(allowNull);
writeInt(0);
@@ -779,7 +780,7 @@
@override
void writeDartTypeNodes(Iterable<ir.DartType> values,
- {bool allowNull: false}) {
+ {bool allowNull = false}) {
if (values == null) {
assert(allowNull);
writeInt(0);
diff --git a/pkg/compiler/lib/src/serialization/node_indexer.dart b/pkg/compiler/lib/src/serialization/node_indexer.dart
index d62ed9f..377eb80 100644
--- a/pkg/compiler/lib/src/serialization/node_indexer.dart
+++ b/pkg/compiler/lib/src/serialization/node_indexer.dart
@@ -387,7 +387,7 @@
@override
void defaultConstant(ir.Constant node) {
- throw new UnimplementedError(
+ throw UnimplementedError(
"Unexpected constant: $node (${node.runtimeType})");
}
}
diff --git a/pkg/compiler/lib/src/serialization/object_sink.dart b/pkg/compiler/lib/src/serialization/object_sink.dart
index 623e104..bbb91e3 100644
--- a/pkg/compiler/lib/src/serialization/object_sink.dart
+++ b/pkg/compiler/lib/src/serialization/object_sink.dart
@@ -22,12 +22,12 @@
@override
void _begin(String tag) {
- _data.add(new Tag('begin:$tag'));
+ _data.add(Tag('begin:$tag'));
}
@override
void _end(String tag) {
- _data.add(new Tag('end:$tag'));
+ _data.add(Tag('end:$tag'));
}
@override
diff --git a/pkg/compiler/lib/src/serialization/object_source.dart b/pkg/compiler/lib/src/serialization/object_source.dart
index 2d61f96..07e07ad 100644
--- a/pkg/compiler/lib/src/serialization/object_source.dart
+++ b/pkg/compiler/lib/src/serialization/object_source.dart
@@ -24,7 +24,7 @@
@override
void _begin(String tag) {
- Tag expectedTag = new Tag('begin:$tag');
+ Tag expectedTag = Tag('begin:$tag');
Tag actualTag = _read();
assert(
expectedTag == actualTag,
@@ -34,7 +34,7 @@
@override
void _end(String tag) {
- Tag expectedTag = new Tag('end:$tag');
+ Tag expectedTag = Tag('end:$tag');
Tag actualTag = _read();
assert(
expectedTag == actualTag,
@@ -56,7 +56,7 @@
@override
String get _errorContext {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
for (int i = _index - 50; i < _index + 10; i++) {
if (i >= 0 && i < _data.length) {
if (i == _index - 1) {
diff --git a/pkg/compiler/lib/src/serialization/serialization.dart b/pkg/compiler/lib/src/serialization/serialization.dart
index 051be85..4fb6654 100644
--- a/pkg/compiler/lib/src/serialization/serialization.dart
+++ b/pkg/compiler/lib/src/serialization/serialization.dart
@@ -78,7 +78,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readList].
void writeList<E>(Iterable<E> values, void f(E value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes the boolean [value] to this data sink.
void writeBool(bool value);
@@ -106,7 +106,7 @@
///
/// This is a convenience method to be used together with
/// [DataSource.readStrings].
- void writeStrings(Iterable<String> values, {bool allowNull: false});
+ void writeStrings(Iterable<String> values, {bool allowNull = false});
/// Writes the [map] from string to [V] values to this data sink, calling [f]
/// to write each value to the data sink. If [allowNull] is `true`, [map] is
@@ -115,7 +115,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readStringMap].
void writeStringMap<V>(Map<String, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes the enum value [value] to this data sink.
// TODO(johnniwinther): Change the signature to
@@ -143,7 +143,7 @@
///
/// This is a convenience method to be used together with
/// [DataSource.readMemberNodes].
- void writeMemberNodes(Iterable<ir.Member> values, {bool allowNull: false});
+ void writeMemberNodes(Iterable<ir.Member> values, {bool allowNull = false});
/// Writes the [map] from references to kernel member nodes to [V] values to
/// this data sink, calling [f] to write each value to the data sink. If
@@ -152,7 +152,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readMemberNodeMap].
void writeMemberNodeMap<V>(Map<ir.Member, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes a kernel name node to this data sink.
void writeName(ir.Name value);
@@ -179,7 +179,7 @@
///
/// This is a convenience method to be used together with
/// [DataSource.readTreeNodes].
- void writeTreeNodes(Iterable<ir.TreeNode> values, {bool allowNull: false});
+ void writeTreeNodes(Iterable<ir.TreeNode> values, {bool allowNull = false});
/// Writes the [map] from references to kernel tree nodes to [V] values to
/// this data sink, calling [f] to write each value to the data sink. If
@@ -188,7 +188,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readTreeNodeMap].
void writeTreeNodeMap<V>(Map<ir.TreeNode, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes a reference to the kernel tree node [value] in the known [context]
/// to this data sink.
@@ -208,7 +208,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readTreeNodesInContext].
void writeTreeNodesInContext(Iterable<ir.TreeNode> values,
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes the [map] from references to kernel tree nodes to [V] values in the
/// known [context] to this data sink, calling [f] to write each value to the
@@ -217,7 +217,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readTreeNodeMapInContext].
void writeTreeNodeMapInContext<V>(Map<ir.TreeNode, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes a reference to the kernel type parameter node [value] to this data
/// sink.
@@ -230,22 +230,22 @@
/// This is a convenience method to be used together with
/// [DataSource.readTypeParameterNodes].
void writeTypeParameterNodes(Iterable<ir.TypeParameter> values,
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes the type [value] to this data sink. If [allowNull] is `true`,
/// [value] is allowed to be `null`.
- void writeDartType(DartType value, {bool allowNull: false});
+ void writeDartType(DartType value, {bool allowNull = false});
/// Writes the type [values] to this data sink. If [allowNull] is `true`,
/// [values] is allowed to be `null`.
///
/// This is a convenience method to be used together with
/// [DataSource.readDartTypes].
- void writeDartTypes(Iterable<DartType> values, {bool allowNull: false});
+ void writeDartTypes(Iterable<DartType> values, {bool allowNull = false});
/// Writes the kernel type node [value] to this data sink. If [allowNull] is
/// `true`, [value] is allowed to be `null`.
- void writeDartTypeNode(ir.DartType value, {bool allowNull: false});
+ void writeDartTypeNode(ir.DartType value, {bool allowNull = false});
/// Writes the kernel type node [values] to this data sink. If [allowNull] is
/// `true`, [values] is allowed to be `null`.
@@ -253,7 +253,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readDartTypeNodes].
void writeDartTypeNodes(Iterable<ir.DartType> values,
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes the source span [value] to this data sink.
void writeSourceSpan(SourceSpan value);
@@ -275,7 +275,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readLibraryMap].
void writeLibraryMap<V>(Map<LibraryEntity, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes a reference to the indexed class [value] to this data sink.
void writeClass(IndexedClass value);
@@ -292,7 +292,7 @@
///
/// This is a convenience method to be used together with
/// [DataSource.readClasses].
- void writeClasses(Iterable<ClassEntity> values, {bool allowNull: false});
+ void writeClasses(Iterable<ClassEntity> values, {bool allowNull = false});
/// Writes the [map] from references to indexed classes to [V] values to this
/// data sink, calling [f] to write each value to the data sink. If
@@ -301,7 +301,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readClassMap].
void writeClassMap<V>(Map<ClassEntity, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes a reference to the indexed member [value] to this data sink.
void writeMember(IndexedMember value);
@@ -318,7 +318,7 @@
///
/// This is a convenience method to be used together with
/// [DataSource.readMembers].
- void writeMembers(Iterable<MemberEntity> values, {bool allowNull: false});
+ void writeMembers(Iterable<MemberEntity> values, {bool allowNull = false});
/// Writes the [map] from references to indexed members to [V] values to this
/// data sink, calling [f] to write each value to the data sink. If
@@ -328,7 +328,7 @@
/// [DataSource.readMemberMap].
void writeMemberMap<V>(
Map<MemberEntity, V> map, void f(MemberEntity member, V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes a reference to the indexed type variable [value] to this data sink.
void writeTypeVariable(IndexedTypeVariable value);
@@ -340,7 +340,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readTypeVariableMap].
void writeTypeVariableMap<V>(Map<IndexedTypeVariable, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes a reference to the local [value] to this data sink.
void writeLocal(Local local);
@@ -357,7 +357,7 @@
///
/// This is a convenience method to be used together with
/// [DataSource.readLocals].
- void writeLocals(Iterable<Local> values, {bool allowNull: false});
+ void writeLocals(Iterable<Local> values, {bool allowNull = false});
/// Writes the [map] from references to locals to [V] values to this data
/// sink, calling [f] to write each value to the data sink. If [allowNull] is
@@ -366,7 +366,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readLocalMap].
void writeLocalMap<V>(Map<Local, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes the constant [value] to this data sink.
void writeConstant(ConstantValue value);
@@ -379,7 +379,7 @@
///
/// This is a convenience method to be used together with
/// [DataSource.readConstants].
- void writeConstants(Iterable<ConstantValue> values, {bool allowNull: false});
+ void writeConstants(Iterable<ConstantValue> values, {bool allowNull = false});
/// Writes the [map] from constant values to [V] values to this data sink,
/// calling [f] to write each value to the data sink. If [allowNull] is
@@ -388,7 +388,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readConstantMap].
void writeConstantMap<V>(Map<ConstantValue, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes a double value to this data sink.
void writeDoubleValue(double value);
@@ -410,7 +410,7 @@
///
/// This is a convenience method to be used together with
/// [DataSource.readImports].
- void writeImports(Iterable<ImportEntity> values, {bool allowNull: false});
+ void writeImports(Iterable<ImportEntity> values, {bool allowNull = false});
/// Writes the [map] from imports to [V] values to this data sink,
/// calling [f] to write each value to the data sink. If [allowNull] is
@@ -419,7 +419,7 @@
/// This is a convenience method to be used together with
/// [DataSource.readImportMap].
void writeImportMap<V>(Map<ImportEntity, V> map, void f(V value),
- {bool allowNull: false});
+ {bool allowNull = false});
/// Writes an abstract [value] to this data sink.
///
@@ -561,7 +561,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeList].
- List<E> readList<E>(E f(), {bool emptyAsNull: false});
+ List<E> readList<E>(E f(), {bool emptyAsNull = false});
/// Reads a boolean value from this data source.
bool readBool();
@@ -590,7 +590,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeStrings].
- List<String> readStrings({bool emptyAsNull: false});
+ List<String> readStrings({bool emptyAsNull = false});
/// Reads a map from string values to [V] values from this data source,
/// calling [f] to read each value from the data source. If [emptyAsNull] is
@@ -598,7 +598,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeStringMap].
- Map<String, V> readStringMap<V>(V f(), {bool emptyAsNull: false});
+ Map<String, V> readStringMap<V>(V f(), {bool emptyAsNull = false});
/// Reads an enum value from the list of enum [values] from this data source.
///
@@ -632,7 +632,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeMemberNodes].
List<ir.Member> readMemberNodes<E extends ir.Member>(
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a map from kernel member nodes to [V] values from this data source,
/// calling [f] to read each value from the data source. If [emptyAsNull] is
@@ -641,7 +641,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeMemberNodeMap].
Map<K, V> readMemberNodeMap<K extends ir.Member, V>(V f(),
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a kernel name node from this data source.
ir.Name readName();
@@ -665,7 +665,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeTreeNodes].
- List<E> readTreeNodes<E extends ir.TreeNode>({bool emptyAsNull: false});
+ List<E> readTreeNodes<E extends ir.TreeNode>({bool emptyAsNull = false});
/// Reads a map from kernel tree nodes to [V] values from this data source,
/// calling [f] to read each value from the data source. If [emptyAsNull] is
@@ -674,7 +674,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeTreeNodeMap].
Map<K, V> readTreeNodeMap<K extends ir.TreeNode, V>(V f(),
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a reference to a kernel tree node in the known [context] from this
/// data source.
@@ -691,7 +691,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeTreeNodesInContext].
List<E> readTreeNodesInContext<E extends ir.TreeNode>(
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a map from kernel tree nodes to [V] values in the known [context]
/// from this data source, calling [f] to read each value from the data
@@ -701,7 +701,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeTreeNodeMapInContext].
Map<K, V> readTreeNodeMapInContext<K extends ir.TreeNode, V>(V f(),
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a reference to a kernel type parameter node from this data source.
ir.TypeParameter readTypeParameterNode();
@@ -712,29 +712,29 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeTypeParameterNodes].
- List<ir.TypeParameter> readTypeParameterNodes({bool emptyAsNull: false});
+ List<ir.TypeParameter> readTypeParameterNodes({bool emptyAsNull = false});
/// Reads a type from this data source. If [allowNull], the returned type is
/// allowed to be `null`.
- DartType readDartType({bool allowNull: false});
+ DartType readDartType({bool allowNull = false});
/// Reads a list of types from this data source. If [emptyAsNull] is `true`,
/// `null` is returned instead of an empty list.
///
/// This is a convenience method to be used together with
/// [DataSink.writeDartTypes].
- List<DartType> readDartTypes({bool emptyAsNull: false});
+ List<DartType> readDartTypes({bool emptyAsNull = false});
/// Reads a kernel type node from this data source. If [allowNull], the
/// returned type is allowed to be `null`.
- ir.DartType readDartTypeNode({bool allowNull: false});
+ ir.DartType readDartTypeNode({bool allowNull = false});
/// Reads a list of kernel type nodes from this data source. If [emptyAsNull]
/// is `true`, `null` is returned instead of an empty list.
///
/// This is a convenience method to be used together with
/// [DataSink.writeDartTypeNodes].
- List<ir.DartType> readDartTypeNodes({bool emptyAsNull: false});
+ List<ir.DartType> readDartTypeNodes({bool emptyAsNull = false});
/// Reads a source span from this data source.
SourceSpan readSourceSpan();
@@ -746,7 +746,7 @@
/// source.
IndexedLibrary readLibraryOrNull();
Map<K, V> readLibraryMap<K extends LibraryEntity, V>(V f(),
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a reference to an indexed class from this data source.
IndexedClass readClass();
@@ -760,7 +760,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeClasses].
- List<E> readClasses<E extends ClassEntity>({bool emptyAsNull: false});
+ List<E> readClasses<E extends ClassEntity>({bool emptyAsNull = false});
/// Reads a map from indexed classes to [V] values from this data source,
/// calling [f] to read each value from the data source. If [emptyAsNull] is
@@ -769,7 +769,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeClassMap].
Map<K, V> readClassMap<K extends ClassEntity, V>(V f(),
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a reference to an indexed member from this data source.
IndexedMember readMember();
@@ -783,7 +783,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeMembers].
- List<E> readMembers<E extends MemberEntity>({bool emptyAsNull: false});
+ List<E> readMembers<E extends MemberEntity>({bool emptyAsNull = false});
/// Reads a map from indexed members to [V] values from this data source,
/// calling [f] to read each value from the data source. If [emptyAsNull] is
@@ -792,7 +792,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeMemberMap].
Map<K, V> readMemberMap<K extends MemberEntity, V>(V f(MemberEntity member),
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a reference to an indexed type variable from this data source.
IndexedTypeVariable readTypeVariable();
@@ -804,7 +804,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeTypeVariableMap].
Map<K, V> readTypeVariableMap<K extends IndexedTypeVariable, V>(V f(),
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a reference to a local from this data source.
Local readLocal();
@@ -817,7 +817,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeLocals].
- List<E> readLocals<E extends Local>({bool emptyAsNull: false});
+ List<E> readLocals<E extends Local>({bool emptyAsNull = false});
/// Reads a map from locals to [V] values from this data source, calling [f]
/// to read each value from the data source. If [emptyAsNull] is `true`,
@@ -825,7 +825,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeLocalMap].
- Map<K, V> readLocalMap<K extends Local, V>(V f(), {bool emptyAsNull: false});
+ Map<K, V> readLocalMap<K extends Local, V>(V f(), {bool emptyAsNull = false});
/// Reads a constant value from this data source.
ConstantValue readConstant();
@@ -847,7 +847,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeConstants].
- List<E> readConstants<E extends ConstantValue>({bool emptyAsNull: false});
+ List<E> readConstants<E extends ConstantValue>({bool emptyAsNull = false});
/// Reads a map from constant values to [V] values from this data source,
/// calling [f] to read each value from the data source. If [emptyAsNull] is
@@ -856,7 +856,7 @@
/// This is a convenience method to be used together with
/// [DataSink.writeConstantMap].
Map<K, V> readConstantMap<K extends ConstantValue, V>(V f(),
- {bool emptyAsNull: false});
+ {bool emptyAsNull = false});
/// Reads a import from this data source.
ImportEntity readImport();
@@ -869,7 +869,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeImports].
- List<ImportEntity> readImports({bool emptyAsNull: false});
+ List<ImportEntity> readImports({bool emptyAsNull = false});
/// Reads a map from imports to [V] values from this data source,
/// calling [f] to read each value from the data source. If [emptyAsNull] is
@@ -877,7 +877,7 @@
///
/// This is a convenience method to be used together with
/// [DataSink.writeImportMap].
- Map<ImportEntity, V> readImportMap<V>(V f(), {bool emptyAsNull: false});
+ Map<ImportEntity, V> readImportMap<V>(V f(), {bool emptyAsNull = false});
/// Reads an [AbstractValue] from this data source.
///
diff --git a/pkg/compiler/lib/src/serialization/strategies.dart b/pkg/compiler/lib/src/serialization/strategies.dart
index 909e909..65c8824 100644
--- a/pkg/compiler/lib/src/serialization/strategies.dart
+++ b/pkg/compiler/lib/src/serialization/strategies.dart
@@ -38,8 +38,8 @@
}
ir.Component deserializeComponent(List<int> data) {
- ir.Component component = new ir.Component();
- new BinaryBuilder(data).readComponent(component);
+ ir.Component component = ir.Component();
+ BinaryBuilder(data).readComponent(component);
return component;
}
@@ -67,13 +67,13 @@
class BytesInMemorySerializationStrategy extends SerializationStrategy<int> {
final bool useDataKinds;
- const BytesInMemorySerializationStrategy({this.useDataKinds: false});
+ const BytesInMemorySerializationStrategy({this.useDataKinds = false});
@override
List<int> serializeGlobalTypeInferenceResults(
DataSourceIndices indices, GlobalTypeInferenceResults results) {
- ByteSink byteSink = new ByteSink();
- DataSink sink = new BinarySink(byteSink,
+ ByteSink byteSink = ByteSink();
+ DataSink sink = BinarySink(byteSink,
useDataKinds: useDataKinds, importedIndices: indices);
serializeGlobalTypeInferenceResultsToSink(results, sink);
return byteSink.builder.takeBytes();
@@ -105,8 +105,8 @@
@override
List<int> serializeClosedWorld(JsClosedWorld closedWorld) {
- ByteSink byteSink = new ByteSink();
- DataSink sink = new BinarySink(byteSink, useDataKinds: useDataKinds);
+ ByteSink byteSink = ByteSink();
+ DataSink sink = BinarySink(byteSink, useDataKinds: useDataKinds);
serializeClosedWorldToSink(closedWorld, sink);
return byteSink.builder.takeBytes();
}
@@ -119,7 +119,7 @@
AbstractValueStrategy abstractValueStrategy,
ir.Component component,
List<int> data) {
- DataSource source = new BinarySourceImpl(data, useDataKinds: useDataKinds);
+ DataSource source = BinarySourceImpl(data, useDataKinds: useDataKinds);
var closedWorld = deserializeClosedWorldFromSource(options, reporter,
environment, abstractValueStrategy, component, source);
return ClosedWorldAndIndices(closedWorld, source.exportIndices());
@@ -129,18 +129,18 @@
class BytesOnDiskSerializationStrategy extends SerializationStrategy<int> {
final bool useDataKinds;
- const BytesOnDiskSerializationStrategy({this.useDataKinds: false});
+ const BytesOnDiskSerializationStrategy({this.useDataKinds = false});
@override
List<int> serializeGlobalTypeInferenceResults(
DataSourceIndices indices, GlobalTypeInferenceResults results) {
Uri uri = Uri.base.resolve('world.data');
- DataSink sink = new BinarySink(
- new BinaryOutputSinkAdapter(new RandomAccessBinaryOutputSink(uri)),
+ DataSink sink = BinarySink(
+ BinaryOutputSinkAdapter(RandomAccessBinaryOutputSink(uri)),
useDataKinds: useDataKinds,
importedIndices: indices);
serializeGlobalTypeInferenceResultsToSink(results, sink);
- return new File.fromUri(uri).readAsBytesSync();
+ return File.fromUri(uri).readAsBytesSync();
}
@override
@@ -170,11 +170,11 @@
@override
List<int> serializeClosedWorld(JsClosedWorld closedWorld) {
Uri uri = Uri.base.resolve('closed_world.data');
- DataSink sink = new BinarySink(
- new BinaryOutputSinkAdapter(new RandomAccessBinaryOutputSink(uri)),
+ DataSink sink = BinarySink(
+ BinaryOutputSinkAdapter(RandomAccessBinaryOutputSink(uri)),
useDataKinds: useDataKinds);
serializeClosedWorldToSink(closedWorld, sink);
- return new File.fromUri(uri).readAsBytesSync();
+ return File.fromUri(uri).readAsBytesSync();
}
@override
@@ -185,7 +185,7 @@
AbstractValueStrategy abstractValueStrategy,
ir.Component component,
List<int> data) {
- DataSource source = new BinarySourceImpl(data, useDataKinds: useDataKinds);
+ DataSource source = BinarySourceImpl(data, useDataKinds: useDataKinds);
var closedWorld = deserializeClosedWorldFromSource(options, reporter,
environment, abstractValueStrategy, component, source);
return ClosedWorldAndIndices(closedWorld, source.exportIndices());
@@ -196,14 +196,14 @@
extends SerializationStrategy<Object> {
final bool useDataKinds;
- const ObjectsInMemorySerializationStrategy({this.useDataKinds: true});
+ const ObjectsInMemorySerializationStrategy({this.useDataKinds = true});
@override
List<Object> serializeGlobalTypeInferenceResults(
DataSourceIndices indices, GlobalTypeInferenceResults results) {
List<Object> data = [];
- DataSink sink = new ObjectSink(data,
- useDataKinds: useDataKinds, importedIndices: indices);
+ DataSink sink =
+ ObjectSink(data, useDataKinds: useDataKinds, importedIndices: indices);
serializeGlobalTypeInferenceResultsToSink(results, sink);
return data;
}
@@ -235,7 +235,7 @@
@override
List<Object> serializeClosedWorld(JsClosedWorld closedWorld) {
List<Object> data = [];
- DataSink sink = new ObjectSink(data, useDataKinds: useDataKinds);
+ DataSink sink = ObjectSink(data, useDataKinds: useDataKinds);
serializeClosedWorldToSink(closedWorld, sink);
return data;
}
@@ -248,7 +248,7 @@
AbstractValueStrategy abstractValueStrategy,
ir.Component component,
List<Object> data) {
- DataSource source = new ObjectSource(data, useDataKinds: useDataKinds);
+ DataSource source = ObjectSource(data, useDataKinds: useDataKinds);
var closedWorld = deserializeClosedWorldFromSource(options, reporter,
environment, abstractValueStrategy, component, source);
return ClosedWorldAndIndices(closedWorld, source.exportIndices());
diff --git a/pkg/compiler/lib/src/serialization/task.dart b/pkg/compiler/lib/src/serialization/task.dart
index 479a2aa..d182e35 100644
--- a/pkg/compiler/lib/src/serialization/task.dart
+++ b/pkg/compiler/lib/src/serialization/task.dart
@@ -86,13 +86,13 @@
AbstractValueStrategy abstractValueStrategy,
ir.Component component,
DataSource source) {
- JsClosedWorld newClosedWorld = new JsClosedWorld.readFromDataSource(
+ JsClosedWorld newClosedWorld = JsClosedWorld.readFromDataSource(
options, reporter, environment, abstractValueStrategy, component, source);
GlobalLocalsMap newGlobalLocalsMap = GlobalLocalsMap.readFromDataSource(
newClosedWorld.closureDataLookup.getEnclosingMember, source);
InferredData newInferredData =
- new InferredData.readFromDataSource(source, newClosedWorld);
- return new GlobalTypeInferenceResults.readFromDataSource(
+ InferredData.readFromDataSource(source, newClosedWorld);
+ return GlobalTypeInferenceResults.readFromDataSource(
source,
newClosedWorld.elementMap,
newClosedWorld,
@@ -112,7 +112,7 @@
AbstractValueStrategy abstractValueStrategy,
ir.Component component,
DataSource source) {
- return new JsClosedWorld.readFromDataSource(
+ return JsClosedWorld.readFromDataSource(
options, reporter, environment, abstractValueStrategy, component, source);
}
@@ -147,8 +147,8 @@
_reporter.log('Writing dill to ${_options.outputUri}');
api.BinaryOutputSink dillOutput =
_outputProvider.createBinarySink(_options.outputUri);
- BinaryOutputSinkAdapter irSink = new BinaryOutputSinkAdapter(dillOutput);
- ir.BinaryPrinter printer = new ir.BinaryPrinter(irSink);
+ BinaryOutputSinkAdapter irSink = BinaryOutputSinkAdapter(dillOutput);
+ ir.BinaryPrinter printer = ir.BinaryPrinter(irSink);
printer.writeComponentFile(component);
irSink.close();
});
@@ -159,7 +159,7 @@
_reporter.log('Reading dill from ${_options.entryPoint}');
api.Input<List<int>> dillInput = await _provider
.readFromUri(_options.entryPoint, inputKind: api.InputKind.binary);
- ir.Component component = new ir.Component();
+ ir.Component component = ir.Component();
// Not using growable lists saves memory.
ir.BinaryBuilder(dillInput.data,
useGrowableLists: false, stringInterner: _stringInterner)
@@ -259,7 +259,7 @@
_reporter.log('Writing closed world to ${_options.writeClosedWorldUri}');
api.BinaryOutputSink dataOutput =
_outputProvider.createBinarySink(_options.writeClosedWorldUri);
- DataSink sink = new BinarySink(new BinaryOutputSinkAdapter(dataOutput));
+ DataSink sink = BinarySink(BinaryOutputSinkAdapter(dataOutput));
serializeClosedWorldToSink(closedWorld, sink);
});
}
@@ -330,7 +330,7 @@
_reporter.log('Writing data to ${_options.writeDataUri}');
api.BinaryOutputSink dataOutput =
_outputProvider.createBinarySink(_options.writeDataUri);
- DataSink sink = new BinarySink(new BinaryOutputSinkAdapter(dataOutput));
+ DataSink sink = BinarySink(BinaryOutputSinkAdapter(dataOutput));
serializeGlobalTypeInferenceResultsToSinkLegacy(results, sink);
});
}
@@ -373,10 +373,10 @@
measureSubtask('serialize codegen', () {
Uri uri = Uri.parse('${_options.writeCodegenUri}$shard');
api.BinaryOutputSink dataOutput = _outputProvider.createBinarySink(uri);
- DataSink sink = new BinarySink(new BinaryOutputSinkAdapter(dataOutput));
+ DataSink sink = BinarySink(BinaryOutputSinkAdapter(dataOutput));
_reporter.log('Writing data to ${uri}');
sink.registerEntityWriter(entityWriter);
- sink.registerCodegenWriter(new CodegenWriterImpl(closedWorld));
+ sink.registerCodegenWriter(CodegenWriterImpl(closedWorld));
sink.writeMemberMap(
results,
(MemberEntity member, CodegenResult result) =>
@@ -405,7 +405,7 @@
dataInput.release();
});
}
- return new DeserializedCodegenResults(
+ return DeserializedCodegenResults(
globalTypeInferenceResults, codegenInputs, results);
}
@@ -423,7 +423,7 @@
List<ModularName> modularNames = [];
List<ModularExpression> modularExpressions = [];
CodegenReader reader =
- new CodegenReaderImpl(closedWorld, modularNames, modularExpressions);
+ CodegenReaderImpl(closedWorld, modularNames, modularExpressions);
source.registerCodegenReader(reader);
CodegenResult result = CodegenResult.readFromDataSource(
source, modularNames, modularExpressions);
diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart
index 72b3ec0..f3d9ab1 100644
--- a/pkg/compiler/lib/src/world.dart
+++ b/pkg/compiler/lib/src/world.dart
@@ -13,7 +13,6 @@
KCommonElements,
KElementEnvironment;
import 'deferred_load/output_unit.dart';
-import 'diagnostics/diagnostic_listener.dart';
import 'elements/entities.dart';
import 'elements/names.dart';
import 'elements/types.dart';
diff --git a/pkg/compiler/test/annotations/annotations_test.dart b/pkg/compiler/test/annotations/annotations_test.dart
index a4424c6..2f81123 100644
--- a/pkg/compiler/test/annotations/annotations_test.dart
+++ b/pkg/compiler/test/annotations/annotations_test.dart
@@ -10,7 +10,6 @@
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_backend/annotations.dart';
import 'package:compiler/src/js_model/element_map.dart';
diff --git a/pkg/compiler/test/codegen/codegen_test_helper.dart b/pkg/compiler/test/codegen/codegen_test_helper.dart
index b2bb6b1..51b1b78 100644
--- a/pkg/compiler/test/codegen/codegen_test_helper.dart
+++ b/pkg/compiler/test/codegen/codegen_test_helper.dart
@@ -10,7 +10,6 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_model/element_map.dart';
import 'package:compiler/src/js_model/js_strategy.dart';
diff --git a/pkg/compiler/test/codegen/model_test.dart b/pkg/compiler/test/codegen/model_test.dart
index ba7376d..9862c60 100644
--- a/pkg/compiler/test/codegen/model_test.dart
+++ b/pkg/compiler/test/codegen/model_test.dart
@@ -11,7 +11,6 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common/codegen.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js/js.dart' as js;
import 'package:compiler/src/js_emitter/model.dart';
diff --git a/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib1.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib1.dart
index 54f922e..a7d086f 100644
--- a/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib1.dart
+++ b/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib1.dart
@@ -14,10 +14,10 @@
/*member: m1:
constants=[
ConstructedConstant(C(x=IntConstant(1)))=main{},
- ConstructedConstant(C(x=IntConstant(2)))=1{l1},
- ConstructedConstant(C(x=IntConstant(3)))=1{l1},
- ConstructedConstant(C(x=IntConstant(4)))=2{l2}],
- member_unit=1{l1}
+ ConstructedConstant(C(x=IntConstant(2)))=2{l1},
+ ConstructedConstant(C(x=IntConstant(3)))=2{l1},
+ ConstructedConstant(C(x=IntConstant(4)))=1{l2}],
+ member_unit=2{l1}
*/
m1() async {
print(c2);
diff --git a/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib2.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib2.dart
index 51392c1..39553ee 100644
--- a/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib2.dart
+++ b/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib2.dart
@@ -15,9 +15,9 @@
/*member: m2:
constants=[
ConstructedConstant(C(x=IntConstant(1)))=main{},
- ConstructedConstant(C(x=IntConstant(4)))=2{l2},
- ConstructedConstant(C(x=IntConstant(5)))=2{l2}],
- member_unit=2{l2}
+ ConstructedConstant(C(x=IntConstant(4)))=1{l2},
+ ConstructedConstant(C(x=IntConstant(5)))=1{l2}],
+ member_unit=1{l2}
*/
m2() async {
print(c3);
diff --git a/pkg/compiler/test/deferred_loading/data/deferred_constant3/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant3/main.dart
index 8f1f9f3..4fd5d66 100644
--- a/pkg/compiler/test/deferred_loading/data/deferred_constant3/main.dart
+++ b/pkg/compiler/test/deferred_loading/data/deferred_constant3/main.dart
@@ -4,11 +4,11 @@
/*library:
a_pre_fragments=[
- p1: {units: [1{l1}], usedBy: [], needs: []},
- p2: {units: [2{l2}], usedBy: [], needs: []}],
+ p1: {units: [2{l1}], usedBy: [], needs: []},
+ p2: {units: [1{l2}], usedBy: [], needs: []}],
b_finalized_fragments=[
- f1: [1{l1}],
- f2: [2{l2}]],
+ f1: [2{l1}],
+ f2: [1{l2}]],
c_steps=[
l1=(f1),
l2=(f2)]
@@ -24,7 +24,7 @@
/*member: main:
constants=[
ConstructedConstant(C(x=IntConstant(1)))=main{},
- ConstructedConstant(C(x=IntConstant(2)))=1{l1}],
+ ConstructedConstant(C(x=IntConstant(2)))=2{l1}],
member_unit=main{}
*/
main() async {
diff --git a/pkg/compiler/test/inference/callers_test.dart b/pkg/compiler/test/inference/callers_test.dart
index 421ff24..8f9250d 100644
--- a/pkg/compiler/test/inference/callers_test.dart
+++ b/pkg/compiler/test/inference/callers_test.dart
@@ -9,7 +9,6 @@
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/inferrer/type_graph_inferrer.dart';
import 'package:compiler/src/js_model/element_map.dart';
diff --git a/pkg/compiler/test/inference/inference_data_test.dart b/pkg/compiler/test/inference/inference_data_test.dart
index 1ad073f..d550d3b 100644
--- a/pkg/compiler/test/inference/inference_data_test.dart
+++ b/pkg/compiler/test/inference/inference_data_test.dart
@@ -10,7 +10,6 @@
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_backend/inferred_data.dart';
import 'package:compiler/src/js_model/element_map.dart';
diff --git a/pkg/compiler/test/inference/inference_test_helper.dart b/pkg/compiler/test/inference/inference_test_helper.dart
index 231a108..79144b9 100644
--- a/pkg/compiler/test/inference/inference_test_helper.dart
+++ b/pkg/compiler/test/inference/inference_test_helper.dart
@@ -9,7 +9,6 @@
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/inferrer/typemasks/masks.dart';
import 'package:compiler/src/inferrer/types.dart';
diff --git a/pkg/compiler/test/inference/side_effects_test.dart b/pkg/compiler/test/inference/side_effects_test.dart
index f6b92f1..53a8d48 100644
--- a/pkg/compiler/test/inference/side_effects_test.dart
+++ b/pkg/compiler/test/inference/side_effects_test.dart
@@ -9,7 +9,6 @@
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_backend/inferred_data.dart';
import 'package:compiler/src/js_model/element_map.dart';
diff --git a/pkg/compiler/test/inlining/inlining_test.dart b/pkg/compiler/test/inlining/inlining_test.dart
index 717045f..77b1501 100644
--- a/pkg/compiler/test/inlining/inlining_test.dart
+++ b/pkg/compiler/test/inlining/inlining_test.dart
@@ -9,7 +9,6 @@
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_model/element_map.dart';
import 'package:compiler/src/js_model/js_strategy.dart';
diff --git a/pkg/compiler/test/optimization/optimization_test.dart b/pkg/compiler/test/optimization/optimization_test.dart
index c89e863..c3e5d37 100644
--- a/pkg/compiler/test/optimization/optimization_test.dart
+++ b/pkg/compiler/test/optimization/optimization_test.dart
@@ -11,7 +11,6 @@
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_model/element_map.dart';
import 'package:compiler/src/js_model/js_strategy.dart';
diff --git a/pkg/compiler/test/rti/rti_emission_test_helper.dart b/pkg/compiler/test/rti/rti_emission_test_helper.dart
index fbded89..aa48230 100644
--- a/pkg/compiler/test/rti/rti_emission_test_helper.dart
+++ b/pkg/compiler/test/rti/rti_emission_test_helper.dart
@@ -10,7 +10,6 @@
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_backend/runtime_types.dart';
import 'package:compiler/src/js_emitter/model.dart';
diff --git a/pkg/compiler/test/rti/rti_need_test_helper.dart b/pkg/compiler/test/rti/rti_need_test_helper.dart
index c59c219..f72a9f4 100644
--- a/pkg/compiler/test/rti/rti_need_test_helper.dart
+++ b/pkg/compiler/test/rti/rti_need_test_helper.dart
@@ -11,7 +11,6 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common_elements.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/elements/types.dart';
import 'package:compiler/src/js_backend/runtime_types_resolution.dart';
diff --git a/pkg/dev_compiler/test/expression_compiler/expression_compiler_e2e_suite.dart b/pkg/dev_compiler/test/expression_compiler/expression_compiler_e2e_suite.dart
index a20eb79..422caec 100644
--- a/pkg/dev_compiler/test/expression_compiler/expression_compiler_e2e_suite.dart
+++ b/pkg/dev_compiler/test/expression_compiler/expression_compiler_e2e_suite.dart
@@ -21,7 +21,6 @@
import 'package:kernel/ast.dart' show Component, Library;
import 'package:kernel/target/targets.dart';
import 'package:path/path.dart' as p;
-import 'package:source_maps/parser.dart' as source_maps;
import 'package:source_maps/source_maps.dart' as source_maps;
import 'package:test/test.dart';
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 0fe5e02..159cbab 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -10,7 +10,6 @@
show ScannerConfiguration;
import 'package:front_end/src/api_prototype/experimental_flags.dart';
-import 'package:front_end/src/api_prototype/front_end.dart';
import 'package:front_end/src/api_prototype/lowering_predicates.dart'
show isExtensionThisName;
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index 6978d00..d012efa 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -24,7 +24,6 @@
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/clone.dart';
import 'package:kernel/core_types.dart';
-import 'package:kernel/kernel.dart';
import 'package:kernel/src/const_canonical_type.dart';
import 'package:kernel/src/legacy_erasure.dart';
import 'package:kernel/src/norm.dart';
diff --git a/pkg/front_end/test/id_testing/id_testing_test.dart b/pkg/front_end/test/id_testing/id_testing_test.dart
index c7c8b83..f3f465f 100644
--- a/pkg/front_end/test/id_testing/id_testing_test.dart
+++ b/pkg/front_end/test/id_testing/id_testing_test.dart
@@ -7,7 +7,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, StringDataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'dart:io' show Directory, Platform;
import 'package:front_end/src/fasta/messages.dart' show FormattedMessage;
import 'package:front_end/src/testing/id_testing_helper.dart'
diff --git a/pkg/front_end/test/id_tests/assigned_variables_test.dart b/pkg/front_end/test/id_tests/assigned_variables_test.dart
index 8a54a08..53e04d5 100644
--- a/pkg/front_end/test/id_tests/assigned_variables_test.dart
+++ b/pkg/front_end/test/id_tests/assigned_variables_test.dart
@@ -11,7 +11,6 @@
show ActualData, Id, IdKind;
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/fasta/builder/member_builder.dart';
import 'package:front_end/src/fasta/source/source_loader.dart';
diff --git a/pkg/front_end/test/id_tests/constant_test.dart b/pkg/front_end/test/id_tests/constant_test.dart
index 0b2db7e..cdf28c3 100644
--- a/pkg/front_end/test/id_tests/constant_test.dart
+++ b/pkg/front_end/test/id_tests/constant_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, StringDataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/testing/id_testing_helper.dart'
show
CfeDataExtractor,
diff --git a/pkg/front_end/test/id_tests/inferred_type_arguments_test.dart b/pkg/front_end/test/id_tests/inferred_type_arguments_test.dart
index 0670441..32f5603 100644
--- a/pkg/front_end/test/id_tests/inferred_type_arguments_test.dart
+++ b/pkg/front_end/test/id_tests/inferred_type_arguments_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/fasta/builder/member_builder.dart';
import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart';
import 'package:front_end/src/testing/id_testing_helper.dart';
diff --git a/pkg/front_end/test/id_tests/inferred_variable_types_test.dart b/pkg/front_end/test/id_tests/inferred_variable_types_test.dart
index 8403ae5..3049cb9 100644
--- a/pkg/front_end/test/id_tests/inferred_variable_types_test.dart
+++ b/pkg/front_end/test/id_tests/inferred_variable_types_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/fasta/builder/member_builder.dart';
import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart';
import 'package:front_end/src/testing/id_testing_helper.dart';
diff --git a/pkg/front_end/test/id_tests/reachability_test.dart b/pkg/front_end/test/id_tests/reachability_test.dart
index 7cd2ab7..288bee9 100644
--- a/pkg/front_end/test/id_tests/reachability_test.dart
+++ b/pkg/front_end/test/id_tests/reachability_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/testing/id_testing_helper.dart';
import 'package:front_end/src/fasta/builder/member_builder.dart';
import 'package:front_end/src/fasta/source/source_loader.dart';
diff --git a/pkg/front_end/test/id_tests/type_promotion_test.dart b/pkg/front_end/test/id_tests/type_promotion_test.dart
index 87d3d38..52e0ec2 100644
--- a/pkg/front_end/test/id_tests/type_promotion_test.dart
+++ b/pkg/front_end/test/id_tests/type_promotion_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/testing/id_testing_helper.dart';
import 'package:front_end/src/testing/id_testing_utils.dart';
import 'package:kernel/ast.dart' hide Variance;
diff --git a/pkg/front_end/test/id_tests/why_not_promoted_test.dart b/pkg/front_end/test/id_tests/why_not_promoted_test.dart
index 603cd8c..8b8d215 100644
--- a/pkg/front_end/test/id_tests/why_not_promoted_test.dart
+++ b/pkg/front_end/test/id_tests/why_not_promoted_test.dart
@@ -9,7 +9,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id;
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:front_end/src/fasta/builder/member_builder.dart';
import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart';
import 'package:front_end/src/testing/id_testing_helper.dart';
diff --git a/pkg/front_end/test/lint_suite.dart b/pkg/front_end/test/lint_suite.dart
index 8e11c97..af61e9a 100644
--- a/pkg/front_end/test/lint_suite.dart
+++ b/pkg/front_end/test/lint_suite.dart
@@ -15,8 +15,6 @@
import 'package:_fe_analyzer_shared/src/scanner/token.dart' show Token;
-import 'package:_fe_analyzer_shared/src/scanner/token.dart';
-
import 'package:_fe_analyzer_shared/src/scanner/utf8_bytes_scanner.dart'
show Utf8BytesScanner;
diff --git a/pkg/front_end/test/predicates/predicate_test.dart b/pkg/front_end/test/predicates/predicate_test.dart
index 98ed0cb..2660e72 100644
--- a/pkg/front_end/test/predicates/predicate_test.dart
+++ b/pkg/front_end/test/predicates/predicate_test.dart
@@ -8,7 +8,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'
show DataInterpreter, runTests;
-import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:_fe_analyzer_shared/src/testing/features.dart';
import 'package:front_end/src/api_prototype/experimental_flags.dart';
import 'package:front_end/src/base/nnbd_mode.dart';
diff --git a/pkg/front_end/tool/perf.dart b/pkg/front_end/tool/perf.dart
index 7844f2b..be32427 100644
--- a/pkg/front_end/tool/perf.dart
+++ b/pkg/front_end/tool/perf.dart
@@ -28,7 +28,6 @@
import 'package:analyzer/src/file_system/file_system.dart';
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:path/path.dart' as path;
diff --git a/pkg/kernel/bin/split.dart b/pkg/kernel/bin/split.dart
index 90f1028..149f28e 100755
--- a/pkg/kernel/bin/split.dart
+++ b/pkg/kernel/bin/split.dart
@@ -8,7 +8,6 @@
import 'package:kernel/ast.dart';
import 'package:kernel/binary/ast_to_binary.dart';
-import 'package:kernel/kernel.dart';
import 'package:kernel/src/tool/command_line_util.dart';
void usage() {
diff --git a/pkg/kernel/lib/transformations/empty.dart b/pkg/kernel/lib/transformations/empty.dart
index 4d7ccff..66ab05c 100644
--- a/pkg/kernel/lib/transformations/empty.dart
+++ b/pkg/kernel/lib/transformations/empty.dart
@@ -5,7 +5,6 @@
library kernel.transformations.empty;
import '../ast.dart';
-import '../kernel.dart';
Component transformComponent(Component component) {
new EmptyTransformer().visitComponent(component);
diff --git a/pkg/kernel/lib/transformations/scanner.dart b/pkg/kernel/lib/transformations/scanner.dart
index ec75cbd..9148fa7 100644
--- a/pkg/kernel/lib/transformations/scanner.dart
+++ b/pkg/kernel/lib/transformations/scanner.dart
@@ -5,7 +5,6 @@
library kernel.transformations.scanner;
import '../ast.dart';
-import '../kernel.dart';
abstract class Scanner<X extends TreeNode?, Y extends TreeNode?> {
final Scanner<Y, TreeNode?>? next;
diff --git a/pkg/kernel/lib/transformations/value_class.dart b/pkg/kernel/lib/transformations/value_class.dart
index cbb27dc..2a96ffd 100644
--- a/pkg/kernel/lib/transformations/value_class.dart
+++ b/pkg/kernel/lib/transformations/value_class.dart
@@ -7,7 +7,6 @@
import 'package:kernel/type_environment.dart';
import '../ast.dart';
-import '../kernel.dart';
import '../core_types.dart' show CoreTypes;
import '../class_hierarchy.dart' show ClassHierarchy;
import './scanner.dart';
diff --git a/runtime/tools/dartfuzz/dartfuzz_test.dart b/runtime/tools/dartfuzz/dartfuzz_test.dart
index fb826ff..7ba2f79 100644
--- a/runtime/tools/dartfuzz/dartfuzz_test.dart
+++ b/runtime/tools/dartfuzz/dartfuzz_test.dart
@@ -356,8 +356,7 @@
}
// Report every 10 minutes.
if ((current_time - report_time) > (10 * 60 * 1000)) {
- print(
- '\n$isolate: busy @$numTests ${current_time - start_time} seconds....');
+ print('\n$isolate: busy @$numTests ${current_time - start_time}ms....');
report_time = current_time;
}
}
diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart
index 7e019bf..5a5d299 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart
@@ -107,11 +107,13 @@
@JSExportName('implements')
final implements_ = JS('', 'Symbol("implements")');
-/// Either `null` if `clazz` doesn't directly implement any interfaces or a
-/// list of type objects if it does. Note, indirectly (e.g., via superclass)
-/// implemented interfaces aren't included here.
-/// See compiler.dart for when/how it is emitted.
-List Function()? getImplements(clazz) => JS(
+/// Returns `null` if [clazz] doesn't directly implement any interfaces or a
+/// a `Function` that when called produces a `List` of the type objects
+/// [clazz] implements.
+///
+/// Note, indirectly (e.g., via superclass) implemented interfaces aren't
+/// included here. See compiler.dart for when/how it is emitted.
+List<Object> Function()? getImplements(clazz) => JS(
'',
'Object.hasOwnProperty.call(#, #) ? #[#] : null',
clazz,
diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
index 3c0267d..c92852f 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
@@ -839,6 +839,26 @@
toString() => name;
}
+/// A helper data class for the subtype check algorithm to represent a generic
+/// function type variable with its bound.
+///
+/// Instances of this class are created during subtype check operations to pass
+/// information deeper into the algorithm. They are not canonicalized and should
+/// be discarded after use.
+class TypeVariableForSubtype extends DartType {
+ /// The position of this type variable in the type variable list of a generic
+ /// function.
+ final int index;
+
+ /// The bound for this type variable.
+ ///
+ /// Only nullable to avoid the cost of a late field within the subtype check.
+ /// Should not be null after initial creation algorithm is complete.
+ DartType? bound;
+
+ TypeVariableForSubtype(this.index);
+}
+
class Variance {
static const int unrelated = 0;
static const int covariant = 1;
@@ -889,6 +909,7 @@
class GenericFunctionType extends AbstractFunctionType {
final _instantiateTypeParts;
+ @notNull
final int formalCount;
final _instantiateTypeBounds;
final List<TypeVariable> _typeFormals;
@@ -1166,7 +1187,9 @@
})()''');
/// Returns true if [ft1] <: [ft2].
-_isFunctionSubtype(ft1, ft2, @notNull bool strictMode) => JS('', '''(() => {
+@notNull
+bool _isFunctionSubtype(ft1, ft2, @notNull bool strictMode) =>
+ JS<bool>('!', '''(() => {
let ret1 = $ft1.returnType;
let ret2 = $ft2.returnType;
@@ -1257,6 +1280,14 @@
return $_isSubtype(ret1, ret2, strictMode);
})()''');
+/// Number of generic function type variables encountered so far during a
+/// subtype check.
+///
+/// This continues to increase through nested generic function types but should
+/// always be reset before performing a new subtype check.
+@notNull
+var _typeVariableCount = 0;
+
/// Returns true if [t1] <: [t2].
@notNull
bool isSubtypeOf(@notNull t1, @notNull t2) {
@@ -1265,9 +1296,12 @@
var map = JS<Object>('!', '#[#]', t1, _subtypeCache);
bool result = JS('', '#.get(#)', map, t2);
if (JS('!', '# !== void 0', result)) return result;
-
+ // Reset count before performing subtype check.
+ _typeVariableCount = 0;
var validSubtype = _isSubtype(t1, t2, true);
if (!validSubtype && !compileTimeFlag('soundNullSafety')) {
+ // Reset count before performing subtype check.
+ _typeVariableCount = 0;
validSubtype = _isSubtype(t1, t2, false);
if (validSubtype) {
// TODO(nshahan) Need more information to be helpful here.
@@ -1339,45 +1373,44 @@
}
@notNull
-bool _isSubtype(t1, t2, @notNull bool strictMode) => JS<bool>('!', '''(() => {
- if (!$strictMode) {
+bool _isSubtype(t1, t2, @notNull bool strictMode) {
+ if (!strictMode) {
// Strip nullable types when performing check in weak mode.
// TODO(nshahan) Investigate stripping off legacy types as well.
- if (${_jsInstanceOf(t1, NullableType)}) {
- t1 = t1.type;
+ if (_jsInstanceOf(t1, NullableType)) {
+ t1 = JS<NullableType>('!', '#', t1).type;
}
- if (${_jsInstanceOf(t2, NullableType)}) {
- t2 = t2.type;
+ if (_jsInstanceOf(t2, NullableType)) {
+ t2 = JS<NullableType>('!', '#', t2).type;
}
}
- if ($t1 === $t2) {
+
+ if (JS<bool>('!', '# === #', t1, t2)) {
return true;
}
// Trivially true, "Right Top" or "Left Bottom".
- if (${_isTop(t2)} || ${_isBottom(t1, strictMode)}) {
+ if (_isTop(t2) || _isBottom(t1, strictMode)) {
return true;
}
// "Left Top".
- if (${_equalType(t1, dynamic)} || $t1 === $void_) {
- return $_isSubtype($nullable($Object), $t2, $strictMode);
+ if (_equalType(t1, dynamic) || JS<bool>('!', '# === #', t1, void_)) {
+ return _isSubtype(typeRep<Object?>(), t2, strictMode);
}
// "Right Object".
- if (${_equalType(t2, Object)}) {
- // TODO(nshahan) Need to handle type variables.
- // https://github.com/dart-lang/sdk/issues/38816
- if (${_isFutureOr(t1)}) {
- let t1TypeArg = ${getGenericArgs(t1)}[0];
- return $_isSubtype(t1TypeArg, $Object, $strictMode);
+ if (_equalType(t2, Object)) {
+ if (_isFutureOr(t1)) {
+ var t1TypeArg = JS('', '#[0]', getGenericArgs(t1));
+ return _isSubtype(t1TypeArg, typeRep<Object>(), strictMode);
}
- if (${_jsInstanceOf(t1, LegacyType)}) {
- return $_isSubtype(t1.type, t2, $strictMode);
+ if (_jsInstanceOf(t1, LegacyType)) {
+ return _isSubtype(JS<LegacyType>('!', '#', t1).type, t2, strictMode);
}
- if (${_equalType(t1, Null)} || ${_jsInstanceOf(t1, NullableType)}) {
+ if (_equalType(t1, Null) || _jsInstanceOf(t1, NullableType)) {
// Checks for t1 is dynamic or void already performed in "Left Top" test.
return false;
}
@@ -1385,81 +1418,78 @@
}
// "Left Null".
- if (${_equalType(t1, Null)}) {
- // TODO(nshahan) Need to handle type variables.
- // https://github.com/dart-lang/sdk/issues/38816
- if (${_isFutureOr(t2)}) {
- let t2TypeArg = ${getGenericArgs(t2)}[0];
- return $_isSubtype($Null, t2TypeArg, $strictMode);
+ if (_equalType(t1, Null)) {
+ if (_isFutureOr(t2)) {
+ var t2TypeArg = JS('', '#[0]', getGenericArgs(t2));
+ return _isSubtype(typeRep<Null>(), t2TypeArg, strictMode);
}
- return ${_equalType(t2, Null)} || ${_jsInstanceOf(t2, LegacyType)} ||
- ${_jsInstanceOf(t2, NullableType)};
+ return _equalType(t2, Null) ||
+ _jsInstanceOf(t2, LegacyType) ||
+ _jsInstanceOf(t2, NullableType);
}
// "Left Legacy".
- if (${_jsInstanceOf(t1, LegacyType)}) {
- return $_isSubtype(t1.type, t2, $strictMode);
+ if (_jsInstanceOf(t1, LegacyType)) {
+ return _isSubtype(JS<LegacyType>('!', '#', t1).type, t2, strictMode);
}
// "Right Legacy".
- if (${_jsInstanceOf(t2, LegacyType)}) {
- return $_isSubtype(t1, $nullable(t2.type), $strictMode);
+ if (_jsInstanceOf(t2, LegacyType)) {
+ return _isSubtype(
+ t1, nullable(JS<LegacyType>('!', '#', t2).type), strictMode);
}
// Handle FutureOr<T> union type.
- if (${_isFutureOr(t1)}) {
- let t1TypeArg = ${getGenericArgs(t1)}[0];
- if (${_isFutureOr(t2)}) {
- let t2TypeArg = ${getGenericArgs(t2)}[0];
+ if (_isFutureOr(t1)) {
+ var t1TypeArg = JS('!', '#[0]', getGenericArgs(t1));
+ if (_isFutureOr(t2)) {
+ var t2TypeArg = JS('!', '#[0]', getGenericArgs(t2));
// FutureOr<A> <: FutureOr<B> if A <: B
- if ($_isSubtype(t1TypeArg, t2TypeArg, $strictMode)) {
+ if (_isSubtype(t1TypeArg, t2TypeArg, strictMode)) {
return true;
}
}
// given t1 is Future<A> | A, then:
// (Future<A> | A) <: t2 iff Future<A> <: t2 and A <: t2.
- let t1Future = ${getGenericClassStatic<Future>()}(t1TypeArg);
+ var t1Future = JS('!', '#(#)', getGenericClassStatic<Future>(), t1TypeArg);
// Known to handle the case FutureOr<Null> <: Future<Null>.
- return $_isSubtype(t1Future, $t2, $strictMode) &&
- $_isSubtype(t1TypeArg, $t2, $strictMode);
+ return _isSubtype(t1Future, t2, strictMode) &&
+ _isSubtype(t1TypeArg, t2, strictMode);
}
// "Left Nullable".
- if (${_jsInstanceOf(t1, NullableType)}) {
- // TODO(nshahan) Need to handle type variables.
- // https://github.com/dart-lang/sdk/issues/38816
- return $_isSubtype(t1.type, t2, $strictMode) && $_isSubtype($Null, t2, $strictMode);
+ if (_jsInstanceOf(t1, NullableType)) {
+ return _isSubtype(JS<NullableType>('!', '#', t1).type, t2, strictMode) &&
+ _isSubtype(typeRep<Null>(), t2, strictMode);
}
- if ($_isFutureOr($t2)) {
+ if (_isFutureOr(t2)) {
// given t2 is Future<A> | A, then:
// t1 <: (Future<A> | A) iff t1 <: Future<A> or t1 <: A
- let t2TypeArg = ${getGenericArgs(t2)}[0];
- let t2Future = ${getGenericClassStatic<Future>()}(t2TypeArg);
- // TODO(nshahan) Need to handle type variables on the left.
- // https://github.com/dart-lang/sdk/issues/38816
- return $_isSubtype($t1, t2Future, $strictMode) || $_isSubtype($t1, t2TypeArg, $strictMode);
+ var t2TypeArg = JS('!', '#[0]', getGenericArgs(t2));
+ var t2Future = JS('!', '#(#)', getGenericClassStatic<Future>(), t2TypeArg);
+ return _isSubtype(t1, t2Future, strictMode) ||
+ _isSubtype(t1, t2TypeArg, strictMode);
}
// "Right Nullable".
- if (${_jsInstanceOf(t2, NullableType)}) {
- // TODO(nshahan) Need to handle type variables.
- // https://github.com/dart-lang/sdk/issues/38816
- return $_isSubtype(t1, t2.type, $strictMode) || $_isSubtype(t1, $Null, $strictMode);
+ if (_jsInstanceOf(t2, NullableType)) {
+ return _isSubtype(t1, JS<NullableType>('!', '#', t2).type, strictMode) ||
+ _isSubtype(t1, typeRep<Null>(), strictMode);
}
// "Traditional" name-based subtype check. Avoid passing
// function types to the class subtype checks, since we don't
// currently distinguish between generic typedefs and classes.
- if (!${_jsInstanceOf(t2, AbstractFunctionType)}) {
+ if (!_jsInstanceOf(t2, AbstractFunctionType)) {
// t2 is an interface type.
- if (${_jsInstanceOf(t1, AbstractFunctionType)}) {
+ if (_jsInstanceOf(t1, AbstractFunctionType)) {
// Function types are only subtypes of interface types `Function` (and top
// types, handled already above).
- return ${_equalType(t2, Function)};
+ return _equalType(t2, Function);
}
// Even though lazy and anonymous JS types are natural subtypes of
@@ -1472,34 +1502,33 @@
// JavaScriptObject <: package:js types
// package:js types <: JavaScriptObject
- if (${_isInterfaceSubtype(t1, JavaScriptObject, strictMode)}
- &&
- // TODO: Since package:js types are instances of PackageJSType and
- // we don't have a mechanism to determine if *some* package:js type
- // implements t2. This will possibly require keeping a map of these
- // relationships for this subtyping check. For now, this will only
- // work if t2 is also a PackageJSType.
- ${_isInterfaceSubtype(_pkgJSTypeForSubtyping, t2, strictMode)}) {
+ if (_isInterfaceSubtype(t1, typeRep<JavaScriptObject>(), strictMode) &&
+ // TODO: Since package:js types are instances of PackageJSType and
+ // we don't have a mechanism to determine if *some* package:js type
+ // implements t2. This will possibly require keeping a map of these
+ // relationships for this subtyping check. For now, this will only
+ // work if t2 is also a PackageJSType.
+ _isInterfaceSubtype(_pkgJSTypeForSubtyping, t2, strictMode)) {
return true;
}
- if (${_isInterfaceSubtype(JavaScriptObject, t2, strictMode)}
- && ${_isInterfaceSubtype(t1, _pkgJSTypeForSubtyping, strictMode)}) {
+ if (_isInterfaceSubtype(typeRep<JavaScriptObject>(), t2, strictMode) &&
+ _isInterfaceSubtype(t1, _pkgJSTypeForSubtyping, strictMode)) {
return true;
}
// Compare two interface types.
- return ${_isInterfaceSubtype(t1, t2, strictMode)};
+ return _isInterfaceSubtype(t1, t2, strictMode);
}
// Function subtyping.
- if (!${_jsInstanceOf(t1, AbstractFunctionType)}) {
+ if (!_jsInstanceOf(t1, AbstractFunctionType)) {
return false;
}
// Handle generic functions.
- if (${_jsInstanceOf(t1, GenericFunctionType)}) {
- if (!${_jsInstanceOf(t2, GenericFunctionType)}) {
+ if (_jsInstanceOf(t1, GenericFunctionType)) {
+ if (!_jsInstanceOf(t2, GenericFunctionType)) {
return false;
}
@@ -1509,97 +1538,142 @@
//
// where TFresh is a list of fresh type variables that both g1 and g2 will
// be instantiated with.
- let formalCount = $t1.formalCount;
- if (formalCount !== $t2.formalCount) {
+ var formalCount = JS<GenericFunctionType>('!', '#', t1).formalCount;
+ if (formalCount != JS<GenericFunctionType>('!', '#', t2).formalCount) {
return false;
}
- // Using either function's type formals will work as long as they're both
- // instantiated with the same ones. The instantiate operation is guaranteed
- // to avoid capture because it does not depend on its TypeVariable objects,
- // rather it uses JS function parameters to ensure correct binding.
- let fresh = $t2.typeFormals;
+ // Fresh type variables will be used to instantiate generic functions.
+ List<Object> fresh1;
+ List<Object> fresh2;
// Without type bounds all will instantiate to dynamic. Only need to check
// further if at least one of the functions has type bounds.
- if ($t1.hasTypeBounds || $t2.hasTypeBounds) {
- // Check the bounds of the type parameters of g1 and g2. Given a type
- // parameter `T1 extends U1` from g1, and a type parameter `T2 extends U2`
- // from g2, we must ensure that U1 and U2 are mutual subtypes.
- //
- // (Note there is no variance in the type bounds of type parameters of
- // generic functions).
- let t1Bounds = $t1.instantiateTypeBounds(fresh);
- let t2Bounds = $t2.instantiateTypeBounds(fresh);
- for (let i = 0; i < formalCount; i++) {
- if (t1Bounds[i] != t2Bounds[i]) {
- if (!($_isSubtype(t1Bounds[i], t2Bounds[i], $strictMode)
- && $_isSubtype(t2Bounds[i], t1Bounds[i], $strictMode))) {
+ if (JS<bool>('!', '#.hasTypeBounds || #.hasTypeBounds', t1, t2)) {
+ // Create two sets of fresh type variables that can store their bounds so
+ // they can be considered in recursive calls.
+ fresh1 = JS('!', 'new Array(#)', formalCount);
+ fresh2 = JS('!', 'new Array(#)', formalCount);
+ for (var i = 0; i < formalCount; i++, _typeVariableCount++) {
+ JS('!', '#[#] = #', fresh1, i,
+ TypeVariableForSubtype(_typeVariableCount));
+ JS('!', '#[#] = #', fresh2, i,
+ TypeVariableForSubtype(_typeVariableCount));
+ }
+ var t1Bounds =
+ JS<GenericFunctionType>('!', '#', t1).instantiateTypeBounds(fresh1);
+ var t2Bounds =
+ JS<GenericFunctionType>('!', '#', t2).instantiateTypeBounds(fresh2);
+
+ for (var i = 0; i < formalCount; i++) {
+ var t1Bound = JS<Object>('!', '#[#]', t1Bounds, i);
+ var t2Bound = JS<Object>('!', '#[#]', t2Bounds, i);
+
+ // Check the bounds of the type parameters of g1 and g2. Given a type
+ // parameter `T1 extends B1` from g1, and a type parameter `T2 extends
+ // B2` from g2, we must ensure that B1 and B2 are mutual subtypes.
+ //
+ // (Note there is no variance in the type bounds of type parameters of
+ // generic functions).
+ if (JS<bool>('!', '# != #', t1Bound, t2Bound)) {
+ if (!(_isSubtype(t1Bound, t2Bound, strictMode) &&
+ _isSubtype(t2Bound, t1Bound, strictMode))) {
return false;
}
}
+ // Assign bounds to be used in the `_isInterfaceSubtype` check later as
+ // this subtype check continues.
+ JS('', '#[#].bound = #', fresh1, i, t1Bound);
+ JS('', '#[#].bound = #', fresh2, i, t2Bound);
}
+ } else {
+ // Using either function's type formals will work as long as they're both
+ // instantiated with the same ones. The instantiate operation is
+ // guaranteed to avoid capture because it does not depend on its
+ // TypeVariable objects, rather it uses JS function parameters to ensure
+ // correct binding.
+ fresh1 = JS<GenericFunctionType>('!', '#', t1).typeFormals;
+ fresh2 = fresh1;
}
- $t1 = $t1.instantiate(fresh);
- $t2 = $t2.instantiate(fresh);
- } else if (${_jsInstanceOf(t2, GenericFunctionType)}) {
+ t1 = JS<GenericFunctionType>('!', '#', t1).instantiate(fresh1);
+ t2 = JS<GenericFunctionType>('!', '#', t2).instantiate(fresh2);
+ } else if (_jsInstanceOf(t2, GenericFunctionType)) {
return false;
}
// Handle non-generic functions.
- return ${_isFunctionSubtype(t1, t2, strictMode)};
-})()''');
+ return _isFunctionSubtype(t1, t2, strictMode);
+}
-bool _isInterfaceSubtype(t1, t2, @notNull bool strictMode) => JS('', '''(() => {
+@notNull
+bool _isInterfaceSubtype(t1, t2, @notNull bool strictMode) {
// Instances of PackageJSType are all subtypes of each other.
- if (${_jsInstanceOf(t1, PackageJSType)}
- && ${_jsInstanceOf(t2, PackageJSType)}) {
+ if (_jsInstanceOf(t1, PackageJSType) && _jsInstanceOf(t2, PackageJSType)) {
return true;
}
- if ($t1 === $t2) {
+ if (JS<bool>('!', '# === #', t1, t2)) {
return true;
}
- if (${_equalType(t1, Object)}) {
+ if (_equalType(t1, Object)) {
return false;
}
// Classes cannot subtype `Function` or vice versa.
- if (${_equalType(t1, Function)} || ${_equalType(t2, Function)}) {
+ if (_equalType(t1, Function) || _equalType(t2, Function)) {
return false;
}
// If t1 is a JS Object, we may not hit core.Object.
- if ($t1 == null) {
- return ${_equalType(t2, Object)} || ${_equalType(t2, dynamic)};
+ if (t1 == null) {
+ return _equalType(t2, Object) || _equalType(t2, dynamic);
+ }
+
+ if (_jsInstanceOf(t1, TypeVariableForSubtype)) {
+ if (_jsInstanceOf(t2, TypeVariableForSubtype)) {
+ // Bounds were already checked to be subtypes of each other in the
+ // generic function section of `_isSubtype()` so just check these type
+ // variables share the same index in their respective signatures.
+ return JS<TypeVariableForSubtype>('!', '#', t1).index ==
+ JS<TypeVariableForSubtype>('!', '#', t2).index;
+ }
+
+ // If t1 <: bound <: t2 then t1 <: t2.
+ return _isSubtype(
+ JS<TypeVariableForSubtype>('!', '#', t1).bound, t2, strictMode);
}
// Check if t1 and t2 have the same raw type. If so, check covariance on
// type parameters.
- let raw1 = $getGenericClass($t1);
- let raw2 = $getGenericClass($t2);
- if (raw1 != null && raw1 == raw2) {
- let typeArguments1 = $getGenericArgs($t1);
- let typeArguments2 = $getGenericArgs($t2);
- if (typeArguments1.length != typeArguments2.length) {
- $assertFailed();
+ var raw1 = getGenericClass(t1);
+ var raw2 = getGenericClass(t2);
+ if (raw1 != null && JS<bool>('!', '# == #', raw1, raw2)) {
+ var typeArguments1 = getGenericArgs(t1);
+ var typeArguments2 = getGenericArgs(t2);
+ if (JS<bool>('!', '#.length != #.length', typeArguments1, typeArguments2)) {
+ assertFailed('Internal type check failure.');
}
- let variances = $getGenericArgVariances($t1);
- for (let i = 0; i < typeArguments1.length; ++i) {
+ var variances = getGenericArgVariances(t1);
+ for (var i = 0; i < JS<int>('!', '#.length', typeArguments1); ++i) {
// When using implicit variance, variances will be undefined and
// considered covariant.
- if (variances === void 0 || variances[i] == ${Variance.covariant}) {
- if (!$_isSubtype(typeArguments1[i], typeArguments2[i], $strictMode)) {
+ var varianceType = JS('!', '# && #[#]', variances, variances, i);
+ var typeArg1 = JS('!', '#[#]', typeArguments1, i);
+ var typeArg2 = JS('!', '#[#]', typeArguments2, i);
+ if (JS<bool>('!', '# === void 0 || # == #', varianceType, varianceType,
+ Variance.covariant)) {
+ if (!_isSubtype(typeArg1, typeArg2, strictMode)) {
return false;
}
- } else if (variances[i] == ${Variance.contravariant}) {
- if (!$_isSubtype(typeArguments2[i], typeArguments1[i], $strictMode)) {
+ } else if (JS<bool>(
+ '!', '# == #', varianceType, Variance.contravariant)) {
+ if (!_isSubtype(typeArg2, typeArg1, strictMode)) {
return false;
}
- } else if (variances[i] == ${Variance.invariant}) {
- if (!$_isSubtype(typeArguments1[i], typeArguments2[i], $strictMode) ||
- !$_isSubtype(typeArguments2[i], typeArguments1[i], $strictMode)) {
+ } else if (JS<bool>('!', '# == #', varianceType, Variance.invariant)) {
+ if (!_isSubtype(typeArg1, typeArg2, strictMode) ||
+ !_isSubtype(typeArg2, typeArg1, strictMode)) {
return false;
}
}
@@ -1607,27 +1681,27 @@
return true;
}
- if ($_isInterfaceSubtype(t1.__proto__, $t2, $strictMode)) {
+ if (_isInterfaceSubtype(JS('', '#.__proto__', t1), t2, strictMode)) {
return true;
}
// Check mixin.
- let m1 = $getMixin($t1);
- if (m1 != null && $_isInterfaceSubtype(m1, $t2, $strictMode)) {
+ var m1 = getMixin(t1);
+ if (m1 != null && _isInterfaceSubtype(m1, t2, strictMode)) {
return true;
}
// Check interfaces.
- let getInterfaces = $getImplements($t1);
- if (getInterfaces) {
- for (let i1 of getInterfaces()) {
- if ($_isInterfaceSubtype(i1, $t2, $strictMode)) {
+ var getInterfaces = getImplements(t1);
+ if (getInterfaces != null) {
+ for (var i1 in getInterfaces()) {
+ if (_isInterfaceSubtype(i1, t2, strictMode)) {
return true;
}
}
}
return false;
-})()''');
+}
Object? extractTypeArguments<T>(T instance, Function f) {
if (instance == null) {
diff --git a/tools/VERSION b/tools/VERSION
index f5db836..198805e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 129
+PRERELEASE 130
PRERELEASE_PATCH 0
\ No newline at end of file