Skip to content

Instantly share code, notes, and snippets.

@munificent
Created June 9, 2015 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save munificent/7a49af339b5325829766 to your computer and use it in GitHub Desktop.
Save munificent/7a49af339b5325829766 to your computer and use it in GitHub Desktop.
This is a diff of the changes between formatting dart2js (151303 lines) using the current 0.1.8 version of the formatter and the new rules version.
diff --git a/pkg/compiler/lib/compiler.dart b/pkg/compiler/lib/compiler.dart
index cf68043..80a6c9c 100644
--- a/pkg/compiler/lib/compiler.dart
+++ b/pkg/compiler/lib/compiler.dart
@@ -96,7 +96,8 @@ class CompilationResult {
*/
Future<CompilationResult> compile(Uri script, Uri libraryRoot, Uri packageRoot,
CompilerInputProvider inputProvider, DiagnosticHandler handler,
- [List<String> options = const [], CompilerOutputProvider outputProvider,
+ [List<String> options = const [],
+ CompilerOutputProvider outputProvider,
Map<String, dynamic> environment = const {}]) {
if (!libraryRoot.path.endsWith("/")) {
throw new ArgumentError("libraryRoot must end with a /");
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index 507b702..9b4434c 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -30,8 +30,13 @@ class Compiler extends leg.Compiler {
leg.GenericTask userHandlerTask;
leg.GenericTask userProviderTask;
- Compiler(this.provider, api.CompilerOutputProvider outputProvider,
- this.handler, this.libraryRoot, this.packageRoot, List<String> options,
+ Compiler(
+ this.provider,
+ api.CompilerOutputProvider outputProvider,
+ this.handler,
+ this.libraryRoot,
+ this.packageRoot,
+ List<String> options,
this.environment)
: this.options = options,
this.allowedLibraryCategories = getAllowedLibraryCategories(options),
@@ -83,7 +88,8 @@ class Compiler extends leg.Compiler {
allowNativeExtensions: hasOption(
options, '--allow-native-extensions'),
enableNullAwareOperators: hasOption(
- options, '--enable-null-aware-operators')) {
+ options,
+ '--enable-null-aware-operators')) {
tasks.addAll([
userHandlerTask = new leg.GenericTask('Diagnostic handler', this),
userProviderTask = new leg.GenericTask('Input provider', this),
@@ -200,17 +206,14 @@ class Compiler extends leg.Compiler {
elements.Element element = currentElement;
void reportReadError(exception) {
if (element == null || node == null) {
- reportError(new leg.SourceSpan(readableUri, 0, 0),
- leg.MessageKind.READ_SELF_ERROR, {
- 'uri': readableUri,
- 'exception': exception
- });
+ reportError(
+ new leg.SourceSpan(readableUri, 0, 0),
+ leg.MessageKind.READ_SELF_ERROR,
+ {'uri': readableUri, 'exception': exception});
} else {
withCurrentElement(element, () {
- reportError(node, leg.MessageKind.READ_SCRIPT_ERROR, {
- 'uri': readableUri,
- 'exception': exception
- });
+ reportError(node, leg.MessageKind.READ_SCRIPT_ERROR,
+ {'uri': readableUri, 'exception': exception});
});
}
}
@@ -252,7 +255,9 @@ class Compiler extends leg.Compiler {
Future<leg.Script> synthesizeScript(leg.Spannable node, Uri readableUri) {
Uri resourceUri = translateUri(node, readableUri);
- return new Future.value(new leg.Script(readableUri, resourceUri,
+ return new Future.value(new leg.Script(
+ readableUri,
+ resourceUri,
new StringSourceFile.fromUri(resourceUri,
"// Synthetic source file generated for '$readableUri'."),
isSynthesized: true));
@@ -293,16 +298,14 @@ class Compiler extends leg.Compiler {
'importingUri': importingLibrary.canonicalUri
});
} else {
- reportError(node, leg.MessageKind.INTERNAL_LIBRARY, {
- 'resolvedUri': resolvedUri
- });
+ reportError(node, leg.MessageKind.INTERNAL_LIBRARY,
+ {'resolvedUri': resolvedUri});
}
}
}
if (path == null) {
- reportError(node, leg.MessageKind.LIBRARY_NOT_FOUND, {
- 'resolvedUri': resolvedUri
- });
+ reportError(node, leg.MessageKind.LIBRARY_NOT_FOUND,
+ {'resolvedUri': resolvedUri});
return null;
}
if (resolvedUri.path == 'html' || resolvedUri.path == 'io') {
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 7f7e944..c6ac1fa 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -168,11 +168,14 @@ class ClosureClassElement extends ClassElementX {
ClosureClassElement(
this.node, String name, Compiler compiler, LocalFunctionElement closure)
: this.methodElement = closure,
- super(name, closure.compilationUnit,
+ super(
+ name,
+ closure.compilationUnit,
// By assigning a fresh class-id we make sure that the hashcode
// is unique, but also emit closure classes after all other
// classes (since the emitter sorts classes by their id).
- compiler.getNextFreeClassId(), STATE_DONE) {
+ compiler.getNextFreeClassId(),
+ STATE_DONE) {
JavaScriptBackend backend = compiler.backend;
ClassElement superclass = methodElement.isInstanceMember
? backend.boundClosureClass
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index 29be699..648d9b2 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -136,7 +136,8 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
return compiler.withCurrentElement(currentElement, () {
compiler.analyzeElement(currentElement.declaration);
ConstantExpression constant = compileVariableWithDefinitions(
- element, currentElement.resolvedAst.elements, isConst: isConst);
+ element, currentElement.resolvedAst.elements,
+ isConst: isConst);
return constant;
});
}
@@ -184,10 +185,8 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
if (!constantSystem.isSubtype(
compiler.types, constantType, elementType)) {
if (isConst) {
- compiler.reportError(node, MessageKind.NOT_ASSIGNABLE, {
- 'fromType': constantType,
- 'toType': elementType
- });
+ compiler.reportError(node, MessageKind.NOT_ASSIGNABLE,
+ {'fromType': constantType, 'toType': elementType});
} else {
// If the field cannot be lazily initialized, we will throw
// the exception at runtime.
@@ -208,10 +207,12 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
}
ConstantExpression compileNodeWithDefinitions(
- Node node, TreeElements definitions, {bool isConst: true}) {
+ Node node, TreeElements definitions,
+ {bool isConst: true}) {
assert(node != null);
CompileTimeConstantEvaluator evaluator = new CompileTimeConstantEvaluator(
- this, definitions, compiler, isConst: isConst);
+ this, definitions, compiler,
+ isConst: isConst);
AstConstant constant = evaluator.evaluate(node);
return constant != null ? constant.expression : null;
}
@@ -252,7 +253,8 @@ class DartConstantCompiler extends ConstantCompilerBase {
}
ConstantExpression compileNodeWithDefinitions(
- Node node, TreeElements definitions, {bool isConst: true}) {
+ Node node, TreeElements definitions,
+ {bool isConst: true}) {
ConstantExpression constant = definitions.getConstant(node);
if (constant != null) {
return constant;
@@ -300,18 +302,27 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
}
AstConstant visitLiteralBool(LiteralBool node) {
- return new AstConstant(context, node, new BoolConstantExpression(
- node.value, constantSystem.createBool(node.value)));
+ return new AstConstant(
+ context,
+ node,
+ new BoolConstantExpression(
+ node.value, constantSystem.createBool(node.value)));
}
AstConstant visitLiteralDouble(LiteralDouble node) {
- return new AstConstant(context, node, new DoubleConstantExpression(
- node.value, constantSystem.createDouble(node.value)));
+ return new AstConstant(
+ context,
+ node,
+ new DoubleConstantExpression(
+ node.value, constantSystem.createDouble(node.value)));
}
AstConstant visitLiteralInt(LiteralInt node) {
- return new AstConstant(context, node, new IntConstantExpression(
- node.value, constantSystem.createInt(node.value)));
+ return new AstConstant(
+ context,
+ node,
+ new IntConstantExpression(
+ node.value, constantSystem.createInt(node.value)));
}
AstConstant visitLiteralList(LiteralList node) {
@@ -331,9 +342,13 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
argumentValues.add(argument.value);
}
DartType type = elements.getType(node);
- return new AstConstant(context, node, new ListConstantExpression(
- constantSystem.createList(type, argumentValues), type,
- argumentExpressions));
+ return new AstConstant(
+ context,
+ node,
+ new ListConstantExpression(
+ constantSystem.createList(type, argumentValues),
+ type,
+ argumentExpressions));
}
AstConstant visitLiteralMap(LiteralMap node) {
@@ -366,10 +381,15 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
}
List<ConstantExpression> valueExpressions = map.values.toList();
InterfaceType type = elements.getType(node);
- return new AstConstant(context, node, new MapConstantExpression(
- constantSystem.createMap(compiler, type, keyValues,
- valueExpressions.map((e) => e.value).toList()), type,
- keyExpressions, valueExpressions));
+ return new AstConstant(
+ context,
+ node,
+ new MapConstantExpression(
+ constantSystem.createMap(compiler, type, keyValues,
+ valueExpressions.map((e) => e.value).toList()),
+ type,
+ keyExpressions,
+ valueExpressions));
}
AstConstant visitLiteralNull(LiteralNull node) {
@@ -378,9 +398,11 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
}
AstConstant visitLiteralString(LiteralString node) {
- return new AstConstant(context, node, new StringConstantExpression(
- node.dartString.slowToString(),
- constantSystem.createString(node.dartString)));
+ return new AstConstant(
+ context,
+ node,
+ new StringConstantExpression(node.dartString.slowToString(),
+ constantSystem.createString(node.dartString)));
}
AstConstant visitStringJuxtaposition(StringJuxtaposition node) {
@@ -389,12 +411,13 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (left == null || right == null) return null;
StringConstantValue leftValue = left.value;
StringConstantValue rightValue = right.value;
- return new AstConstant(context, node, new ConcatenateConstantExpression(
- constantSystem.createString(new DartString.concat(
- leftValue.primitiveValue, rightValue.primitiveValue)), [
- left.expression,
- right.expression
- ]));
+ return new AstConstant(
+ context,
+ node,
+ new ConcatenateConstantExpression(
+ constantSystem.createString(new DartString.concat(
+ leftValue.primitiveValue, rightValue.primitiveValue)),
+ [left.expression, right.expression]));
}
AstConstant visitStringInterpolation(StringInterpolation node) {
@@ -435,16 +458,22 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
new DartString.concat(accumulator, partStringValue.primitiveValue);
}
;
- return new AstConstant(context, node, new ConcatenateConstantExpression(
- constantSystem.createString(accumulator), subexpressions));
+ return new AstConstant(
+ context,
+ node,
+ new ConcatenateConstantExpression(
+ constantSystem.createString(accumulator), subexpressions));
}
AstConstant visitLiteralSymbol(LiteralSymbol node) {
InterfaceType type = compiler.symbolClass.rawType;
String text = node.slowNameString;
List<AstConstant> arguments = <AstConstant>[
- new AstConstant(context, node, new StringConstantExpression(
- text, constantSystem.createString(new LiteralDartString(text))))
+ new AstConstant(
+ context,
+ node,
+ new StringConstantExpression(
+ text, constantSystem.createString(new LiteralDartString(text))))
];
ConstructorElement constructor = compiler.symbolConstructor;
AstConstant constant = createConstructorInvocation(
@@ -548,8 +577,11 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
ConstantValue result =
constantSystem.identity.fold(left.value, right.value);
if (result != null) {
- return new AstConstant(context, send, new IdenticalConstantExpression(
- result, left.expression, right.expression));
+ return new AstConstant(
+ context,
+ send,
+ new IdenticalConstantExpression(
+ result, left.expression, right.expression));
}
}
return signalNotCompileTimeConstant(send);
@@ -569,8 +601,11 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (folded == null) {
return signalNotCompileTimeConstant(send);
}
- return new AstConstant(context, send, new UnaryConstantExpression(
- folded, operator, receiverConstant.expression));
+ return new AstConstant(
+ context,
+ send,
+ new UnaryConstantExpression(
+ folded, operator, receiverConstant.expression));
} else if (send.isOperator && !send.isPostfix) {
assert(send.argumentCount() == 1);
AstConstant left = evaluate(send.receiver);
@@ -612,8 +647,11 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (folded == null) {
return signalNotCompileTimeConstant(send);
}
- return new AstConstant(context, send, new BinaryConstantExpression(
- folded, left.expression, operator, right.expression));
+ return new AstConstant(
+ context,
+ send,
+ new BinaryConstantExpression(
+ folded, left.expression, operator, right.expression));
}
return signalNotCompileTimeConstant(send);
}
@@ -625,10 +663,8 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
} else if (!condition.value.isBool) {
DartType conditionType = condition.value.getType(compiler.coreTypes);
if (isEvaluatingConstant) {
- compiler.reportError(node.condition, MessageKind.NOT_ASSIGNABLE, {
- 'fromType': conditionType,
- 'toType': compiler.boolClass.rawType
- });
+ compiler.reportError(node.condition, MessageKind.NOT_ASSIGNABLE,
+ {'fromType': conditionType, 'toType': compiler.boolClass.rawType});
return new ErroneousAstConstant(context, node);
}
return null;
@@ -639,11 +675,16 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
return null;
}
BoolConstantValue boolCondition = condition.value;
- return new AstConstant(context, node, new ConditionalConstantExpression(
- boolCondition.primitiveValue
- ? thenExpression.value
- : elseExpression.value, condition.expression,
- thenExpression.expression, elseExpression.expression));
+ return new AstConstant(
+ context,
+ node,
+ new ConditionalConstantExpression(
+ boolCondition.primitiveValue
+ ? thenExpression.value
+ : elseExpression.value,
+ condition.expression,
+ thenExpression.expression,
+ elseExpression.expression));
}
AstConstant visitSendSet(SendSet node) {
@@ -671,9 +712,8 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (!callStructure.signatureApplies(target)) {
String name = Elements.constructorNameForDiagnostics(
target.enclosingClass.name, target.name);
- compiler.reportError(node, MessageKind.INVALID_CONSTRUCTOR_ARGUMENTS, {
- 'constructorName': name
- });
+ compiler.reportError(node, MessageKind.INVALID_CONSTRUCTOR_ARGUMENTS,
+ {'constructorName': name});
return new List<AstConstant>.filled(
target.functionSignature.parameterCount,
@@ -727,10 +767,16 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
ConstructorElement implementation = target.implementation;
if (implementation.isErroneous) {
- return new AstConstant(context, node, new ConstructedConstantExpression(
- new ConstructedConstantValue(
- constructedType, const <FieldElement, ConstantValue>{}), type,
- constructor, callStructure, const <ConstantExpression>[]));
+ return new AstConstant(
+ context,
+ node,
+ new ConstructedConstantExpression(
+ new ConstructedConstantValue(
+ constructedType, const <FieldElement, ConstantValue>{}),
+ type,
+ constructor,
+ callStructure,
+ const <ConstantExpression>[]));
}
List<AstConstant> concreteArguments;
@@ -760,14 +806,26 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
return createFromEnvironmentConstant(node, constructedType, target,
callStructure, normalizedArguments, concreteArguments);
} else {
- return makeConstructedConstant(compiler, handler, context, node, type,
- constructor, constructedType, implementation, callStructure,
- concreteArguments, normalizedArguments);
+ return makeConstructedConstant(
+ compiler,
+ handler,
+ context,
+ node,
+ type,
+ constructor,
+ constructedType,
+ implementation,
+ callStructure,
+ concreteArguments,
+ normalizedArguments);
}
}
- AstConstant createFromEnvironmentConstant(Node node, InterfaceType type,
- ConstructorElement constructor, CallStructure callStructure,
+ AstConstant createFromEnvironmentConstant(
+ Node node,
+ InterfaceType type,
+ ConstructorElement constructor,
+ CallStructure callStructure,
List<AstConstant> normalizedArguments,
List<AstConstant> concreteArguments) {
var firstArgument = normalizedArguments[0].value;
@@ -781,44 +839,40 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (!firstArgument.isString) {
DartType type = defaultValue.getType(compiler.coreTypes);
- compiler.reportError(normalizedArguments[0].node,
- MessageKind.NOT_ASSIGNABLE, {
- 'fromType': type,
- 'toType': compiler.stringClass.rawType
- });
+ compiler.reportError(
+ normalizedArguments[0].node,
+ MessageKind.NOT_ASSIGNABLE,
+ {'fromType': type, 'toType': compiler.stringClass.rawType});
return null;
}
if (constructor == compiler.intEnvironment &&
!(defaultValue.isNull || defaultValue.isInt)) {
DartType type = defaultValue.getType(compiler.coreTypes);
- compiler.reportError(normalizedArguments[1].node,
- MessageKind.NOT_ASSIGNABLE, {
- 'fromType': type,
- 'toType': compiler.intClass.rawType
- });
+ compiler.reportError(
+ normalizedArguments[1].node,
+ MessageKind.NOT_ASSIGNABLE,
+ {'fromType': type, 'toType': compiler.intClass.rawType});
return null;
}
if (constructor == compiler.boolEnvironment &&
!(defaultValue.isNull || defaultValue.isBool)) {
DartType type = defaultValue.getType(compiler.coreTypes);
- compiler.reportError(normalizedArguments[1].node,
- MessageKind.NOT_ASSIGNABLE, {
- 'fromType': type,
- 'toType': compiler.boolClass.rawType
- });
+ compiler.reportError(
+ normalizedArguments[1].node,
+ MessageKind.NOT_ASSIGNABLE,
+ {'fromType': type, 'toType': compiler.boolClass.rawType});
return null;
}
if (constructor == compiler.stringEnvironment &&
!(defaultValue.isNull || defaultValue.isString)) {
DartType type = defaultValue.getType(compiler.coreTypes);
- compiler.reportError(normalizedArguments[1].node,
- MessageKind.NOT_ASSIGNABLE, {
- 'fromType': type,
- 'toType': compiler.stringClass.rawType
- });
+ compiler.reportError(
+ normalizedArguments[1].node,
+ MessageKind.NOT_ASSIGNABLE,
+ {'fromType': type, 'toType': compiler.stringClass.rawType});
return null;
}
@@ -861,11 +915,17 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
}
}
- static AstConstant makeConstructedConstant(Compiler compiler,
- ConstantCompilerBase handler, Element context, Node node,
- InterfaceType type, ConstructorElement constructor,
- InterfaceType constructedType, ConstructorElement target,
- CallStructure callStructure, List<AstConstant> concreteArguments,
+ static AstConstant makeConstructedConstant(
+ Compiler compiler,
+ ConstantCompilerBase handler,
+ Element context,
+ Node node,
+ InterfaceType type,
+ ConstructorElement constructor,
+ InterfaceType constructedType,
+ ConstructorElement target,
+ CallStructure callStructure,
+ List<AstConstant> concreteArguments,
List<AstConstant> normalizedArguments) {
if (target.isRedirectingFactory) {
// This happens is case of cyclic redirection.
@@ -874,7 +934,9 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
"effective target: $constructor"));
return new AstConstant(context, node, new ErroneousConstantExpression());
}
- assert(invariant(node, callStructure.signatureApplies(constructor) ||
+ assert(invariant(
+ node,
+ callStructure.signatureApplies(constructor) ||
compiler.compilationFailed,
message: "Call structure $callStructure does not apply to constructor "
"$constructor."));
@@ -889,10 +951,15 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
fieldConstants.forEach((FieldElement field, AstConstant astConstant) {
fieldValues[field] = astConstant.value;
});
- return new AstConstant(context, node, new ConstructedConstantExpression(
- new ConstructedConstantValue(constructedType, fieldValues), type,
- constructor, callStructure,
- concreteArguments.map((e) => e.expression).toList()));
+ return new AstConstant(
+ context,
+ node,
+ new ConstructedConstantExpression(
+ new ConstructedConstantValue(constructedType, fieldValues),
+ type,
+ constructor,
+ callStructure,
+ concreteArguments.map((e) => e.expression).toList()));
}
AstConstant visitParenthesizedExpression(ParenthesizedExpression node) {
@@ -938,9 +1005,11 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
: this.constructor = constructor,
this.definitions = new Map<Element, AstConstant>(),
this.fieldValues = new Map<Element, AstConstant>(),
- super(handler,
+ super(
+ handler,
compiler.resolver.resolveMethodElement(constructor.declaration),
- compiler, isConst: true) {
+ compiler,
+ isConst: true) {
assert(invariant(constructor, constructor.isImplementation));
}
@@ -964,10 +1033,8 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
if (!constantSystem.isSubtype(
compiler.types, constantType, elementType)) {
compiler.withCurrentElement(constant.element, () {
- compiler.reportError(constant.node, MessageKind.NOT_ASSIGNABLE, {
- 'fromType': constantType,
- 'toType': elementType
- });
+ compiler.reportError(constant.node, MessageKind.NOT_ASSIGNABLE,
+ {'fromType': constantType, 'toType': elementType});
});
}
}
@@ -1005,7 +1072,9 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
List<AstConstant> compiledArguments, FunctionElement targetConstructor) {
ConstructorEvaluator evaluator = new ConstructorEvaluator(
constructedType.asInstanceOf(targetConstructor.enclosingClass),
- targetConstructor, handler, compiler);
+ targetConstructor,
+ handler,
+ compiler);
evaluator.evaluateConstructorFieldValues(compiledArguments);
// Copy over the fieldValues from the super/redirect-constructor.
// No need to go through [updateFieldValue] because the
@@ -1044,8 +1113,11 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
Send call = link.head;
FunctionElement target = elements[call];
List<AstConstant> compiledArguments = evaluateArgumentsToConstructor(
- call, elements.getSelector(call).callStructure, call.arguments,
- target, compileArgument: evaluateConstant);
+ call,
+ elements.getSelector(call).callStructure,
+ call.arguments,
+ target,
+ compileArgument: evaluateConstant);
evaluateSuperOrRedirectSend(compiledArguments, target);
foundSuperOrRedirect = true;
} else {
@@ -1074,7 +1146,9 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
// already and compilation will fail anyway. So just ignore that case.
if (targetConstructor != null) {
List<AstConstant> compiledArguments = evaluateArgumentsToConstructor(
- functionNode, CallStructure.NO_ARGS, const Link<Node>(),
+ functionNode,
+ CallStructure.NO_ARGS,
+ const Link<Node>(),
targetConstructor);
evaluateSuperOrRedirectSend(compiledArguments, targetConstructor);
}
@@ -1099,8 +1173,8 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
/// inheritance chain of [classElement].
Map<FieldElement, AstConstant> buildFieldConstants(
ClassElement classElement) {
- Map<FieldElement, AstConstant> fieldConstants = <FieldElement, AstConstant>{
- };
+ Map<FieldElement, AstConstant> fieldConstants =
+ <FieldElement, AstConstant>{};
classElement.implementation
.forEachInstanceField((ClassElement enclosing, FieldElement field) {
AstConstant fieldValue = fieldValues[field];
@@ -1133,9 +1207,10 @@ class AstConstant {
factory AstConstant.fromDefaultValue(
VariableElement element, ConstantExpression constant) {
- return new AstConstant(element, element.initializer != null
- ? element.initializer
- : element.node, constant);
+ return new AstConstant(
+ element,
+ element.initializer != null ? element.initializer : element.node,
+ constant);
}
ConstantValue get value => expression.value;
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index ae399dc..407b4fd 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -997,25 +997,44 @@ abstract class Compiler implements DiagnosticListener {
/// Set by the backend if real reflection is detected in use of dart:mirrors.
bool disableTypeInferenceForMirrors = false;
- Compiler({this.enableTypeAssertions: false, this.enableUserAssertions: false,
- this.trustTypeAnnotations: false, this.trustPrimitives: false,
+ Compiler(
+ {this.enableTypeAssertions: false,
+ this.enableUserAssertions: false,
+ this.trustTypeAnnotations: false,
+ this.trustPrimitives: false,
this.enableConcreteTypeInference: false,
- bool disableTypeInferenceFlag: false, this.maxConcreteTypeSize: 5,
- this.enableMinification: false, this.preserveUris: false,
- this.enableNativeLiveTypeAnalysis: false, bool emitJavaScript: true,
- bool dart2dartMultiFile: false, bool generateSourceMap: true,
- bool analyzeAllFlag: false, bool analyzeOnly: false,
- this.analyzeMain: false, bool analyzeSignaturesOnly: false,
- this.preserveComments: false, this.useCpsIr: false, this.verbose: false,
- this.sourceMapUri: null, this.outputUri: null,
- this.buildId: UNDETERMINED_BUILD_ID, this.terseDiagnostics: false,
- this.deferredMapUri: null, this.dumpInfo: false,
- this.showPackageWarnings: false, this.useContentSecurityPolicy: false,
- this.suppressWarnings: false, this.fatalWarnings: false,
- bool hasIncrementalSupport: false, this.enableExperimentalMirrors: false,
- this.allowNativeExtensions: false, this.enableNullAwareOperators: false,
+ bool disableTypeInferenceFlag: false,
+ this.maxConcreteTypeSize: 5,
+ this.enableMinification: false,
+ this.preserveUris: false,
+ this.enableNativeLiveTypeAnalysis: false,
+ bool emitJavaScript: true,
+ bool dart2dartMultiFile: false,
+ bool generateSourceMap: true,
+ bool analyzeAllFlag: false,
+ bool analyzeOnly: false,
+ this.analyzeMain: false,
+ bool analyzeSignaturesOnly: false,
+ this.preserveComments: false,
+ this.useCpsIr: false,
+ this.verbose: false,
+ this.sourceMapUri: null,
+ this.outputUri: null,
+ this.buildId: UNDETERMINED_BUILD_ID,
+ this.terseDiagnostics: false,
+ this.deferredMapUri: null,
+ this.dumpInfo: false,
+ this.showPackageWarnings: false,
+ this.useContentSecurityPolicy: false,
+ this.suppressWarnings: false,
+ this.fatalWarnings: false,
+ bool hasIncrementalSupport: false,
+ this.enableExperimentalMirrors: false,
+ this.allowNativeExtensions: false,
+ this.enableNullAwareOperators: false,
this.generateCodeWithCompileTimeErrors: false,
- api.CompilerOutputProvider outputProvider, List<String> strips: const []})
+ api.CompilerOutputProvider outputProvider,
+ List<String> strips: const []})
: this.disableTypeInferenceFlag = disableTypeInferenceFlag ||
!emitJavaScript,
this.analyzeOnly = analyzeOnly ||
@@ -1052,14 +1071,15 @@ abstract class Compiler implements DiagnosticListener {
SourceInformationFactory sourceInformationFactory =
const SourceInformationFactory();
if (generateSourceMap) {
- sourceInformationFactory = const bool.fromEnvironment(
- 'USE_NEW_SOURCE_INFO', defaultValue: false)
- ? const PositionSourceInformationFactory()
- : const StartEndSourceInformationFactory();
+ sourceInformationFactory =
+ const bool.fromEnvironment('USE_NEW_SOURCE_INFO', defaultValue: false)
+ ? const PositionSourceInformationFactory()
+ : const StartEndSourceInformationFactory();
}
if (emitJavaScript) {
js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend(
- this, sourceInformationFactory, generateSourceMap: generateSourceMap);
+ this, sourceInformationFactory,
+ generateSourceMap: generateSourceMap);
backend = jsBackend;
} else {
backend = new dart_backend.DartBackend(this, strips,
@@ -1306,8 +1326,8 @@ abstract class Compiler implements DiagnosticListener {
compactImportChain.prepend(currentCodeLocation);
}
}
- String importChain = compactImportChain
- .map((CodeLocation codeLocation) {
+ String importChain =
+ compactImportChain.map((CodeLocation codeLocation) {
return codeLocation.relativize(rootUri);
}).join(' => ');
@@ -1333,8 +1353,8 @@ abstract class Compiler implements DiagnosticListener {
reportError(
NO_LOCATION_SPANNABLE, MessageKind.MIRRORS_LIBRARY_NEW_EMITTER);
} else {
- reportWarning(NO_LOCATION_SPANNABLE,
- MessageKind.IMPORT_EXPERIMENTAL_MIRRORS, {
+ reportWarning(
+ NO_LOCATION_SPANNABLE, MessageKind.IMPORT_EXPERIMENTAL_MIRRORS, {
'importChain': importChains
.join(MessageKind.IMPORT_EXPERIMENTAL_MIRRORS_PADDING)
});
@@ -1360,7 +1380,8 @@ abstract class Compiler implements DiagnosticListener {
Element findRequiredElement(LibraryElement library, String name) {
var element = library.find(name);
if (element == null) {
- internalError(library,
+ internalError(
+ library,
"The library '${library.canonicalUri}' does not contain required "
"element: '$name'.");
}
@@ -1414,7 +1435,8 @@ abstract class Compiler implements DiagnosticListener {
_coreTypes.iterableClass = lookupCoreClass('Iterable');
_coreTypes.symbolClass = lookupCoreClass('Symbol');
if (!missingCoreClasses.isEmpty) {
- internalError(coreLibrary,
+ internalError(
+ coreLibrary,
'dart:core library does not contain required classes: '
'$missingCoreClasses');
}
@@ -1515,9 +1537,10 @@ abstract class Compiler implements DiagnosticListener {
parameters.orderedForEachParameter((Element parameter) {
if (index++ < 2) return;
errorElement = new ErroneousElementX(
- MessageKind.MAIN_WITH_EXTRA_PARAMETER, {
- 'main': MAIN
- }, MAIN, parameter);
+ MessageKind.MAIN_WITH_EXTRA_PARAMETER,
+ {'main': MAIN},
+ MAIN,
+ parameter);
mainFunction = backend.helperForMainArity();
// Don't warn about main not being used:
enqueuer.resolution.registerStaticUse(main);
@@ -1576,11 +1599,12 @@ abstract class Compiler implements DiagnosticListener {
} else if (info.hints == 0) {
kind = MessageKind.HIDDEN_WARNINGS;
}
- reportDiagnostic(null, kind.message({
- 'warnings': info.warnings,
- 'hints': info.hints,
- 'uri': uri
- }, terseDiagnostics), api.Diagnostic.HINT);
+ reportDiagnostic(
+ null,
+ kind.message(
+ {'warnings': info.warnings, 'hints': info.hints, 'uri': uri},
+ terseDiagnostics),
+ api.Diagnostic.HINT);
});
}
@@ -1735,19 +1759,21 @@ abstract class Compiler implements DiagnosticListener {
}
log('Excess resolution work: ${resolved.length}.');
for (Element e in resolved) {
- reportWarning(e, MessageKind.GENERIC, {
- 'text': 'Warning: $e resolved but not compiled.'
- });
+ reportWarning(e, MessageKind.GENERIC,
+ {'text': 'Warning: $e resolved but not compiled.'});
}
}
void analyzeElement(Element element) {
- assert(invariant(element, element.impliesType ||
- element.isField ||
- element.isFunction ||
- element.isGenerativeConstructor ||
- element.isGetter ||
- element.isSetter, message: 'Unexpected element kind: ${element.kind}'));
+ assert(invariant(
+ element,
+ element.impliesType ||
+ element.isField ||
+ element.isFunction ||
+ element.isGenerativeConstructor ||
+ element.isGetter ||
+ element.isSetter,
+ message: 'Unexpected element kind: ${element.kind}'));
assert(invariant(element, element is AnalyzableElement,
message: 'Element $element is not analyzable.'));
assert(invariant(element, element.isDeclaration));
@@ -1869,8 +1895,11 @@ abstract class Compiler implements DiagnosticListener {
if (uri == null && currentElement != null) {
uri = currentElement.compilationUnit.script.readableUri;
}
- return SourceSpan.withCharacterOffsets(begin, end, (beginOffset,
- endOffset) => new SourceSpan(uri, beginOffset, endOffset));
+ return SourceSpan.withCharacterOffsets(
+ begin,
+ end,
+ (beginOffset, endOffset) =>
+ new SourceSpan(uri, beginOffset, endOffset));
}
SourceSpan spanFromNode(Node node) {
@@ -2377,7 +2406,8 @@ class _CompilerCoreTypes implements CoreTypes {
}
@override
- InterfaceType mapType([DartType keyType = const DynamicType(),
+ InterfaceType mapType(
+ [DartType keyType = const DynamicType(),
DartType valueType = const DynamicType()]) {
return mapClass
.computeType(compiler)
diff --git a/pkg/compiler/lib/src/constants/constructors.dart b/pkg/compiler/lib/src/constants/constructors.dart
index c74d0f6..1c6d992 100644
--- a/pkg/compiler/lib/src/constants/constructors.dart
+++ b/pkg/compiler/lib/src/constants/constructors.dart
@@ -55,8 +55,12 @@ class ConstantConstructorComputer extends SemanticVisitor
}
ConstantConstructor visitGenerativeConstructorDeclaration(
- FunctionExpression node, ConstructorElement constructor,
- NodeList parameters, NodeList initializers, Node body, _) {
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ Node body,
+ _) {
applyParameters(parameters, _);
ConstructedConstantExpression constructorInvocation =
applyInitializers(initializers, _);
@@ -65,8 +69,11 @@ class ConstantConstructorComputer extends SemanticVisitor
}
ConstantConstructor visitRedirectingGenerativeConstructorDeclaration(
- FunctionExpression node, ConstructorElement constructor,
- NodeList parameters, NodeList initializers, _) {
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ _) {
applyParameters(parameters, _);
ConstructedConstantExpression constructorInvocation =
applyInitializers(initializers, _);
@@ -75,9 +82,12 @@ class ConstantConstructorComputer extends SemanticVisitor
}
ConstantConstructor visitRedirectingFactoryConstructorDeclaration(
- FunctionExpression node, ConstructorElement constructor,
- NodeList parameters, InterfaceType redirectionType,
- ConstructorElement redirectionTarget, _) {
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ InterfaceType redirectionType,
+ ConstructorElement redirectionTarget,
+ _) {
List<String> argumentNames = [];
List<ConstantExpression> arguments = [];
int index = 0;
@@ -114,8 +124,12 @@ class ConstantConstructorComputer extends SemanticVisitor
// Do nothing.
}
- visitOptionalParameterDeclaration(VariableDefinitions node, Node definition,
- ParameterElement parameter, ConstantExpression defaultValue, int index,
+ visitOptionalParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ ConstantExpression defaultValue,
+ int index,
_) {
assert(invariant(node, defaultValue != null));
defaultValues[index] = defaultValue;
@@ -133,17 +147,24 @@ class ConstantConstructorComputer extends SemanticVisitor
fieldMap[parameter.fieldElement] = new PositionalArgumentReference(index);
}
- visitOptionalInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement parameter,
- ConstantExpression defaultValue, int index, _) {
+ visitOptionalInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ ConstantExpression defaultValue,
+ int index,
+ _) {
assert(invariant(node, defaultValue != null));
defaultValues[index] = defaultValue;
fieldMap[parameter.fieldElement] = new PositionalArgumentReference(index);
}
- visitNamedInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement parameter,
- ConstantExpression defaultValue, _) {
+ visitNamedInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ ConstantExpression defaultValue,
+ _) {
assert(invariant(node, defaultValue != null));
String name = parameter.name;
defaultValues[name] = defaultValue;
@@ -166,7 +187,8 @@ class ConstantConstructorComputer extends SemanticVisitor
}
}
if (constructorInvocation == null && !currentClass.isObject) {
- constructorInvocation = new ConstructedConstantExpression(null,
+ constructorInvocation = new ConstructedConstantExpression(
+ null,
currentClass.supertype,
currentClass.superclass.lookupDefaultConstructor(),
CallStructure.NO_ARGS, const <ConstantExpression>[]);
@@ -187,17 +209,24 @@ class ConstantConstructorComputer extends SemanticVisitor
}
}
- ConstructedConstantExpression visitSuperConstructorInvoke(Send node,
- ConstructorElement superConstructor, InterfaceType type,
- NodeList arguments, Selector selector, _) {
+ ConstructedConstantExpression visitSuperConstructorInvoke(
+ Send node,
+ ConstructorElement superConstructor,
+ InterfaceType type,
+ NodeList arguments,
+ Selector selector,
+ _) {
List<ConstantExpression> argumentExpression =
arguments.nodes.map((a) => apply(a)).toList();
return new ConstructedConstantExpression(null, type, superConstructor,
selector.callStructure, argumentExpression);
}
- ConstructedConstantExpression visitThisConstructorInvoke(Send node,
- ConstructorElement thisConstructor, NodeList arguments, Selector selector,
+ ConstructedConstantExpression visitThisConstructorInvoke(
+ Send node,
+ ConstructorElement thisConstructor,
+ NodeList arguments,
+ Selector selector,
_) {
List<ConstantExpression> argumentExpression =
arguments.nodes.map((a) => apply(a)).toList();
@@ -262,8 +291,11 @@ class ConstantConstructorComputer extends SemanticVisitor
}
@override
- ConstantExpression visitTopLevelFunctionInvoke(Send node,
- MethodElement function, NodeList arguments, CallStructure callStructure,
+ ConstantExpression visitTopLevelFunctionInvoke(
+ Send node,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
_) {
if (function.name != 'identical' || !function.library.isDartCore) {
throw new UnsupportedError("Unexpected function call: $function");
diff --git a/pkg/compiler/lib/src/constants/expressions.dart b/pkg/compiler/lib/src/constants/expressions.dart
index a3d6ec2..25d1565 100644
--- a/pkg/compiler/lib/src/constants/expressions.dart
+++ b/pkg/compiler/lib/src/constants/expressions.dart
@@ -540,13 +540,17 @@ class MapConstantExpression extends ConstantExpression {
@override
ConstantValue evaluate(
Environment environment, ConstantSystem constantSystem) {
- return constantSystem.createMap(environment.compiler, type,
+ return constantSystem.createMap(
+ environment.compiler,
+ type,
keys.map((k) => k.evaluate(environment, constantSystem)).toList(),
values.map((v) => v.evaluate(environment, constantSystem)).toList());
}
ConstantExpression apply(NormalizedArguments arguments) {
- return new MapConstantExpression(null, type,
+ return new MapConstantExpression(
+ null,
+ type,
keys.map((k) => k.apply(arguments)).toList(),
values.map((v) => v.apply(arguments)).toList());
}
diff --git a/pkg/compiler/lib/src/core_types.dart b/pkg/compiler/lib/src/core_types.dart
index 35f7e10..287f649 100644
--- a/pkg/compiler/lib/src/core_types.dart
+++ b/pkg/compiler/lib/src/core_types.dart
@@ -42,7 +42,8 @@ abstract class CoreTypes {
/// Returns an instance of the `Map` type defined in 'dart:core' with
/// [keyType] and [valueType] as its type arguments.
- InterfaceType mapType([DartType keyType = const DynamicType(),
+ InterfaceType mapType(
+ [DartType keyType = const DynamicType(),
DartType valueType = const DynamicType()]);
/// Returns an instance of the `Iterable` type defined in 'dart:core' with
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index b7853c2..65b3226 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -319,10 +319,12 @@ class BackwardJumpCollector extends JumpCollector {
assert(_continuation.parameters.length <= builder.environment.length);
isEmpty = false;
_buildTryExit(builder);
- builder.add(new ir.InvokeContinuation(_continuation,
+ builder.add(new ir.InvokeContinuation(
+ _continuation,
builder.environment.index2value
.take(_continuation.parameters.length)
- .toList(), isRecursive: true));
+ .toList(),
+ isRecursive: true));
builder._current = null;
}
}
@@ -574,8 +576,8 @@ abstract class IrBuilder {
/// Construct a builder for an inner function.
IrBuilder makeInnerFunctionBuilder(ExecutableElement currentElement) {
- IrBuilderSharedState innerState = new IrBuilderSharedState(
- state.constantSystem, currentElement)
+ IrBuilderSharedState innerState =
+ new IrBuilderSharedState(state.constantSystem, currentElement)
..enclosingMethodThisParameter = state.enclosingMethodThisParameter;
return _makeInstance()
..state = innerState
@@ -745,7 +747,8 @@ abstract class IrBuilder {
/// Creates a conditional expression with the provided [condition] where the
/// then and else expression are created through the [buildThenExpression]
/// and [buildElseExpression] functions, respectively.
- ir.Primitive buildConditional(ir.Primitive condition,
+ ir.Primitive buildConditional(
+ ir.Primitive condition,
ir.Primitive buildThenExpression(IrBuilder builder),
ir.Primitive buildElseExpression(IrBuilder builder)) {
assert(isOpen);
@@ -787,11 +790,12 @@ abstract class IrBuilder {
ir.Continuation elseContinuation = new ir.Continuation([]);
thenContinuation.body = thenBuilder._root;
elseContinuation.body = elseBuilder._root;
- add(new ir.LetCont(join.continuation, new ir.LetCont.many(<ir.Continuation>[
- thenContinuation,
- elseContinuation
- ], new ir.Branch(
- new ir.IsTrue(condition), thenContinuation, elseContinuation))));
+ add(new ir.LetCont(
+ join.continuation,
+ new ir.LetCont.many(
+ <ir.Continuation>[thenContinuation, elseContinuation],
+ new ir.Branch(new ir.IsTrue(condition), thenContinuation,
+ elseContinuation))));
environment = join.environment;
environment.discard(1);
return (thenValue == elseValue)
@@ -880,8 +884,13 @@ abstract class IrBuilder {
List<ConstantExpression> defaults, List<ir.Initializer> initializers) {
FunctionElement element = state.currentElement;
ir.Body body = makeBody();
- return new ir.ConstructorDefinition(element, state.thisParameter,
- state.functionParameters, body, initializers, state.localConstants,
+ return new ir.ConstructorDefinition(
+ element,
+ state.thisParameter,
+ state.functionParameters,
+ body,
+ initializers,
+ state.localConstants,
defaults);
}
@@ -915,7 +924,8 @@ abstract class IrBuilder {
/// closurization of [method].
ir.Primitive buildSuperMethodGet(MethodElement method) {
// TODO(johnniwinther): This should have its own ir node.
- return _buildInvokeSuper(method,
+ return _buildInvokeSuper(
+ method,
new Selector.getter(method.name, method.library),
const <ir.Primitive>[]);
}
@@ -923,7 +933,8 @@ abstract class IrBuilder {
/// Create a getter invocation of the [getter] on the super class.
ir.Primitive buildSuperGetterGet(MethodElement getter) {
// TODO(johnniwinther): This should have its own ir node.
- return _buildInvokeSuper(getter,
+ return _buildInvokeSuper(
+ getter,
new Selector.getter(getter.name, getter.library),
const <ir.Primitive>[]);
}
@@ -1151,8 +1162,10 @@ abstract class IrBuilder {
? <ir.Continuation>[elseContinuation, thenContinuation]
: <ir.Continuation>[thenContinuation, elseContinuation];
- ir.Expression result = new ir.LetCont.many(arms, new ir.Branch(
- new ir.IsTrue(condition), thenContinuation, elseContinuation));
+ ir.Expression result = new ir.LetCont.many(
+ arms,
+ new ir.Branch(
+ new ir.IsTrue(condition), thenContinuation, elseContinuation));
JumpCollector join; // Null if there is no join.
if (thenBuilder.isOpen && elseBuilder.isOpen) {
@@ -1198,8 +1211,10 @@ abstract class IrBuilder {
void addRecursiveContinuation(BackwardJumpCollector collector) {
assert(environment.length == collector.environment.length);
- add(new ir.LetCont(collector.continuation, new ir.InvokeContinuation(
- collector.continuation, environment.index2value)));
+ add(new ir.LetCont(
+ collector.continuation,
+ new ir.InvokeContinuation(
+ collector.continuation, environment.index2value)));
environment = collector.environment;
}
@@ -1216,10 +1231,14 @@ abstract class IrBuilder {
///
/// [loopVariables] is the list of variables declared in the for-loop
/// initializer.
- void buildFor({SubbuildFunction buildInitializer,
- SubbuildFunction buildCondition, SubbuildFunction buildBody,
- SubbuildFunction buildUpdate, JumpTarget target,
- ClosureScope closureScope, List<LocalElement> loopVariables}) {
+ void buildFor(
+ {SubbuildFunction buildInitializer,
+ SubbuildFunction buildCondition,
+ SubbuildFunction buildBody,
+ SubbuildFunction buildUpdate,
+ JumpTarget target,
+ ClosureScope closureScope,
+ List<LocalElement> loopVariables}) {
assert(isOpen);
// For loops use four named continuations: the entry to the condition,
@@ -1315,11 +1334,10 @@ abstract class IrBuilder {
bodyContinuation.body = outerBodyBuilder._root;
// Note the order of continuations: the first one is the one that will
// be filled by LetCont.plug.
- ir.LetCont branch = new ir.LetCont.many(<ir.Continuation>[
- exitContinuation,
- bodyContinuation
- ], new ir.Branch(
- new ir.IsTrue(condition), bodyContinuation, exitContinuation));
+ ir.LetCont branch = new ir.LetCont.many(
+ <ir.Continuation>[exitContinuation, bodyContinuation],
+ new ir.Branch(
+ new ir.IsTrue(condition), bodyContinuation, exitContinuation));
// If there are breaks in the body, then there must be a join-point
// continuation for the normal exit and the breaks. Otherwise, the
// successor is translated in the hole in the exit continuation.
@@ -1353,9 +1371,13 @@ abstract class IrBuilder {
/// [buildBody] creates the body, `b`, of the loop. The jump [target] is used
/// to identify which `break` and `continue` statements that have this for-in
/// statement as their target.
- void buildForIn({SubbuildFunction buildExpression,
- SubbuildFunction buildVariableDeclaration, Element variableElement,
- Selector variableSelector, SubbuildFunction buildBody, JumpTarget target,
+ void buildForIn(
+ {SubbuildFunction buildExpression,
+ SubbuildFunction buildVariableDeclaration,
+ Element variableElement,
+ Selector variableSelector,
+ SubbuildFunction buildBody,
+ JumpTarget target,
ClosureScope closureScope}) {
// The for-in loop
//
@@ -1378,9 +1400,13 @@ abstract class IrBuilder {
List<ir.Primitive> emptyArguments = <ir.Primitive>[];
ir.Parameter iterator = new ir.Parameter(null);
ir.Continuation iteratorInvoked = new ir.Continuation([iterator]);
- add(new ir.LetCont(iteratorInvoked, new ir.InvokeMethod(expressionReceiver,
- new Selector.getter("iterator", null), emptyArguments,
- iteratorInvoked)));
+ add(new ir.LetCont(
+ iteratorInvoked,
+ new ir.InvokeMethod(
+ expressionReceiver,
+ new Selector.getter("iterator", null),
+ emptyArguments,
+ iteratorInvoked)));
// Fill with:
// let cont loop(x, ...) =
@@ -1392,9 +1418,10 @@ abstract class IrBuilder {
addRecursiveContinuation(loop);
ir.Parameter condition = new ir.Parameter(null);
ir.Continuation moveNextInvoked = new ir.Continuation([condition]);
- add(new ir.LetCont(moveNextInvoked, new ir.InvokeMethod(iterator,
- new Selector.call("moveNext", null, 0), emptyArguments,
- moveNextInvoked)));
+ add(new ir.LetCont(
+ moveNextInvoked,
+ new ir.InvokeMethod(iterator, new Selector.call("moveNext", null, 0),
+ emptyArguments, moveNextInvoked)));
// As a delimited term, build:
// <<BODY>> =
@@ -1411,15 +1438,18 @@ abstract class IrBuilder {
}
ir.Parameter currentValue = new ir.Parameter(null);
ir.Continuation currentInvoked = new ir.Continuation([currentValue]);
- bodyBuilder.add(new ir.LetCont(currentInvoked, new ir.InvokeMethod(iterator,
- new Selector.getter("current", null), emptyArguments, currentInvoked)));
+ bodyBuilder.add(new ir.LetCont(
+ currentInvoked,
+ new ir.InvokeMethod(iterator, new Selector.getter("current", null),
+ emptyArguments, currentInvoked)));
// TODO(sra): Does this cover all cases? The general setter case include
// super.
// TODO(johnniwinther): Extract this as a provided strategy.
if (Elements.isLocal(variableElement)) {
bodyBuilder.buildLocalVariableSet(variableElement, currentValue);
} else if (Elements.isErroneous(variableElement)) {
- bodyBuilder.buildErroneousInvocation(variableElement,
+ bodyBuilder.buildErroneousInvocation(
+ variableElement,
new Selector.setter(variableElement.name, variableElement.library),
<ir.Primitive>[currentValue]);
} else if (Elements.isStaticOrTopLevel(variableElement)) {
@@ -1457,11 +1487,10 @@ abstract class IrBuilder {
bodyContinuation.body = bodyBuilder._root;
// Note the order of continuations: the first one is the one that will
// be filled by LetCont.plug.
- ir.LetCont branch = new ir.LetCont.many(<ir.Continuation>[
- exitContinuation,
- bodyContinuation
- ], new ir.Branch(
- new ir.IsTrue(condition), bodyContinuation, exitContinuation));
+ ir.LetCont branch = new ir.LetCont.many(
+ <ir.Continuation>[exitContinuation, bodyContinuation],
+ new ir.Branch(
+ new ir.IsTrue(condition), bodyContinuation, exitContinuation));
// If there are breaks in the body, then there must be a join-point
// continuation for the normal exit and the breaks. Otherwise, the
// successor is translated in the hole in the exit continuation.
@@ -1484,8 +1513,11 @@ abstract class IrBuilder {
///
/// The jump [target] is used to identify which `break` and `continue`
/// statements that have this `while` statement as their target.
- void buildWhile({SubbuildFunction buildCondition, SubbuildFunction buildBody,
- JumpTarget target, ClosureScope closureScope}) {
+ void buildWhile(
+ {SubbuildFunction buildCondition,
+ SubbuildFunction buildBody,
+ JumpTarget target,
+ ClosureScope closureScope}) {
assert(isOpen);
// While loops use four named continuations: the entry to the body, the
// loop exit, the loop back edge (continue), and the loop exit (break).
@@ -1530,11 +1562,10 @@ abstract class IrBuilder {
bodyContinuation.body = bodyBuilder._root;
// Note the order of continuations: the first one is the one that will
// be filled by LetCont.plug.
- ir.LetCont branch = new ir.LetCont.many(<ir.Continuation>[
- exitContinuation,
- bodyContinuation
- ], new ir.Branch(
- new ir.IsTrue(condition), bodyContinuation, exitContinuation));
+ ir.LetCont branch = new ir.LetCont.many(
+ <ir.Continuation>[exitContinuation, bodyContinuation],
+ new ir.Branch(
+ new ir.IsTrue(condition), bodyContinuation, exitContinuation));
// If there are breaks in the body, then there must be a join-point
// continuation for the normal exit and the breaks. Otherwise, the
// successor is translated in the hole in the exit continuation.
@@ -1559,8 +1590,10 @@ abstract class IrBuilder {
/// statements in the body that have the loop as their target.
/// [closureScope] contains all the variables declared in the loop (but not
/// declared in some inner closure scope).
- void buildDoWhile({SubbuildFunction buildBody,
- SubbuildFunction buildCondition, JumpTarget target,
+ void buildDoWhile(
+ {SubbuildFunction buildBody,
+ SubbuildFunction buildCondition,
+ JumpTarget target,
ClosureScope closureScope}) {
assert(isOpen);
// The CPS translation of [[do body; while (condition); successor]] is:
@@ -1614,11 +1647,10 @@ abstract class IrBuilder {
repeatBuilder.jumpTo(loop);
repeatContinuation.body = repeatBuilder._root;
- continueBuilder.add(new ir.LetCont.many(<ir.Continuation>[
- exitContinuation,
- repeatContinuation
- ], new ir.Branch(
- new ir.IsTrue(condition), repeatContinuation, exitContinuation)));
+ continueBuilder.add(new ir.LetCont.many(
+ <ir.Continuation>[exitContinuation, repeatContinuation],
+ new ir.Branch(
+ new ir.IsTrue(condition), repeatContinuation, exitContinuation)));
continueCollector.continuation.body = continueBuilder._root;
// Construct the loop continuation (i.e., the body and condition).
@@ -1641,7 +1673,8 @@ abstract class IrBuilder {
/// [buildTryBlock] builds the try block.
/// [catchClauseInfos] provides access to the catch type, exception variable,
/// and stack trace variable, and a function for building the catch block.
- void buildTry({TryStatementInfo tryStatementInfo,
+ void buildTry(
+ {TryStatementInfo tryStatementInfo,
SubbuildFunction buildTryBlock,
List<CatchClauseInfo> catchClauseInfos: const <CatchClauseInfo>[],
ClosureClassMap closureClassMap}) {
@@ -1774,13 +1807,12 @@ abstract class IrBuilder {
// Build the type test guarding this clause. We can share the environment
// with the nested builder because this part cannot mutate it.
IrBuilder checkBuilder = catchBuilder.makeDelimitedBuilder(environment);
- ir.Primitive typeMatches = checkBuilder.buildTypeOperator(
- exceptionParameter, clause.type, isTypeTest: true);
- checkBuilder.add(new ir.LetCont.many([
- thenContinuation,
- elseContinuation
- ], new ir.Branch(
- new ir.IsTrue(typeMatches), thenContinuation, elseContinuation)));
+ ir.Primitive typeMatches = checkBuilder
+ .buildTypeOperator(exceptionParameter, clause.type, isTypeTest: true);
+ checkBuilder.add(new ir.LetCont.many(
+ [thenContinuation, elseContinuation],
+ new ir.Branch(
+ new ir.IsTrue(typeMatches), thenContinuation, elseContinuation)));
catchBody = checkBuilder._root;
}
@@ -1925,11 +1957,12 @@ abstract class IrBuilder {
elseContinuation.body = new ir.LetPrim(trueConstant)
..plug(new ir.InvokeContinuation(joinContinuation, [trueConstant]));
- add(new ir.LetCont(joinContinuation, new ir.LetCont.many(<ir.Continuation>[
- thenContinuation,
- elseContinuation
- ], new ir.Branch(
- new ir.IsTrue(condition), thenContinuation, elseContinuation))));
+ add(new ir.LetCont(
+ joinContinuation,
+ new ir.LetCont.many(
+ <ir.Continuation>[thenContinuation, elseContinuation],
+ new ir.Branch(new ir.IsTrue(condition), thenContinuation,
+ elseContinuation))));
return resultParameter;
}
@@ -1989,11 +2022,10 @@ abstract class IrBuilder {
rightTrueContinuation.body = rightTrueBuilder._root;
rightFalseContinuation.body = rightFalseBuilder._root;
// The right subexpression has two continuations.
- rightBuilder.add(new ir.LetCont.many(<ir.Continuation>[
- rightTrueContinuation,
- rightFalseContinuation
- ], new ir.Branch(new ir.IsTrue(rightValue), rightTrueContinuation,
- rightFalseContinuation)));
+ rightBuilder.add(new ir.LetCont.many(
+ <ir.Continuation>[rightTrueContinuation, rightFalseContinuation],
+ new ir.Branch(new ir.IsTrue(rightValue), rightTrueContinuation,
+ rightFalseContinuation)));
// Depending on the operator, the left subexpression's continuations are
// either the right subexpression or an invocation of the join-point
// continuation.
@@ -2005,11 +2037,12 @@ abstract class IrBuilder {
leftFalseContinuation.body = emptyBuilder._root;
}
- add(new ir.LetCont(join.continuation, new ir.LetCont.many(<ir.Continuation>[
- leftTrueContinuation,
- leftFalseContinuation
- ], new ir.Branch(new ir.IsTrue(leftValue), leftTrueContinuation,
- leftFalseContinuation))));
+ add(new ir.LetCont(
+ join.continuation,
+ new ir.LetCont.many(
+ <ir.Continuation>[leftTrueContinuation, leftFalseContinuation],
+ new ir.Branch(new ir.IsTrue(leftValue), leftTrueContinuation,
+ leftFalseContinuation))));
environment = join.environment;
environment.discard(1);
// There is always a join parameter for the result value, because it
@@ -2196,8 +2229,10 @@ class DartIrBuilder extends IrBuilder {
}
@override
- ir.Primitive buildConstructorInvocation(ConstructorElement element,
- CallStructure callStructure, DartType type,
+ ir.Primitive buildConstructorInvocation(
+ ConstructorElement element,
+ CallStructure callStructure,
+ DartType type,
List<ir.Primitive> arguments) {
assert(isOpen);
Selector selector =
@@ -2217,7 +2252,8 @@ class DartIrBuilder extends IrBuilder {
assert(isOpen);
assert(isTypeTest != null);
ir.Primitive check = _continueWithExpression((k) => new ir.TypeOperator(
- value, type, const <ir.Primitive>[], k, isTypeTest: isTypeTest));
+ value, type, const <ir.Primitive>[], k,
+ isTypeTest: isTypeTest));
return check;
}
}
@@ -2488,8 +2524,10 @@ class JsIrBuilder extends IrBuilder {
}
@override
- ir.Primitive buildConstructorInvocation(ConstructorElement element,
- CallStructure callStructure, DartType type,
+ ir.Primitive buildConstructorInvocation(
+ ConstructorElement element,
+ CallStructure callStructure,
+ DartType type,
List<ir.Primitive> arguments) {
assert(isOpen);
Selector selector =
@@ -2497,8 +2535,8 @@ class JsIrBuilder extends IrBuilder {
ClassElement cls = element.enclosingClass;
if (program.requiresRuntimeTypesFor(cls)) {
InterfaceType interface = type;
- Iterable<ir.Primitive> typeArguments = interface.typeArguments
- .map((DartType argument) {
+ Iterable<ir.Primitive> typeArguments =
+ interface.typeArguments.map((DartType argument) {
return type.treatAsRaw
? buildNullConstant()
: buildTypeExpression(argument);
@@ -2592,7 +2630,8 @@ class JsIrBuilder extends IrBuilder {
typeArguments = <ir.Primitive>[buildTypeVariableAccess(type)];
}
ir.Primitive check = _continueWithExpression((k) => new ir.TypeOperator(
- value, type, typeArguments, k, isTypeTest: isTypeTest));
+ value, type, typeArguments, k,
+ isTypeTest: isTypeTest));
return check;
}
}
@@ -2661,6 +2700,9 @@ class CatchClauseInfo {
final LocalVariableElement stackTraceVariable;
final SubbuildFunction buildCatchBlock;
- CatchClauseInfo({this.type, this.exceptionVariable, this.stackTraceVariable,
+ CatchClauseInfo(
+ {this.type,
+ this.exceptionVariable,
+ this.stackTraceVariable,
this.buildCatchBlock});
}
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index d09237a..2dcee58 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -307,8 +307,8 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
ConstructorElement constructor = elements[initializer].implementation;
Selector selector = elements.getSelector(initializer);
- List<ir.Body> arguments = initializer.arguments
- .mapToList((ast.Node argument) {
+ List<ir.Body> arguments =
+ initializer.arguments.mapToList((ast.Node argument) {
return withBuilder(irBuilder.makeInitializerBuilder(), () {
ir.Primitive value = visit(argument);
return irBuilder.makeBody(value);
@@ -772,7 +772,8 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
ir.Primitive translateLogicalOperator(
- ast.Expression left, ast.Expression right, {bool isLazyOr}) {
+ ast.Expression left, ast.Expression right,
+ {bool isLazyOr}) {
ir.Primitive leftValue = visit(left);
ir.Primitive buildRightValue(IrBuilder rightBuilder) {
@@ -953,9 +954,12 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
@override
- ir.Primitive visitLocalFunctionInvoke(ast.Send node,
- LocalFunctionElement function, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ ir.Primitive visitLocalFunctionInvoke(
+ ast.Send node,
+ LocalFunctionElement function,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
return irBuilder.buildLocalFunctionInvocation(function, callStructure,
translateDynamicArguments(arguments, callStructure));
}
@@ -987,9 +991,12 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
@override
- ir.Primitive handleStaticFunctionIncompatibleInvoke(ast.Send node,
- MethodElement function, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ ir.Primitive handleStaticFunctionIncompatibleInvoke(
+ ast.Send node,
+ MethodElement function,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
return buildStaticNoSuchMethod(
elements.getSelector(node), arguments.nodes.mapToList(visit));
}
@@ -1029,8 +1036,11 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
@override
- ir.Primitive visitSuperMethodIncompatibleInvoke(ast.Send node,
- MethodElement method, ast.NodeList arguments, CallStructure callStructure,
+ ir.Primitive visitSuperMethodIncompatibleInvoke(
+ ast.Send node,
+ MethodElement method,
+ ast.NodeList arguments,
+ CallStructure callStructure,
_) {
return buildInstanceNoSuchMethod(elements.getSelector(node),
translateDynamicArguments(arguments, callStructure));
@@ -1050,9 +1060,12 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
@override
- ir.Primitive visitTypeVariableTypeLiteralInvoke(ast.Send node,
- TypeVariableElement element, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ ir.Primitive visitTypeVariableTypeLiteralInvoke(
+ ast.Send node,
+ TypeVariableElement element,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
return translateCallInvoke(
translateTypeVariableTypeLiteral(element), arguments, callStructure);
}
@@ -1070,7 +1083,9 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
return irBuilder.buildSuperIndexSet(function, visit(index), visit(rhs));
}
- ir.Primitive translateCompounds({ir.Primitive getValue(), CompoundRhs rhs,
+ ir.Primitive translateCompounds(
+ {ir.Primitive getValue(),
+ CompoundRhs rhs,
void setValue(ir.Primitive value)}) {
ir.Primitive value = getValue();
Selector operatorSelector =
@@ -1150,8 +1165,8 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
getValue: () => irBuilder.buildDynamicGet(target, getterSelector),
rhs: rhs,
setValue: (ir.Primitive result) {
- irBuilder.buildDynamicSet(target, setterSelector, result);
- });
+ irBuilder.buildDynamicSet(target, setterSelector, result);
+ });
}
ir.Primitive buildLocalNoSuchSetter(Local local, ir.Primitive value) {
@@ -1163,19 +1178,22 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
ir.Primitive handleLocalCompounds(
ast.SendSet node, LocalElement local, CompoundRhs rhs, arg,
{bool isSetterValid}) {
- return translateCompounds(getValue: () {
- if (local.isFunction) {
- return irBuilder.buildLocalFunctionGet(local);
- } else {
- return irBuilder.buildLocalVariableGet(local);
- }
- }, rhs: rhs, setValue: (ir.Primitive result) {
- if (isSetterValid) {
- irBuilder.buildLocalVariableSet(local, result);
- } else {
- return buildLocalNoSuchSetter(local, result);
- }
- });
+ return translateCompounds(
+ getValue: () {
+ if (local.isFunction) {
+ return irBuilder.buildLocalFunctionGet(local);
+ } else {
+ return irBuilder.buildLocalVariableGet(local);
+ }
+ },
+ rhs: rhs,
+ setValue: (ir.Primitive result) {
+ if (isSetterValid) {
+ irBuilder.buildLocalVariableSet(local, result);
+ } else {
+ return buildLocalNoSuchSetter(local, result);
+ }
+ });
}
ir.Primitive buildStaticNoSuchGetter(Element element) {
@@ -1191,33 +1209,41 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
@override
- ir.Primitive handleStaticCompounds(ast.SendSet node, Element getter,
- CompoundGetter getterKind, Element setter, CompoundSetter setterKind,
- CompoundRhs rhs, arg) {
- return translateCompounds(getValue: () {
- switch (getterKind) {
- case CompoundGetter.FIELD:
- SourceInformation src = sourceInformationBuilder.buildGet(node);
- return irBuilder.buildStaticFieldGet(getter, src);
- case CompoundGetter.GETTER:
- return irBuilder.buildStaticGetterGet(getter);
- case CompoundGetter.METHOD:
- return irBuilder.buildStaticFunctionGet(getter);
- case CompoundGetter.UNRESOLVED:
- return buildStaticNoSuchGetter(getter);
- }
- }, rhs: rhs, setValue: (ir.Primitive result) {
- switch (setterKind) {
- case CompoundSetter.FIELD:
- return irBuilder.buildStaticFieldSet(setter, result);
- case CompoundSetter.SETTER:
- return irBuilder.buildStaticSetterSet(setter, result);
- case CompoundSetter.INVALID:
- // TODO(johnniwinther): Ensure [setter] is non null.
- return buildStaticNoSuchSetter(
- setter != null ? setter : getter, result);
- }
- });
+ ir.Primitive handleStaticCompounds(
+ ast.SendSet node,
+ Element getter,
+ CompoundGetter getterKind,
+ Element setter,
+ CompoundSetter setterKind,
+ CompoundRhs rhs,
+ arg) {
+ return translateCompounds(
+ getValue: () {
+ switch (getterKind) {
+ case CompoundGetter.FIELD:
+ SourceInformation src = sourceInformationBuilder.buildGet(node);
+ return irBuilder.buildStaticFieldGet(getter, src);
+ case CompoundGetter.GETTER:
+ return irBuilder.buildStaticGetterGet(getter);
+ case CompoundGetter.METHOD:
+ return irBuilder.buildStaticFunctionGet(getter);
+ case CompoundGetter.UNRESOLVED:
+ return buildStaticNoSuchGetter(getter);
+ }
+ },
+ rhs: rhs,
+ setValue: (ir.Primitive result) {
+ switch (setterKind) {
+ case CompoundSetter.FIELD:
+ return irBuilder.buildStaticFieldSet(setter, result);
+ case CompoundSetter.SETTER:
+ return irBuilder.buildStaticSetterSet(setter, result);
+ case CompoundSetter.INVALID:
+ // TODO(johnniwinther): Ensure [setter] is non null.
+ return buildStaticNoSuchSetter(
+ setter != null ? setter : getter, result);
+ }
+ });
}
ir.Primitive buildSuperNoSuchGetter(Element element) {
@@ -1233,31 +1259,39 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
@override
- ir.Primitive handleSuperCompounds(ast.SendSet node, Element getter,
- CompoundGetter getterKind, Element setter, CompoundSetter setterKind,
- CompoundRhs rhs, arg) {
- return translateCompounds(getValue: () {
- switch (getterKind) {
- case CompoundGetter.FIELD:
- return irBuilder.buildSuperFieldGet(getter);
- case CompoundGetter.GETTER:
- return irBuilder.buildSuperGetterGet(getter);
- case CompoundGetter.METHOD:
- return irBuilder.buildSuperMethodGet(getter);
- case CompoundGetter.UNRESOLVED:
- // TODO(johnniwinther): Ensure [getter] is not null.
- return buildSuperNoSuchGetter(getter != null ? getter : setter);
- }
- }, rhs: rhs, setValue: (ir.Primitive result) {
- switch (setterKind) {
- case CompoundSetter.FIELD:
- return irBuilder.buildSuperFieldSet(setter, result);
- case CompoundSetter.SETTER:
- return irBuilder.buildSuperSetterSet(setter, result);
- case CompoundSetter.INVALID:
- return buildSuperNoSuchSetter(setter, result);
- }
- });
+ ir.Primitive handleSuperCompounds(
+ ast.SendSet node,
+ Element getter,
+ CompoundGetter getterKind,
+ Element setter,
+ CompoundSetter setterKind,
+ CompoundRhs rhs,
+ arg) {
+ return translateCompounds(
+ getValue: () {
+ switch (getterKind) {
+ case CompoundGetter.FIELD:
+ return irBuilder.buildSuperFieldGet(getter);
+ case CompoundGetter.GETTER:
+ return irBuilder.buildSuperGetterGet(getter);
+ case CompoundGetter.METHOD:
+ return irBuilder.buildSuperMethodGet(getter);
+ case CompoundGetter.UNRESOLVED:
+ // TODO(johnniwinther): Ensure [getter] is not null.
+ return buildSuperNoSuchGetter(getter != null ? getter : setter);
+ }
+ },
+ rhs: rhs,
+ setValue: (ir.Primitive result) {
+ switch (setterKind) {
+ case CompoundSetter.FIELD:
+ return irBuilder.buildSuperFieldSet(setter, result);
+ case CompoundSetter.SETTER:
+ return irBuilder.buildSuperSetterSet(setter, result);
+ case CompoundSetter.INVALID:
+ return buildSuperNoSuchSetter(setter, result);
+ }
+ });
}
@override
@@ -1274,36 +1308,49 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
ast.Node index, CompoundRhs rhs, arg) {
ir.Primitive target = visit(receiver);
ir.Primitive indexValue = visit(index);
- return translateCompounds(getValue: () {
- Selector selector = new Selector.index();
- List<ir.Primitive> arguments = <ir.Primitive>[indexValue];
- arguments = normalizeDynamicArguments(selector.callStructure, arguments);
- return irBuilder.buildDynamicInvocation(target, selector, arguments);
- }, rhs: rhs, setValue: (ir.Primitive result) {
- irBuilder.buildDynamicIndexSet(target, indexValue, result);
- });
+ return translateCompounds(
+ getValue: () {
+ Selector selector = new Selector.index();
+ List<ir.Primitive> arguments = <ir.Primitive>[indexValue];
+ arguments =
+ normalizeDynamicArguments(selector.callStructure, arguments);
+ return irBuilder.buildDynamicInvocation(target, selector, arguments);
+ },
+ rhs: rhs,
+ setValue: (ir.Primitive result) {
+ irBuilder.buildDynamicIndexSet(target, indexValue, result);
+ });
}
@override
- ir.Primitive handleSuperIndexCompounds(ast.SendSet node,
- Element indexFunction, Element indexSetFunction, ast.Node index,
- CompoundRhs rhs, arg, {bool isGetterValid, bool isSetterValid}) {
+ ir.Primitive handleSuperIndexCompounds(
+ ast.SendSet node,
+ Element indexFunction,
+ Element indexSetFunction,
+ ast.Node index,
+ CompoundRhs rhs,
+ arg,
+ {bool isGetterValid,
+ bool isSetterValid}) {
ir.Primitive indexValue = visit(index);
- return translateCompounds(getValue: () {
- if (isGetterValid) {
- return irBuilder.buildSuperIndex(indexFunction, indexValue);
- } else {
- return buildInstanceNoSuchMethod(
- new Selector.index(), <ir.Primitive>[indexValue]);
- }
- }, rhs: rhs, setValue: (ir.Primitive result) {
- if (isSetterValid) {
- irBuilder.buildSuperIndexSet(indexSetFunction, indexValue, result);
- } else {
- buildInstanceNoSuchMethod(
- new Selector.indexSet(), <ir.Primitive>[indexValue, result]);
- }
- });
+ return translateCompounds(
+ getValue: () {
+ if (isGetterValid) {
+ return irBuilder.buildSuperIndex(indexFunction, indexValue);
+ } else {
+ return buildInstanceNoSuchMethod(
+ new Selector.index(), <ir.Primitive>[indexValue]);
+ }
+ },
+ rhs: rhs,
+ setValue: (ir.Primitive result) {
+ if (isSetterValid) {
+ irBuilder.buildSuperIndexSet(indexSetFunction, indexValue, result);
+ } else {
+ buildInstanceNoSuchMethod(
+ new Selector.indexSet(), <ir.Primitive>[indexValue, result]);
+ }
+ });
}
ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) {
@@ -1366,26 +1413,38 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
@override
- ir.Primitive visitUnresolvedClassConstructorInvoke(ast.NewExpression node,
- Element element, DartType type, ast.NodeList arguments, Selector selector,
+ ir.Primitive visitUnresolvedClassConstructorInvoke(
+ ast.NewExpression node,
+ Element element,
+ DartType type,
+ ast.NodeList arguments,
+ Selector selector,
_) {
// If the class is missing it's a runtime error.
return buildRuntimeError("Unresolved class: '${element.name}'");
}
@override
- ir.Primitive visitUnresolvedConstructorInvoke(ast.NewExpression node,
- Element constructor, DartType type, ast.NodeList arguments,
- Selector selector, _) {
+ ir.Primitive visitUnresolvedConstructorInvoke(
+ ast.NewExpression node,
+ Element constructor,
+ DartType type,
+ ast.NodeList arguments,
+ Selector selector,
+ _) {
// If the class is there but the constructor is missing, it's an NSM error.
return buildStaticNoSuchMethod(
selector, translateDynamicArguments(arguments, selector.callStructure));
}
@override
- ir.Primitive errorNonConstantConstructorInvoke(ast.NewExpression node,
- Element element, DartType type, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ ir.Primitive errorNonConstantConstructorInvoke(
+ ast.NewExpression node,
+ Element element,
+ DartType type,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
assert(compiler.compilationFailed);
return irBuilder.buildNullConstant();
}
@@ -1404,8 +1463,11 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
@override
ir.Primitive visitUnresolvedRedirectingFactoryConstructorInvoke(
- ast.NewExpression node, ConstructorElement constructor,
- InterfaceType type, ast.NodeList arguments, CallStructure callStructure,
+ ast.NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ ast.NodeList arguments,
+ CallStructure callStructure,
_) {
String nameString = Elements.reconstructConstructorName(constructor);
Name name = new Name(nameString, constructor.library);
@@ -1488,9 +1550,13 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
}
@override
- ir.Primitive visitAbstractClassConstructorInvoke(ast.NewExpression node,
- ConstructorElement element, InterfaceType type, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ ir.Primitive visitAbstractClassConstructorInvoke(
+ ast.NewExpression node,
+ ConstructorElement element,
+ InterfaceType type,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
return buildAbstractClassInstantiationError(element.enclosingClass);
}
@@ -1899,9 +1965,13 @@ class DartIrBuilderVisitor extends IrBuilderVisitor {
}
@override
- ir.Primitive handleConstructorInvoke(ast.NewExpression node,
- ConstructorElement constructor, DartType type, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ ir.Primitive handleConstructorInvoke(
+ ast.NewExpression node,
+ ConstructorElement constructor,
+ DartType type,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
List<ir.Primitive> arguments =
node.send.arguments.mapToList(visit, growable: false);
return irBuilder.buildConstructorInvocation(
@@ -2017,7 +2087,8 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
/// indicating how to access these.
ClosureEnvironment getClosureEnvironment() {
if (closureClassMap.closureElement == null) return null;
- return new ClosureEnvironment(closureClassMap.closureElement,
+ return new ClosureEnvironment(
+ closureClassMap.closureElement,
closureClassMap.thisLocal,
mapValues(closureClassMap.freeVariableMap, getLocation));
}
@@ -2033,7 +2104,8 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
// We translate a ClosureScope from closure.dart into IR builder's variant
// because the IR builder should not depend on the synthetic elements
// created in closure.dart.
- return new ClosureScope(scope.boxElement,
+ return new ClosureScope(
+ scope.boxElement,
mapValues(scope.capturedVariables, getLocation),
scope.boxedLoopVariables);
}
@@ -2045,7 +2117,8 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
.computeClosureToClassMapping(function, function.node, elements);
closurelib.ClosureScope scope = map.capturingScopes[function.node];
if (scope == null) return null;
- return new ClosureScope(scope.boxElement,
+ return new ClosureScope(
+ scope.boxElement,
mapValues(scope.capturedVariables, getLocation),
scope.boxedLoopVariables);
}
@@ -2107,7 +2180,8 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
/// [elements] mapping.
ir.Primitive inlineExpression(AstElement context, ast.Expression expression) {
JsIrBuilderVisitor visitor = new JsIrBuilderVisitor(
- context.resolvedAst.elements, compiler,
+ context.resolvedAst.elements,
+ compiler,
sourceInformationBuilder.forContext(context));
return visitor.withBuilder(irBuilder, () => visitor.visit(expression));
}
@@ -2118,7 +2192,8 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
/// [elements] mapping.
ir.Primitive inlineConstant(AstElement context, ast.Expression exp) {
JsIrBuilderVisitor visitor = new JsIrBuilderVisitor(
- context.resolvedAst.elements, compiler,
+ context.resolvedAst.elements,
+ compiler,
sourceInformationBuilder.forContext(context));
return visitor.withBuilder(irBuilder, () => visitor.translateConstant(exp));
}
@@ -2599,9 +2674,13 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
return result;
}
@override
- ir.Primitive handleConstructorInvoke(ast.NewExpression node,
- ConstructorElement constructor, DartType type, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ ir.Primitive handleConstructorInvoke(
+ ast.NewExpression node,
+ ConstructorElement constructor,
+ DartType type,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
List<ir.Primitive> arguments =
node.send.arguments.mapToList(visit, growable: false);
// Use default values from the effective target, not the immediate target.
@@ -2619,19 +2698,17 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
ir.Primitive name = irBuilder.buildStringConstant(selector.name);
ir.Primitive argumentList = irBuilder.buildListLiteral(null, arguments);
ir.Primitive expectedArgumentNames = irBuilder.buildNullConstant();
- return irBuilder.buildStaticFunctionInvocation(thrower,
- new CallStructure.unnamed(4), [
- receiver,
- name,
- argumentList,
- expectedArgumentNames
- ]);
+ return irBuilder.buildStaticFunctionInvocation(
+ thrower,
+ new CallStructure.unnamed(4),
+ [receiver, name, argumentList, expectedArgumentNames]);
}
@override
ir.Primitive buildInstanceNoSuchMethod(
Selector selector, List<ir.Primitive> arguments) {
- return irBuilder.buildDynamicInvocation(irBuilder.buildThis(),
+ return irBuilder.buildDynamicInvocation(
+ irBuilder.buildThis(),
useSelectorType(compiler.noSuchMethodSelector, selector),
[irBuilder.buildInvocationMirror(selector, arguments)]);
}
@@ -2639,7 +2716,8 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
@override
ir.Primitive buildRuntimeError(String message) {
return irBuilder.buildStaticFunctionInvocation(
- backend.getThrowRuntimeError(), new CallStructure.unnamed(1),
+ backend.getThrowRuntimeError(),
+ new CallStructure.unnamed(1),
[irBuilder.buildStringConstant(message)]);
}
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart
index 4c48dec..eb6b71a 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart
@@ -28,8 +28,8 @@ class CheckCpsIntegrity extends RecursiveVisitor {
RootNode topLevelNode;
Set<Definition> seenDefinitions = new Set<Definition>();
- Map<Definition, Set<Reference>> seenReferences = <Definition, Set<Reference>>{
- };
+ Map<Definition, Set<Reference>> seenReferences =
+ <Definition, Set<Reference>>{};
Map<Definition, Node> bindings = <Definition, Node>{};
Set<Continuation> insideContinuations = new Set<Continuation>();
@@ -134,10 +134,13 @@ class CheckCpsIntegrity extends RecursiveVisitor {
@override
visitDeclareFunction(DeclareFunction node) {
markAsSeen(node.variable);
- doInScope([node.variable], node, () {
- visit(node.definition);
- visit(node.body);
- });
+ doInScope(
+ [node.variable],
+ node,
+ () {
+ visit(node.definition);
+ visit(node.body);
+ });
}
@override
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
index 523f594..6b11211 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
@@ -266,9 +266,13 @@ class InvokeMethod extends Expression implements Invoke {
final SourceInformation sourceInformation;
InvokeMethod(Primitive receiver, Selector selector, List<Primitive> arguments,
- Continuation continuation, {SourceInformation sourceInformation})
- : this.internal(new Reference<Primitive>(receiver), selector,
- _referenceList(arguments), new Reference<Continuation>(continuation),
+ Continuation continuation,
+ {SourceInformation sourceInformation})
+ : this.internal(
+ new Reference<Primitive>(receiver),
+ selector,
+ _referenceList(arguments),
+ new Reference<Continuation>(continuation),
sourceInformation);
InvokeMethod.internal(this.receiver, this.selector, this.arguments,
@@ -367,7 +371,9 @@ class InvokeConstructor extends Expression implements Invoke {
Continuation cont)
: arguments = _referenceList(args),
continuation = new Reference<Continuation>(cont) {
- assert(dart2js.invariant(target, target.isErroneous ||
+ assert(dart2js.invariant(
+ target,
+ target.isErroneous ||
type.isDynamic ||
type.element == target.enclosingClass.declaration,
message: "Constructor invocation target is not a constructor: "
@@ -399,7 +405,8 @@ class TypeOperator extends Expression {
final bool isTypeTest;
TypeOperator(Primitive value, this.type, List<Primitive> typeArguments,
- Continuation cont, {bool this.isTypeTest})
+ Continuation cont,
+ {bool this.isTypeTest})
: this.value = new Reference<Primitive>(value),
this.typeArguments = _referenceList(typeArguments),
this.continuation = new Reference<Continuation>(cont) {
@@ -920,8 +927,13 @@ class ConstructorDefinition extends RootNode implements DartSpecificNode {
/// Values for optional parameters.
final List<ConstantExpression> defaultParameterValues;
- ConstructorDefinition(this.element, this.thisParameter, this.parameters,
- this.body, this.initializers, this.localConstants,
+ ConstructorDefinition(
+ this.element,
+ this.thisParameter,
+ this.parameters,
+ this.body,
+ this.initializers,
+ this.localConstants,
this.defaultParameterValues);
// 'Abstract' here means "has no body" and is used to represent external
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index 59ef006..3523dee 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -729,7 +729,8 @@ class _TypePropagationVisitor<T> implements Visitor {
result = constantValue(
constantSystem.isSubtype(_dartTypes, constantType, checkedType)
? new TrueConstantValue()
- : new FalseConstantValue(), type);
+ : new FalseConstantValue(),
+ type);
}
setValues(result);
} else {
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 9aa18e6..71f38b5 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -171,7 +171,10 @@ Future<api.CompilationResult> compile(List<String> argv) {
out = currentDirectory.resolve('out.dart');
sourceMapOut = currentDirectory.resolve('out.dart.map');
}
- diagnosticHandler(null, null, null,
+ diagnosticHandler(
+ null,
+ null,
+ null,
"--output-type=dart is deprecated. It will remain available "
"in Dart 1.11, but will be removed in Dart 1.12.",
api.Diagnostic.WARNING);
@@ -349,13 +352,17 @@ Future<api.CompilationResult> compile(List<String> argv) {
new OptionHandler('--csp', passThrough),
new OptionHandler('--enable-experimental-mirrors', passThrough),
new OptionHandler('--enable-async', (_) {
- diagnosticHandler.info("Option '--enable-async' is no longer needed. "
- "Async-await is supported by default.", api.Diagnostic.HINT);
+ diagnosticHandler.info(
+ "Option '--enable-async' is no longer needed. "
+ "Async-await is supported by default.",
+ api.Diagnostic.HINT);
}),
new OptionHandler('--enable-null-aware-operators', passThrough),
new OptionHandler('--enable-enum', (_) {
- diagnosticHandler.info("Option '--enable-enum' is no longer needed. "
- "Enums are supported by default.", api.Diagnostic.HINT);
+ diagnosticHandler.info(
+ "Option '--enable-enum' is no longer needed. "
+ "Enums are supported by default.",
+ api.Diagnostic.HINT);
}),
new OptionHandler('--allow-native-extensions', setAllowNativeExtensions),
new OptionHandler('--generate-code-with-compile-time-errors', passThrough),
@@ -376,7 +383,8 @@ Future<api.CompilationResult> compile(List<String> argv) {
}
if (hasDisallowUnsafeEval) {
- String precompiledName = relativize(currentDirectory,
+ String precompiledName = relativize(
+ currentDirectory,
RandomAccessFileOutputProvider.computePrecompiledUri(out),
Platform.isWindows);
helpAndFail("Option '--disallow-unsafe-eval' has been removed."
@@ -444,11 +452,11 @@ Future<api.CompilationResult> compile(List<String> argv) {
}
writeString(
Uri.parse('$out.deps'), getDepsOutput(inputProvider.sourceFiles));
- diagnosticHandler.info(
- 'Compiled ${inputProvider.dartCharactersRead} characters Dart '
- '-> ${outputProvider.totalCharactersWritten} characters '
- '$outputLanguage in '
- '${relativize(currentDirectory, out, Platform.isWindows)}');
+ diagnosticHandler
+ .info('Compiled ${inputProvider.dartCharactersRead} characters Dart '
+ '-> ${outputProvider.totalCharactersWritten} characters '
+ '$outputLanguage in '
+ '${relativize(currentDirectory, out, Platform.isWindows)}');
if (diagnosticHandler.verbose) {
String input = uriPathToNative(arguments[0]);
print('Dart file ($input) compiled to $outputLanguage.');
@@ -464,9 +472,15 @@ Future<api.CompilationResult> compile(List<String> argv) {
return result;
}
- return compileFunc(uri, libraryRoot, packageRoot, inputProvider,
- diagnosticHandler, options, outputProvider, environment)
- .then(compilationDone);
+ return compileFunc(
+ uri,
+ libraryRoot,
+ packageRoot,
+ inputProvider,
+ diagnosticHandler,
+ options,
+ outputProvider,
+ environment).then(compilationDone);
}
class AbortLeg {
diff --git a/pkg/compiler/lib/src/dart_backend/backend.dart b/pkg/compiler/lib/src/dart_backend/backend.dart
index d70b6e1..4b000f0 100644
--- a/pkg/compiler/lib/src/dart_backend/backend.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend.dart
@@ -227,7 +227,10 @@ class DartBackend extends Backend {
void postProcessElementAst(AstElement element, ElementAst elementAst,
newTypedefElementCallback, newClassElementCallback) {
ReferencedElementCollector collector = new ReferencedElementCollector(
- compiler, element, elementAst, newTypedefElementCallback,
+ compiler,
+ element,
+ elementAst,
+ newTypedefElementCallback,
newClassElementCallback);
collector.collect();
}
@@ -289,7 +292,8 @@ class DartBackend extends Backend {
return compiler.libraryLoader
.loadLibrary(compiler.translateResolvedUri(
loadedLibraries.getLibrary(Compiler.DART_MIRRORS),
- MirrorRenamerImpl.DART_MIRROR_HELPER, null))
+ MirrorRenamerImpl.DART_MIRROR_HELPER,
+ null))
.then((LibraryElement library) {
mirrorRenamer = new MirrorRenamerImpl(compiler, this, library);
});
diff --git a/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart b/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
index e39fee9..22554b3 100644
--- a/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
@@ -32,8 +32,8 @@ class BuilderContext<T> {
final Map<tree.Variable, String> variableNames;
/// Maps local constants to their name.
- final Map<VariableElement, String> constantNames = <VariableElement, String>{
- };
+ final Map<VariableElement, String> constantNames =
+ <VariableElement, String>{};
/// Variables that have had their declaration created.
final Set<tree.Variable> declaredVariables = new Set<tree.Variable>();
@@ -304,8 +304,8 @@ class ASTEmitter
Statement body;
if (!definition.isEmpty) {
- initializers = definition.initializers
- .map((tree.Initializer initializer) {
+ initializers =
+ definition.initializers.map((tree.Initializer initializer) {
return visitInitializer(initializer, context);
}).toList();
@@ -342,9 +342,12 @@ class ASTEmitter
bodyParts.addAll(context.statements);
body = new Block(bodyParts);
}
- return new ConstructorDefinition(parameters, body, initializers,
- context.currentElement.name, definition.element.isConst)
- ..element = context.currentElement;
+ return new ConstructorDefinition(
+ parameters,
+ body,
+ initializers,
+ context.currentElement.name,
+ definition.element.isConst)..element = context.currentElement;
}
@override
@@ -417,7 +420,8 @@ class ASTEmitter
FunctionType functionType = function.element.type;
List<Parameter> required = TypeGenerator.createParameters(
functionType.parameterTypes,
- context: context, elements: function.parameters.map((p) => p.element));
+ context: context,
+ elements: function.parameters.map((p) => p.element));
bool optionalParametersAreNamed = !functionType.namedParameters.isEmpty;
List<Parameter> optional = TypeGenerator.createParameters(
optionalParametersAreNamed
@@ -475,10 +479,10 @@ class ASTEmitter
Block visitInSubContext(
tree.Statement statement, BuilderContext<Statement> context,
{tree.Statement fallthrough}) {
- return new Block(context
- .inSubcontext((BuilderContext<Statement> subcontext) {
- visitStatement(statement, subcontext);
- }, fallthrough: fallthrough));
+ return new Block(
+ context.inSubcontext((BuilderContext<Statement> subcontext) {
+ visitStatement(statement, subcontext);
+ }, fallthrough: fallthrough));
}
void addLabeledStatement(tree.Label label, Statement statement,
@@ -703,7 +707,8 @@ class ASTEmitter
Expression visitLiteralMap(
tree.LiteralMap exp, BuilderContext<Statement> context) {
List<LiteralMapEntry> entries = new List<LiteralMapEntry>.generate(
- exp.entries.length, (i) => new LiteralMapEntry(
+ exp.entries.length,
+ (i) => new LiteralMapEntry(
visitExpression(exp.entries[i].key, context),
visitExpression(exp.entries[i].value, context)));
List<TypeAnnotation> typeArguments = exp.type.treatAsRaw
@@ -747,13 +752,17 @@ class ASTEmitter
return new Identifier(exp.target.name)..element = exp.target;
case SelectorKind.SETTER:
- return new Assignment(new Identifier(exp.target.name)
- ..element = exp.target, '=',
+ return new Assignment(
+ new Identifier(exp.target.name)..element = exp.target,
+ '=',
visitExpression(exp.arguments[0], context));
case SelectorKind.CALL:
- return new CallStatic(null, exp.target.name, emitArguments(
- visitArgumentList(exp.arguments, context), exp.selector))
+ return new CallStatic(
+ null,
+ exp.target.name,
+ emitArguments(
+ visitArgumentList(exp.arguments, context), exp.selector))
..element = exp.target;
default:
@@ -840,7 +849,8 @@ class ASTEmitter
@override
Expression visitConditional(
tree.Conditional exp, BuilderContext<Statement> context) {
- return new Conditional(visitExpression(exp.condition, context),
+ return new Conditional(
+ visitExpression(exp.condition, context),
visitExpression(exp.thenExpression, context),
visitExpression(exp.elseExpression, context));
}
@@ -1027,9 +1037,11 @@ class TypeGenerator {
return new Parameters(createParameters(functionType.parameterTypes),
createParameters(functionType.optionalParameterTypes), false);
} else {
- return new Parameters(createParameters(functionType.parameterTypes),
+ return new Parameters(
+ createParameters(functionType.parameterTypes),
createParameters(functionType.namedParameterTypes,
- names: functionType.namedParameters), true);
+ names: functionType.namedParameters),
+ true);
}
}
@@ -1113,8 +1125,9 @@ class ConstantEmitter
List<Expression> visitExpressions(
List<ConstantExpression> expressions, BuilderContext<Statement> context) {
- return expressions.map((expression) => visit(expression, context)).toList(
- growable: false);
+ return expressions
+ .map((expression) => visit(expression, context))
+ .toList(growable: false);
}
@override
@@ -1175,7 +1188,8 @@ class ConstantEmitter
Expression visitMap(
MapConstantExpression exp, BuilderContext<Statement> context) {
List<LiteralMapEntry> entries = new List<LiteralMapEntry>.generate(
- exp.values.length, (i) => new LiteralMapEntry(
+ exp.values.length,
+ (i) => new LiteralMapEntry(
visit(exp.keys[i], context), visit(exp.values[i], context)));
List<TypeAnnotation> typeArguments = exp.type.treatAsRaw
? null
diff --git a/pkg/compiler/lib/src/dart_backend/backend_ast_nodes.dart b/pkg/compiler/lib/src/dart_backend/backend_ast_nodes.dart
index 0800d91..bcccf28 100644
--- a/pkg/compiler/lib/src/dart_backend/backend_ast_nodes.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend_ast_nodes.dart
@@ -324,8 +324,11 @@ class FunctionExpression extends Expression implements RootNode {
elements.FunctionElement element;
- FunctionExpression(this.parameters, this.body, {this.name, this.returnType,
- this.isGetter: false, this.isSetter: false}) {
+ FunctionExpression(this.parameters, this.body,
+ {this.name,
+ this.returnType,
+ this.isGetter: false,
+ this.isSetter: false}) {
// Function must have a name if it has a return type
assert(returnType == null || name != null);
}
@@ -1368,8 +1371,10 @@ class Unparser {
for (int j in penalized) {
// Check if another track can benefit from switching from this track.
for (int k in nonPenalized) {
- num newCost = best[j].cost + 1 // Whitespace in string juxtaposition
- + getQuoteCost(best[k].quoting);
+ num newCost = best[j].cost +
+ 1 // Whitespace in string juxtaposition
+ +
+ getQuoteCost(best[k].quoting);
if (newCost < best[k].cost) {
best[k] = new OpenStringChunk(
best[j].end(endIndex), best[k].quoting, newCost);
@@ -1422,8 +1427,10 @@ class Unparser {
for (int k = 0; k < best.length; k++) {
num newCost = best[j].cost +
1 // Whitespace in string juxtaposition
- - 2 // Save two curly braces
- + getQuoteCost(best[k].quoting);
+ -
+ 2 // Save two curly braces
+ +
+ getQuoteCost(best[k].quoting);
if (newCost < best[k].cost) {
best[k] = new OpenStringChunk(
best[j].end(i + 1), best[k].quoting, newCost);
diff --git a/pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart b/pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart
index d33da00..9123601 100644
--- a/pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart
@@ -37,12 +37,15 @@ class TreePrinter {
if (node.initializer == null) {
definition = makeIdentifier(node.element.name);
} else {
- definition = new tree.SendSet(null, makeIdentifier(node.element.name),
+ definition = new tree.SendSet(
+ null,
+ makeIdentifier(node.element.name),
new tree.Operator(assignmentToken("=")),
singleton(makeExpression(node.initializer)));
}
setElement(definition, node.element, node);
- return new tree.VariableDefinitions(null, // TODO(sigurdm): Type
+ return new tree.VariableDefinitions(
+ null, // TODO(sigurdm): Type
makeVarModifiers(
useVar: true,
isFinal: node.element.isFinal,
@@ -449,7 +452,8 @@ class TreePrinter {
setElement(send, exp.constructor, exp);
} else if (exp is CallStatic) {
precedence = CALLEE;
- result = new tree.Send(makeStaticReceiver(exp.element),
+ result = new tree.Send(
+ makeStaticReceiver(exp.element),
makeIdentifier(exp.methodName),
argList(exp.arguments.map(makeArgument)));
setElement(result, exp.element, exp);
@@ -458,7 +462,9 @@ class TreePrinter {
result = new tree.Conditional(
makeExp(exp.condition, LOGICAL_OR, beginStmt: beginStmt),
makeExp(exp.thenExpression, EXPRESSION),
- makeExp(exp.elseExpression, EXPRESSION), question, colon);
+ makeExp(exp.elseExpression, EXPRESSION),
+ question,
+ colon);
} else if (exp is FieldExpression) {
precedence = PRIMARY;
// TODO(sra): Elide receiver when This, but only if not in a scope that
@@ -475,9 +481,14 @@ class TreePrinter {
tree.Node body = exp.isConst || exp.body == null
? new tree.EmptyStatement(semicolon)
: makeFunctionBody(exp.body);
- result = new tree.FunctionExpression(constructorName(exp), parameters,
- body, null, // return type
- makeFunctionModifiers(exp), initializers, null, // get/set
+ result = new tree.FunctionExpression(
+ constructorName(exp),
+ parameters,
+ body,
+ null, // return type
+ makeFunctionModifiers(exp),
+ initializers,
+ null, // get/set
null); // async modifier
setElement(result, exp.element, exp);
} else if (exp is FunctionExpression) {
@@ -489,10 +500,14 @@ class TreePrinter {
tree.NodeList parameters =
exp.isGetter ? makeList("", []) : makeParameters(exp.parameters);
tree.Node body = makeFunctionBody(exp.body);
- result = new tree.FunctionExpression(functionName(exp), parameters, body,
+ result = new tree.FunctionExpression(
+ functionName(exp),
+ parameters,
+ body,
exp.returnType == null || exp.element.isConstructor
? null
- : makeType(exp.returnType), makeFunctionModifiers(exp),
+ : makeType(exp.returnType),
+ makeFunctionModifiers(exp),
null, // initializers
getOrSet, // get/set
null); // async modifier
@@ -535,7 +550,8 @@ class TreePrinter {
}
} else if (exp is IndexExpression) {
precedence = CALLEE;
- result = new tree.Send(makeExp(exp.object, PRIMARY, beginStmt: beginStmt),
+ result = new tree.Send(
+ makeExp(exp.object, PRIMARY, beginStmt: beginStmt),
new tree.Operator(indexToken),
bracketList(',', [makeExpression(exp.index)]));
} else if (exp is Literal) {
@@ -572,7 +588,8 @@ class TreePrinter {
if (exp.typeArgument != null) {
typeArgs = typeArgList([makeType(exp.typeArgument)]);
}
- result = new tree.LiteralList(typeArgs,
+ result = new tree.LiteralList(
+ typeArgs,
bracketList(',', exp.values.map(makeExpression)),
exp.isConst ? constToken : null);
} else if (exp is LiteralMap) {
@@ -585,7 +602,8 @@ class TreePrinter {
if (exp.typeArguments != null && exp.typeArguments.length > 0) {
typeArgs = typeArgList(exp.typeArguments.map(makeType));
}
- result = new tree.LiteralMap(typeArgs,
+ result = new tree.LiteralMap(
+ typeArgs,
braceList(',', exp.entries.map(makeLiteralMapEntry)),
exp.isConst ? constToken : null);
} else if (exp is LiteralSymbol) {
@@ -630,7 +648,8 @@ class TreePrinter {
operator = new tree.Operator(typeOpToken(exp.operator));
}
result = new tree.Send(
- makeExp(exp.expression, BITWISE_OR, beginStmt: beginStmt), operator,
+ makeExp(exp.expression, BITWISE_OR, beginStmt: beginStmt),
+ operator,
singleton(rightOperand));
} else if (exp is UnaryOperator) {
precedence = UNARY;
@@ -713,15 +732,20 @@ class TreePrinter {
return new tree.Block(braceList('', body));
} else if (stmt is Break) {
return new tree.BreakStatement(
- stmt.label == null ? null : makeIdentifier(stmt.label), breakToken,
+ stmt.label == null ? null : makeIdentifier(stmt.label),
+ breakToken,
semicolon);
} else if (stmt is Continue) {
return new tree.ContinueStatement(
- stmt.label == null ? null : makeIdentifier(stmt.label), continueToken,
+ stmt.label == null ? null : makeIdentifier(stmt.label),
+ continueToken,
semicolon);
} else if (stmt is DoWhile) {
- return new tree.DoWhile(makeStatement(stmt.body, shortIf: shortIf),
- parenthesize(makeExpression(stmt.condition)), doToken, whileToken,
+ return new tree.DoWhile(
+ makeStatement(stmt.body, shortIf: shortIf),
+ parenthesize(makeExpression(stmt.condition)),
+ doToken,
+ whileToken,
semicolon);
} else if (stmt is EmptyStatement) {
return new tree.EmptyStatement(semicolon);
@@ -744,9 +768,12 @@ class TreePrinter {
} else {
condition = new tree.EmptyStatement(semicolon);
}
- return new tree.For(initializer, condition,
+ return new tree.For(
+ initializer,
+ condition,
makeList(',', stmt.updates.map(makeExpression)),
- makeStatement(stmt.body, shortIf: shortIf), forToken);
+ makeStatement(stmt.body, shortIf: shortIf),
+ forToken);
} else if (stmt is ForIn) {
tree.Node left;
if (stmt.leftHandValue is Identifier) {
@@ -759,9 +786,11 @@ class TreePrinter {
} else if (stmt is FunctionDeclaration) {
tree.FunctionExpression function = new tree.FunctionExpression(
stmt.name != null ? makeIdentifier(stmt.name) : null,
- makeParameters(stmt.parameters), makeFunctionBody(stmt.body),
+ makeParameters(stmt.parameters),
+ makeFunctionBody(stmt.body),
stmt.returnType != null ? makeType(stmt.returnType) : null,
- makeEmptyModifiers(), null, // initializers
+ makeEmptyModifiers(),
+ null, // initializers
null, // get/set
null); // async modifier
setElement(function, stmt.function.element, stmt);
@@ -770,14 +799,18 @@ class TreePrinter {
if (stmt.elseStatement == null || isEmptyStatement(stmt.elseStatement)) {
tree.Node node = new tree.If(
parenthesize(makeExpression(stmt.condition)),
- makeStatement(stmt.thenStatement), null, // else statement
- ifToken, null); // else token
+ makeStatement(stmt.thenStatement),
+ null, // else statement
+ ifToken,
+ null); // else token
if (shortIf) return node;
else return new tree.Block(braceList('', [node]));
} else {
- return new tree.If(parenthesize(makeExpression(stmt.condition)),
+ return new tree.If(
+ parenthesize(makeExpression(stmt.condition)),
makeStatement(stmt.thenStatement, shortIf: false),
- makeStatement(stmt.elseStatement, shortIf: shortIf), ifToken,
+ makeStatement(stmt.elseStatement, shortIf: shortIf),
+ ifToken,
elseToken); // else token
}
} else if (stmt is LabeledStatement) {
@@ -798,12 +831,15 @@ class TreePrinter {
} else if (stmt is Switch) {
return new tree.SwitchStatement(
parenthesize(makeExpression(stmt.expression)),
- braceList('', stmt.cases.map(makeSwitchCase)), switchToken);
+ braceList('', stmt.cases.map(makeSwitchCase)),
+ switchToken);
} else if (stmt is Try) {
- return new tree.TryStatement(makeBlock(stmt.tryBlock),
+ return new tree.TryStatement(
+ makeBlock(stmt.tryBlock),
makeList(null, stmt.catchBlocks.map(makeCatchBlock)),
stmt.finallyBlock == null ? null : makeBlock(stmt.finallyBlock),
- tryToken, stmt.finallyBlock == null ? null : finallyToken);
+ tryToken,
+ stmt.finallyBlock == null ? null : finallyToken);
} else if (stmt is VariableDeclarations) {
return makeVariableDeclarations(stmt, useVar: true, endToken: semicolon);
} else if (stmt is While) {
@@ -832,11 +868,12 @@ class TreePrinter {
tree.Node makeVariableDeclarations(VariableDeclarations decl,
{bool useVar: false, Token endToken: null}) {
return new tree.VariableDefinitions(
- decl.type == null ? null : makeType(decl.type), makeVarModifiers(
+ decl.type == null ? null : makeType(decl.type),
+ makeVarModifiers(
isConst: decl.isConst,
isFinal: decl.isFinal,
- useVar: useVar && decl.type == null), makeList(
- ',', decl.declarations.map(makeVariableDeclaration),
+ useVar: useVar && decl.type == null),
+ makeList(',', decl.declarations.map(makeVariableDeclaration),
close: endToken));
}
@@ -857,13 +894,16 @@ class TreePrinter {
return new tree.CatchBlock(
block.onType == null ? null : makeType(block.onType),
block.exceptionVar == null ? null : argList(formals),
- makeBlock(block.body), block.onType == null ? null : onToken,
+ makeBlock(block.body),
+ block.onType == null ? null : onToken,
block.exceptionVar == null ? null : catchToken);
}
tree.SwitchCase makeSwitchCase(SwitchCase caze) {
if (caze.isDefaultCase) {
- return new tree.SwitchCase(blankList(), defaultToken,
+ return new tree.SwitchCase(
+ blankList(),
+ defaultToken,
makeList('', caze.statements.map(makeStatement)),
null); // startToken unused by unparser
} else {
@@ -910,7 +950,8 @@ class TreePrinter {
tree.Node makeParameter(Parameter param, [Token assignOperator]) {
if (param.isFunction) {
tree.Node definition = new tree.FunctionExpression(
- makeIdentifier(param.name), makeParameters(param.parameters),
+ makeIdentifier(param.name),
+ makeParameters(param.parameters),
null, // body
param.type == null ? null : makeType(param.type),
makeEmptyModifiers(), // TODO: Function parameter modifiers?
@@ -921,7 +962,9 @@ class TreePrinter {
setElement(definition, param.element, param);
}
if (param.defaultValue != null) {
- definition = new tree.SendSet(null, definition,
+ definition = new tree.SendSet(
+ null,
+ definition,
new tree.Operator(assignOperator),
singleton(makeExpression(param.defaultValue)));
}
@@ -930,7 +973,9 @@ class TreePrinter {
} else {
tree.Node definition;
if (param.defaultValue != null) {
- definition = new tree.SendSet(null, makeIdentifier(param.name),
+ definition = new tree.SendSet(
+ null,
+ makeIdentifier(param.name),
new tree.Operator(assignOperator),
singleton(makeExpression(param.defaultValue)));
} else {
@@ -950,9 +995,14 @@ class TreePrinter {
return new tree.Modifiers(blankList());
}
- tree.Modifiers makeModifiers({bool isExternal: false, bool isStatic: false,
- bool isAbstract: false, bool isFactory: false, bool isConst: false,
- bool isFinal: false, bool isVar: false}) {
+ tree.Modifiers makeModifiers(
+ {bool isExternal: false,
+ bool isStatic: false,
+ bool isAbstract: false,
+ bool isFactory: false,
+ bool isConst: false,
+ bool isFinal: false,
+ bool isVar: false}) {
List<tree.Node> nodes = [];
if (isExternal) {
nodes.add(makeIdentifier('external'));
@@ -978,8 +1028,11 @@ class TreePrinter {
return new tree.Modifiers(makeList(' ', nodes));
}
- tree.Modifiers makeVarModifiers({bool isConst: false, bool isFinal: false,
- bool useVar: false, bool isStatic: false}) {
+ tree.Modifiers makeVarModifiers(
+ {bool isConst: false,
+ bool isFinal: false,
+ bool useVar: false,
+ bool isStatic: false}) {
return makeModifiers(
isStatic: isStatic,
isConst: isConst,
@@ -1074,8 +1127,10 @@ class TreePrinter {
return forNamedMixinApplication ? null : new tree.NodeList.empty();
} else {
return new tree.NodeList(
- forNamedMixinApplication ? null : implementsToken, typeAnnotations,
- null, ',');
+ forNamedMixinApplication ? null : implementsToken,
+ typeAnnotations,
+ null,
+ ',');
}
}
@@ -1121,9 +1176,11 @@ class TreePrinter {
}
tree.Enum makeEnum(elements.EnumClassElement cls) {
- return new tree.Enum(enumToken, makeIdentifier(cls.name), makeList(
- ',', cls.enumValues.map((e) => makeIdentifier(e.name)),
- open: openBrace, close: closeBrace));
+ return new tree.Enum(
+ enumToken,
+ makeIdentifier(cls.name),
+ makeList(',', cls.enumValues.map((e) => makeIdentifier(e.name)),
+ open: openBrace, close: closeBrace));
}
/// Creates a [tree.ClassNode] node for [cls].
@@ -1163,8 +1220,15 @@ class TreePrinter {
tree.NodeList interfaces = makeInterfaces(cls.interfaces, mixinTypes);
Token extendsKeyword = supernode != null ? extendsToken : null;
- return new tree.ClassNode(modifiers, name, typeParameters, supernode,
- interfaces, openBrace, extendsKeyword, null, // No body.
+ return new tree.ClassNode(
+ modifiers,
+ name,
+ typeParameters,
+ supernode,
+ interfaces,
+ openBrace,
+ extendsKeyword,
+ null, // No body.
closeBrace);
}
diff --git a/pkg/compiler/lib/src/dart_backend/outputter.dart b/pkg/compiler/lib/src/dart_backend/outputter.dart
index 928dee3..3887c25 100644
--- a/pkg/compiler/lib/src/dart_backend/outputter.dart
+++ b/pkg/compiler/lib/src/dart_backend/outputter.dart
@@ -7,8 +7,10 @@ part of dart_backend;
typedef bool IsSafeToRemoveTypeDeclarations(
Map<ClassElement, Iterable<Element>> classMembers);
typedef void ElementCallback<E>(E element);
-typedef void ElementPostProcessFunction(AstElement element,
- ElementAst elementAst, ElementCallback<TypedefElement> typedefCallback,
+typedef void ElementPostProcessFunction(
+ AstElement element,
+ ElementAst elementAst,
+ ElementCallback<TypedefElement> typedefCallback,
ElementCallback<ClassElement> classCallback);
typedef ElementAst ComputeElementAstFunction(AstElement element);
typedef bool ElementFilter(Element element);
@@ -37,7 +39,8 @@ class DartOutputter {
// TODO(johnniwinther): Support recompilation.
DartOutputter(this.listener, this.outputProvider,
- {bool this.forceStripTypes: false, bool this.enableMinification: false,
+ {bool this.forceStripTypes: false,
+ bool this.enableMinification: false,
bool this.multiFile: false});
/// Generate Dart code for the program starting at [mainFunction].
@@ -55,13 +58,17 @@ class DartOutputter {
/// [resolvedElements] in the generated output.
///
/// Returns the total size of the generated code.
- int assembleProgram({MirrorRenamer mirrorRenamer: const MirrorRenamer(),
- Iterable<LibraryElement> libraries, Iterable<Element> instantiatedClasses,
+ int assembleProgram(
+ {MirrorRenamer mirrorRenamer: const MirrorRenamer(),
+ Iterable<LibraryElement> libraries,
+ Iterable<Element> instantiatedClasses,
Iterable<Element> resolvedElements,
Iterable<ClassElement> usedTypeLiterals: const <ClassElement>[],
- FunctionElement mainFunction, Uri outputUri,
+ FunctionElement mainFunction,
+ Uri outputUri,
ElementPostProcessFunction postProcessElementAst,
- ComputeElementAstFunction computeElementAst, ElementFilter shouldOutput,
+ ComputeElementAstFunction computeElementAst,
+ ElementFilter shouldOutput,
IsSafeToRemoveTypeDeclarations isSafeToRemoveTypeDeclarations,
ElementSorter sortElements}) {
assert(invariant(NO_LOCATION_SPANNABLE, libraries != null,
@@ -123,12 +130,18 @@ class DartOutputter {
}
}
- static PlaceholderCollector collectPlaceholders(DiagnosticListener listener,
- MirrorRenamer mirrorRenamer, FunctionElement mainFunction,
- LibraryInfo libraryInfo, ElementInfo elementInfo) {
+ static PlaceholderCollector collectPlaceholders(
+ DiagnosticListener listener,
+ MirrorRenamer mirrorRenamer,
+ FunctionElement mainFunction,
+ LibraryInfo libraryInfo,
+ ElementInfo elementInfo) {
// Create all necessary placeholders.
- PlaceholderCollector collector = new PlaceholderCollector(listener,
- mirrorRenamer, libraryInfo.fixedDynamicNames, elementInfo.elementAsts,
+ PlaceholderCollector collector = new PlaceholderCollector(
+ listener,
+ mirrorRenamer,
+ libraryInfo.fixedDynamicNames,
+ elementInfo.elementAsts,
mainFunction);
makePlaceholders(element) {
@@ -144,7 +157,8 @@ class DartOutputter {
static PlaceholderRenamer createRenamer(PlaceholderCollector collector,
LibraryInfo libraryInfo, ElementInfo elementInfo,
- {bool enableMinification: false, bool forceStripTypes: false,
+ {bool enableMinification: false,
+ bool forceStripTypes: false,
isSafeToRemoveTypeDeclarations}) {
// Create renames.
bool shouldCutDeclarationTypes = forceStripTypes ||
@@ -152,7 +166,8 @@ class DartOutputter {
isSafeToRemoveTypeDeclarations(elementInfo.classMembers));
PlaceholderRenamer placeholderRenamer = new PlaceholderRenamer(
- libraryInfo.fixedDynamicNames, libraryInfo.fixedStaticNames,
+ libraryInfo.fixedDynamicNames,
+ libraryInfo.fixedStaticNames,
libraryInfo.reexportingLibraries,
cutDeclarationTypes: shouldCutDeclarationTypes,
enableMinification: enableMinification);
@@ -193,7 +208,8 @@ class LibraryInfo {
LibraryInfo(this.fixedStaticNames, this.fixedDynamicNames,
this.reexportingLibraries, this.userLibraries);
- static LibraryInfo processLibraries(DiagnosticListener listener,
+ static LibraryInfo processLibraries(
+ DiagnosticListener listener,
Iterable<LibraryElement> libraries,
Iterable<AstElement> resolvedElements) {
Set<String> fixedStaticNames = new Set<String>();
@@ -262,12 +278,10 @@ class LibraryInfo {
ClassElement existingEnumClass =
enumClassMap.putIfAbsent(cls.name, () => cls);
if (existingEnumClass != cls) {
- listener.reportError(cls, MessageKind.GENERIC, {
- 'text': "Duplicate enum names are not supported in dart2dart."
- });
- listener.reportInfo(existingEnumClass, MessageKind.GENERIC, {
- 'text': "This is the other declaration of '${cls.name}'."
- });
+ listener.reportError(cls, MessageKind.GENERIC,
+ {'text': "Duplicate enum names are not supported in dart2dart."});
+ listener.reportInfo(existingEnumClass, MessageKind.GENERIC,
+ {'text': "This is the other declaration of '${cls.name}'."});
}
}
}
@@ -311,7 +325,8 @@ class ElementInfoProcessor implements ElementInfo {
Iterable<AstElement> resolvedElements,
Iterable<ClassElement> usedTypeLiterals,
{ElementPostProcessFunction postProcessElementAst,
- ComputeElementAstFunction parseElementAst, ElementFilter shouldOutput,
+ ComputeElementAstFunction parseElementAst,
+ ElementFilter shouldOutput,
ElementSorter sortElements}) {
ElementInfoProcessor processor = new ElementInfoProcessor(
postProcessElementAst: postProcessElementAst,
@@ -322,9 +337,11 @@ class ElementInfoProcessor implements ElementInfo {
sortElements: sortElements);
}
- ElementInfo process(Iterable<ClassElement> instantiatedClasses,
+ ElementInfo process(
+ Iterable<ClassElement> instantiatedClasses,
Iterable<AstElement> resolvedElements,
- Iterable<ClassElement> usedTypeLiterals, {ElementSorter sortElements}) {
+ Iterable<ClassElement> usedTypeLiterals,
+ {ElementSorter sortElements}) {
// Build all top level elements to emit and necessary class members.
instantiatedClasses.where(shouldOutput).forEach(addClass);
resolvedElements.where(shouldOutput).forEach(addMember);
@@ -412,11 +429,17 @@ class MainOutputGenerator {
final List<Node> topLevelNodes = <Node>[];
/// Generates the code and returns the total size.
- int generateCode(LibraryInfo libraryInfo, ElementInfo elementInfo,
- PlaceholderCollector collector, PlaceholderRenamer placeholderRenamer,
- FunctionElement mainFunction, Uri outputUri,
- CompilerOutputProvider outputProvider, MirrorRenamer mirrorRenamer,
- {bool multiFile: false, bool forceStripTypes: false,
+ int generateCode(
+ LibraryInfo libraryInfo,
+ ElementInfo elementInfo,
+ PlaceholderCollector collector,
+ PlaceholderRenamer placeholderRenamer,
+ FunctionElement mainFunction,
+ Uri outputUri,
+ CompilerOutputProvider outputProvider,
+ MirrorRenamer mirrorRenamer,
+ {bool multiFile: false,
+ bool forceStripTypes: false,
bool enableMinification: false}) {
for (Element element in elementInfo.topLevelElements) {
topLevelNodes.add(elementInfo.elementAsts[element].ast);
@@ -473,7 +496,8 @@ class MainOutputGenerator {
for (LibraryElement outputLibrary in libraryInfo.userLibraries) {
EmitterUnparser unparser = new EmitterUnparser(
placeholderRenamer.renames,
- stripTypes: forceStripTypes, minify: enableMinification);
+ stripTypes: forceStripTypes,
+ minify: enableMinification);
unparsers[outputLibrary] = unparser;
LibraryName libraryName = outputLibrary.libraryTag;
if (libraryName != null) {
diff --git a/pkg/compiler/lib/src/dart_backend/renamer.dart b/pkg/compiler/lib/src/dart_backend/renamer.dart
index 9411122..16029e2 100644
--- a/pkg/compiler/lib/src/dart_backend/renamer.dart
+++ b/pkg/compiler/lib/src/dart_backend/renamer.dart
@@ -70,8 +70,8 @@ class PlaceholderRenamer {
final Map<Node, String> renames = new Map<Node, String>();
/// After running [computeRenames] this will map the used platform
/// libraries to their respective prefixes.
- final Map<LibraryElement, String> platformImports = <LibraryElement, String>{
- };
+ final Map<LibraryElement, String> platformImports =
+ <LibraryElement, String>{};
final bool enableMinification;
final Set<String> fixedDynamicNames;
@@ -144,7 +144,8 @@ class PlaceholderRenamer {
// TODO(johnniwinther): Handle prefixes for dart:core.
if (library.canonicalUri == Compiler.DART_CORE) return entity.name;
if (library.isInternalLibrary) {
- throw new SpannableAssertionFailure(entity,
+ throw new SpannableAssertionFailure(
+ entity,
"Internal library $library should never have been imported from "
"the code compiled by dart2dart.");
}
diff --git a/pkg/compiler/lib/src/dart_types.dart b/pkg/compiler/lib/src/dart_types.dart
index c3b4fe5..bf60d8a 100644
--- a/pkg/compiler/lib/src/dart_types.dart
+++ b/pkg/compiler/lib/src/dart_types.dart
@@ -355,15 +355,18 @@ abstract class GenericType extends DartType {
GenericType(TypeDeclarationElement element, this.typeArguments,
{bool checkTypeArgumentCount: true})
: this.element = element {
- assert(invariant(element, () {
- if (!checkTypeArgumentCount) return true;
- if (element is TypeDeclarationElementX) {
- return element.thisTypeCache == null ||
- typeArguments.length == element.typeVariables.length;
- }
- return true;
- }, message: () => 'Invalid type argument count on ${element.thisType}. '
- 'Provided type arguments: $typeArguments.'));
+ assert(invariant(
+ element,
+ () {
+ if (!checkTypeArgumentCount) return true;
+ if (element is TypeDeclarationElementX) {
+ return element.thisTypeCache == null ||
+ typeArguments.length == element.typeVariables.length;
+ }
+ return true;
+ },
+ message: () => 'Invalid type argument count on ${element.thisType}. '
+ 'Provided type arguments: $typeArguments.'));
}
/// Creates a new instance of this type using the provided type arguments.
@@ -583,7 +586,8 @@ class FunctionType extends DartType {
optionalParameterTypes, namedParameters, namedParameterTypes);
}
- factory FunctionType.synthesized([DartType returnType = const DynamicType(),
+ factory FunctionType.synthesized(
+ [DartType returnType = const DynamicType(),
List<DartType> parameterTypes = const <DartType>[],
List<DartType> optionalParameterTypes = const <DartType>[],
List<String> namedParameters = const <String>[],
@@ -638,8 +642,12 @@ class FunctionType extends DartType {
}
if (changed) {
// Create a new type only if necessary.
- return new FunctionType.internal(element, newReturnType,
- newParameterTypes, newOptionalParameterTypes, namedParameters,
+ return new FunctionType.internal(
+ element,
+ newReturnType,
+ newParameterTypes,
+ newOptionalParameterTypes,
+ namedParameters,
newNamedParameterTypes);
}
return this;
@@ -962,7 +970,6 @@ abstract class AbstractTypeRelation
bool visitMalformedType(MalformedType t, DartType s) => true;
bool visitInterfaceType(InterfaceType t, DartType s) {
-
// TODO(johnniwinther): Currently needed since literal types like int,
// double, bool etc. might not have been resolved yet.
t.element.ensureResolved(compiler);
@@ -1496,7 +1503,6 @@ class Types implements DartTypes {
/// Computes the least upper bound of two interface types [a] and [b].
InterfaceType computeLeastUpperBoundInterfaces(
InterfaceType a, InterfaceType b) {
-
/// Returns the set of supertypes of [type] at depth [depth].
Set<DartType> getSupertypesAtDepth(InterfaceType type, int depth) {
OrderedTypeSet types = type.element.allSupertypesAndSelf;
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index 2e4b899..e738abe 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -245,7 +245,6 @@ class DeferredLoadTask extends CompilerTask {
/// Adds the results to [elements] and [constants].
void _collectAllElementsAndConstantsResolvedFrom(Element element,
Set<Element> elements, Set<ConstantValue> constants, isMirrorUsage) {
-
/// Collects all direct dependencies of [element].
///
/// The collected dependent elements and constants are are added to
@@ -588,7 +587,6 @@ class DeferredLoadTask extends CompilerTask {
_importedDeferredBy[_fakeMainImport] = _mainElements;
measureElement(mainLibrary, () {
-
// Starting from main, traverse the program and find all dependencies.
_mapDependencies(element: compiler.mainFunction, import: _fakeMainImport);
@@ -837,13 +835,14 @@ class DeferredLoadTask extends CompilerTask {
List<OutputUnit> outputUnits = hunksToLoad[importDeferName[import]];
ImportDescription description = _deferredImportDescriptions[import];
Map<String, dynamic> libraryMap = mapping.putIfAbsent(
- description.importingUri, () => <String, dynamic>{
- "name": description.importingLibraryName,
- "imports": <String, List<String>>{}
- });
-
- libraryMap["imports"][description.prefix] = outputUnits
- .map((OutputUnit outputUnit) {
+ description.importingUri,
+ () => <String, dynamic>{
+ "name": description.importingLibraryName,
+ "imports": <String, List<String>>{}
+ });
+
+ libraryMap["imports"][description.prefix] =
+ outputUnits.map((OutputUnit outputUnit) {
return backend.deferredPartFileName(outputUnit.name);
}).toList();
});
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index 3f2ceab..a521d38 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -565,7 +565,8 @@ class DumpInfoTask extends CompilerTask {
};
})
// Filter non-null ids for the same reason as above.
- .where((a) => a['id'] != null).toList();
+ .where((a) => a['id'] != null)
+ .toList();
}
}
}
@@ -626,8 +627,8 @@ class DumpInfoTask extends CompilerTask {
ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
new StringConversionSink.fromStringSink(buffer));
sink.add(outJson);
- compiler.reportInfo(NO_LOCATION_SPANNABLE, const MessageKind(
- "View the dumped .info.json file at "
- "https://dart-lang.github.io/dump-info-visualizer"));
+ compiler.reportInfo(NO_LOCATION_SPANNABLE,
+ const MessageKind("View the dumped .info.json file at "
+ "https://dart-lang.github.io/dump-info-visualizer"));
}
}
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index a867636..4982b8a 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -614,9 +614,11 @@ class ScopeX {
other, MessageKind.EXISTING_DEFINITION, {'name': accessor.name});
contents[accessor.name] = new DuplicatedElementX(
- MessageKind.DUPLICATE_DEFINITION, {
- 'name': accessor.name
- }, accessor.memberContext.enclosingElement, other, accessor);
+ MessageKind.DUPLICATE_DEFINITION,
+ {'name': accessor.name},
+ accessor.memberContext.enclosingElement,
+ other,
+ accessor);
}
if (existing != null) {
@@ -706,14 +708,12 @@ class CompilationUnitElementX extends ElementX
if (libraryTag != null) {
String expectedName = libraryTag.name.toString();
if (expectedName != actualName) {
- listener.reportWarning(tag.name, MessageKind.LIBRARY_NAME_MISMATCH, {
- 'libraryName': expectedName
- });
+ listener.reportWarning(tag.name, MessageKind.LIBRARY_NAME_MISMATCH,
+ {'libraryName': expectedName});
}
} else {
- listener.reportWarning(library, MessageKind.MISSING_LIBRARY_NAME, {
- 'libraryName': actualName
- });
+ listener.reportWarning(library, MessageKind.MISSING_LIBRARY_NAME,
+ {'libraryName': actualName});
listener.reportInfo(tag.name, MessageKind.THIS_IS_THE_PART_OF_TAG);
}
}
@@ -786,16 +786,15 @@ class ImportScope {
Element hidingElement, Element hiddenElement) {
Uri hiddenUri = hiddenElement.library.canonicalUri;
Uri hidingUri = hidingElement.library.canonicalUri;
- Element element = new WarnOnUseElementX(new WrappedMessage(
- null, // Report on reference to [hidingElement].
- messageKind, {
- 'name': name,
- 'hiddenUri': hiddenUri,
- 'hidingUri': hidingUri
- }), new WrappedMessage(listener.spanFromSpannable(import),
- MessageKind.IMPORTED_HERE, {
- 'name': name
- }), enclosingElement, hidingElement);
+ Element element = new WarnOnUseElementX(
+ new WrappedMessage(
+ null, // Report on reference to [hidingElement].
+ messageKind,
+ {'name': name, 'hiddenUri': hiddenUri, 'hidingUri': hidingUri}),
+ new WrappedMessage(listener.spanFromSpannable(import),
+ MessageKind.IMPORTED_HERE, {'name': name}),
+ enclosingElement,
+ hidingElement);
importScope[name] = element;
importers.registerImport(element, import);
}
@@ -820,9 +819,11 @@ class ImportScope {
}
} else {
Element ambiguousElement = new AmbiguousImportX(
- MessageKind.DUPLICATE_IMPORT, {
- 'name': name
- }, enclosingElement, existing, element);
+ MessageKind.DUPLICATE_IMPORT,
+ {'name': name},
+ enclosingElement,
+ existing,
+ element);
importScope[name] = ambiguousElement;
importers.registerImport(ambiguousElement, import);
importers.registerImport(ambiguousElement, existingImport);
@@ -1335,8 +1336,10 @@ abstract class VariableElementX extends ElementX
} else {
// Create a [VariableDefinitions] node for the single definition of
// [node].
- definitionsCache = new VariableDefinitions(definitions.type,
- definitions.modifiers, new NodeList(
+ definitionsCache = new VariableDefinitions(
+ definitions.type,
+ definitions.modifiers,
+ new NodeList(
definitions.definitions.beginToken,
const Link<Node>().prepend(node),
definitions.definitions.endToken));
@@ -1563,10 +1566,14 @@ abstract class ParameterElementX extends FormalElementX
final bool isOptional;
final bool isNamed;
- ParameterElementX(ElementKind elementKind,
- FunctionElement functionDeclaration, VariableDefinitions definitions,
- Identifier identifier, this.initializer,
- {this.isOptional: false, this.isNamed: false})
+ ParameterElementX(
+ ElementKind elementKind,
+ FunctionElement functionDeclaration,
+ VariableDefinitions definitions,
+ Identifier identifier,
+ this.initializer,
+ {this.isOptional: false,
+ this.isNamed: false})
: super(elementKind, functionDeclaration, definitions, identifier);
FunctionElement get functionDeclaration => enclosingElement;
@@ -1584,11 +1591,16 @@ abstract class ParameterElementX extends FormalElementX
class LocalParameterElementX extends ParameterElementX
implements LocalParameterElement {
- LocalParameterElementX(FunctionElement functionDeclaration,
- VariableDefinitions definitions, Identifier identifier,
- Expression initializer, {bool isOptional: false, bool isNamed: false})
+ LocalParameterElementX(
+ FunctionElement functionDeclaration,
+ VariableDefinitions definitions,
+ Identifier identifier,
+ Expression initializer,
+ {bool isOptional: false,
+ bool isNamed: false})
: super(ElementKind.PARAMETER, functionDeclaration, definitions,
- identifier, initializer, isOptional: isOptional, isNamed: isNamed);
+ identifier, initializer,
+ isOptional: isOptional, isNamed: isNamed);
}
/// Parameters in constructors that directly initialize fields. For example:
@@ -1597,10 +1609,14 @@ class InitializingFormalElementX extends ParameterElementX
implements InitializingFormalElement {
final FieldElement fieldElement;
- InitializingFormalElementX(ConstructorElement constructorDeclaration,
- VariableDefinitions variables, Identifier identifier,
- Expression initializer, this.fieldElement,
- {bool isOptional: false, bool isNamed: false})
+ InitializingFormalElementX(
+ ConstructorElement constructorDeclaration,
+ VariableDefinitions variables,
+ Identifier identifier,
+ Expression initializer,
+ this.fieldElement,
+ {bool isOptional: false,
+ bool isNamed: false})
: super(ElementKind.INITIALIZING_FORMAL, constructorDeclaration,
variables, identifier, initializer,
isOptional: isOptional, isNamed: isNamed);
@@ -1706,11 +1722,14 @@ class FunctionSignatureX implements FunctionSignature {
final FunctionType type;
final bool hasOptionalParameters;
- FunctionSignatureX({this.requiredParameters: const <Element>[],
+ FunctionSignatureX(
+ {this.requiredParameters: const <Element>[],
this.requiredParameterCount: 0,
List<Element> optionalParameters: const <Element>[],
- this.optionalParameterCount: 0, this.optionalParametersAreNamed: false,
- this.orderedOptionalParameters: const <Element>[], this.type})
+ this.optionalParameterCount: 0,
+ this.optionalParametersAreNamed: false,
+ this.orderedOptionalParameters: const <Element>[],
+ this.type})
: optionalParameters = optionalParameters,
hasOptionalParameters = !optionalParameters.isEmpty;
@@ -1874,11 +1893,13 @@ abstract class FunctionElementX extends BaseFunctionElementX
abstract class MethodElementX extends FunctionElementX {
final bool hasBody;
- MethodElementX(String name, ElementKind kind, Modifiers modifiers,
+ MethodElementX(
+ String name,
+ ElementKind kind,
+ Modifiers modifiers,
Element enclosing,
// TODO(15101): Make this a named parameter.
- this.hasBody)
- : super(name, kind, modifiers, enclosing);
+ this.hasBody) : super(name, kind, modifiers, enclosing);
@override
bool get isAbstract {
@@ -2230,16 +2251,18 @@ abstract class TypeDeclarationElementX<T extends GenericType>
// Create types and elements for type variable.
Link<Node> nodes = parameters.nodes;
- List<DartType> arguments = new List.generate(nodes.slowLength(), (_) {
- TypeVariable node = nodes.head;
- String variableName = node.name.source;
- nodes = nodes.tail;
- TypeVariableElementX variableElement =
- new TypeVariableElementX(variableName, this, node);
- TypeVariableType variableType = new TypeVariableType(variableElement);
- variableElement.typeCache = variableType;
- return variableType;
- }, growable: false);
+ List<DartType> arguments = new List.generate(
+ nodes.slowLength(),
+ (_) {
+ TypeVariable node = nodes.head;
+ String variableName = node.name.source;
+ nodes = nodes.tail;
+ TypeVariableElementX variableElement =
+ new TypeVariableElementX(variableName, this, node);
+ TypeVariableType variableType = new TypeVariableType(variableElement);
+ variableElement.typeCache = variableType;
+ return variableType;
+ }, growable: false);
return arguments;
}
@@ -2770,8 +2793,11 @@ class EnumConstructorElementX extends ConstructorElementX {
EnumConstructorElementX(
EnumClassElementX enumClass, Modifiers modifiers, this.node)
- : super('', // Name.
- ElementKind.GENERATIVE_CONSTRUCTOR, modifiers, enumClass);
+ : super(
+ '', // Name.
+ ElementKind.GENERATIVE_CONSTRUCTOR,
+ modifiers,
+ enumClass);
@override
bool get hasNode => true;
@@ -2795,8 +2821,10 @@ class EnumMethodElementX extends MethodElementX {
}
class EnumFormalElementX extends InitializingFormalElementX {
- EnumFormalElementX(ConstructorElement constructor,
- VariableDefinitions variables, Identifier identifier,
+ EnumFormalElementX(
+ ConstructorElement constructor,
+ VariableDefinitions variables,
+ Identifier identifier,
EnumFieldElementX fieldElement)
: super(constructor, variables, identifier, null, fieldElement) {
typeCache = fieldElement.type;
@@ -2805,7 +2833,8 @@ class EnumFormalElementX extends InitializingFormalElementX {
class EnumFieldElementX extends FieldElementX {
EnumFieldElementX(Identifier name, EnumClassElementX enumClass,
- VariableList variableList, Node definition, [Expression initializer])
+ VariableList variableList, Node definition,
+ [Expression initializer])
: super(name, enumClass, variableList) {
definitionsCache = new VariableDefinitions(
null, variableList.modifiers, new NodeList.singleton(definition));
@@ -2885,7 +2914,8 @@ class MixinApplicationElementX extends BaseClassElementX
List<DartType> computeTypeParameters(Compiler compiler) {
NamedMixinApplication named = node.asNamedMixinApplication();
if (named == null) {
- throw new SpannableAssertionFailure(node,
+ throw new SpannableAssertionFailure(
+ node,
"Type variables on unnamed mixin applications must be set on "
"creation.");
}
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index d63a698..2dacdee 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -427,7 +427,9 @@ abstract class Enqueuer {
// Keep looking at new classes until fixpoint is reached.
logEnqueueReflectiveAction("!START enqueueRecents");
recents.forEach((ClassElement cls) {
- enqueueReflectiveElementsInClass(cls, recents,
+ enqueueReflectiveElementsInClass(
+ cls,
+ recents,
shouldIncludeElementDueToMirrors(cls.library,
includedEnclosing: false));
});
@@ -758,7 +760,8 @@ class ResolutionEnqueuer extends Enqueuer {
*/
void addDeferredAction(Element element, DeferredAction action) {
if (queueIsClosed) {
- throw new SpannableAssertionFailure(element,
+ throw new SpannableAssertionFailure(
+ element,
"Resolution work list is closed. "
"Trying to add deferred action for $element");
}
diff --git a/pkg/compiler/lib/src/helpers/expensive_set.dart b/pkg/compiler/lib/src/helpers/expensive_set.dart
index 2038a2b..b0973ba 100644
--- a/pkg/compiler/lib/src/helpers/expensive_set.dart
+++ b/pkg/compiler/lib/src/helpers/expensive_set.dart
@@ -98,7 +98,9 @@ class ExpensiveSet<E> extends IterableBase<E> implements Set<E> {
}
Set<E> union(Set<E> other) {
- return _newSet()..addAll(this)..addAll(other);
+ return _newSet()
+ ..addAll(this)
+ ..addAll(other);
}
Set<E> difference(Set<E> other) {
diff --git a/pkg/compiler/lib/src/helpers/stats.dart b/pkg/compiler/lib/src/helpers/stats.dart
index f136b8d..674b79c 100644
--- a/pkg/compiler/lib/src/helpers/stats.dart
+++ b/pkg/compiler/lib/src/helpers/stats.dart
@@ -27,8 +27,12 @@ Stats _stats;
/// If [xml] is `true`, stats output is formatted as XML with a default
/// extension of 'xml', otherwise the output is indented text with a default
/// extension of 'log'.
-void enableStatsOutput({CompilerOutputProvider outputProvider, bool xml: true,
- String name: 'stats', String extension, int examples: 10}) {
+void enableStatsOutput(
+ {CompilerOutputProvider outputProvider,
+ bool xml: true,
+ String name: 'stats',
+ String extension,
+ int examples: 10}) {
if (_stats != null) {
throw new StateError('Stats have already been initialized.');
}
@@ -241,7 +245,8 @@ abstract class StatsPrinter {
/// Create a stat entry for [id] with additional [data] and content created by
/// [createChildContent].
- void child(String id, [Map<String, dynamic> data = const <String, dynamic>{},
+ void child(String id,
+ [Map<String, dynamic> data = const <String, dynamic>{},
void createChildContent()]) {
open(id, data);
if (createChildContent != null) createChildContent();
@@ -408,7 +413,8 @@ class _StackTraceNode implements Comparable<_StackTraceNode> {
subtrace.commonPrefix.sublist(commonPrefixLength);
subtraces.remove(subtrace);
subtraces.add(new _StackTraceNode.node(
- lines.sublist(0, commonPrefixLength), subtrace,
+ lines.sublist(0, commonPrefixLength),
+ subtrace,
new _StackTraceNode.leaf(stackTrace)));
}
return;
@@ -503,8 +509,8 @@ class ActiveStats implements Stats {
Map<dynamic, Map> maps = {};
Map<dynamic, Map<dynamic, List>> frequencyMaps = {};
Map<dynamic, Map> setsMap = {};
- Map<dynamic, Map<dynamic, List>> countersMap = <dynamic, Map<dynamic, List>>{
- };
+ Map<dynamic, Map<dynamic, List>> countersMap =
+ <dynamic, Map<dynamic, List>>{};
Map<dynamic, _StackTraceTree> traceMap = {};
int stackTraceSampleFrequency = 1;
@@ -593,7 +599,9 @@ class ActiveStats implements Stats {
void dumpFrequencies() {
printer.group('frequencies', () {
frequencyMaps.forEach((key, Map<dynamic, List> map) {
- printer.child('frequency', {'title': '$key'}, () {
+ printer.child('frequency', {
+ 'title': '$key'
+ }, () {
dumpFrequency(map);
});
});
@@ -679,7 +687,9 @@ class ActiveStats implements Stats {
void dumpCorrelation(keyA, Iterable a, keyB, Iterable b,
{Map dataA, Map dataB}) {
- printer.child('correlations', {'title': '$keyA vs $keyB'}, () {
+ printer.child('correlations', {
+ 'title': '$keyA vs $keyB'
+ }, () {
List aAndB = a.where((e) => e != null && b.contains(e)).toList();
List aAndNotB = a.where((e) => e != null && !b.contains(e)).toList();
List notAandB = b.where((e) => e != null && !a.contains(e)).toList();
@@ -737,8 +747,10 @@ class ActiveStats implements Stats {
///
/// If [isValidKey] is provided, this is used to determine with a value of [map]
/// is a potential key of the inversion map.
-Map<dynamic, Set> inverseMap(Map map, {bool equals(key1, key2),
- int hashCode(key), bool isValidKey(potentialKey)}) {
+Map<dynamic, Set> inverseMap(Map map,
+ {bool equals(key1, key2),
+ int hashCode(key),
+ bool isValidKey(potentialKey)}) {
Map<dynamic, Set> result = new LinkedHashMap<dynamic, Set>(
equals: equals, hashCode: hashCode, isValidKey: isValidKey);
map.forEach((k, v) {
diff --git a/pkg/compiler/lib/src/helpers/trace.dart b/pkg/compiler/lib/src/helpers/trace.dart
index 9acfcb6..5f71c3b 100644
--- a/pkg/compiler/lib/src/helpers/trace.dart
+++ b/pkg/compiler/lib/src/helpers/trace.dart
@@ -68,13 +68,15 @@ TraceAndReport get reportAndTrace => traceAndReport;
void _traceAndReport(Compiler compiler, Spannable node, String message,
{bool condition(String stackTrace), int limit, bool throwOnPrint: false}) {
trace(message,
- limit: limit, throwOnPrint: throwOnPrint, condition: (String stackTrace) {
- bool result = condition != null ? condition(stackTrace) : true;
- if (result) {
- reportHere(compiler, node, message);
- }
- return result;
- });
+ limit: limit,
+ throwOnPrint: throwOnPrint,
+ condition: (String stackTrace) {
+ bool result = condition != null ? condition(stackTrace) : true;
+ if (result) {
+ reportHere(compiler, node, message);
+ }
+ return result;
+ });
}
/// Returns the [StackTraceLines] for the current call stack.
@@ -220,8 +222,12 @@ class StackTraceLine {
StackTraceLine(
this.index, this.file, this.lineNo, this.columnNo, this.method);
- void printOn(StringBuffer sb, {String padding: ' ', int fileLength,
- int lineNoLength, int columnNoLength, bool showColumnNo: false}) {
+ void printOn(StringBuffer sb,
+ {String padding: ' ',
+ int fileLength,
+ int lineNoLength,
+ int columnNoLength,
+ bool showColumnNo: false}) {
String fileText = '${file} ';
if (fileLength != null) {
fileText = pad(fileText, fileLength, dots: padding);
@@ -275,8 +281,12 @@ class StackTraceLine {
* [filePrefix] only the remainder is printed.
* If [lambda] is non-null, anonymous closures are printed as [lambda].
*/
-String prettifyStackTrace(StackTrace stackTrace, {int rangeStart, int rangeEnd,
- bool showColumnNo: false, bool showDots: true, String filePrefix,
+String prettifyStackTrace(StackTrace stackTrace,
+ {int rangeStart,
+ int rangeEnd,
+ bool showColumnNo: false,
+ bool showDots: true,
+ String filePrefix,
String lambda: r'?'}) {
return new StackTraceLines.fromTrace(stackTrace,
rangeStart: rangeStart,
diff --git a/pkg/compiler/lib/src/inferrer/concrete_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/concrete_types_inferrer.dart
index 346c34f..1e5519c 100644
--- a/pkg/compiler/lib/src/inferrer/concrete_types_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/concrete_types_inferrer.dart
@@ -315,7 +315,9 @@ class ConcreteTypeSystem extends TypeSystem<ConcreteType> {
factory ConcreteTypeSystem(ConcreteTypesInferrer inferrer) {
Compiler compiler = inferrer.compiler;
BaseTypes baseTypes = new BaseTypes(compiler);
- return new ConcreteTypeSystem.internal(inferrer, baseTypes,
+ return new ConcreteTypeSystem.internal(
+ inferrer,
+ baseTypes,
(BaseType baseType) => new ConcreteType.singleton(
compiler.maxConcreteTypeSize, baseTypes, baseType));
}
@@ -539,7 +541,8 @@ class ConcreteTypeSystem extends TypeSystem<ConcreteType> {
void registerClass(ClassElement element) {
if (!element.isAbstract) {
result = result.union(new ConcreteType.singleton(
- compiler.maxConcreteTypeSize, baseTypes,
+ compiler.maxConcreteTypeSize,
+ baseTypes,
new ClassBaseType(element)));
inferrer.augmentSeenClasses(element);
}
@@ -1710,7 +1713,9 @@ class ConcreteTypesInferrer
ConcreteType analyzeMethod(
Element element, ConcreteTypesEnvironment environment) {
- TypeInferrerVisitor visitor = new TypeInferrerVisitor(element, this,
+ TypeInferrerVisitor visitor = new TypeInferrerVisitor(
+ element,
+ this,
singletonConcreteType(new ClassBaseType(environment.classOfThis)),
environment.environment);
visitor.run();
@@ -1808,8 +1813,10 @@ class ConcreteTypesInferrer
getTemplatesOrEmpty(currentWorkItem.method);
template.putIfAbsent(
currentWorkItem.environment, () => emptyConcreteType);
- recordReturnType(currentWorkItem.method, analyzeMethodOrClosure(
- currentWorkItem.method, currentWorkItem.environment));
+ recordReturnType(
+ currentWorkItem.method,
+ analyzeMethodOrClosure(
+ currentWorkItem.method, currentWorkItem.environment));
}
}
return true;
@@ -1953,9 +1960,14 @@ class ConcreteTypesInferrer
}
@override
- ConcreteType registerCalledElement(Spannable node, Selector selector,
- Element caller, Element callee, ArgumentsTypes<ConcreteType> arguments,
- SideEffects sideEffects, bool inLoop) {
+ ConcreteType registerCalledElement(
+ Spannable node,
+ Selector selector,
+ Element caller,
+ Element callee,
+ ArgumentsTypes<ConcreteType> arguments,
+ SideEffects sideEffects,
+ bool inLoop) {
caller = getRealCaller(caller);
if ((selector == null) || (selector.kind == SelectorKind.CALL)) {
callee = callee.implementation;
@@ -2032,9 +2044,13 @@ class ConcreteTypesInferrer
}
@override
- ConcreteType registerCalledSelector(Node node, Selector selector,
- ConcreteType receiverType, Element caller,
- ArgumentsTypes<ConcreteType> arguments, SideEffects sideEffects,
+ ConcreteType registerCalledSelector(
+ Node node,
+ Selector selector,
+ ConcreteType receiverType,
+ Element caller,
+ ArgumentsTypes<ConcreteType> arguments,
+ SideEffects sideEffects,
bool inLoop) {
caller = getRealCaller(caller);
switch (selector.kind) {
@@ -2096,8 +2112,10 @@ class ConcreteTypesInferrer
return result;
}
- ConcreteType registerDynamicSetterSend(Selector selector,
- ConcreteType receiverType, Element caller,
+ ConcreteType registerDynamicSetterSend(
+ Selector selector,
+ ConcreteType receiverType,
+ Element caller,
ArgumentsTypes<ConcreteType> arguments) {
caller = getRealCaller(caller);
ConcreteType argumentType = arguments.positional.first;
@@ -2213,9 +2231,13 @@ class ConcreteTypesInferrer
bool hasAlreadyComputedTypeOfParameterDefault(Element parameter) => false;
@override
- ConcreteType registerCalledClosure(Node node, Selector selector,
- ConcreteType closure, Element caller,
- ArgumentsTypes<ConcreteType> arguments, SideEffects sideEffects,
+ ConcreteType registerCalledClosure(
+ Node node,
+ Selector selector,
+ ConcreteType closure,
+ Element caller,
+ ArgumentsTypes<ConcreteType> arguments,
+ SideEffects sideEffects,
bool inLoop) {
caller = getRealCaller(caller);
ConcreteType result = emptyConcreteType;
diff --git a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
index ff9b4ae..6f92ace 100644
--- a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
@@ -236,8 +236,13 @@ abstract class InferrerEngine<T, V extends TypeSystem>
*
* [inLoop] tells whether the call happens in a loop.
*/
- T registerCalledElement(Spannable node, Selector selector, Element caller,
- Element callee, ArgumentsTypes<T> arguments, SideEffects sideEffects,
+ T registerCalledElement(
+ Spannable node,
+ Selector selector,
+ Element caller,
+ Element callee,
+ ArgumentsTypes<T> arguments,
+ SideEffects sideEffects,
bool inLoop);
/**
@@ -249,8 +254,13 @@ abstract class InferrerEngine<T, V extends TypeSystem>
*
* [inLoop] tells whether the call happens in a loop.
*/
- T registerCalledSelector(ast.Node node, Selector selector, T receiverType,
- Element caller, ArgumentsTypes<T> arguments, SideEffects sideEffects,
+ T registerCalledSelector(
+ ast.Node node,
+ Selector selector,
+ T receiverType,
+ Element caller,
+ ArgumentsTypes<T> arguments,
+ SideEffects sideEffects,
bool inLoop);
/**
@@ -261,8 +271,13 @@ abstract class InferrerEngine<T, V extends TypeSystem>
*
* [inLoop] tells whether the call happens in a loop.
*/
- T registerCalledClosure(ast.Node node, Selector selector, T closure,
- Element caller, ArgumentsTypes<T> arguments, SideEffects sideEffects,
+ T registerCalledClosure(
+ ast.Node node,
+ Selector selector,
+ T closure,
+ Element caller,
+ ArgumentsTypes<T> arguments,
+ SideEffects sideEffects,
bool inLoop);
/**
@@ -438,10 +453,14 @@ class SimpleTypeInferrerVisitor<T>
}
SimpleTypeInferrerVisitor(Element element, Compiler compiler,
- InferrerEngine<T, TypeSystem<T>> inferrer, [LocalsHandler<T> handler])
- : this.internal(element,
- element.outermostEnclosingMemberOrTopLevel.implementation, inferrer,
- compiler, handler);
+ InferrerEngine<T, TypeSystem<T>> inferrer,
+ [LocalsHandler<T> handler])
+ : this.internal(
+ element,
+ element.outermostEnclosingMemberOrTopLevel.implementation,
+ inferrer,
+ compiler,
+ handler);
void analyzeSuperConstructorCall(Element target, ArgumentsTypes arguments) {
inferrer.analyze(target, arguments);
@@ -919,9 +938,14 @@ class SimpleTypeInferrerVisitor<T>
}
@override
- T visitSuperCompoundIndexSet(ast.SendSet node, MethodElement getter,
- MethodElement setter, ast.Node index, op.AssignmentOperator operator,
- ast.Node rhs, _) {
+ T visitSuperCompoundIndexSet(
+ ast.SendSet node,
+ MethodElement getter,
+ MethodElement setter,
+ ast.Node index,
+ op.AssignmentOperator operator,
+ ast.Node rhs,
+ _) {
return handleSuperCompoundIndexSet(node, index, rhs);
}
@@ -932,16 +956,26 @@ class SimpleTypeInferrerVisitor<T>
}
@override
- T visitUnresolvedSuperGetterCompoundIndexSet(ast.SendSet node,
- Element element, MethodElement setter, ast.Node index,
- op.AssignmentOperator operator, ast.Node rhs, _) {
+ T visitUnresolvedSuperGetterCompoundIndexSet(
+ ast.SendSet node,
+ Element element,
+ MethodElement setter,
+ ast.Node index,
+ op.AssignmentOperator operator,
+ ast.Node rhs,
+ _) {
return handleSuperCompoundIndexSet(node, index, rhs);
}
@override
- T visitUnresolvedSuperSetterCompoundIndexSet(ast.SendSet node,
- MethodElement getter, Element element, ast.Node index,
- op.AssignmentOperator operator, ast.Node rhs, _) {
+ T visitUnresolvedSuperSetterCompoundIndexSet(
+ ast.SendSet node,
+ MethodElement getter,
+ Element element,
+ ast.Node index,
+ op.AssignmentOperator operator,
+ ast.Node rhs,
+ _) {
return handleSuperCompoundIndexSet(node, index, rhs);
}
@@ -960,9 +994,13 @@ class SimpleTypeInferrerVisitor<T>
}
@override
- T visitUnresolvedSuperSetterIndexPrefix(ast.SendSet node,
- MethodElement getter, Element element, ast.Node index,
- op.IncDecOperator operator, _) {
+ T visitUnresolvedSuperSetterIndexPrefix(
+ ast.SendSet node,
+ MethodElement getter,
+ Element element,
+ ast.Node index,
+ op.IncDecOperator operator,
+ _) {
T indexType = visit(index);
return handleCompoundPrefixPostfix(node, superType, indexType);
}
@@ -982,9 +1020,13 @@ class SimpleTypeInferrerVisitor<T>
}
@override
- T visitUnresolvedSuperSetterIndexPostfix(ast.SendSet node,
- MethodElement getter, Element element, ast.Node index,
- op.IncDecOperator operator, _) {
+ T visitUnresolvedSuperSetterIndexPostfix(
+ ast.SendSet node,
+ MethodElement getter,
+ Element element,
+ ast.Node index,
+ op.IncDecOperator operator,
+ _) {
T indexType = visit(index);
return handleCompoundPrefixPostfix(node, superType, indexType);
}
@@ -1093,9 +1135,14 @@ class SimpleTypeInferrerVisitor<T>
// TODO(herhut): We could do better here if we knew what we
// are calling does not expose this.
isThisExposed = true;
- return inferrer.registerCalledClosure(node, selector,
- inferrer.typeOfElement(element), outermostElement, argumentTypes,
- sideEffects, inLoop);
+ return inferrer.registerCalledClosure(
+ node,
+ selector,
+ inferrer.typeOfElement(element),
+ outermostElement,
+ argumentTypes,
+ sideEffects,
+ inLoop);
}
/// Handle an invocation of super [method].
@@ -1319,26 +1366,34 @@ class SimpleTypeInferrerVisitor<T>
T returnType = handleStaticSend(node, selector, element, arguments);
if (Elements.isGrowableListConstructorCall(element, node, compiler)) {
- return inferrer.concreteTypes.putIfAbsent(node, () => types.allocateList(
- types.growableListType, node, outermostElement, types.nonNullEmpty(),
- 0));
+ return inferrer.concreteTypes.putIfAbsent(
+ node,
+ () => types.allocateList(types.growableListType, node,
+ outermostElement, types.nonNullEmpty(), 0));
} else if (Elements.isFixedListConstructorCall(element, node, compiler) ||
Elements.isFilledListConstructorCall(element, node, compiler)) {
int length = findLength(node);
T elementType = Elements.isFixedListConstructorCall(
element, node, compiler) ? types.nullType : arguments.positional[1];
- return inferrer.concreteTypes.putIfAbsent(node, () => types.allocateList(
- types.fixedListType, node, outermostElement, elementType, length));
+ return inferrer.concreteTypes.putIfAbsent(
+ node,
+ () => types.allocateList(types.fixedListType, node, outermostElement,
+ elementType, length));
} else if (Elements.isConstructorOfTypedArraySubclass(element, compiler)) {
int length = findLength(node);
ConstructorElement constructor = element.implementation;
constructor = constructor.effectiveTarget;
T elementType = inferrer
.returnTypeOfElement(constructor.enclosingClass.lookupMember('[]'));
- return inferrer.concreteTypes.putIfAbsent(node, () => types.allocateList(
- types.nonNullExact(constructor.enclosingClass), node,
- outermostElement, elementType, length));
+ return inferrer.concreteTypes.putIfAbsent(
+ node,
+ () => types.allocateList(
+ types.nonNullExact(constructor.enclosingClass),
+ node,
+ outermostElement,
+ elementType,
+ length));
} else {
return returnType;
}
@@ -1353,9 +1408,14 @@ class SimpleTypeInferrerVisitor<T>
ArgumentsTypes arguments = analyzeArguments(node.arguments);
Selector selector = elements.getSelector(node);
handleStaticSend(node, selector, element, arguments);
- return inferrer.registerCalledClosure(node, selector,
- inferrer.typeOfElement(element), outermostElement, arguments,
- sideEffects, inLoop);
+ return inferrer.registerCalledClosure(
+ node,
+ selector,
+ inferrer.typeOfElement(element),
+ outermostElement,
+ arguments,
+ sideEffects,
+ inLoop);
}
/// Handle invocation of a top level or static [function].
@@ -1412,9 +1472,12 @@ class SimpleTypeInferrerVisitor<T>
}
@override
- T visitTopLevelFunctionIncompatibleInvoke(ast.Send node,
- MethodElement function, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ T visitTopLevelFunctionIncompatibleInvoke(
+ ast.Send node,
+ MethodElement function,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
return handleInvalidStaticInvoke(node);
}
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
index d98c1fd..7876c6d 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
@@ -546,8 +546,8 @@ class TypeGraphInferrerEngine
* A set of selector names that [List] implements, that we know return
* their element type.
*/
- final Set<Selector> _returnsListElementTypeSet = new Set<Selector>.from(
- <Selector>[
+ final Set<Selector> _returnsListElementTypeSet =
+ new Set<Selector>.from(<Selector>[
new Selector.getter('first', null),
new Selector.getter('last', null),
new Selector.getter('single', null),
@@ -655,8 +655,9 @@ class TypeGraphInferrerEngine
compiler.world.registerMightBePassedToApply(e);
if (_VERBOSE) print("traced closure $e as ${true} (bail)");
e.functionSignature.forEachParameter((parameter) {
- types.getInferredTypeOf(parameter).giveUp(this,
- clearAssignments: false);
+ types
+ .getInferredTypeOf(parameter)
+ .giveUp(this, clearAssignments: false);
});
});
bailedOutOn.addAll(elements);
@@ -1058,9 +1059,14 @@ class TypeGraphInferrerEngine
return type;
}
- TypeInformation registerCalledElement(Spannable node, Selector selector,
- Element caller, Element callee, ArgumentsTypes arguments,
- SideEffects sideEffects, bool inLoop) {
+ TypeInformation registerCalledElement(
+ Spannable node,
+ Selector selector,
+ Element caller,
+ Element callee,
+ ArgumentsTypes arguments,
+ SideEffects sideEffects,
+ bool inLoop) {
CallSiteTypeInformation info = new StaticCallSiteTypeInformation(
types.currentMember, node, caller, callee, selector, arguments, inLoop);
info.addToGraph(this);
@@ -1069,9 +1075,14 @@ class TypeGraphInferrerEngine
return info;
}
- TypeInformation registerCalledSelector(ast.Node node, Selector selector,
- TypeInformation receiverType, Element caller, ArgumentsTypes arguments,
- SideEffects sideEffects, bool inLoop) {
+ TypeInformation registerCalledSelector(
+ ast.Node node,
+ Selector selector,
+ TypeInformation receiverType,
+ Element caller,
+ ArgumentsTypes arguments,
+ SideEffects sideEffects,
+ bool inLoop) {
if (selector.isClosureCall) {
return registerCalledClosure(
node, selector, receiverType, caller, arguments, sideEffects, inLoop);
@@ -1082,7 +1093,12 @@ class TypeGraphInferrerEngine
});
CallSiteTypeInformation info = new DynamicCallSiteTypeInformation(
- types.currentMember, node, caller, selector, receiverType, arguments,
+ types.currentMember,
+ node,
+ caller,
+ selector,
+ receiverType,
+ arguments,
inLoop);
info.addToGraph(this);
@@ -1098,13 +1114,23 @@ class TypeGraphInferrerEngine
return info;
}
- TypeInformation registerCalledClosure(ast.Node node, Selector selector,
- TypeInformation closure, Element caller, ArgumentsTypes arguments,
- SideEffects sideEffects, bool inLoop) {
+ TypeInformation registerCalledClosure(
+ ast.Node node,
+ Selector selector,
+ TypeInformation closure,
+ Element caller,
+ ArgumentsTypes arguments,
+ SideEffects sideEffects,
+ bool inLoop) {
sideEffects.setDependsOnSomething();
sideEffects.setAllSideEffects();
CallSiteTypeInformation info = new ClosureCallSiteTypeInformation(
- types.currentMember, node, caller, selector, closure, arguments,
+ types.currentMember,
+ node,
+ caller,
+ selector,
+ closure,
+ arguments,
inLoop);
info.addToGraph(this);
allocatedCalls.add(info);
@@ -1124,7 +1150,9 @@ class TypeGraphInferrerEngine
TreeElementMapping mapping = element.resolvedAst.elements;
element = element.implementation;
if (element.impliesType) return;
- assert(invariant(element, element.isField ||
+ assert(invariant(
+ element,
+ element.isField ||
element.isFunction ||
element.isGenerativeConstructor ||
element.isGetter ||
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index 0b26cc4..08eec3c 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -511,7 +511,8 @@ class ParameterTypeInformation extends ElementTypeInformation {
ParameterTypeInformation._instanceMember(
ParameterElement element, TypeInformationSystem types)
: super._withAssignments(
- types.getInferredTypeOf(element.functionDeclaration), element,
+ types.getInferredTypeOf(element.functionDeclaration),
+ element,
new ParameterAssignments()) {
assert(element.functionDeclaration.isInstanceMember);
}
@@ -643,9 +644,14 @@ abstract class CallSiteTypeInformation extends TypeInformation
class StaticCallSiteTypeInformation extends CallSiteTypeInformation {
final Element calledElement;
- StaticCallSiteTypeInformation(MemberTypeInformation context, Spannable call,
- Element enclosing, this.calledElement, Selector selector,
- ArgumentsTypes arguments, bool inLoop)
+ StaticCallSiteTypeInformation(
+ MemberTypeInformation context,
+ Spannable call,
+ Element enclosing,
+ this.calledElement,
+ Selector selector,
+ ArgumentsTypes arguments,
+ bool inLoop)
: super(context, call, enclosing, selector, arguments, inLoop);
void addToGraph(TypeGraphInferrerEngine inferrer) {
@@ -706,9 +712,14 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
/// Cached targets of this call.
Iterable<Element> targets;
- DynamicCallSiteTypeInformation(MemberTypeInformation context, Spannable call,
- Element enclosing, Selector selector, this.receiver,
- ArgumentsTypes arguments, bool inLoop)
+ DynamicCallSiteTypeInformation(
+ MemberTypeInformation context,
+ Spannable call,
+ Element enclosing,
+ Selector selector,
+ this.receiver,
+ ArgumentsTypes arguments,
+ bool inLoop)
: super(context, call, enclosing, selector, arguments, inLoop);
void addToGraph(TypeGraphInferrerEngine inferrer) {
@@ -883,50 +894,52 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
// Walk over the found targets, and compute the joined union type mask
// for all these targets.
TypeMask result = inferrer.types.joinTypeMasks(targets.map((element) {
- // If [canReachAll] is true, then we are iterating over all
- // targets that satisfy the untyped selector. We skip the return
- // type of the targets that can only be reached through
- // `Invocation.delegate`. Note that the `noSuchMethod` targets
- // are included in [typedTargets].
- if (canReachAll && !typedTargets.contains(element)) {
- return const TypeMask.nonNullEmpty();
- }
+ // If [canReachAll] is true, then we are iterating over all
+ // targets that satisfy the untyped selector. We skip the return
+ // type of the targets that can only be reached through
+ // `Invocation.delegate`. Note that the `noSuchMethod` targets
+ // are included in [typedTargets].
+ if (canReachAll && !typedTargets.contains(element)) {
+ return const TypeMask.nonNullEmpty();
+ }
- if (inferrer.returnsListElementType(typedSelector)) {
- ContainerTypeMask mask = receiver.type;
- return mask.elementType;
- } else if (inferrer.returnsMapValueType(typedSelector)) {
- if (typedSelector.mask.isDictionary &&
- arguments.positional[0].type.isValue) {
- DictionaryTypeMask mask = typedSelector.mask;
- ValueTypeMask arg = arguments.positional[0].type;
- String key = arg.value;
- if (mask.typeMap.containsKey(key)) {
- if (_VERBOSE) {
- print("Dictionary lookup for $key yields ${mask.typeMap[key]}.");
+ if (inferrer.returnsListElementType(typedSelector)) {
+ ContainerTypeMask mask = receiver.type;
+ return mask.elementType;
+ } else if (inferrer.returnsMapValueType(typedSelector)) {
+ if (typedSelector.mask.isDictionary &&
+ arguments.positional[0].type.isValue) {
+ DictionaryTypeMask mask = typedSelector.mask;
+ ValueTypeMask arg = arguments.positional[0].type;
+ String key = arg.value;
+ if (mask.typeMap.containsKey(key)) {
+ if (_VERBOSE) {
+ print(
+ "Dictionary lookup for $key yields ${mask.typeMap[key]}.");
+ }
+ return mask.typeMap[key];
+ } else {
+ // The typeMap is precise, so if we do not find the key, the lookup
+ // will be [null] at runtime.
+ if (_VERBOSE) {
+ print("Dictionary lookup for $key yields [null].");
+ }
+ return inferrer.types.nullType.type;
+ }
}
- return mask.typeMap[key];
- } else {
- // The typeMap is precise, so if we do not find the key, the lookup
- // will be [null] at runtime.
+ MapTypeMask mask = typedSelector.mask;
if (_VERBOSE) {
- print("Dictionary lookup for $key yields [null].");
+ print("Map lookup for $typedSelector yields ${mask.valueType}.");
}
- return inferrer.types.nullType.type;
+ return mask.valueType;
+ } else {
+ TypeInformation info =
+ handleIntrisifiedSelector(typedSelector, inferrer);
+ if (info != null) return info.type;
+ return inferrer.typeOfElementWithSelector(
+ element, typedSelector).type;
}
- }
- MapTypeMask mask = typedSelector.mask;
- if (_VERBOSE) {
- print("Map lookup for $typedSelector yields ${mask.valueType}.");
- }
- return mask.valueType;
- } else {
- TypeInformation info =
- handleIntrisifiedSelector(typedSelector, inferrer);
- if (info != null) return info.type;
- return inferrer.typeOfElementWithSelector(element, typedSelector).type;
- }
- }));
+ }));
if (call is ast.Send) {
ast.Send send = call;
@@ -986,9 +999,14 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
class ClosureCallSiteTypeInformation extends CallSiteTypeInformation {
final TypeInformation closure;
- ClosureCallSiteTypeInformation(MemberTypeInformation context, Spannable call,
- Element enclosing, Selector selector, this.closure,
- ArgumentsTypes arguments, bool inLoop)
+ ClosureCallSiteTypeInformation(
+ MemberTypeInformation context,
+ Spannable call,
+ Element enclosing,
+ Selector selector,
+ this.closure,
+ ArgumentsTypes arguments,
+ bool inLoop)
: super(context, call, enclosing, selector, arguments, inLoop);
void addToGraph(TypeGraphInferrerEngine inferrer) {
@@ -1208,9 +1226,12 @@ class ListTypeInformation extends TypeInformation with TracedTypeInformation {
if (!mask.isContainer ||
mask.elementType != elementType.type ||
mask.length != inferredLength) {
- return new ContainerTypeMask(originalType.forwardTo,
- originalType.allocationNode, originalType.allocationElement,
- elementType.type, inferredLength);
+ return new ContainerTypeMask(
+ originalType.forwardTo,
+ originalType.allocationNode,
+ originalType.allocationElement,
+ elementType.type,
+ inferredLength);
}
return mask;
}
@@ -1321,13 +1342,20 @@ class MapTypeInformation extends TypeInformation with TracedTypeInformation {
for (var key in typeInfoMap.keys) {
mappings[key] = typeInfoMap[key].type;
}
- return new DictionaryTypeMask(originalType.forwardTo,
- originalType.allocationNode, originalType.allocationElement,
- keyType.type, valueType.type, mappings);
+ return new DictionaryTypeMask(
+ originalType.forwardTo,
+ originalType.allocationNode,
+ originalType.allocationElement,
+ keyType.type,
+ valueType.type,
+ mappings);
} else {
- return new MapTypeMask(originalType.forwardTo,
- originalType.allocationNode, originalType.allocationElement,
- keyType.type, valueType.type);
+ return new MapTypeMask(
+ originalType.forwardTo,
+ originalType.allocationNode,
+ originalType.allocationElement,
+ keyType.type,
+ valueType.type);
}
}
diff --git a/pkg/compiler/lib/src/io/source_information.dart b/pkg/compiler/lib/src/io/source_information.dart
index 5e5a84b..e57f466 100644
--- a/pkg/compiler/lib/src/io/source_information.dart
+++ b/pkg/compiler/lib/src/io/source_information.dart
@@ -345,8 +345,10 @@ class PositionSourceInformationBuilder implements SourceInformationBuilder {
return new PositionSourceInformation(new OffsetSourceLocation(
sourceFile, element.position.charOffset, name));
} else {
- return new PositionSourceInformation(null, new OffsetSourceLocation(
- sourceFile, element.resolvedAst.node.getEndToken().charOffset, name));
+ return new PositionSourceInformation(
+ null,
+ new OffsetSourceLocation(sourceFile,
+ element.resolvedAst.node.getEndToken().charOffset, name));
}
}
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart
index 6f3fc4e..bdbffa0 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -503,8 +503,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
return (node == null) ? null : _storeIfNecessary(visitExpression(node));
}).toList();
visited.addAll(nodes.skip(lastTransformIndex).map((js.Node node) {
- return (node == null) ? null : visitExpression(node);
- }));
+ return (node == null) ? null : visitExpression(node);
+ }));
var result = fn(visited);
currentTempVarIndex = oldTempVarIndex;
return result;
@@ -525,7 +525,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
}
/// Returns the rewritten function.
- js.Fun finishFunction(List<js.Parameter> parameters,
+ js.Fun finishFunction(
+ List<js.Parameter> parameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations);
@@ -707,8 +708,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
variables.add(_makeVariableInitializer(self, js.js('this')));
}
variables.addAll(localVariables.map((js.VariableDeclaration declaration) {
- return new js.VariableInitialization(declaration, null);
- }));
+ return new js.VariableInitialization(declaration, null);
+ }));
variables.addAll(new Iterable.generate(tempVarHighWaterMark,
(int i) => _makeVariableInitializer(useTempVar(i + 1).name, null)));
js.VariableDeclarationList variableDeclarations =
@@ -743,13 +744,15 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
}
js.Expression leftHandSide = node.leftHandSide;
if (leftHandSide is js.VariableUse) {
- return withExpression(node.value, (js.Expression value) {
- // A non-compound [js.Assignment] has `op==null`. So it works out to
- // use [js.Assignment.compound] for all cases.
- // Visit the [js.VariableUse] to ensure renaming is done correctly.
- return new js.Assignment.compound(
- visitExpression(leftHandSide), node.op, value);
- }, store: false);
+ return withExpression(
+ node.value,
+ (js.Expression value) {
+ // A non-compound [js.Assignment] has `op==null`. So it works out to
+ // use [js.Assignment.compound] for all cases.
+ // Visit the [js.VariableUse] to ensure renaming is done correctly.
+ return new js.Assignment.compound(
+ visitExpression(leftHandSide), node.op, value);
+ }, store: false);
} else if (leftHandSide is js.PropertyAccess) {
return withExpressions([
leftHandSide.receiver,
@@ -757,7 +760,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
node.value
], (evaluated) {
return new js.Assignment.compound(
- new js.PropertyAccess(evaluated[0], evaluated[1]), node.op,
+ new js.PropertyAccess(evaluated[0], evaluated[1]),
+ node.op,
evaluated[2]);
});
} else {
@@ -774,10 +778,12 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
js.Expression visitAwait(js.Await node) {
assert(isAsync || isAsyncStar);
int afterAwait = newLabel("returning from await.");
- withExpression(node.expression, (js.Expression value) {
- addStatement(setGotoVariable(afterAwait));
- addStatement(awaitStatement(value));
- }, store: false);
+ withExpression(
+ node.expression,
+ (js.Expression value) {
+ addStatement(setGotoVariable(afterAwait));
+ addStatement(awaitStatement(value));
+ }, store: false);
beginLabel(afterAwait);
return result;
}
@@ -799,32 +805,30 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (shouldTransform(node.right) && (node.op == "||" || node.op == "&&")) {
int thenLabel = newLabel("then");
int joinLabel = newLabel("join");
- withExpression(node.left, (js.Expression left) {
- js.Statement assignLeft = isResult(left)
- ? new js.Block.empty()
- : js.js.statement('# = #;', [result, left]);
- if (node.op == "&&") {
- addStatement(js.js.statement('if (#) {#} else #', [
- left,
- gotoAndBreak(thenLabel),
- assignLeft
- ]));
- } else {
- assert(node.op == "||");
- addStatement(js.js.statement('if (#) {#} else #', [
- left,
- assignLeft,
- gotoAndBreak(thenLabel)
- ]));
- }
- }, store: true);
+ withExpression(
+ node.left,
+ (js.Expression left) {
+ js.Statement assignLeft = isResult(left)
+ ? new js.Block.empty()
+ : js.js.statement('# = #;', [result, left]);
+ if (node.op == "&&") {
+ addStatement(js.js.statement('if (#) {#} else #',
+ [left, gotoAndBreak(thenLabel), assignLeft]));
+ } else {
+ assert(node.op == "||");
+ addStatement(js.js.statement('if (#) {#} else #',
+ [left, assignLeft, gotoAndBreak(thenLabel)]));
+ }
+ }, store: true);
addGoto(joinLabel);
beginLabel(thenLabel);
- withExpression(node.right, (js.Expression value) {
- if (!isResult(value)) {
- addStatement(js.js.statement('# = #;', [result, value]));
- }
- }, store: false);
+ withExpression(
+ node.right,
+ (js.Expression value) {
+ if (!isResult(value)) {
+ addStatement(js.js.statement('# = #;', [result, value]));
+ }
+ }, store: false);
beginLabel(joinLabel);
return result;
}
@@ -853,11 +857,14 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
@override
js.Expression visitCall(js.Call node) {
bool storeTarget = node.arguments.any(shouldTransform);
- return withCallTargetExpression(node.target, (target) {
- return withExpressions(node.arguments, (List<js.Expression> arguments) {
- return new js.Call(target, arguments);
- });
- }, store: storeTarget);
+ return withCallTargetExpression(
+ node.target,
+ (target) {
+ return withExpressions(
+ node.arguments, (List<js.Expression> arguments) {
+ return new js.Call(target, arguments);
+ });
+ }, store: storeTarget);
}
@override
@@ -887,28 +894,30 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
int thenLabel = newLabel("then");
int joinLabel = newLabel("join");
int elseLabel = newLabel("else");
- withExpression(node.condition, (js.Expression condition) {
- addStatement(js.js.statement('# = # ? # : #;', [
- goto,
- condition,
- js.number(thenLabel),
- js.number(elseLabel)
- ]));
- }, store: false);
+ withExpression(
+ node.condition,
+ (js.Expression condition) {
+ addStatement(js.js.statement('# = # ? # : #;',
+ [goto, condition, js.number(thenLabel), js.number(elseLabel)]));
+ }, store: false);
addBreak();
beginLabel(thenLabel);
- withExpression(node.then, (js.Expression value) {
- if (!isResult(value)) {
- addStatement(js.js.statement('# = #;', [result, value]));
- }
- }, store: false);
+ withExpression(
+ node.then,
+ (js.Expression value) {
+ if (!isResult(value)) {
+ addStatement(js.js.statement('# = #;', [result, value]));
+ }
+ }, store: false);
addGoto(joinLabel);
beginLabel(elseLabel);
- withExpression(node.otherwise, (js.Expression value) {
- if (!isResult(value)) {
- addStatement(js.js.statement('# = #;', [result, value]));
- }
- }, store: false);
+ withExpression(
+ node.otherwise,
+ (js.Expression value) {
+ if (!isResult(value)) {
+ addStatement(js.js.statement('# = #;', [result, value]));
+ }
+ }, store: false);
beginLabel(joinLabel);
return result;
}
@@ -973,10 +982,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (!shouldTransform(node)) {
bool oldInsideUntranslatedBreakable = insideUntranslatedBreakable;
insideUntranslatedBreakable = true;
- addStatement(js.js.statement('do {#} while (#)', [
- translateInBlock(node.body),
- visitExpression(node.condition)
- ]));
+ addStatement(js.js.statement('do {#} while (#)',
+ [translateInBlock(node.body), visitExpression(node.condition)]));
insideUntranslatedBreakable = oldInsideUntranslatedBreakable;
return;
}
@@ -995,10 +1002,12 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
jumpTargets.removeLast();
beginLabel(continueLabel);
- withExpression(node.condition, (js.Expression condition) {
- addStatement(
- js.js.statement('if (#) #', [condition, gotoAndBreak(startLabel)]));
- }, store: false);
+ withExpression(
+ node.condition,
+ (js.Expression condition) {
+ addStatement(js.js.statement(
+ 'if (#) #', [condition, gotoAndBreak(startLabel)]));
+ }, store: false);
beginLabel(afterLabel);
}
@@ -1048,10 +1057,12 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
(condition is js.LiteralBool && condition.value == true)) {
addStatement(new js.Comment("trivial condition"));
} else {
- withExpression(condition, (js.Expression condition) {
- addStatement(new js.If.noElse(
- new js.Prefix("!", condition), gotoAndBreak(afterLabel)));
- }, store: false);
+ withExpression(
+ condition,
+ (js.Expression condition) {
+ addStatement(new js.If.noElse(
+ new js.Prefix("!", condition), gotoAndBreak(afterLabel)));
+ }, store: false);
}
jumpTargets.add(node);
visitStatement(node.body);
@@ -1089,10 +1100,12 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
@override
void visitIf(js.If node) {
if (!shouldTransform(node.then) && !shouldTransform(node.otherwise)) {
- withExpression(node.condition, (js.Expression condition) {
- addStatement(new js.If(condition, translateInBlock(node.then),
- translateInBlock(node.otherwise)));
- }, store: false);
+ withExpression(
+ node.condition,
+ (js.Expression condition) {
+ addStatement(new js.If(condition, translateInBlock(node.then),
+ translateInBlock(node.otherwise)));
+ }, store: false);
return;
}
int thenLabel = newLabel("then");
@@ -1100,10 +1113,14 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
int elseLabel =
(node.otherwise is js.EmptyStatement) ? joinLabel : newLabel("else");
- withExpression(node.condition, (js.Expression condition) {
- addExpressionStatement(new js.Assignment(goto, new js.Conditional(
- condition, js.number(thenLabel), js.number(elseLabel))));
- }, store: false);
+ withExpression(
+ node.condition,
+ (js.Expression condition) {
+ addExpressionStatement(new js.Assignment(
+ goto,
+ new js.Conditional(
+ condition, js.number(thenLabel), js.number(elseLabel))));
+ }, store: false);
addBreak();
beginLabel(thenLabel);
visitStatement(node.then);
@@ -1188,11 +1205,14 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
@override
js.Expression visitNew(js.New node) {
bool storeTarget = node.arguments.any(shouldTransform);
- return withCallTargetExpression(node.target, (target) {
- return withExpressions(node.arguments, (List<js.Expression> arguments) {
- return new js.New(target, arguments);
- });
- }, store: storeTarget);
+ return withCallTargetExpression(
+ node.target,
+ (target) {
+ return withExpressions(
+ node.arguments, (List<js.Expression> arguments) {
+ return new js.New(target, arguments);
+ });
+ }, store: storeTarget);
}
@override
@@ -1217,8 +1237,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (argument is js.VariableUse) {
return new js.Postfix(node.op, visitExpression(argument));
} else if (argument is js.PropertyAccess) {
- return withExpression2(argument.receiver, argument.selector,
- (receiver, selector) {
+ return withExpression2(
+ argument.receiver, argument.selector, (receiver, selector) {
return new js.Postfix(
node.op, new js.PropertyAccess(receiver, selector));
});
@@ -1239,8 +1259,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (argument is js.VariableUse) {
return new js.Prefix(node.op, visitExpression(argument));
} else if (argument is js.PropertyAccess) {
- return withExpression2(argument.receiver, argument.selector,
- (receiver, selector) {
+ return withExpression2(
+ argument.receiver, argument.selector, (receiver, selector) {
return new js.Prefix(
node.op, new js.PropertyAccess(receiver, selector));
});
@@ -1272,9 +1292,11 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
assert(node.value == null || (!isSyncStar && !isAsyncStar));
js.Node target = analysis.targets[node];
if (node.value != null) {
- withExpression(node.value, (js.Expression value) {
- addStatement(js.js.statement("# = #;", [returnValue, value]));
- }, store: false);
+ withExpression(
+ node.value,
+ (js.Expression value) {
+ addStatement(js.js.statement("# = #;", [returnValue, value]));
+ }, store: false);
}
translateJump(target, exitLabel);
}
@@ -1285,17 +1307,20 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
// If only the key has an await, translation can be simplified.
bool oldInsideUntranslated = insideUntranslatedBreakable;
insideUntranslatedBreakable = true;
- withExpression(node.key, (js.Expression key) {
- List<js.SwitchClause> cases = node.cases.map((js.SwitchClause clause) {
- if (clause is js.Case) {
- return new js.Case(
- clause.expression, translateInBlock(clause.body));
- } else if (clause is js.Default) {
- return new js.Default(translateInBlock(clause.body));
- }
- }).toList();
- addStatement(new js.Switch(key, cases));
- }, store: false);
+ withExpression(
+ node.key,
+ (js.Expression key) {
+ List<js.SwitchClause> cases =
+ node.cases.map((js.SwitchClause clause) {
+ if (clause is js.Case) {
+ return new js.Case(
+ clause.expression, translateInBlock(clause.body));
+ } else if (clause is js.Default) {
+ return new js.Default(translateInBlock(clause.body));
+ }
+ }).toList();
+ addStatement(new js.Switch(key, cases));
+ }, store: false);
insideUntranslatedBreakable = oldInsideUntranslated;
return;
}
@@ -1312,26 +1337,30 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
int defaultIndex = null; // Null means no default was found.
// If there is an await in one of the keys, a chain of ifs has to be used.
- withExpression(node.key, (js.Expression key) {
- int i = 0;
- for (js.SwitchClause clause in node.cases) {
- if (clause is js.Default) {
- // The goto for the default case is added after all non-default
- // clauses have been handled.
- defaultIndex = i;
- labels[i] = newLabel("default");
- continue;
- } else if (clause is js.Case) {
- labels[i] = newLabel("case");
- withExpression(clause.expression, (expression) {
- addStatement(new js.If.noElse(
- new js.Binary("===", key, expression),
- gotoAndBreak(labels[i])));
- }, store: false);
- }
- i++;
- }
- }, store: true);
+ withExpression(
+ node.key,
+ (js.Expression key) {
+ int i = 0;
+ for (js.SwitchClause clause in node.cases) {
+ if (clause is js.Default) {
+ // The goto for the default case is added after all non-default
+ // clauses have been handled.
+ defaultIndex = i;
+ labels[i] = newLabel("default");
+ continue;
+ } else if (clause is js.Case) {
+ labels[i] = newLabel("case");
+ withExpression(
+ clause.expression,
+ (expression) {
+ addStatement(new js.If.noElse(
+ new js.Binary("===", key, expression),
+ gotoAndBreak(labels[i])));
+ }, store: false);
+ }
+ i++;
+ }
+ }, store: true);
if (defaultIndex == null) {
addGoto(after);
@@ -1360,9 +1389,11 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (!hasDefault) {
clauses.add(new js.Default(gotoAndBreak(after)));
}
- withExpression(node.key, (js.Expression key) {
- addStatement(new js.Switch(key, clauses));
- }, store: false);
+ withExpression(
+ node.key,
+ (js.Expression key) {
+ addStatement(new js.Switch(key, clauses));
+ }, store: false);
addBreak();
}
@@ -1383,9 +1414,11 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
@override
void visitThrow(js.Throw node) {
- withExpression(node.expression, (js.Expression expression) {
- addStatement(new js.Throw(expression));
- }, store: false);
+ withExpression(
+ node.expression,
+ (js.Expression expression) {
+ addStatement(new js.Throw(expression));
+ }, store: false);
}
setErrorHandler([int errorHandler]) {
@@ -1501,9 +1534,9 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
// [enclosingFinallies] can be empty if there is no surrounding finally
// blocks. Then [nextLabel] will be [rethrowLabel].
addStatement(js.js.statement("# = #;", [
- next,
- new js.ArrayInitializer(enclosingFinallies.map(js.number).toList())
- ]));
+ next,
+ new js.ArrayInitializer(enclosingFinallies.map(js.number).toList())
+ ]));
}
if (node.finallyPart == null) {
// The finally-block belonging to [node] will be visited because of
@@ -1539,10 +1572,12 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
js.VariableDeclaration declaration = initialization.declaration;
localVariables.add(declaration);
if (initialization.value != null) {
- withExpression(initialization.value, (js.Expression value) {
- initializations.add(
- new js.Assignment(new js.VariableUse(declaration.name), value));
- }, store: false);
+ withExpression(
+ initialization.value,
+ (js.Expression value) {
+ initializations.add(new js.Assignment(
+ new js.VariableUse(declaration.name), value));
+ }, store: false);
}
}
if (initializations.isEmpty) {
@@ -1564,7 +1599,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
@override
js.Expression visitVariableUse(js.VariableUse node) {
Pair<String, String> renaming = variableRenamings.lastWhere(
- (Pair renaming) => renaming.a == node.name, orElse: () => null);
+ (Pair renaming) => renaming.a == node.name,
+ orElse: () => null);
if (renaming == null) return node;
return new js.VariableUse(renaming.b);
}
@@ -1574,9 +1610,11 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (!shouldTransform(node)) {
bool oldInsideUntranslated = insideUntranslatedBreakable;
insideUntranslatedBreakable = true;
- withExpression(node.condition, (js.Expression condition) {
- addStatement(new js.While(condition, translateInBlock(node.body)));
- }, store: false);
+ withExpression(
+ node.condition,
+ (js.Expression condition) {
+ addStatement(new js.While(condition, translateInBlock(node.body)));
+ }, store: false);
insideUntranslatedBreakable = oldInsideUntranslated;
return;
}
@@ -1589,10 +1627,12 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
js.Expression condition = node.condition;
// If the condition is `true`, a test is not needed.
if (!(condition is js.LiteralBool && condition.value == true)) {
- withExpression(node.condition, (js.Expression condition) {
- addStatement(new js.If.noElse(
- new js.Prefix("!", condition), gotoAndBreak(afterLabel)));
- }, store: false);
+ withExpression(
+ node.condition,
+ (js.Expression condition) {
+ addStatement(new js.If.noElse(
+ new js.Prefix("!", condition), gotoAndBreak(afterLabel)));
+ }, store: false);
}
jumpTargets.add(node);
visitStatement(node.body);
@@ -1609,10 +1649,12 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
int label = newLabel("after yield");
// Don't do a break here for the goto, but instead a return in either
// addSynYield or addAsyncYield.
- withExpression(node.expression, (js.Expression expression) {
- addStatement(setGotoVariable(label));
- addYield(node, expression);
- }, store: false);
+ withExpression(
+ node.expression,
+ (js.Expression expression) {
+ addStatement(setGotoVariable(label));
+ addYield(node, expression);
+ }, store: false);
beginLabel(label);
}
}
@@ -1667,8 +1709,10 @@ class AsyncRewriter extends AsyncRewriterBase {
final js.Expression newCompleter;
AsyncRewriter(DiagnosticListener diagnosticListener, spannable,
- {this.asyncHelper, this.newCompleter,
- String safeVariableName(String proposedName), String bodyName})
+ {this.asyncHelper,
+ this.newCompleter,
+ String safeVariableName(String proposedName),
+ String bodyName})
: super(diagnosticListener, spannable, safeVariableName, bodyName);
@override
@@ -1680,12 +1724,12 @@ class AsyncRewriter extends AsyncRewriterBase {
void addErrorExit() {
beginLabel(rethrowLabel);
addStatement(js.js.statement(
- "return #thenHelper(#currentError, #errorCode, #completer);", {
- "thenHelper": asyncHelper,
- "errorCode": js.number(error_codes.ERROR),
- "currentError": currentError,
- "completer": completer
- }));
+ "return #thenHelper(#currentError, #errorCode, #completer);", {
+ "thenHelper": asyncHelper,
+ "errorCode": js.number(error_codes.ERROR),
+ "currentError": currentError,
+ "completer": completer
+ }));
}
/// Returning from an async method calls [asyncStarHelper] with the result.
@@ -1698,14 +1742,15 @@ class AsyncRewriter extends AsyncRewriterBase {
addStatement(new js.Comment("implicit return"));
}
addStatement(js.js.statement(
- "return #runtimeHelper(#returnValue, #successCode, "
- "#completer, null);", {
- "runtimeHelper": asyncHelper,
- "successCode": js.number(error_codes.SUCCESS),
- "returnValue":
- analysis.hasExplicitReturns ? returnValue : new js.LiteralNull(),
- "completer": completer
- }));
+ "return #runtimeHelper(#returnValue, #successCode, "
+ "#completer, null);",
+ {
+ "runtimeHelper": asyncHelper,
+ "successCode": js.number(error_codes.SUCCESS),
+ "returnValue":
+ analysis.hasExplicitReturns ? returnValue : new js.LiteralNull(),
+ "completer": completer
+ }));
}
@override
@@ -1727,11 +1772,13 @@ class AsyncRewriter extends AsyncRewriterBase {
@override
js.Statement awaitStatement(js.Expression value) {
- return js.js.statement("""
+ return js.js.statement(
+ """
return #asyncHelper(#value,
#body,
#completer);
- """, {
+ """,
+ {
"asyncHelper": asyncHelper,
"value": value,
"body": body,
@@ -1740,10 +1787,12 @@ class AsyncRewriter extends AsyncRewriterBase {
}
@override
- js.Fun finishFunction(List<js.Parameter> parameters,
+ js.Fun finishFunction(
+ List<js.Parameter> parameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations) {
- return js.js("""
+ return js.js(
+ """
function (#parameters) {
#variableDeclarations;
function #bodyName(#errorCode, #result) {
@@ -1754,7 +1803,8 @@ class AsyncRewriter extends AsyncRewriterBase {
#rewrittenBody;
}
return #asyncHelper(null, #bodyName, #completer, null);
- }""", {
+ }""",
+ {
"parameters": parameters,
"variableDeclarations": variableDeclarations,
"ERROR": js.number(error_codes.ERROR),
@@ -1792,9 +1842,12 @@ class SyncStarRewriter extends AsyncRewriterBase {
final js.Expression uncaughtErrorExpression;
SyncStarRewriter(DiagnosticListener diagnosticListener, spannable,
- {this.endOfIteration, this.newIterable, this.yieldStarExpression,
+ {this.endOfIteration,
+ this.newIterable,
+ this.yieldStarExpression,
this.uncaughtErrorExpression,
- String safeVariableName(String proposedName), String bodyName})
+ String safeVariableName(String proposedName),
+ String bodyName})
: super(diagnosticListener, spannable, safeVariableName, bodyName);
/// Translates a yield/yield* in an sync*.
@@ -1812,7 +1865,8 @@ class SyncStarRewriter extends AsyncRewriterBase {
}
@override
- js.Fun finishFunction(List<js.Parameter> parameters,
+ js.Fun finishFunction(
+ List<js.Parameter> parameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations) {
// Each iterator invocation on the iterable should work on its own copy of
@@ -1831,7 +1885,8 @@ class SyncStarRewriter extends AsyncRewriterBase {
}
js.VariableDeclarationList copyParameters =
new js.VariableDeclarationList(declarations);
- return js.js("""
+ return js.js(
+ """
function (#renamedParameters) {
if (#needsThis)
var #self = this;
@@ -1849,7 +1904,8 @@ class SyncStarRewriter extends AsyncRewriterBase {
};
});
}
- """, {
+ """,
+ {
"renamedParameters": renamedParameters,
"needsThis": analysis.hasThis,
"helperBody": rewrittenBody,
@@ -1952,9 +2008,13 @@ class AsyncStarRewriter extends AsyncRewriterBase {
final js.Expression yieldStarExpression;
AsyncStarRewriter(DiagnosticListener diagnosticListener, spannable,
- {this.asyncStarHelper, this.streamOfController, this.newController,
- this.yieldExpression, this.yieldStarExpression,
- String safeVariableName(String proposedName), String bodyName})
+ {this.asyncStarHelper,
+ this.streamOfController,
+ this.newController,
+ this.yieldExpression,
+ this.yieldStarExpression,
+ String safeVariableName(String proposedName),
+ String bodyName})
: super(diagnosticListener, spannable, safeVariableName, bodyName);
/// Translates a yield/yield* in an async* function.
@@ -1975,25 +2035,31 @@ class AsyncStarRewriter extends AsyncRewriterBase {
.where((js.Node node) => finallyLabels[node] != null)
.map((js.Block node) => finallyLabels[node]));
addStatement(js.js.statement("# = #;", [
- nextWhenCanceled,
- new js.ArrayInitializer(enclosingFinallyLabels.map(js.number).toList())
- ]));
- addStatement(js.js.statement("""
+ nextWhenCanceled,
+ new js.ArrayInitializer(
+ enclosingFinallyLabels.map(js.number).toList())
+ ]));
+ addStatement(js.js.statement(
+ """
return #asyncStarHelper(#yieldExpression(#expression), #body,
- #controller);""", {
- "asyncStarHelper": asyncStarHelper,
- "yieldExpression": node.hasStar ? yieldStarExpression : yieldExpression,
- "expression": expression,
- "body": body,
- "controller": controllerName,
- }));
+ #controller);""",
+ {
+ "asyncStarHelper": asyncStarHelper,
+ "yieldExpression":
+ node.hasStar ? yieldStarExpression : yieldExpression,
+ "expression": expression,
+ "body": body,
+ "controller": controllerName,
+ }));
}
@override
- js.Fun finishFunction(List<js.Parameter> parameters,
+ js.Fun finishFunction(
+ List<js.Parameter> parameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations) {
- return js.js("""
+ return js.js(
+ """
function (#parameters) {
#variableDeclarations;
function #bodyName(#errorCode, #result) {
@@ -2016,7 +2082,8 @@ class AsyncStarRewriter extends AsyncRewriterBase {
#rewrittenBody;
}
return #streamOfController(#controller);
- }""", {
+ }""",
+ {
"parameters": parameters,
"variableDeclarations": variableDeclarations,
"STREAM_WAS_CANCELED": js.number(error_codes.STREAM_WAS_CANCELED),
@@ -2040,12 +2107,12 @@ class AsyncStarRewriter extends AsyncRewriterBase {
void addErrorExit() {
beginLabel(rethrowLabel);
addStatement(js.js.statement(
- "return #asyncHelper(#currentError, #errorCode, #controller);", {
- "asyncHelper": asyncStarHelper,
- "errorCode": js.number(error_codes.ERROR),
- "currentError": currentError,
- "controller": controllerName
- }));
+ "return #asyncHelper(#currentError, #errorCode, #controller);", {
+ "asyncHelper": asyncStarHelper,
+ "errorCode": js.number(error_codes.ERROR),
+ "currentError": currentError,
+ "controller": controllerName
+ }));
}
/// Returning from an async* function calls the [streamHelper] with an
@@ -2055,11 +2122,11 @@ class AsyncStarRewriter extends AsyncRewriterBase {
beginLabel(exitLabel);
addStatement(js.js.statement(
- "return #streamHelper(null, #successCode, #controller);", {
- "streamHelper": asyncStarHelper,
- "successCode": js.number(error_codes.SUCCESS),
- "controller": controllerName
- }));
+ "return #streamHelper(null, #successCode, #controller);", {
+ "streamHelper": asyncStarHelper,
+ "successCode": js.number(error_codes.SUCCESS),
+ "controller": controllerName
+ }));
}
@override
@@ -2082,11 +2149,13 @@ class AsyncStarRewriter extends AsyncRewriterBase {
@override
js.Statement awaitStatement(js.Expression value) {
- return js.js.statement("""
+ return js.js.statement(
+ """
return #asyncHelper(#value,
#body,
#controller);
- """, {
+ """,
+ {
"asyncHelper": asyncStarHelper,
"value": value,
"body": body,
@@ -2193,8 +2262,8 @@ class PreTranslationAnalysis extends js.NodeVisitor<bool> {
@override
bool visitBreak(js.Break node) {
if (node.targetLabel != null) {
- targets[node] = labelledStatements
- .lastWhere((js.LabeledStatement statement) {
+ targets[node] =
+ labelledStatements.lastWhere((js.LabeledStatement statement) {
return statement.label == node.targetLabel;
});
} else {
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index b09e817..db8adbe 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -107,7 +107,8 @@ class FunctionInlineCache {
if (insideLoop) {
switch (oldDecision) {
case _mustNotInline:
- throw new SpannableAssertionFailure(element,
+ throw new SpannableAssertionFailure(
+ element,
"Can't mark a function as non-inlinable and inlinable at the "
"same time.");
@@ -133,7 +134,8 @@ class FunctionInlineCache {
case _mustNotInline:
case _mayInlineInLoopMustNotOutside:
case _canInlineInLoopMustNotOutside:
- throw new SpannableAssertionFailure(element,
+ throw new SpannableAssertionFailure(
+ element,
"Can't mark a function as non-inlinable and inlinable at the "
"same time.");
@@ -163,7 +165,8 @@ class FunctionInlineCache {
case _canInlineInLoopMayInlineOutside:
case _canInline:
case _mustInline:
- throw new SpannableAssertionFailure(element,
+ throw new SpannableAssertionFailure(
+ element,
"Can't mark a function as non-inlinable and inlinable at the "
"same time.");
@@ -180,7 +183,8 @@ class FunctionInlineCache {
switch (oldDecision) {
case _canInline:
case _mustInline:
- throw new SpannableAssertionFailure(element,
+ throw new SpannableAssertionFailure(
+ element,
"Can't mark a function as non-inlinable and inlinable at the "
"same time.");
@@ -769,8 +773,8 @@ class JavaScriptBackend extends Backend {
* explicit receiver' optimization.
*/
bool isInterceptedMixinSelector(Selector selector) {
- Set<Element> elements = interceptedMixinElements.putIfAbsent(selector.name,
- () {
+ Set<Element> elements =
+ interceptedMixinElements.putIfAbsent(selector.name, () {
Set<Element> elements = interceptedElements[selector.name];
if (elements == null) return null;
return elements
@@ -1005,7 +1009,8 @@ class JavaScriptBackend extends Backend {
if (ctor == null ||
(isPrivateName(name) &&
ctor.library != mapLiteralClass.library)) {
- compiler.internalError(mapLiteralClass,
+ compiler.internalError(
+ mapLiteralClass,
"Map literal class $mapLiteralClass missing "
"'$name' constructor"
" ${mapLiteralClass.constructors}");
@@ -1018,7 +1023,8 @@ class JavaScriptBackend extends Backend {
ClassElement implementation = cls.patch != null ? cls.patch : cls;
Element element = implementation.lookupLocalMember(name);
if (element == null || !element.isFunction || !element.isStatic) {
- compiler.internalError(mapLiteralClass,
+ compiler.internalError(
+ mapLiteralClass,
"Map literal class $mapLiteralClass missing "
"'$name' static member function");
}
@@ -1156,7 +1162,8 @@ class JavaScriptBackend extends Backend {
}
void registerBoundClosure(Enqueuer enqueuer) {
- enqueuer.registerInstantiatedClass(boundClosureClass,
+ enqueuer.registerInstantiatedClass(
+ boundClosureClass,
// Precise dependency is not important here.
compiler.globalDependencies);
}
@@ -1933,7 +1940,8 @@ class JavaScriptBackend extends Backend {
boundClosureClass = lookupHelperClass('BoundClosure');
closureClass = lookupHelperClass('Closure');
if (!missingHelperClasses.isEmpty) {
- compiler.internalError(jsHelperLibrary,
+ compiler.internalError(
+ jsHelperLibrary,
'dart:_js_helper library does not contain required classes: '
'$missingHelperClasses');
}
@@ -2329,7 +2337,8 @@ class JavaScriptBackend extends Backend {
// TODO(20791): compute closure classes after resolution and move this code to
// [computeMembersNeededForReflection].
void maybeMarkClosureAsNeededForReflection(
- ClosureClassElement globalizedElement, FunctionElement callFunction,
+ ClosureClassElement globalizedElement,
+ FunctionElement callFunction,
FunctionElement function) {
if (!_membersNeededForReflection.contains(function)) return;
_membersNeededForReflection.add(callFunction);
@@ -2449,9 +2458,10 @@ class JavaScriptBackend extends Backend {
compiler.libraryLoader.libraries.forEach(retainMetadataOf);
if (!enqueuer.isResolutionQueue) {
for (Dependency dependency in metadataConstants) {
- registerCompileTimeConstant(dependency.constant, new CodegenRegistry(
- compiler,
- dependency.annotatedElement.analyzableElement.treeElements));
+ registerCompileTimeConstant(
+ dependency.constant,
+ new CodegenRegistry(compiler,
+ dependency.annotatedElement.analyzableElement.treeElements));
}
metadataConstants.clear();
}
@@ -2493,7 +2503,8 @@ class JavaScriptBackend extends Backend {
} else if (cls == noThrowsClass) {
hasNoThrows = true;
if (!Elements.isStaticOrTopLevelFunction(element)) {
- compiler.internalError(element,
+ compiler.internalError(
+ element,
"@NoThrows() is currently limited to top-level"
" or static functions");
}
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index a9ae9ff..da4e016 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -112,8 +112,10 @@ class CodeGenerator extends tree_ir.StatementVisitor
if (jsVariables.length > 0) {
// Would be nice to avoid inserting at the beginning of list.
- accumulator.insert(0, new js.ExpressionStatement(
- new js.VariableDeclarationList(jsVariables)));
+ accumulator.insert(
+ 0,
+ new js.ExpressionStatement(
+ new js.VariableDeclarationList(jsVariables)));
}
return new js.Fun(parameters, new js.Block(accumulator));
}
@@ -189,7 +191,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
@override
js.Expression visitConditional(tree_ir.Conditional node) {
- return new js.Conditional(visitExpression(node.condition),
+ return new js.Conditional(
+ visitExpression(node.condition),
visitExpression(node.thenExpression),
visitExpression(node.elseExpression));
}
@@ -248,10 +251,13 @@ class CodeGenerator extends tree_ir.StatementVisitor
} else if (selector.isSetter) {
registry.registerDynamicSetter(selector);
} else {
- assert(invariant(CURRENT_ELEMENT_SPANNABLE, selector.isCall ||
- selector.isOperator ||
- selector.isIndex ||
- selector.isIndexSet, message: 'unexpected kind ${selector.kind}'));
+ assert(invariant(
+ CURRENT_ELEMENT_SPANNABLE,
+ selector.isCall ||
+ selector.isOperator ||
+ selector.isIndex ||
+ selector.isIndexSet,
+ message: 'unexpected kind ${selector.kind}'));
// TODO(sigurdm): We should find a better place to register the call.
Selector call = new Selector.callClosureFrom(selector);
registry.registerDynamicInvocation(call);
@@ -322,7 +328,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
: <js.Expression>[new js.ArrayInitializer(entries)];
return buildStaticInvoke(
new Selector.call(constructor.name, constructor.library, 2),
- constructor, args);
+ constructor,
+ args);
}
@override
@@ -424,7 +431,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
@override
void visitIf(tree_ir.If node) {
- accumulator.add(new js.If(visitExpression(node.condition),
+ accumulator.add(new js.If(
+ visitExpression(node.condition),
buildBodyStatement(node.thenStatement),
buildBodyStatement(node.elseStatement)));
}
@@ -577,13 +585,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
new js.ArrayInitializer(node.arguments.map(visitExpression).toList());
js.Expression argumentNames = new js.ArrayInitializer(
node.selector.namedArguments.map(js.string).toList());
- return buildStaticHelperInvocation(glue.createInvocationMirrorMethod, [
- name,
- internalName,
- kind,
- arguments,
- argumentNames
- ]);
+ return buildStaticHelperInvocation(glue.createInvocationMirrorMethod,
+ [name, internalName, kind, arguments, argumentNames]);
}
@override
@@ -650,11 +653,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
js.Expression index = js.number(glue.getTypeVariableIndex(node.variable));
if (glue.needsSubstitutionForTypeVariableAccess(context)) {
js.Expression typeName = glue.getRuntimeTypeName(context);
- return buildStaticHelperInvocation(glue.getRuntimeTypeArgument(), [
- visitExpression(node.target),
- typeName,
- index
- ]);
+ return buildStaticHelperInvocation(glue.getRuntimeTypeArgument(),
+ [visitExpression(node.target), typeName, index]);
} else {
return buildStaticHelperInvocation(
glue.getTypeArgumentByIndex(), [visitExpression(node.target), index]);
diff --git a/pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart b/pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart
index 2a13e3d..ccda7c2 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart
@@ -62,7 +62,8 @@ class JsTreeBuilder extends Builder {
}
Expression visitCreateInstance(cps_ir.CreateInstance node) {
- return new CreateInstance(node.classElement,
+ return new CreateInstance(
+ node.classElement,
node.arguments.map(getVariableUse).toList(growable: false),
node.typeInformation.map(getVariableUse).toList(growable: false));
}
diff --git a/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart b/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart
index 95eedf8..8a8e7ba 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart
@@ -117,17 +117,20 @@ class UnsugarVisitor extends RecursiveVisitor {
Continuation returnFalse = new Continuation(<Parameter>[]);
Primitive falsePrimitive = falseConstant;
- returnFalse.body = new LetPrim(falsePrimitive, new InvokeContinuation(
- function.body.returnContinuation, <Primitive>[falsePrimitive]));
+ returnFalse.body = new LetPrim(
+ falsePrimitive,
+ new InvokeContinuation(
+ function.body.returnContinuation, <Primitive>[falsePrimitive]));
Primitive nullPrimitive = nullConstant;
Primitive test = new Identical(function.parameters.single, nullPrimitive);
- Expression newBody = new LetCont.many(<Continuation>[
- returnFalse,
- originalBody
- ], new LetPrim(nullPrimitive, new LetPrim(
- test, new Branch(new IsTrue(test), returnFalse, originalBody))));
+ Expression newBody = new LetCont.many(
+ <Continuation>[returnFalse, originalBody],
+ new LetPrim(
+ nullPrimitive,
+ new LetPrim(test,
+ new Branch(new IsTrue(test), returnFalse, originalBody))));
function.body.body = newBody;
}
@@ -265,8 +268,12 @@ class UnsugarVisitor extends RecursiveVisitor {
IsTrue condition = node.condition;
Primitive t = trueConstant;
Primitive i = new Identical(condition.value.definition, t);
- LetPrim newNode = new LetPrim(t, new LetPrim(i, new Branch(new IsTrue(i),
- node.trueContinuation.definition, node.falseContinuation.definition)));
+ LetPrim newNode = new LetPrim(
+ t,
+ new LetPrim(
+ i,
+ new Branch(new IsTrue(i), node.trueContinuation.definition,
+ node.falseContinuation.definition)));
condition.value.unlink();
node.trueContinuation.unlink();
node.falseContinuation.unlink();
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
index 36e9cdb..659e827 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -30,7 +30,9 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
* constant, either return a reference or return its literal expression if it
* can be inlined.
*/
- ConstantEmitter(this.compiler, this.namer,
+ ConstantEmitter(
+ this.compiler,
+ this.namer,
jsAst.Expression this.constantReferenceGenerator(ConstantValue constant),
this.makeConstantListTemplate);
@@ -215,7 +217,8 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
} else if (field.name == JavaScriptMapConstant.JS_DATA_NAME) {
arguments.add(jsGeneralMap());
} else {
- compiler.internalError(field,
+ compiler.internalError(
+ field,
"Compiler has unexpected field ${field.name} for "
"${className}.");
}
diff --git a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
index ccbedcf..da48ba4 100644
--- a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
@@ -43,8 +43,8 @@ class JavaScriptConstantTask extends ConstantCompilerTask {
ConstantExpression compileNode(Node node, TreeElements elements,
{bool enforceConst: true}) {
return measure(() {
- ConstantExpression result = dartConstantCompiler.compileNode(
- node, elements, enforceConst: enforceConst);
+ ConstantExpression result = dartConstantCompiler
+ .compileNode(node, elements, enforceConst: enforceConst);
jsConstantCompiler.compileNode(node, elements,
enforceConst: enforceConst);
return result;
@@ -94,8 +94,8 @@ class JavaScriptConstantCompiler extends ConstantCompilerBase
if (!isConst && lazyStatics.contains(element)) {
return null;
}
- ConstantExpression value = super.compileVariableWithDefinitions(
- element, definitions, isConst: isConst);
+ ConstantExpression value = super
+ .compileVariableWithDefinitions(element, definitions, isConst: isConst);
if (!isConst && value == null) {
lazyStatics.add(element);
}
@@ -169,7 +169,8 @@ class JavaScriptConstantCompiler extends ConstantCompilerBase
}
ConstantExpression compileNodeWithDefinitions(
- Node node, TreeElements definitions, {bool isConst: true}) {
+ Node node, TreeElements definitions,
+ {bool isConst: true}) {
ConstantExpression constant = nodeConstantMap[node];
if (constant != null) {
return constant;
diff --git a/pkg/compiler/lib/src/js_backend/minify_namer.dart b/pkg/compiler/lib/src/js_backend/minify_namer.dart
index e9214ec..7995341 100644
--- a/pkg/compiler/lib/src/js_backend/minify_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/minify_namer.dart
@@ -256,8 +256,8 @@ class MinifyNamer extends Namer {
// 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(suggestedInstanceNames, usedInstanceNames,
- const <String>[
+ _populateSuggestedNames(
+ suggestedInstanceNames, usedInstanceNames, const <String>[
r'$add',
r'add$1',
r'$and',
@@ -298,8 +298,8 @@ class MinifyNamer extends Namer {
r'toString$0'
]);
- _populateSuggestedNames(suggestedGlobalNames, usedGlobalNames,
- const <String>[
+ _populateSuggestedNames(
+ suggestedGlobalNames, usedGlobalNames, const <String>[
r'Object',
'wrapException',
r'$eq',
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 69c85a0..9759811 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -648,8 +648,8 @@ class Namer {
final Map<String, int> popularNameCounters = <String, int>{};
final Map<ConstantValue, String> constantNames = <ConstantValue, String>{};
- final Map<ConstantValue, String> constantLongNames = <ConstantValue, String>{
- };
+ final Map<ConstantValue, String> constantLongNames =
+ <ConstantValue, String>{};
ConstantCanonicalHasher constantHasher;
/// Maps private names to a library that may use that name without prefixing
@@ -724,9 +724,8 @@ class Namer {
case JsGetName.DEFERRED_ACTION_PROPERTY:
return deferredAction;
default:
- compiler.reportError(node, MessageKind.GENERIC, {
- 'text': 'Error: Namer has no name for "$name".'
- });
+ compiler.reportError(node, MessageKind.GENERIC,
+ {'text': 'Error: Namer has no name for "$name".'});
return 'BROKEN';
}
}
diff --git a/pkg/compiler/lib/src/js_backend/patch_resolver.dart b/pkg/compiler/lib/src/js_backend/patch_resolver.dart
index ed4e394..72d3e6e 100644
--- a/pkg/compiler/lib/src/js_backend/patch_resolver.dart
+++ b/pkg/compiler/lib/src/js_backend/patch_resolver.dart
@@ -57,10 +57,10 @@ class PatchResolverTask extends CompilerTask {
'originParameterType': originParameterType,
'patchParameterType': patchParameterType
});
- compiler.reportInfo(patchParameter,
- MessageKind.PATCH_POINT_TO_PARAMETER, {
- 'parameterName': patchParameter.name
- });
+ compiler.reportInfo(
+ patchParameter,
+ MessageKind.PATCH_POINT_TO_PARAMETER,
+ {'parameterName': patchParameter.name});
} else {
// Hack: Use unparser to test parameter equality. This only works
// because we are restricting patch uses and the approach cannot be used
@@ -75,17 +75,18 @@ class PatchResolverTask extends CompilerTask {
if (originParameterText != patchParameterText
// We special case the list constructor because of the
// optional parameter.
- && origin != compiler.unnamedListConstructor) {
+ &&
+ origin != compiler.unnamedListConstructor) {
compiler.reportError(originParameter.parseNode(compiler),
MessageKind.PATCH_PARAMETER_MISMATCH, {
'methodName': origin.name,
'originParameter': originParameterText,
'patchParameter': patchParameterText
});
- compiler.reportInfo(patchParameter,
- MessageKind.PATCH_POINT_TO_PARAMETER, {
- 'parameterName': patchParameter.name
- });
+ compiler.reportInfo(
+ patchParameter,
+ MessageKind.PATCH_POINT_TO_PARAMETER,
+ {'parameterName': patchParameter.name});
}
}
}
@@ -102,8 +103,8 @@ class PatchResolverTask extends CompilerTask {
compiler.withCurrentElement(patch, () {
Node errorNode =
patchTree.returnType != null ? patchTree.returnType : patchTree;
- compiler.reportError(errorNode, MessageKind.PATCH_RETURN_TYPE_MISMATCH,
- {
+ compiler.reportError(
+ errorNode, MessageKind.PATCH_RETURN_TYPE_MISMATCH, {
'methodName': origin.name,
'originReturnType': originSignature.type.returnType,
'patchReturnType': patchSignature.type.returnType
@@ -113,8 +114,8 @@ class PatchResolverTask extends CompilerTask {
if (originSignature.requiredParameterCount !=
patchSignature.requiredParameterCount) {
compiler.withCurrentElement(patch, () {
- compiler.reportError(patchTree,
- MessageKind.PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH, {
+ compiler.reportError(
+ patchTree, MessageKind.PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH, {
'methodName': origin.name,
'originParameterCount': originSignature.requiredParameterCount,
'patchParameterCount': patchSignature.requiredParameterCount
@@ -129,18 +130,18 @@ class PatchResolverTask extends CompilerTask {
if (originSignature.optionalParametersAreNamed !=
patchSignature.optionalParametersAreNamed) {
compiler.withCurrentElement(patch, () {
- compiler.reportError(patchTree,
- MessageKind.PATCH_OPTIONAL_PARAMETER_NAMED_MISMATCH, {
- 'methodName': origin.name
- });
+ compiler.reportError(
+ patchTree,
+ MessageKind.PATCH_OPTIONAL_PARAMETER_NAMED_MISMATCH,
+ {'methodName': origin.name});
});
}
}
if (originSignature.optionalParameterCount !=
patchSignature.optionalParameterCount) {
compiler.withCurrentElement(patch, () {
- compiler.reportError(patchTree,
- MessageKind.PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH, {
+ compiler.reportError(
+ patchTree, MessageKind.PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH, {
'methodName': origin.name,
'originParameterCount': originSignature.optionalParameterCount,
'patchParameterCount': patchSignature.optionalParameterCount
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index ce86377..33586ca 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -630,7 +630,8 @@ class TypeRepresentationGenerator implements DartTypeVisitor {
* Creates a type representation for [type]. [onVariable] is called to provide
* the type representation for type variables.
*/
- jsAst.Expression getTypeRepresentation(DartType type,
+ jsAst.Expression getTypeRepresentation(
+ DartType type,
OnVariableCallback onVariable,
ShouldEncodeTypedefCallback encodeTypedef) {
this.onVariable = onVariable;
diff --git a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
index 9472800..5302d7c 100644
--- a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
+++ b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
@@ -76,7 +76,8 @@ class TypeVariableHandler {
}
ConstantExpression name = new StringConstantExpression(
- currentTypeVariable.name, _backend.constantSystem
+ currentTypeVariable.name,
+ _backend.constantSystem
.createString(new DartString.literal(currentTypeVariable.name)));
int boundIndex = _metadataCollector.reifyType(typeVariableElement.bound);
ConstantExpression bound = new IntConstantExpression(
@@ -93,11 +94,18 @@ class TypeVariableHandler {
// TODO(johnniwinther): Support a less front-end specific creation of
// constructed constants.
AstConstant constant = CompileTimeConstantEvaluator
- .makeConstructedConstant(_compiler, _backend.constants,
- typeVariableElement, typeVariableElement.node, typeVariableType,
- _typeVariableConstructor, typeVariableType,
- _typeVariableConstructor, const CallStructure.unnamed(3),
- arguments, arguments);
+ .makeConstructedConstant(
+ _compiler,
+ _backend.constants,
+ typeVariableElement,
+ typeVariableElement.node,
+ typeVariableType,
+ _typeVariableConstructor,
+ typeVariableType,
+ _typeVariableConstructor,
+ const CallStructure.unnamed(3),
+ arguments,
+ arguments);
ConstantValue value = constant.value;
_backend.registerCompileTimeConstant(value, _compiler.globalDependencies);
_backend.constants.addCompileTimeConstantForEmission(value);
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 1602f32..a80ff28 100644
--- a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
@@ -102,12 +102,8 @@ class ClassStubGenerator {
arguments.add(js('#', name));
}
- jsAst.Fun function = js('function(#) { return #.#(#); }', [
- parameters,
- buildGetter(),
- closureCallName,
- arguments
- ]);
+ jsAst.Fun function = js('function(#) { return #.#(#); }',
+ [parameters, buildGetter(), closureCallName, arguments]);
generatedStubs[invocationName] = function;
}
@@ -161,12 +157,14 @@ class ClassStubGenerator {
String internalName = namer.invocationMirrorInternalName(selector);
assert(backend.isInterceptedName(Compiler.NO_SUCH_METHOD));
- jsAst.Expression expression = js('''this.#noSuchMethodName(this,
+ jsAst.Expression expression = js(
+ '''this.#noSuchMethodName(this,
#createInvocationMirror(#methodName,
#internalName,
#type,
#arguments,
- #namedArguments))''', {
+ #namedArguments))''',
+ {
'noSuchMethodName': namer.noSuchMethodName,
'createInvocationMirror': backend.emitter
.staticFunctionAccess(backend.getCreateInvocationMirror()),
@@ -255,7 +253,8 @@ function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
"}")(funcs, reflectionInfo, name, $tearOffGlobalObject, null);
}''').instantiate([]);
} else {
- tearOffGetter = js.statement('''
+ tearOffGetter = js.statement(
+ '''
function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
var cache = null;
return isIntercepted
@@ -269,10 +268,12 @@ function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
this, funcs, reflectionInfo, false, [], name);
return new cache(this, funcs[0], null, name);
};
- }''', [tearOffAccessExpression, tearOffAccessExpression]);
+ }''',
+ [tearOffAccessExpression, tearOffAccessExpression]);
}
- jsAst.Statement tearOff = js.statement('''
+ jsAst.Statement tearOff = js.statement(
+ '''
function tearOff(funcs, reflectionInfo, isStatic, name, isIntercepted) {
var cache;
return isStatic
@@ -282,7 +283,8 @@ function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
return cache;
}
: tearOffGetter(funcs, reflectionInfo, name, isIntercepted);
- }''', {'tearOff': tearOffAccessExpression});
+ }''',
+ {'tearOff': tearOffAccessExpression});
return <jsAst.Statement>[tearOffGetter, tearOff];
}
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 d881617..f64beeb 100644
--- a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
+++ b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
@@ -215,8 +215,11 @@ class CodeEmitterTask extends CompilerTask {
if (!onlyForRti) {
backend.retainMetadataOf(cls);
oldEmitter.classEmitter.visitFields(cls, false, (Element member,
- String name, String accessorName, bool needsGetter,
- bool needsSetter, bool needsCheckedSetter) {
+ String name,
+ String accessorName,
+ bool needsGetter,
+ bool needsSetter,
+ bool needsCheckedSetter) {
bool needsAccessor = needsGetter || needsSetter;
if (needsAccessor && backend.isAccessibleByReflection(member)) {
backend.retainMetadataOf(member);
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 8e801e5..d1dd4c1 100644
--- a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
@@ -106,10 +106,12 @@ class InterceptorStubGenerator {
hasDouble ? backend.jsDoubleClass : backend.jsNumberClass);
if (hasInt) {
- whenNumber = js.statement('''{
+ whenNumber = js.statement(
+ '''{
if (Math.floor(receiver) == receiver) return #;
return #;
- }''', [interceptorFor(backend.jsIntClass), interceptorForNumber]);
+ }''',
+ [interceptorFor(backend.jsIntClass), interceptorForNumber]);
} else {
whenNumber = js.statement('return #', interceptorForNumber);
}
@@ -138,22 +140,25 @@ class InterceptorStubGenerator {
}
if (hasNative) {
- statements.add(js.statement(r'''{
+ statements.add(js.statement(
+ r'''{
if (typeof receiver != "object") return receiver;
if (receiver instanceof #) return receiver;
return #(receiver);
- }''', [
- backend.emitter.constructorAccess(compiler.objectClass),
- backend.emitter.staticFunctionAccess(backend.getNativeInterceptorMethod)
- ]));
+ }''',
+ [
+ backend.emitter.constructorAccess(compiler.objectClass),
+ backend.emitter
+ .staticFunctionAccess(backend.getNativeInterceptorMethod)
+ ]));
} else {
ClassElement jsUnknown = backend.jsUnknownJavaScriptObjectClass;
if (compiler.codegenWorld.directlyInstantiatedClasses
.contains(jsUnknown)) {
statements.add(js.statement('if (!(receiver instanceof #)) return #;', [
- backend.emitter.constructorAccess(compiler.objectClass),
- interceptorFor(jsUnknown)
- ]));
+ backend.emitter.constructorAccess(compiler.objectClass),
+ interceptorFor(jsUnknown)
+ ]));
}
statements.add(js.statement('return receiver'));
@@ -192,7 +197,8 @@ class InterceptorStubGenerator {
}
return js.statement(
'if (typeof receiver == "number" && typeof a0 == "number")'
- ' return #;', result);
+ ' return #;',
+ result);
} else if (name == 'unary-') {
return js
.statement('if (typeof receiver == "number") return -receiver');
@@ -222,10 +228,11 @@ class InterceptorStubGenerator {
bool containsArray = classes.contains(backend.jsArrayClass);
bool containsString = classes.contains(backend.jsStringClass);
bool containsJsIndexable =
- backend.jsIndexingBehaviorInterface.isResolved && classes.any((cls) {
- return compiler.world.isSubtypeOf(
- cls, backend.jsIndexingBehaviorInterface);
- });
+ backend.jsIndexingBehaviorInterface.isResolved &&
+ classes.any((cls) {
+ return compiler.world.isSubtypeOf(
+ cls, backend.jsIndexingBehaviorInterface);
+ });
// The index set operator requires a check on its set value in
// checked mode, so we don't optimize the interceptor if the
// compiler has type assertions enabled.
@@ -258,11 +265,13 @@ class InterceptorStubGenerator {
typeCheck = orExp(typeCheck, indexableCheck);
}
- return js.statement('''
+ return js.statement(
+ '''
if (#)
if ((a0 >>> 0) === a0 && a0 < receiver.length)
return receiver[a0];
- ''', typeCheck);
+ ''',
+ typeCheck);
} else {
jsAst.Expression typeCheck;
if (containsArray) {
@@ -273,11 +282,13 @@ class InterceptorStubGenerator {
typeCheck = orExp(typeCheck, indexableCheck);
}
- return js.statement(r'''
+ return js.statement(
+ r'''
if (# && !receiver.immutable$list &&
(a0 >>> 0) === a0 && a0 < receiver.length)
return receiver[a0] = a1;
- ''', typeCheck);
+ ''',
+ typeCheck);
}
}
return null;
diff --git a/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
index 25df091..587a144 100644
--- a/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
@@ -19,10 +19,8 @@ class MainCallStubGenerator {
emitterTask.isolateStaticClosureAccess(appMain);
// Since we pass the closurized version of the main method to
// the isolate method, we must make sure that it exists.
- return js('function(a){ #(#, a); }', [
- emitterTask.staticFunctionAccess(isolateMain),
- mainAccess
- ]);
+ return js('function(a){ #(#, a); }',
+ [emitterTask.staticFunctionAccess(isolateMain), mainAccess]);
}
jsAst.Statement generateInvokeMain() {
@@ -46,7 +44,8 @@ class MainCallStubGenerator {
// onload event of all script tags and getting the first script which
// finishes. Since onload is called immediately after execution this should
// not substantially change execution order.
- return js.statement('''
+ return js.statement(
+ '''
(function (callback) {
if (typeof document === "undefined") {
callback(null);
@@ -75,7 +74,8 @@ class MainCallStubGenerator {
} else {
#mainCallClosure([]);
}
- })''', {
+ })''',
+ {
'currentScript': currentScriptAccess,
'mainCallClosure': mainCallClosure
});
diff --git a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
index fd5ef89..354d722 100644
--- a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
+++ b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
@@ -97,8 +97,8 @@ class MetadataCollector {
int reifyTypeForOutputUnit(DartType type, OutputUnit outputUnit,
{bool ignoreTypeVariables: false}) {
- jsAst.Expression representation = _backend.rti.getTypeRepresentation(type,
- (variable) {
+ jsAst.Expression representation =
+ _backend.rti.getTypeRepresentation(type, (variable) {
if (ignoreTypeVariables) return new jsAst.LiteralNull();
return js
.number(_typeVariableHandler.reifyTypeVariable(variable.element));
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index 15c5090..1ccdf07 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -31,8 +31,10 @@ class Program {
final MetadataCollector _metadataCollector;
Program(this.fragments, this.holders, this.loadMap, this.typeToInterceptorMap,
- this._metadataCollector, {this.needsNativeSupport,
- this.outputContainsConstantList, this.hasIsolateSupport}) {
+ this._metadataCollector,
+ {this.needsNativeSupport,
+ this.outputContainsConstantList,
+ this.hasIsolateSupport}) {
assert(needsNativeSupport != null);
assert(outputContainsConstantList != null);
assert(hasIsolateSupport != null);
@@ -99,8 +101,12 @@ abstract class Fragment {
/// Output file name without extension.
final String outputFileName;
- Fragment(this.outputUnit, this.outputFileName, this.libraries,
- this.staticNonFinalFields, this.staticLazilyInitializedFields,
+ Fragment(
+ this.outputUnit,
+ this.outputFileName,
+ this.libraries,
+ this.staticNonFinalFields,
+ this.staticLazilyInitializedFields,
this.constants);
bool get isMainFragment;
@@ -115,9 +121,14 @@ abstract class Fragment {
class MainFragment extends Fragment {
final js.Statement invokeMain;
- MainFragment(OutputUnit outputUnit, String outputFileName, this.invokeMain,
- List<Library> libraries, List<StaticField> staticNonFinalFields,
- List<StaticField> staticLazilyInitializedFields, List<Constant> constants)
+ MainFragment(
+ OutputUnit outputUnit,
+ String outputFileName,
+ this.invokeMain,
+ List<Library> libraries,
+ List<StaticField> staticNonFinalFields,
+ List<StaticField> staticLazilyInitializedFields,
+ List<Constant> constants)
: super(outputUnit, outputFileName, libraries, staticNonFinalFields,
staticLazilyInitializedFields, constants);
@@ -130,9 +141,14 @@ class MainFragment extends Fragment {
class DeferredFragment extends Fragment {
final String name;
- DeferredFragment(OutputUnit outputUnit, String outputFileName, this.name,
- List<Library> libraries, List<StaticField> staticNonFinalFields,
- List<StaticField> staticLazilyInitializedFields, List<Constant> constants)
+ DeferredFragment(
+ OutputUnit outputUnit,
+ String outputFileName,
+ this.name,
+ List<Library> libraries,
+ List<StaticField> staticNonFinalFields,
+ List<StaticField> staticLazilyInitializedFields,
+ List<Constant> constants)
: super(outputUnit, outputFileName, libraries, staticNonFinalFields,
staticLazilyInitializedFields, constants);
@@ -218,11 +234,21 @@ class Class implements FieldContainer {
/// Data that must be emitted with the class for native interop.
String nativeInfo;
- Class(this.element, this.name, this.holder, this.methods, this.fields,
- this.staticFieldsForReflection, this.callStubs,
- this.typeVariableReaderStubs, this.noSuchMethodStubs, this.isChecks,
+ Class(
+ this.element,
+ this.name,
+ this.holder,
+ this.methods,
+ this.fields,
+ this.staticFieldsForReflection,
+ this.callStubs,
+ this.typeVariableReaderStubs,
+ this.noSuchMethodStubs,
+ this.isChecks,
this.functionTypeIndex,
- {this.onlyForRti, this.isDirectlyInstantiated, this.isNative}) {
+ {this.onlyForRti,
+ this.isDirectlyInstantiated,
+ this.isNative}) {
assert(onlyForRti != null);
assert(isDirectlyInstantiated != null);
assert(isNative != null);
@@ -243,14 +269,30 @@ class Class implements FieldContainer {
class MixinApplication extends Class {
Class _mixinClass;
- MixinApplication(Element element, String name, Holder holder,
- List<Field> instanceFields, List<Field> staticFieldsForReflection,
- List<StubMethod> callStubs, List<StubMethod> typeVariableReaderStubs,
- List<StubMethod> isChecks, int functionTypeIndex,
- {bool onlyForRti, bool isDirectlyInstantiated})
- : super(element, name, holder, const <Method>[], instanceFields,
- staticFieldsForReflection, callStubs, typeVariableReaderStubs,
- const <StubMethod>[], isChecks, functionTypeIndex,
+ MixinApplication(
+ Element element,
+ String name,
+ Holder holder,
+ List<Field> instanceFields,
+ List<Field> staticFieldsForReflection,
+ List<StubMethod> callStubs,
+ List<StubMethod> typeVariableReaderStubs,
+ List<StubMethod> isChecks,
+ int functionTypeIndex,
+ {bool onlyForRti,
+ bool isDirectlyInstantiated})
+ : super(
+ element,
+ name,
+ holder,
+ const <Method>[],
+ instanceFields,
+ staticFieldsForReflection,
+ callStubs,
+ typeVariableReaderStubs,
+ const <StubMethod>[],
+ isChecks,
+ functionTypeIndex,
onlyForRti: onlyForRti,
isDirectlyInstantiated: isDirectlyInstantiated,
isNative: false);
@@ -336,9 +378,14 @@ class DartMethod extends Method {
final String callName;
DartMethod(Element element, String name, js.Expression code,
- this.parameterStubs, this.callName, {this.needsTearOff, this.tearOffName,
- this.canBeApplied, this.canBeReflected, this.requiredParameterCount,
- this.optionalParameterDefaultValues, this.functionType})
+ this.parameterStubs, this.callName,
+ {this.needsTearOff,
+ this.tearOffName,
+ this.canBeApplied,
+ this.canBeReflected,
+ this.requiredParameterCount,
+ this.optionalParameterDefaultValues,
+ this.functionType})
: super(element, name, code) {
assert(needsTearOff != null);
assert(!needsTearOff || tearOffName != null);
@@ -360,9 +407,14 @@ class InstanceMethod extends DartMethod {
InstanceMethod(Element element, String name, js.Expression code,
List<ParameterStubMethod> parameterStubs, String callName,
- {bool needsTearOff, String tearOffName, this.aliasName, bool canBeApplied,
- bool canBeReflected, int requiredParameterCount,
- /* List | Map */ optionalParameterDefaultValues, this.isClosure,
+ {bool needsTearOff,
+ String tearOffName,
+ this.aliasName,
+ bool canBeApplied,
+ bool canBeReflected,
+ int requiredParameterCount,
+ /* List | Map */ optionalParameterDefaultValues,
+ this.isClosure,
js.Expression functionType})
: super(element, name, code, parameterStubs, callName,
needsTearOff: needsTearOff,
@@ -412,10 +464,18 @@ abstract class StaticMethod implements Method {
class StaticDartMethod extends DartMethod implements StaticMethod {
final Holder holder;
- StaticDartMethod(Element element, String name, this.holder,
- js.Expression code, List<ParameterStubMethod> parameterStubs,
- String callName, {bool needsTearOff, String tearOffName,
- bool canBeApplied, bool canBeReflected, int requiredParameterCount,
+ StaticDartMethod(
+ Element element,
+ String name,
+ this.holder,
+ js.Expression code,
+ List<ParameterStubMethod> parameterStubs,
+ String callName,
+ {bool needsTearOff,
+ String tearOffName,
+ bool canBeApplied,
+ bool canBeReflected,
+ int requiredParameterCount,
/* List | Map */ optionalParameterDefaultValues,
js.Expression functionType})
: super(element, name, code, parameterStubs, callName,
diff --git a/pkg/compiler/lib/src/js_emitter/native_emitter.dart b/pkg/compiler/lib/src/js_emitter/native_emitter.dart
index a904eab..502209a 100644
--- a/pkg/compiler/lib/src/js_emitter/native_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/native_emitter.dart
@@ -189,7 +189,9 @@ class NativeEmitter {
StringBuffer sb = new StringBuffer(leafStr);
if (nonleafStr != '') {
- sb..write(';')..write(nonleafStr);
+ sb
+ ..write(';')
+ ..write(nonleafStr);
}
if (extensions != null) {
sb
@@ -290,8 +292,10 @@ class NativeEmitter {
});
}
- List<jsAst.Statement> generateParameterStubStatements(FunctionElement member,
- bool isInterceptedMethod, String invocationName,
+ List<jsAst.Statement> generateParameterStubStatements(
+ FunctionElement member,
+ bool isInterceptedMethod,
+ String invocationName,
List<jsAst.Parameter> stubParameters,
List<jsAst.Expression> argumentsBuffer,
int indexOfLastOptionalArgumentInParameters) {
@@ -396,14 +400,16 @@ class NativeEmitter {
///
/// Both variables are passed in (instead of creating the access here) to
/// make sure the caller is aware of these globals.
- jsAst.Statement buildNativeInfoHandler(jsAst.Expression infoAccess,
+ jsAst.Statement buildNativeInfoHandler(
+ jsAst.Expression infoAccess,
jsAst.Expression constructorAccess,
jsAst.Expression subclassReadGenerator(jsAst.Expression subclass),
jsAst.Expression interceptorsByTagAccess,
jsAst.Expression leafTagsAccess) {
jsAst.Expression subclassRead =
subclassReadGenerator(js('subclasses[i]', []));
- return js.statement('''
+ return js.statement(
+ '''
// The native info looks like this:
//
// HtmlElement: {
@@ -451,7 +457,8 @@ class NativeEmitter {
}
}
}
- ''', {
+ ''',
+ {
'info': infoAccess,
'constructor': constructorAccess,
'subclassRead': subclassRead,
diff --git a/pkg/compiler/lib/src/js_emitter/native_generator.dart b/pkg/compiler/lib/src/js_emitter/native_generator.dart
index 14cebb7..12aea33 100644
--- a/pkg/compiler/lib/src/js_emitter/native_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/native_generator.dart
@@ -26,7 +26,8 @@ class NativeGenerator {
jsAst.Expression dispatchPropertyNameAccess =
generateEmbeddedGlobalAccess(embeddedNames.DISPATCH_PROPERTY_NAME);
- return js.statement('''
+ return js.statement(
+ '''
!function() {
// On V8, the 'intern' function converts a string to a symbol, which
// makes property access much faster.
@@ -60,7 +61,8 @@ class NativeGenerator {
#dispatchPropertyName = #getIsolateTag("dispatch_record");
}
}();
- ''', {
+ ''',
+ {
'initializeDispatchProperty': backend.needToInitializeDispatchProperty,
'convertToFastObject': convertToFastObject,
'getIsolateTag': getIsolateTagAccess,
diff --git a/pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart
index 6a12df4..b646aa5 100644
--- a/pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart
@@ -77,10 +77,8 @@ class Emitter implements emitterTask.Emitter {
@override
js.Expression isolateLazyInitializerAccess(FieldElement element) {
- return js.js('#.#', [
- namer.globalObjectFor(element),
- namer.lazyInitializerName(element)
- ]);
+ return js.js('#.#',
+ [namer.globalObjectFor(element), namer.lazyInitializerName(element)]);
}
@override
diff --git a/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
index f0b8178..e307541 100644
--- a/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
@@ -105,10 +105,8 @@ class ModelEmitter {
}
js.Expression generateStaticClosureAccess(FunctionElement element) {
- return js.js('#.#()', [
- namer.globalObjectFor(element),
- namer.staticClosureName(element)
- ]);
+ return js.js('#.#()',
+ [namer.globalObjectFor(element), namer.staticClosureName(element)]);
}
js.Expression generateConstantReference(ConstantValue value) {
@@ -122,10 +120,8 @@ class ModelEmitter {
if (isConstantInlinedOrAlreadyEmitted(value)) {
return constantEmitter.generate(value);
}
- return js.js('#.#()', [
- namer.globalObjectForConstant(value),
- namer.constantName(value)
- ]);
+ return js.js('#.#()',
+ [namer.globalObjectForConstant(value), namer.constantName(value)]);
}
int emitProgram(Program program) {
@@ -198,8 +194,8 @@ class ModelEmitter {
'deferredInitializer': emitDeferredInitializerGlobal(program.loadMap),
'holders': emitHolders(program.holders),
'tearOff': buildTearOffCode(backend),
- 'parseFunctionDescriptor': js.js.statement(
- parseFunctionDescriptorBoilerplate, {
+ 'parseFunctionDescriptor':
+ js.js.statement(parseFunctionDescriptorBoilerplate, {
'argumentCount': js.string(namer.requiredParameterField),
'defaultArgumentValues': js.string(namer.defaultValuesField),
'callName': js.string(namer.callNameField)
@@ -230,8 +226,9 @@ class ModelEmitter {
js.Statement nativeIsolateAffinityTagInitialization;
if (NativeGenerator.needsIsolateAffinityTagInitialization(backend)) {
- nativeIsolateAffinityTagInitialization = NativeGenerator
- .generateIsolateAffinityTagInitialization(backend,
+ nativeIsolateAffinityTagInitialization =
+ NativeGenerator.generateIsolateAffinityTagInitialization(
+ backend,
generateEmbeddedGlobalAccess,
// TODO(floitsch): convertToFastObject.
js.js("(function(x) { return x; })", []));
@@ -250,8 +247,11 @@ class ModelEmitter {
generateEmbeddedGlobalAccess(INTERCEPTORS_BY_TAG);
js.Expression leafTagsAccess = generateEmbeddedGlobalAccess(LEAF_TAGS);
js.Statement nativeInfoHandler = nativeEmitter.buildNativeInfoHandler(
- nativeInfoAccess, constructorAccess, subclassReadGenerator,
- interceptorsByTagAccess, leafTagsAccess);
+ nativeInfoAccess,
+ constructorAccess,
+ subclassReadGenerator,
+ interceptorsByTagAccess,
+ leafTagsAccess);
nativeHoles['needsNativeSupport'] = program.needsNativeSupport;
nativeHoles['needsNoNativeSupport'] = !program.needsNativeSupport;
@@ -277,9 +277,11 @@ class ModelEmitter {
new js.VariableDeclaration(e.name, allowRename: false),
new js.ObjectInitializer(const [])))
.toList())),
- js.js.statement('var holders = #', new js.ArrayInitializer(holders
- .map((e) => new js.VariableUse(e.name))
- .toList(growable: false))),
+ js.js.statement(
+ 'var holders = #',
+ new js.ArrayInitializer(holders
+ .map((e) => new js.VariableUse(e.name))
+ .toList(growable: false))),
js.js.statement('var holdersMap = Object.create(null)')
];
return new js.Block(statements);
@@ -321,10 +323,10 @@ class ModelEmitter {
List<js.Statement> statements = [
new js.ExpressionStatement(new js.VariableDeclarationList([
- new js.VariableInitialization(
- new js.VariableDeclaration("init", allowRename: false),
- globalsObject)
- ]))
+ new js.VariableInitialization(
+ new js.VariableDeclaration("init", allowRename: false),
+ globalsObject)
+ ]))
];
return new js.Block(statements);
}
@@ -404,14 +406,16 @@ class ModelEmitter {
/// See [emitEmbeddedGlobalsForDeferredLoading] for the format of the
/// deferred hunk.
- js.Expression initializeLoadedHunkFunction = js.js("""
+ js.Expression initializeLoadedHunkFunction = js.js(
+ """
function(hash) {
var hunk = $deferredInitializersGlobal[hash];
$setupProgramName(hunk[0], #typesAccess.length);
eval(hunk[1]);
var deferredTypes = eval(hunk[2]);
#typesAccess.push.apply(#typesAccess, deferredTypes);
- }""", {'typesAccess': typesAccess});
+ }""",
+ {'typesAccess': typesAccess});
globals.add(new js.Property(
js.string(INITIALIZE_LOADED_HUNK), initializeLoadedHunkFunction));
@@ -432,14 +436,16 @@ class ModelEmitter {
// Types are non-evaluated and must be compiled at first use.
// Compiled strings are guaranteed not to be strings, and it's thus safe
// to use a type-test to determine if a type has already been compiled.
- return js.js.statement('''function $readMetadataTypeName(index) {
+ return js.js.statement(
+ '''function $readMetadataTypeName(index) {
var type = #typesAccess[index];
if (typeof type == 'string') {
type = expressionCompile(type);
#typesAccess[index] = type;
}
return type;
- }''', {"typesAccess": generateEmbeddedGlobalAccess(TYPES)});
+ }''',
+ {"typesAccess": generateEmbeddedGlobalAccess(TYPES)});
}
js.Template get templateForReadType {
@@ -455,14 +461,16 @@ class ModelEmitter {
// Types are non-evaluated and must be compiled at first use.
// Compiled strings are guaranteed not to be strings, and it's thus safe
// to use a type-test to determine if a type has already been compiled.
- return js.js.statement('''function $readMetadataName(index) {
+ return js.js.statement(
+ '''function $readMetadataName(index) {
var lazyMetadata = #lazyMetadataAccess[index];
if (typeof lazyMetadata == 'string') {
#metadataAccess[index] = expressionCompile(lazyMetadata);
#lazyMetadataAccess[index] = null;
}
return #metadataAccess[index];
- }''', {
+ }''',
+ {
"lazyMetadataAccess": generateEmbeddedGlobalAccess(lazyMetadataName),
"metadataAccess": generateEmbeddedGlobalAccess(METADATA)
});
@@ -549,10 +557,10 @@ class ModelEmitter {
int holderIndex = constants.first.holder.index;
data.add(js.number(holderIndex));
data.addAll(constants.expand((Constant constant) {
- assert(constant.holder.index == holderIndex);
- js.Expression code = constantEmitter.generate(constant.value);
- return [js.string(constant.name), unparse(compiler, code)];
- }));
+ assert(constant.holder.index == holderIndex);
+ js.Expression code = constantEmitter.generate(constant.value);
+ return [js.string(constant.name), unparse(compiler, code)];
+ }));
}
return new js.ArrayInitializer(data);
}
@@ -567,11 +575,11 @@ class ModelEmitter {
js.Expression emitLazilyInitializedStatics(List<StaticField> fields) {
Iterable fieldDescriptors = fields.expand((field) => [
- js.string(field.name),
- js.string("${namer.getterPrefix}${field.name}"),
- js.number(field.holder.index),
- emitLazyInitializer(field)
- ]);
+ js.string(field.name),
+ js.string("${namer.getterPrefix}${field.name}"),
+ js.number(field.holder.index),
+ emitLazyInitializer(field)
+ ]);
return new js.ArrayInitializer(fieldDescriptors.toList(growable: false));
}
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart
index 187dbbf..8746bdd 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart
@@ -502,10 +502,8 @@ class ClassEmitter extends CodeEmitterHelper {
.add(js('#.prototype.# = #', [className, getterName, function]));
if (backend.isAccessibleByReflection(member)) {
emitter.cspPrecompiledFunctionFor(outputUnit).add(js(
- '#.prototype.#.${namer.reflectableField} = 1', [
- className,
- getterName
- ]));
+ '#.prototype.#.${namer.reflectableField} = 1',
+ [className, getterName]));
}
}
@@ -524,15 +522,14 @@ class ClassEmitter extends CodeEmitterHelper {
.add(js('#.prototype.# = #', [className, setterName, function]));
if (backend.isAccessibleByReflection(member)) {
emitter.cspPrecompiledFunctionFor(outputUnit).add(js(
- '#.prototype.#.${namer.reflectableField} = 1', [
- className,
- setterName
- ]));
+ '#.prototype.#.${namer.reflectableField} = 1',
+ [className, setterName]));
}
}
void generateReflectionDataForFieldGetterOrSetter(
- Element member, String name, ClassBuilder builder, {bool isGetter}) {
+ Element member, String name, ClassBuilder builder,
+ {bool isGetter}) {
Selector selector = isGetter
? new Selector.getter(member.name, member.library)
: new Selector.setter(member.name, member.library);
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart
index 84fbe7d..342364f 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart
@@ -138,8 +138,8 @@ class ContainerBuilder extends CodeEmitterHelper {
expressions
.add(js.number(task.metadataCollector.reifyName(parameter.name)));
if (backend.mustRetainMetadata) {
- Iterable<int> metadataIndices = parameter.metadata
- .map((MetadataAnnotation annotation) {
+ Iterable<int> metadataIndices =
+ parameter.metadata.map((MetadataAnnotation annotation) {
ConstantValue constant =
backend.constants.getConstantForMetadata(annotation).value;
backend.constants.addCompileTimeConstantForEmission(constant);
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/declarations.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/declarations.dart
index 4127f9e..49241bc 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/declarations.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/declarations.dart
@@ -30,8 +30,12 @@ typedef jsAst.Property AddPropertyFunction(String name, jsAst.Expression value);
* case, [needsSetter] is always false. [needsCheckedSetter] is only true when
* type assertions are enabled (checked mode).
*/
-typedef void AcceptField(VariableElement member, String name,
- String accessorName, bool needsGetter, bool needsSetter,
+typedef void AcceptField(
+ VariableElement member,
+ String name,
+ String accessorName,
+ bool needsGetter,
+ bool needsSetter,
bool needsCheckedSetter);
// Function signatures used in the generation of runtime type information.
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
index 288130a..1cc1ace 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -164,10 +164,8 @@ class OldEmitter implements Emitter {
if (isConstantInlinedOrAlreadyEmitted(value)) {
return constantEmitter.generate(value);
}
- return js('#.#', [
- namer.globalObjectForConstant(value),
- namer.constantName(value)
- ]);
+ return js('#.#',
+ [namer.globalObjectForConstant(value), namer.constantName(value)]);
}
jsAst.Expression constantInitializerExpression(ConstantValue value) {
@@ -218,18 +216,14 @@ class OldEmitter implements Emitter {
@override
jsAst.Expression isolateLazyInitializerAccess(FieldElement element) {
- return jsAst.js('#.#', [
- namer.globalObjectFor(element),
- namer.lazyInitializerName(element)
- ]);
+ return jsAst.js('#.#',
+ [namer.globalObjectFor(element), namer.lazyInitializerName(element)]);
}
@override
jsAst.Expression isolateStaticClosureAccess(FunctionElement element) {
- return jsAst.js('#.#()', [
- namer.globalObjectFor(element),
- namer.staticClosureName(element)
- ]);
+ return jsAst.js('#.#()',
+ [namer.globalObjectFor(element), namer.staticClosureName(element)]);
}
@override
@@ -332,7 +326,8 @@ class OldEmitter implements Emitter {
return nsmEmitter.buildTrivialNsmHandlers();
}
- jsAst.Statement buildNativeInfoHandler(jsAst.Expression infoAccess,
+ jsAst.Statement buildNativeInfoHandler(
+ jsAst.Expression infoAccess,
jsAst.Expression constructorAccess,
jsAst.Expression subclassReadGenerator(jsAst.Expression subclass),
jsAst.Expression interceptorsByTagAccess,
@@ -370,11 +365,13 @@ class OldEmitter implements Emitter {
/// This is used by js_mirrors.dart.
String getReflectionName(elementOrSelector, String mangledName) {
String name = elementOrSelector.name;
- if (backend.shouldRetainName(name) || elementOrSelector is Element &&
- // Make sure to retain names of unnamed constructors, and
- // for common native types.
- ((name == '' && backend.isAccessibleByReflection(elementOrSelector)) ||
- _isNativeTypeNeedingReflectionName(elementOrSelector))) {
+ if (backend.shouldRetainName(name) ||
+ elementOrSelector is Element &&
+ // Make sure to retain names of unnamed constructors, and
+ // for common native types.
+ ((name == '' &&
+ backend.isAccessibleByReflection(elementOrSelector)) ||
+ _isNativeTypeNeedingReflectionName(elementOrSelector))) {
// TODO(ahe): Enable the next line when I can tell the difference between
// an instance method and a global. They may have the same mangled name.
@@ -471,13 +468,15 @@ class OldEmitter implements Emitter {
// constructor-functions and getter/setter functions can be stored in the
// library-description table. Setting properties on these can be moved to
// finishClasses.
- return js.statement(r"""
+ return js.statement(
+ r"""
#precompiled = function ($collectedClasses$) {
#norename;
var $desc;
#functions;
return #result;
- };""", {
+ };""",
+ {
'norename': new jsAst.Comment("// ::norenaming:: "),
'precompiled': generateEmbeddedGlobalAccess(embeddedNames.PRECOMPILED),
'functions': cspPrecompiledFunctionFor(outputUnit),
@@ -494,8 +493,8 @@ class OldEmitter implements Emitter {
ClassElement classElement = cls.element;
compiler.withCurrentElement(classElement, () {
if (compiler.hasIncrementalSupport) {
- ClassBuilder cachedBuilder = cachedClassBuilders.putIfAbsent(
- classElement, () {
+ ClassBuilder cachedBuilder =
+ cachedClassBuilders.putIfAbsent(classElement, () {
ClassBuilder builder = new ClassBuilder(classElement, namer);
classEmitter.emitClass(cls, builder, fragment);
return builder;
@@ -532,10 +531,8 @@ class OldEmitter implements Emitter {
jsAst.Statement buildInitialization(
Element element, jsAst.Expression initialValue) {
// Note: `namer.currentIsolate` refers to the isolate properties here.
- return js.statement('${namer.currentIsolate}.# = #', [
- namer.globalPropertyName(element),
- initialValue
- ]);
+ return js.statement('${namer.currentIsolate}.# = #',
+ [namer.globalPropertyName(element), initialValue]);
}
bool inMainUnit = (outputUnit == compiler.deferredLoadTask.mainOutputUnit);
@@ -557,8 +554,8 @@ class OldEmitter implements Emitter {
if (inMainUnit && task.outputStaticNonFinalFieldLists.length > 1) {
// In the main output-unit we output a stub initializer for deferred
// variables, so that `isolateProperties` stays a fast object.
- task.outputStaticNonFinalFieldLists.forEach((OutputUnit fieldsOutputUnit,
- Iterable<VariableElement> fields) {
+ task.outputStaticNonFinalFieldLists.forEach(
+ (OutputUnit fieldsOutputUnit, Iterable<VariableElement> fields) {
if (fieldsOutputUnit == outputUnit) return; // Skip the main unit.
for (Element element in fields) {
compiler.withCurrentElement(element, () {
@@ -578,7 +575,8 @@ class OldEmitter implements Emitter {
if (lazyFields.isNotEmpty) {
needsLazyInitializer = true;
List<jsAst.Expression> laziesInfo = buildLaziesInfo(lazyFields);
- return js.statement('''
+ return js.statement(
+ '''
(function(lazies) {
if (#notInMinifiedMode) {
var descriptorLength = 4;
@@ -605,7 +603,8 @@ class OldEmitter implements Emitter {
}
}
})(#laziesInfo)
- ''', {
+ ''',
+ {
'notInMinifiedMode': !compiler.enableMinification,
'laziesInfo': new jsAst.ArrayInitializer(laziesInfo),
'lazy': js(lazyInitializerName)
@@ -748,7 +747,8 @@ class OldEmitter implements Emitter {
jsAst.Statement buildMakeConstantList() {
if (task.outputContainsConstantList) {
- return js.statement(r'''
+ return js.statement(
+ r'''
// Functions are stored in the hidden class and not as properties in
// the object. We never actually look at the value, but only want
// to know if the property exists.
@@ -756,7 +756,8 @@ class OldEmitter implements Emitter {
list.immutable$list = Array;
list.fixed$length = Array;
return list;
- }''', [namer.isolateName, makeConstListProperty]);
+ }''',
+ [namer.isolateName, makeConstListProperty]);
} else {
return js.comment("Output contains no constant list.");
}
@@ -778,7 +779,8 @@ class OldEmitter implements Emitter {
if (NativeGenerator.needsIsolateAffinityTagInitialization(backend)) {
parts.add(NativeGenerator.generateIsolateAffinityTagInitialization(
- backend, generateEmbeddedGlobalAccess,
+ backend,
+ generateEmbeddedGlobalAccess,
js("convertToFastObject", [])));
}
@@ -806,7 +808,8 @@ class OldEmitter implements Emitter {
jsAst.Expression laziesAccess =
generateEmbeddedGlobalAccess(embeddedNames.LAZIES);
- return js.statement('''
+ return js.statement(
+ '''
function init() {
$isolatePropertiesName = Object.create(null);
#allClasses = Object.create(null);
@@ -914,7 +917,8 @@ class OldEmitter implements Emitter {
return Isolate;
}
- }''', {
+ }''',
+ {
'allClasses': allClassesAccess,
'getTypeFromName': getTypeFromNameAccess,
'interceptorsByTag': interceptorsByTagAccess,
@@ -947,7 +951,8 @@ class OldEmitter implements Emitter {
}'''));
}
- return js.statement(r'''
+ return js.statement(
+ r'''
function convertToFastObject(properties) {
// Create an instance that uses 'properties' as prototype. This should
// make 'properties' a fast object.
@@ -956,7 +961,8 @@ class OldEmitter implements Emitter {
new MyClass();
#;
return properties;
- }''', [debugCode]);
+ }''',
+ [debugCode]);
}
jsAst.Statement buildConvertToSlowObjectFunction() {
@@ -1037,8 +1043,10 @@ class OldEmitter implements Emitter {
return new jsAst.ArrayInitializer(parts);
}
- void assemblePrecompiledConstructor(OutputUnit outputUnit,
- String constructorName, jsAst.Expression constructorAst,
+ void assemblePrecompiledConstructor(
+ OutputUnit outputUnit,
+ String constructorName,
+ jsAst.Expression constructorAst,
List<String> fields) {
cspPrecompiledFunctionFor(outputUnit).add(new jsAst.FunctionDeclaration(
new jsAst.VariableDeclaration(constructorName), constructorAst));
@@ -1048,7 +1056,8 @@ class OldEmitter implements Emitter {
jsAst.Node fieldNamesArray =
hasIsolateSupport ? js.stringArray(fields) : new jsAst.LiteralNull();
- cspPrecompiledFunctionFor(outputUnit).add(js.statement(r'''
+ cspPrecompiledFunctionFor(outputUnit).add(js.statement(
+ r'''
{
#constructorName.#typeNameProperty = #constructorNameString;
if (!"name" in #constructorName)
@@ -1059,13 +1068,14 @@ class OldEmitter implements Emitter {
if (#hasIsolateSupport) {
#constructorName.$fieldNamesProperty = #fieldNamesArray;
}
- }''', {
- "constructorName": constructorName,
- "typeNameProperty": typeNameProperty,
- "constructorNameString": js.string(constructorName),
- "hasIsolateSupport": hasIsolateSupport,
- "fieldNamesArray": fieldNamesArray
- }));
+ }''',
+ {
+ "constructorName": constructorName,
+ "typeNameProperty": typeNameProperty,
+ "constructorNameString": js.string(constructorName),
+ "hasIsolateSupport": hasIsolateSupport,
+ "fieldNamesArray": fieldNamesArray
+ }));
cspPrecompiledConstructorNamesFor(outputUnit).add(js('#', constructorName));
}
@@ -1126,10 +1136,8 @@ class OldEmitter implements Emitter {
if (isProgramSplit) {
String template =
"var #globalObject = #globalsHolder.#globalObject = map();";
- parts.add(js.statement(template, {
- "globalObject": globalObject,
- "globalsHolder": globalsHolder
- }));
+ parts.add(js.statement(template,
+ {"globalObject": globalObject, "globalsHolder": globalsHolder}));
} else {
parts.add(js.statement(
"var #globalObject = map();", {"globalObject": globalObject}));
@@ -1144,9 +1152,8 @@ class OldEmitter implements Emitter {
for (String globalObject in Namer.reservedGlobalObjectNames) {
parts.add(js.statement(
- '#globalObject = convertToFastObject(#globalObject);', {
- "globalObject": globalObject
- }));
+ '#globalObject = convertToFastObject(#globalObject);',
+ {"globalObject": globalObject}));
}
return new jsAst.Block(parts);
@@ -1186,13 +1193,15 @@ class OldEmitter implements Emitter {
'''));
for (String object in Namer.userGlobalObjects) {
- parts.add(js.statement('''
+ parts.add(js.statement(
+ '''
if (typeof print === "function") {
print("Size of " + #objectString + ": "
+ String(Object.getOwnPropertyNames(#object).length)
+ ", fast properties " + HasFastProperties(#object));
}
- ''', {"object": object, "objectString": js.string(object)}));
+ ''',
+ {"object": object, "objectString": js.string(object)}));
}
}
@@ -1293,17 +1302,19 @@ class OldEmitter implements Emitter {
List<jsAst.Statement> statements = <jsAst.Statement>[];
- statements..add(buildGeneratedBy())..add(js.comment(HOOKS_API_USAGE));
+ statements
+ ..add(buildGeneratedBy())
+ ..add(js.comment(HOOKS_API_USAGE));
if (isProgramSplit) {
/// For deferred loading we communicate the initializers via this global
/// variable. The deferred hunks will add their initialization to this.
/// The semicolon is important in minified mode, without it the
/// following parenthesis looks like a call to the object literal.
- statements.add(js.statement('self.#deferredInitializers = '
- 'self.#deferredInitializers || Object.create(null);', {
- 'deferredInitializers': deferredInitializers
- }));
+ statements.add(js.statement(
+ 'self.#deferredInitializers = '
+ 'self.#deferredInitializers || Object.create(null);',
+ {'deferredInitializers': deferredInitializers}));
}
// Collect the AST for the decriptors
@@ -1341,7 +1352,8 @@ class OldEmitter implements Emitter {
// Using a named function here produces easier to read stack traces in
// Chrome/V8.
- statements.add(js.statement("""
+ statements.add(js.statement(
+ """
(function() {
// No renaming in the top-level function to save the locals for the
// nested context where they will be used more. We have to put the
@@ -1451,46 +1463,50 @@ class OldEmitter implements Emitter {
#main;
})();
- """, {
- "disableVariableRenaming": js.comment("/* ::norenaming:: */"),
- "hasIncrementalSupport": compiler.hasIncrementalSupport,
- "helper": js('this.#', [namer.incrementalHelperName]),
- "schemaChange": buildSchemaChangeFunction(),
- "addMethod": buildIncrementalAddMethod(),
- "isProgramSplit": isProgramSplit,
- "supportsDirectProtoAccess": buildSupportsDirectProtoAccess(),
- "globalsHolder": globalsHolder,
- "globalObjectSetup": buildGlobalObjectSetup(isProgramSplit),
- "isolateName": namer.isolateName,
- "isolatePropertiesName": js(isolatePropertiesName),
- "initName": initName,
- "functionThatReturnsNull": buildFunctionThatReturnsNull(),
- "mangledNames": buildMangledNames(),
- "setupProgram":
- buildSetupProgram(program, compiler, backend, namer, this),
- "setupProgramName": setupProgramName,
- "descriptors": descriptorsAst,
- "cspPrecompiledFunctions": buildCspPrecompiledFunctionFor(mainOutputUnit),
- "getInterceptorMethods": interceptorEmitter.buildGetInterceptorMethods(),
- "oneShotInterceptors": interceptorEmitter.buildOneShotInterceptors(),
- "makeConstantList": buildMakeConstantList(),
- "compileTimeConstants": buildCompileTimeConstants(mainFragment.constants,
- isMainFragment: true),
- "deferredBoilerPlate": buildDeferredBoilerPlate(deferredLoadHashes),
- "staticNonFinalInitializers":
- buildStaticNonFinalFieldInitializations(mainOutputUnit),
- "typeToInterceptorMap":
- interceptorEmitter.buildTypeToInterceptorMap(program),
- "lazyStaticFields": buildLazilyInitializedStaticFields(),
- "metadata": buildMetadata(program, mainOutputUnit),
- "convertToFastObject": buildConvertToFastObjectFunction(),
- "convertToSlowObject": buildConvertToSlowObjectFunction(),
- "convertGlobalObjectsToFastObjects":
- buildConvertGlobalObjectToFastObjects(),
- "debugFastObjects": buildDebugFastObjectCode(),
- "init": buildInitFunction(),
- "main": buildMain(mainFragment.invokeMain)
- }));
+ """,
+ {
+ "disableVariableRenaming": js.comment("/* ::norenaming:: */"),
+ "hasIncrementalSupport": compiler.hasIncrementalSupport,
+ "helper": js('this.#', [namer.incrementalHelperName]),
+ "schemaChange": buildSchemaChangeFunction(),
+ "addMethod": buildIncrementalAddMethod(),
+ "isProgramSplit": isProgramSplit,
+ "supportsDirectProtoAccess": buildSupportsDirectProtoAccess(),
+ "globalsHolder": globalsHolder,
+ "globalObjectSetup": buildGlobalObjectSetup(isProgramSplit),
+ "isolateName": namer.isolateName,
+ "isolatePropertiesName": js(isolatePropertiesName),
+ "initName": initName,
+ "functionThatReturnsNull": buildFunctionThatReturnsNull(),
+ "mangledNames": buildMangledNames(),
+ "setupProgram":
+ buildSetupProgram(program, compiler, backend, namer, this),
+ "setupProgramName": setupProgramName,
+ "descriptors": descriptorsAst,
+ "cspPrecompiledFunctions":
+ buildCspPrecompiledFunctionFor(mainOutputUnit),
+ "getInterceptorMethods":
+ interceptorEmitter.buildGetInterceptorMethods(),
+ "oneShotInterceptors": interceptorEmitter.buildOneShotInterceptors(),
+ "makeConstantList": buildMakeConstantList(),
+ "compileTimeConstants": buildCompileTimeConstants(
+ mainFragment.constants,
+ isMainFragment: true),
+ "deferredBoilerPlate": buildDeferredBoilerPlate(deferredLoadHashes),
+ "staticNonFinalInitializers":
+ buildStaticNonFinalFieldInitializations(mainOutputUnit),
+ "typeToInterceptorMap":
+ interceptorEmitter.buildTypeToInterceptorMap(program),
+ "lazyStaticFields": buildLazilyInitializedStaticFields(),
+ "metadata": buildMetadata(program, mainOutputUnit),
+ "convertToFastObject": buildConvertToFastObjectFunction(),
+ "convertToSlowObject": buildConvertToSlowObjectFunction(),
+ "convertGlobalObjectsToFastObjects":
+ buildConvertGlobalObjectToFastObjects(),
+ "debugFastObjects": buildDebugFastObjectCode(),
+ "init": buildInitFunction(),
+ "main": buildMain(mainFragment.invokeMain)
+ }));
mainOutput.addBuffer(jsAst.prettyPrint(
new jsAst.Program(statements), compiler,
@@ -1723,7 +1739,8 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
Map<OutputUnit, String> deferredLoadHashes) {
List<jsAst.Statement> parts = <jsAst.Statement>[];
- parts.add(js.statement('''
+ parts.add(js.statement(
+ '''
{
// Function for checking if a hunk is loaded given its hash.
#isHunkLoaded = function(hunkHash) {
@@ -1741,16 +1758,17 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
#deferredInitialized[hunkHash] = true;
};
}
- ''', {
- "isHunkLoaded":
- generateEmbeddedGlobalAccess(embeddedNames.IS_HUNK_LOADED),
- "isHunkInitialized":
- generateEmbeddedGlobalAccess(embeddedNames.IS_HUNK_INITIALIZED),
- "initializeLoadedHunk":
- generateEmbeddedGlobalAccess(embeddedNames.INITIALIZE_LOADED_HUNK),
- "deferredInitialized":
- generateEmbeddedGlobalAccess(embeddedNames.DEFERRED_INITIALIZED)
- }));
+ ''',
+ {
+ "isHunkLoaded":
+ generateEmbeddedGlobalAccess(embeddedNames.IS_HUNK_LOADED),
+ "isHunkInitialized":
+ generateEmbeddedGlobalAccess(embeddedNames.IS_HUNK_INITIALIZED),
+ "initializeLoadedHunk": generateEmbeddedGlobalAccess(
+ embeddedNames.INITIALIZE_LOADED_HUNK),
+ "deferredInitialized":
+ generateEmbeddedGlobalAccess(embeddedNames.DEFERRED_INITIALIZED)
+ }));
// Write a javascript mapping from Deferred import load ids (derrived
// from the import prefix.) to a list of lists of uris of hunks to load,
@@ -1813,9 +1831,8 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
body.add(js.comment("/* ::norenaming:: "));
for (String globalObject in Namer.reservedGlobalObjectNames) {
- body.add(js.statement('var #object = ${globalsHolder}.#object;', {
- 'object': globalObject
- }));
+ body.add(js.statement('var #object = ${globalsHolder}.#object;',
+ {'object': globalObject}));
}
body
..add(js.statement('var init = ${globalsHolder}.init;'))
@@ -1857,11 +1874,13 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
statements
..add(buildGeneratedBy())
- ..add(js.statement('${deferredInitializers}.current = '
+ ..add(js.statement(
+ '${deferredInitializers}.current = '
"""function (${globalsHolder}) {
#
}
- """, [body]));
+ """,
+ [body]));
result[outputUnit] = new jsAst.Program(statements);
}
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart
index a3d3cf2..8f389df 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart
@@ -36,10 +36,10 @@ class InterceptorEmitter extends CodeEmitterHelper {
for (String name in specializedGetInterceptors.keys.toList()..sort()) {
Set<ClassElement> classes = specializedGetInterceptors[name];
parts.add(js.statement('#.# = #', [
- namer.globalObjectFor(backend.interceptorsLibrary),
- name,
- buildGetInterceptorMethod(name, classes)
- ]));
+ namer.globalObjectFor(backend.interceptorsLibrary),
+ name,
+ buildGetInterceptorMethod(name, classes)
+ ]));
}
return new jsAst.Block(parts);
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart
index 1c37de8..9e2a849 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart
@@ -222,7 +222,8 @@ class NsmEmitter extends CodeEmitterHelper {
.staticFunctionAccess(backend.getCreateInvocationMirror());
var type = 0;
if (useDiffEncoding) {
- statements.add(js.statement('''{
+ statements.add(js.statement(
+ '''{
var objectClassObject = processedClasses.collected[#objectClass],
shortNames = #diffEncoding.split(","),
nameNumber = 0,
@@ -261,24 +262,25 @@ class NsmEmitter extends CodeEmitterHelper {
}
shortNames.splice.apply(shortNames, calculatedShortNames);
}
- }''', {
- 'objectClass': js.string(namer.className(objectClass)),
- 'diffEncoding': js.string('$diffEncoding')
- }));
+ }''',
+ {
+ 'objectClass': js.string(namer.className(objectClass)),
+ 'diffEncoding': js.string('$diffEncoding')
+ }));
} else {
// No useDiffEncoding version.
Iterable<String> longs = trivialNsmHandlers
.map((selector) => selector.invocationMirrorMemberName);
statements.add(js.statement(
- 'var objectClassObject = processedClasses.collected[#objectClass],'
- ' shortNames = #diffEncoding.split(",")', {
- 'objectClass': js.string(namer.className(objectClass)),
- 'diffEncoding': js.string('$diffEncoding')
- }));
+ 'var objectClassObject = processedClasses.collected[#objectClass],'
+ ' shortNames = #diffEncoding.split(",")',
+ {
+ 'objectClass': js.string(namer.className(objectClass)),
+ 'diffEncoding': js.string('$diffEncoding')
+ }));
if (!minify) {
- statements.add(js.statement('var longNames = #longs.split(",")', {
- 'longs': js.string(longs.join(','))
- }));
+ statements.add(js.statement('var longNames = #longs.split(",")',
+ {'longs': js.string(longs.join(','))}));
}
statements.add(js.statement('if (objectClassObject instanceof Array)'
' objectClassObject = objectClassObject[1];'));
@@ -292,7 +294,8 @@ class NsmEmitter extends CodeEmitterHelper {
var sliceOffsetParams = sliceOffsetArguments.isEmpty ? [] : ['sliceOffset'];
- statements.add(js.statement('''
+ statements.add(js.statement(
+ '''
// If we are loading a deferred library the object class will not be in
// the collectedClasses so objectClassObject is undefined, and we skip
// setting up the names.
@@ -318,13 +321,14 @@ class NsmEmitter extends CodeEmitterHelper {
}
})(#names[j], short, type, #sliceOffsetArguments);
}
- }''', {
- 'sliceOffsetParams': sliceOffsetParams,
- 'noSuchMethodName': namer.noSuchMethodName,
- 'createInvocationMirror': createInvocationMirror,
- 'names': minify ? 'shortNames' : 'longNames',
- 'sliceOffsetArguments': sliceOffsetArguments
- }));
+ }''',
+ {
+ 'sliceOffsetParams': sliceOffsetParams,
+ 'noSuchMethodName': namer.noSuchMethodName,
+ 'createInvocationMirror': createInvocationMirror,
+ 'names': minify ? 'shortNames' : 'longNames',
+ 'sliceOffsetArguments': sliceOffsetArguments
+ }));
return statements;
}
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/setup_program_builder.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/setup_program_builder.dart
index c592ade..430c388 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/setup_program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/setup_program_builder.dart
@@ -86,8 +86,11 @@ jsAst.Statement buildSetupProgram(Program program, Compiler compiler,
Function subclassReadGenerator =
(jsAst.Expression subclass) => js('allClasses[#]', subclass);
jsAst.Statement nativeInfoHandler = emitter.buildNativeInfoHandler(
- nativeInfoAccess, constructorAccess, subclassReadGenerator,
- interceptorsByTagAccess, leafTagsAccess);
+ nativeInfoAccess,
+ constructorAccess,
+ subclassReadGenerator,
+ interceptorsByTagAccess,
+ leafTagsAccess);
Map<String, dynamic> holes = {
'needsClassSupport': emitter.needsClassSupport,
@@ -818,15 +821,21 @@ String readString(String array, String index) {
}
String readInt(String array, String index) {
- return readChecked(array, index,
+ return readChecked(
+ array,
+ index,
'result != null && (typeof result != "number" || (result|0) !== result)',
'int');
}
String readFunctionType(String array, String index) {
- return readChecked(array, index, 'result != null && '
+ return readChecked(
+ array,
+ index,
+ 'result != null && '
'(typeof result != "number" || (result|0) !== result) && '
- 'typeof result != "function"', 'function or int');
+ 'typeof result != "function"',
+ 'function or int');
}
String readChecked(String array, String index, String check, String type) {
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 af63ff0..d4b52dd 100644
--- a/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
@@ -118,9 +118,13 @@ class ParameterStubGenerator {
var body; // List or jsAst.Statement.
if (member.hasFixedBackendName) {
- body = emitterTask.nativeEmitter.generateParameterStubStatements(member,
- isInterceptedMethod, namer.invocationName(selector), parametersBuffer,
- argumentsBuffer, indexOfLastOptionalArgumentInParameters);
+ body = emitterTask.nativeEmitter.generateParameterStubStatements(
+ member,
+ isInterceptedMethod,
+ namer.invocationName(selector),
+ parametersBuffer,
+ argumentsBuffer,
+ indexOfLastOptionalArgumentInParameters);
} else if (member.isInstanceMember) {
if (needsSuperGetter(member)) {
ClassElement superClass = member.enclosingClass;
@@ -136,16 +140,12 @@ class ParameterStubGenerator {
argumentsBuffer
]);
} else {
- body = js.statement('return this.#(#);', [
- namer.instanceMethodName(member),
- argumentsBuffer
- ]);
+ body = js.statement('return this.#(#);',
+ [namer.instanceMethodName(member), argumentsBuffer]);
}
} else {
- body = js.statement('return #(#)', [
- emitter.staticFunctionAccess(member),
- argumentsBuffer
- ]);
+ body = js.statement('return #(#)',
+ [emitter.staticFunctionAccess(member), argumentsBuffer]);
}
jsAst.Fun function = js('function(#) { #; }', [parametersBuffer, body]);
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder.dart
index 3a6ba9e..90ef07f 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder.dart
@@ -152,9 +152,11 @@ class ProgramBuilder {
MainFragment _buildMainFragment(LibrariesMap librariesMap) {
// Construct the main output from the libraries and the registered holders.
- MainFragment result = new MainFragment(librariesMap.outputUnit,
+ MainFragment result = new MainFragment(
+ librariesMap.outputUnit,
"", // The empty string is the name for the main output file.
- _buildInvokeMain(), _buildLibraries(librariesMap),
+ _buildInvokeMain(),
+ _buildLibraries(librariesMap),
_buildStaticNonFinalFields(librariesMap),
_buildStaticLazilyInitializedFields(librariesMap),
_buildConstants(librariesMap));
@@ -169,9 +171,11 @@ class ProgramBuilder {
}
DeferredFragment _buildDeferredFragment(LibrariesMap librariesMap) {
- DeferredFragment result = new DeferredFragment(librariesMap.outputUnit,
+ DeferredFragment result = new DeferredFragment(
+ librariesMap.outputUnit,
backend.deferredPartFileName(librariesMap.name, addExtension: false),
- librariesMap.name, _buildLibraries(librariesMap),
+ librariesMap.name,
+ _buildLibraries(librariesMap),
_buildStaticNonFinalFields(librariesMap),
_buildStaticLazilyInitializedFields(librariesMap),
_buildConstants(librariesMap));
@@ -391,14 +395,31 @@ class ProgramBuilder {
assert(!element.isNative);
assert(methods.isEmpty);
- result = new MixinApplication(element, name, holder, instanceFields,
- staticFieldsForReflection, callStubs, typeVariableReaderStubs,
- isChecks, typeTests.functionTypeIndex,
- isDirectlyInstantiated: isInstantiated, onlyForRti: onlyForRti);
+ result = new MixinApplication(
+ element,
+ name,
+ holder,
+ instanceFields,
+ staticFieldsForReflection,
+ callStubs,
+ typeVariableReaderStubs,
+ isChecks,
+ typeTests.functionTypeIndex,
+ isDirectlyInstantiated: isInstantiated,
+ onlyForRti: onlyForRti);
} else {
- result = new Class(element, name, holder, methods, instanceFields,
- staticFieldsForReflection, callStubs, typeVariableReaderStubs,
- noSuchMethodStubs, isChecks, typeTests.functionTypeIndex,
+ result = new Class(
+ element,
+ name,
+ holder,
+ methods,
+ instanceFields,
+ staticFieldsForReflection,
+ callStubs,
+ typeVariableReaderStubs,
+ noSuchMethodStubs,
+ isChecks,
+ typeTests.functionTypeIndex,
isDirectlyInstantiated: isInstantiated,
onlyForRti: onlyForRti,
isNative: element.isNative);
@@ -604,9 +625,13 @@ class ProgramBuilder {
List<Field> _buildFields(Element holder, bool visitStatics) {
List<Field> fields = <Field>[];
- _task.oldEmitter.classEmitter.visitFields(holder, visitStatics,
- (VariableElement field, String name, String accessorName,
- bool needsGetter, bool needsSetter, bool needsCheckedSetter) {
+ _task.oldEmitter.classEmitter.visitFields(
+ holder, visitStatics, (VariableElement field,
+ String name,
+ String accessorName,
+ bool needsGetter,
+ bool needsSetter,
+ bool needsCheckedSetter) {
assert(invariant(field, field.isDeclaration));
int getterFlags = 0;
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 e52877f..fb8cf68 100644
--- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
@@ -130,7 +130,8 @@ class RuntimeTypeGenerator {
* they will be inherited at runtime, but we may need to generate the
* substitutions, because they may have changed.
*/
- void _generateIsTestsOn(ClassElement cls,
+ void _generateIsTestsOn(
+ ClassElement cls,
void generateIsTest(Element element),
FunctionTypeSignatureEmitter generateFunctionTypeSignature,
SubstitutionEmitter generateSubstitution,
@@ -229,9 +230,11 @@ class RuntimeTypeGenerator {
/**
* Generate "is tests" where [cls] is being implemented.
*/
- void _generateInterfacesIsTests(ClassElement cls,
+ void _generateInterfacesIsTests(
+ ClassElement cls,
void generateIsTest(ClassElement element),
- SubstitutionEmitter generateSubstitution, Set<Element> alreadyGenerated) {
+ SubstitutionEmitter generateSubstitution,
+ Set<Element> alreadyGenerated) {
void tryEmitTest(ClassElement check) {
if (!alreadyGenerated.contains(check) && checkedClasses.contains(check)) {
alreadyGenerated.add(check);
@@ -283,7 +286,8 @@ class RuntimeTypeGenerator {
jsAst.Expression computeTypeVariable;
Substitution substitution = backend.rti.computeSubstitution(
- cls, element.typeDeclaration, alwaysGenerateFunction: true);
+ cls, element.typeDeclaration,
+ alwaysGenerateFunction: true);
if (substitution != null) {
computeTypeVariable = js(r'#.apply(null, this.$builtinTypeInfo)',
substitution.getCodeForVariable(index, backend.rti));
@@ -296,9 +300,9 @@ class RuntimeTypeGenerator {
jsAst.Expression convertRtiToRuntimeType = backend.emitter
.staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType'));
- return new StubMethod(name, js('function () { return #(#) }', [
- convertRtiToRuntimeType,
- computeTypeVariable
- ]));
+ return new StubMethod(
+ name,
+ js('function () { return #(#) }',
+ [convertRtiToRuntimeType, computeTypeVariable]));
}
}
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index 24399cf..6913289 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -438,8 +438,8 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
if (!identical(existing, library)) {
if (tag != null) {
compiler.withCurrentElement(library, () {
- compiler.reportWarning(tag.name,
- MessageKind.DUPLICATED_LIBRARY_RESOURCE, {
+ compiler.reportWarning(
+ tag.name, MessageKind.DUPLICATED_LIBRARY_RESOURCE, {
'libraryName': tag.name,
'resourceUri': resourceUri,
'canonicalUri1': library.canonicalUri,
@@ -528,7 +528,8 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
* If a new library is created, the [handler] is notified.
*/
Future<LibraryElement> createLibrary(LibraryDependencyHandler handler,
- LibraryElement importingLibrary, Uri resolvedUri, [Node node]) {
+ LibraryElement importingLibrary, Uri resolvedUri,
+ [Node node]) {
Uri readableUri =
compiler.translateResolvedUri(importingLibrary, resolvedUri, node);
LibraryElement library = libraryCanonicalUriMap[resolvedUri];
@@ -867,10 +868,8 @@ class LibraryDependencyNode {
assert(invariant(library, !duplicateExports.isEmpty,
message: "No export for $duplicate from ${duplicate.library} "
"in $library."));
- compiler.reportInfo(duplicate, MessageKind.DUPLICATE_EXPORT_DECL, {
- 'name': name,
- 'uriString': duplicateExports.head.uri
- });
+ compiler.reportInfo(duplicate, MessageKind.DUPLICATE_EXPORT_DECL,
+ {'name': name, 'uriString': duplicateExports.head.uri});
}
Element existingElement = exportScope[name];
diff --git a/pkg/compiler/lib/src/mirrors/analyze.dart b/pkg/compiler/lib/src/mirrors/analyze.dart
index c2938d2..963c288 100644
--- a/pkg/compiler/lib/src/mirrors/analyze.dart
+++ b/pkg/compiler/lib/src/mirrors/analyze.dart
@@ -21,8 +21,11 @@ import '../dart2jslib.dart' show Compiler;
* static inspection of the source code.
*/
// TODO(johnniwinther): Move this to [compiler/compiler.dart].
-Future<MirrorSystem> analyze(List<Uri> libraries, Uri libraryRoot,
- Uri packageRoot, api.CompilerInputProvider inputProvider,
+Future<MirrorSystem> analyze(
+ List<Uri> libraries,
+ Uri libraryRoot,
+ Uri packageRoot,
+ api.CompilerInputProvider inputProvider,
api.DiagnosticHandler diagnosticHandler,
[List<String> options = const <String>[]]) {
if (!libraryRoot.path.endsWith("/")) {
diff --git a/pkg/compiler/lib/src/mirrors/dart2js_instance_mirrors.dart b/pkg/compiler/lib/src/mirrors/dart2js_instance_mirrors.dart
index 7d4dc9f..df77b55 100644
--- a/pkg/compiler/lib/src/mirrors/dart2js_instance_mirrors.dart
+++ b/pkg/compiler/lib/src/mirrors/dart2js_instance_mirrors.dart
@@ -32,7 +32,8 @@ abstract class InstanceMirrorMixin implements InstanceMirror {
}
InstanceMirror _convertConstantToInstanceMirror(
- Dart2JsMirrorSystem mirrorSystem, ConstantExpression constant,
+ Dart2JsMirrorSystem mirrorSystem,
+ ConstantExpression constant,
ConstantValue value) {
if (value.isBool) {
return new Dart2JsBoolConstantMirror(mirrorSystem, constant, value);
diff --git a/pkg/compiler/lib/src/mirrors/dart2js_member_mirrors.dart b/pkg/compiler/lib/src/mirrors/dart2js_member_mirrors.dart
index fce817d..a8794c7 100644
--- a/pkg/compiler/lib/src/mirrors/dart2js_member_mirrors.dart
+++ b/pkg/compiler/lib/src/mirrors/dart2js_member_mirrors.dart
@@ -39,8 +39,10 @@ class Dart2JsMethodMirror extends Dart2JsMemberMirror implements MethodMirror {
final String _simpleNameString;
final Dart2JsMethodKind _kind;
- Dart2JsMethodMirror._internal(Dart2JsDeclarationMirror owner,
- FunctionElement function, String this._simpleNameString,
+ Dart2JsMethodMirror._internal(
+ Dart2JsDeclarationMirror owner,
+ FunctionElement function,
+ String this._simpleNameString,
Dart2JsMethodKind this._kind)
: this.owner = owner,
super(owner.mirrorSystem, function);
diff --git a/pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart b/pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart
index 5f8379f..f02134e 100644
--- a/pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart
+++ b/pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart
@@ -351,10 +351,10 @@ abstract class ContainerMixin {
var declarations = <Symbol, DeclarationMirror>{};
_forEachElement((Element element) {
for (DeclarationMirror mirror in _getDeclarationMirrors(element)) {
- assert(invariant(
- _element, !declarations.containsKey(mirror.simpleName),
- message: "Declaration name '${nameOf(mirror)}' "
- "is not unique in $_element."));
+ assert(
+ invariant(_element, !declarations.containsKey(mirror.simpleName),
+ message: "Declaration name '${nameOf(mirror)}' "
+ "is not unique in $_element."));
declarations[mirror.simpleName] = mirror;
}
});
diff --git a/pkg/compiler/lib/src/mirrors/mirrors_util.dart b/pkg/compiler/lib/src/mirrors/mirrors_util.dart
index 3007fbe..52eb0a9 100644
--- a/pkg/compiler/lib/src/mirrors/mirrors_util.dart
+++ b/pkg/compiler/lib/src/mirrors/mirrors_util.dart
@@ -414,10 +414,12 @@ DeclarationMirror _lookupLocal(Mirror mirror, Symbol id) {
if (result != null) return result;
// Try type variables.
result = mirror.typeVariables.firstWhere(
- (TypeVariableMirror v) => v.simpleName == id, orElse: () => null);
+ (TypeVariableMirror v) => v.simpleName == id,
+ orElse: () => null);
} else if (mirror is MethodMirror) {
result = mirror.parameters.firstWhere(
- (ParameterMirror p) => p.simpleName == id, orElse: () => null);
+ (ParameterMirror p) => p.simpleName == id,
+ orElse: () => null);
}
return result;
}
diff --git a/pkg/compiler/lib/src/mirrors_used.dart b/pkg/compiler/lib/src/mirrors_used.dart
index 3af8a0c..7087a83 100644
--- a/pkg/compiler/lib/src/mirrors_used.dart
+++ b/pkg/compiler/lib/src/mirrors_used.dart
@@ -231,8 +231,8 @@ class MirrorUsageAnalyzer {
}
}
});
- propagatedOverrides.forEach((LibraryElement overridden,
- List<MirrorUsage> overriddenUsages) {
+ propagatedOverrides.forEach(
+ (LibraryElement overridden, List<MirrorUsage> overriddenUsages) {
List<MirrorUsage> usages =
usageMap.putIfAbsent(overridden, () => <MirrorUsage>[]);
usages.addAll(overriddenUsages);
@@ -324,7 +324,8 @@ class MirrorUsageAnalyzer {
VariableElement overrideField =
compiler.mirrorsUsedClass.lookupLocalMember('override');
- return new MirrorUsage(cachedStrings[fields[symbolsField]],
+ return new MirrorUsage(
+ cachedStrings[fields[symbolsField]],
cachedElements[fields[targetsField]],
cachedElements[fields[metaTargetsField]],
cachedElements[fields[overrideField]]);
@@ -490,10 +491,10 @@ class MirrorUsageBuilder {
List<String> identifiers = expression.split('.');
Element element = enclosingLibrary.find(identifiers[0]);
if (element == null) {
- compiler.reportHint(spannable,
- MessageKind.MIRRORS_CANNOT_RESOLVE_IN_CURRENT_LIBRARY, {
- 'name': expression
- });
+ compiler.reportHint(
+ spannable,
+ MessageKind.MIRRORS_CANNOT_RESOLVE_IN_CURRENT_LIBRARY,
+ {'name': expression});
return null;
} else {
if (identifiers.length == 1) return element;
@@ -509,17 +510,16 @@ class MirrorUsageBuilder {
if (e == null) {
if (current.isLibrary) {
LibraryElement library = current;
- compiler.reportHint(spannable,
- MessageKind.MIRRORS_CANNOT_RESOLVE_IN_LIBRARY, {
+ compiler.reportHint(
+ spannable, MessageKind.MIRRORS_CANNOT_RESOLVE_IN_LIBRARY, {
'name': identifiers[0],
'library': library.getLibraryOrScriptName()
});
} else {
- compiler.reportHint(spannable,
- MessageKind.MIRRORS_CANNOT_FIND_IN_ELEMENT, {
- 'name': identifier,
- 'element': current.name
- });
+ compiler.reportHint(
+ spannable,
+ MessageKind.MIRRORS_CANNOT_FIND_IN_ELEMENT,
+ {'name': identifier, 'element': current.name});
}
return current;
}
diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart
index 5b40a6f..e435200 100644
--- a/pkg/compiler/lib/src/native/behavior.dart
+++ b/pkg/compiler/lib/src/native/behavior.dart
@@ -197,11 +197,16 @@ class NativeBehavior {
/// [validTags] can be used to restrict which tags are accepted.
static void processSpecString(
DiagnosticListener listener, Spannable spannable, String specString,
- {Iterable<String> validTags, void setSideEffects(SideEffects newEffects),
+ {Iterable<String> validTags,
+ void setSideEffects(SideEffects newEffects),
void setThrows(NativeThrowBehavior throwKind),
- void setIsAllocation(bool isAllocation), void setUseGvn(bool useGvn),
- dynamic resolveType(String typeString), List typesReturned,
- List typesInstantiated, objectType, nullType}) {
+ void setIsAllocation(bool isAllocation),
+ void setUseGvn(bool useGvn),
+ dynamic resolveType(String typeString),
+ List typesReturned,
+ List typesInstantiated,
+ objectType,
+ nullType}) {
bool seenError = false;
void reportError(String message) {
@@ -428,25 +433,22 @@ class NativeBehavior {
var argNodes = jsCall.arguments;
if (argNodes.isEmpty || argNodes.tail.isEmpty) {
- compiler.reportError(jsCall, MessageKind.GENERIC, {
- 'text': "JS expression takes two or more arguments."
- });
+ compiler.reportError(jsCall, MessageKind.GENERIC,
+ {'text': "JS expression takes two or more arguments."});
return behavior;
}
var specArgument = argNodes.head;
if (specArgument is! StringNode || specArgument.isInterpolation) {
- compiler.reportError(specArgument, MessageKind.GENERIC, {
- 'text': "JS first argument must be a string literal."
- });
+ compiler.reportError(specArgument, MessageKind.GENERIC,
+ {'text': "JS first argument must be a string literal."});
return behavior;
}
var codeArgument = argNodes.tail.head;
if (codeArgument is! StringNode || codeArgument.isInterpolation) {
- compiler.reportError(codeArgument, MessageKind.GENERIC, {
- 'text': "JS second argument must be a string literal."
- });
+ compiler.reportError(codeArgument, MessageKind.GENERIC,
+ {'text': "JS second argument must be a string literal."});
return behavior;
}
@@ -456,7 +458,9 @@ class NativeBehavior {
String specString = specArgument.dartString.slowToString();
dynamic resolveType(String typeString) {
- return _parseType(typeString, compiler,
+ return _parseType(
+ typeString,
+ compiler,
(name) => resolver.resolveTypeFromString(specArgument, name),
specArgument);
}
@@ -506,9 +510,12 @@ class NativeBehavior {
}
static void _fillNativeBehaviorOfBuiltinOrEmbeddedGlobal(
- NativeBehavior behavior, Send jsBuiltinOrEmbeddedGlobalCall,
- Compiler compiler, ResolverVisitor resolver,
- {bool isBuiltin, List<String> validTags}) {
+ NativeBehavior behavior,
+ Send jsBuiltinOrEmbeddedGlobalCall,
+ Compiler compiler,
+ ResolverVisitor resolver,
+ {bool isBuiltin,
+ List<String> validTags}) {
// The first argument of a JS-embedded global call is a string encoding
// the type of the code.
//
@@ -548,7 +555,9 @@ class NativeBehavior {
String specString = specLiteral.dartString.slowToString();
dynamic resolveType(String typeString) {
- return _parseType(typeString, compiler,
+ return _parseType(
+ typeString,
+ compiler,
(name) => resolver.resolveTypeFromString(specLiteral, name),
jsBuiltinOrEmbeddedGlobalCall);
}
@@ -573,7 +582,8 @@ class NativeBehavior {
behavior.sideEffects.setTo(new SideEffects());
_fillNativeBehaviorOfBuiltinOrEmbeddedGlobal(
- behavior, jsBuiltinCall, compiler, resolver, isBuiltin: true);
+ behavior, jsBuiltinCall, compiler, resolver,
+ isBuiltin: true);
return behavior;
}
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index 1ce96c7..e669cd6 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -441,7 +441,8 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
if (isIdentifier(name)) {
List<String> nativeNames = nativeTagsOfClassRaw(element.enclosingClass);
if (nativeNames.length != 1) {
- compiler.internalError(element,
+ compiler.internalError(
+ element,
'Unable to determine a native name for the enclosing class, '
'options: $nativeNames');
}
@@ -542,7 +543,8 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
assert(type is DartType);
enqueueUnusedClassesMatching(
(nativeClass) => compiler.types.isSubtype(nativeClass.thisType, type),
- cause, 'subtypeof($type)');
+ cause,
+ 'subtypeof($type)');
}
// Give an info so that library developers can compile with -v to find why
diff --git a/pkg/compiler/lib/src/native/ssa.dart b/pkg/compiler/lib/src/native/ssa.dart
index c0e0fd0..b024ea3 100644
--- a/pkg/compiler/lib/src/native/ssa.dart
+++ b/pkg/compiler/lib/src/native/ssa.dart
@@ -88,17 +88,24 @@ void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
// TODO(sra): This could be cached. The number of templates should
// be proportional to the number of native methods, which is bounded
// by the dart: libraries.
- js.js.uncachedExpressionTemplate(nativeMethodCall), backend.dynamicType,
+ js.js.uncachedExpressionTemplate(nativeMethodCall),
+ backend.dynamicType,
inputs, effects: new SideEffects()));
builder.close(new HReturn(builder.pop())).addSuccessor(builder.graph.exit);
} else {
if (parameters.parameterCount != 0) {
- compiler.internalError(nativeBody, 'native "..." syntax is restricted to '
+ compiler.internalError(
+ nativeBody,
+ 'native "..." syntax is restricted to '
'functions with zero parameters.');
}
LiteralString jsCode = nativeBody.asLiteralString();
- builder.push(new HForeignCode.statement(js.js.statementTemplateYielding(
+ builder.push(new HForeignCode.statement(
+ js.js.statementTemplateYielding(
new js.LiteralStatement(jsCode.dartString.slowToString())),
- <HInstruction>[], new SideEffects(), null, backend.dynamicType));
+ <HInstruction>[],
+ new SideEffects(),
+ null,
+ backend.dynamicType));
}
}
diff --git a/pkg/compiler/lib/src/patch_parser.dart b/pkg/compiler/lib/src/patch_parser.dart
index 7855089..db94613 100644
--- a/pkg/compiler/lib/src/patch_parser.dart
+++ b/pkg/compiler/lib/src/patch_parser.dart
@@ -183,19 +183,19 @@ class PatchParserTask extends CompilerTask {
if (cls.cachedNode != null) return;
measure(() => compiler.withCurrentElement(cls, () {
- MemberListener listener = new PatchMemberListener(compiler, cls);
- Parser parser = new PatchClassElementParser(listener);
- try {
- Token token = parser.parseTopLevelDeclaration(cls.beginToken);
- assert(identical(token, cls.endToken.next));
- } on ParserError catch (e) {
- // No need to recover from a parser error in platform libraries, user
- // will never see this if the libraries are tested correctly.
- compiler.internalError(cls, "Parser error in patch file: $e");
- }
- cls.cachedNode = listener.popNode();
- assert(listener.nodes.isEmpty);
- }));
+ MemberListener listener = new PatchMemberListener(compiler, cls);
+ Parser parser = new PatchClassElementParser(listener);
+ try {
+ Token token = parser.parseTopLevelDeclaration(cls.beginToken);
+ assert(identical(token, cls.endToken.next));
+ } on ParserError catch (e) {
+ // No need to recover from a parser error in platform libraries, user
+ // will never see this if the libraries are tested correctly.
+ compiler.internalError(cls, "Parser error in patch file: $e");
+ }
+ cls.cachedNode = listener.popNode();
+ assert(listener.nodes.isEmpty);
+ }));
}
}
@@ -479,12 +479,10 @@ void tryPatchSetter(
void tryPatchConstructor(
DiagnosticListener listener, Element origin, FunctionElement patch) {
if (!origin.isConstructor) {
- listener.reportError(origin, MessageKind.PATCH_NON_CONSTRUCTOR, {
- 'constructorName': patch.name
- });
- listener.reportInfo(patch, MessageKind.PATCH_POINT_TO_CONSTRUCTOR, {
- 'constructorName': patch.name
- });
+ listener.reportError(origin, MessageKind.PATCH_NON_CONSTRUCTOR,
+ {'constructorName': patch.name});
+ listener.reportInfo(patch, MessageKind.PATCH_POINT_TO_CONSTRUCTOR,
+ {'constructorName': patch.name});
return;
}
patchFunction(listener, origin, patch);
@@ -495,9 +493,8 @@ void tryPatchFunction(
if (!origin.isFunction) {
listener.reportError(
origin, MessageKind.PATCH_NON_FUNCTION, {'functionName': patch.name});
- listener.reportInfo(patch, MessageKind.PATCH_POINT_TO_FUNCTION, {
- 'functionName': patch.name
- });
+ listener.reportInfo(patch, MessageKind.PATCH_POINT_TO_FUNCTION,
+ {'functionName': patch.name});
return;
}
patchFunction(listener, origin, patch);
@@ -507,9 +504,8 @@ void patchFunction(DiagnosticListener listener, BaseFunctionElementX origin,
BaseFunctionElementX patch) {
if (!origin.modifiers.isExternal) {
listener.reportError(origin, MessageKind.PATCH_NON_EXTERNAL);
- listener.reportInfo(patch, MessageKind.PATCH_POINT_TO_FUNCTION, {
- 'functionName': patch.name
- });
+ listener.reportInfo(patch, MessageKind.PATCH_POINT_TO_FUNCTION,
+ {'functionName': patch.name});
return;
}
if (origin.isPatched) {
diff --git a/pkg/compiler/lib/src/resolution/class_hierarchy.dart b/pkg/compiler/lib/src/resolution/class_hierarchy.dart
index 7fbeff6..5c68e61 100644
--- a/pkg/compiler/lib/src/resolution/class_hierarchy.dart
+++ b/pkg/compiler/lib/src/resolution/class_hierarchy.dart
@@ -31,9 +31,8 @@ class TypeDefinitionVisitor extends MappingVisitor<DartType> {
TypeVariable typeNode = nodeLink.head;
registry.useType(typeNode, typeVariable);
if (nameSet.contains(typeName)) {
- error(typeNode, MessageKind.DUPLICATE_TYPE_VARIABLE_NAME, {
- 'typeVariableName': typeName
- });
+ error(typeNode, MessageKind.DUPLICATE_TYPE_VARIABLE_NAME,
+ {'typeVariableName': typeName});
}
nameSet.add(typeName);
@@ -54,9 +53,8 @@ class TypeDefinitionVisitor extends MappingVisitor<DartType> {
if (identical(element, variableElement)) {
// Only report an error on the checked type variable to avoid
// generating multiple errors for the same cyclicity.
- warning(typeNode.name, MessageKind.CYCLIC_TYPE_VARIABLE, {
- 'typeVariableName': variableElement.name
- });
+ warning(typeNode.name, MessageKind.CYCLIC_TYPE_VARIABLE,
+ {'typeVariableName': variableElement.name});
}
break;
}
@@ -216,15 +214,11 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
} else if (mixinType.isTypeVariable) {
compiler.reportError(mixinNode, MessageKind.CLASS_NAME_EXPECTED);
} else if (mixinType.isMalformed) {
- compiler.reportError(mixinNode, MessageKind.CANNOT_MIXIN_MALFORMED, {
- 'className': element.name,
- 'malformedType': mixinType
- });
+ compiler.reportError(mixinNode, MessageKind.CANNOT_MIXIN_MALFORMED,
+ {'className': element.name, 'malformedType': mixinType});
} else if (mixinType.isEnumType) {
- compiler.reportError(mixinNode, MessageKind.CANNOT_MIXIN_ENUM, {
- 'className': element.name,
- 'enumType': mixinType
- });
+ compiler.reportError(mixinNode, MessageKind.CANNOT_MIXIN_ENUM,
+ {'className': element.name, 'enumType': mixinType});
}
return mixinType;
}
@@ -265,8 +259,10 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
String superName = supertype.name;
String mixinName = mixinType.name;
MixinApplicationElementX mixinApplication = new MixinApplicationElementX(
- "${superName}+${mixinName}", element.compilationUnit,
- compiler.getNextFreeClassId(), node,
+ "${superName}+${mixinName}",
+ element.compilationUnit,
+ compiler.getNextFreeClassId(),
+ node,
new Modifiers.withFlags(new NodeList.empty(), Modifiers.FLAG_ABSTRACT));
// Create synthetic type variables for the mixin application.
List<DartType> typeVariables = <DartType>[];
@@ -409,16 +405,12 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
DartType supertype = resolveType(superclass);
if (supertype != null) {
if (supertype.isMalformed) {
- compiler.reportError(superclass, MessageKind.CANNOT_EXTEND_MALFORMED, {
- 'className': element.name,
- 'malformedType': supertype
- });
+ compiler.reportError(superclass, MessageKind.CANNOT_EXTEND_MALFORMED,
+ {'className': element.name, 'malformedType': supertype});
return objectType;
} else if (supertype.isEnumType) {
- compiler.reportError(superclass, MessageKind.CANNOT_EXTEND_ENUM, {
- 'className': element.name,
- 'enumType': supertype
- });
+ compiler.reportError(superclass, MessageKind.CANNOT_EXTEND_ENUM,
+ {'className': element.name, 'enumType': supertype});
return objectType;
} else if (!supertype.isInterfaceType) {
compiler.reportError(
@@ -440,41 +432,36 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
DartType interfaceType = resolveType(link.head);
if (interfaceType != null) {
if (interfaceType.isMalformed) {
- compiler.reportError(superclass,
- MessageKind.CANNOT_IMPLEMENT_MALFORMED, {
- 'className': element.name,
- 'malformedType': interfaceType
- });
+ compiler.reportError(
+ superclass,
+ MessageKind.CANNOT_IMPLEMENT_MALFORMED,
+ {'className': element.name, 'malformedType': interfaceType});
} else if (interfaceType.isEnumType) {
- compiler.reportError(superclass, MessageKind.CANNOT_IMPLEMENT_ENUM, {
- 'className': element.name,
- 'enumType': interfaceType
- });
+ compiler.reportError(superclass, MessageKind.CANNOT_IMPLEMENT_ENUM,
+ {'className': element.name, 'enumType': interfaceType});
} else if (!interfaceType.isInterfaceType) {
// TODO(johnniwinther): Handle dynamic.
TypeAnnotation typeAnnotation = link.head;
error(typeAnnotation.typeName, MessageKind.CLASS_NAME_EXPECTED);
} else {
if (interfaceType == element.supertype) {
- compiler.reportError(superclass,
- MessageKind.DUPLICATE_EXTENDS_IMPLEMENTS, {
- 'type': interfaceType
- });
- compiler.reportError(link.head,
- MessageKind.DUPLICATE_EXTENDS_IMPLEMENTS, {
- 'type': interfaceType
- });
+ compiler.reportError(
+ superclass,
+ MessageKind.DUPLICATE_EXTENDS_IMPLEMENTS,
+ {'type': interfaceType});
+ compiler.reportError(
+ link.head,
+ MessageKind.DUPLICATE_EXTENDS_IMPLEMENTS,
+ {'type': interfaceType});
}
if (result.contains(interfaceType)) {
- compiler.reportError(link.head, MessageKind.DUPLICATE_IMPLEMENTS, {
- 'type': interfaceType
- });
+ compiler.reportError(link.head, MessageKind.DUPLICATE_IMPLEMENTS,
+ {'type': interfaceType});
}
result = result.prepend(interfaceType);
if (isBlackListed(interfaceType)) {
- error(link.head, MessageKind.CANNOT_IMPLEMENT, {
- 'type': interfaceType
- });
+ error(link.head, MessageKind.CANNOT_IMPLEMENT,
+ {'type': interfaceType});
}
}
}
@@ -633,9 +620,8 @@ class ClassSupertypeResolver extends CommonResolverVisitor {
Identifier selector = node.selector.asIdentifier();
var e = prefixElement.lookupLocalMember(selector.source);
if (e == null || !e.impliesType) {
- error(node.selector, MessageKind.CANNOT_RESOLVE_TYPE, {
- 'typeName': node.selector
- });
+ error(node.selector, MessageKind.CANNOT_RESOLVE_TYPE,
+ {'typeName': node.selector});
return;
}
loadSupertype(e, node);
diff --git a/pkg/compiler/lib/src/resolution/class_members.dart b/pkg/compiler/lib/src/resolution/class_members.dart
index f4d7ffc..7b2c0b6 100644
--- a/pkg/compiler/lib/src/resolution/class_members.dart
+++ b/pkg/compiler/lib/src/resolution/class_members.dart
@@ -32,7 +32,9 @@ abstract class MembersCreator {
Map<dynamic /* Member | Element */, Set<MessageKind>> reportedMessages =
new Map<dynamic, Set<MessageKind>>();
- MembersCreator(Compiler this.compiler, ClassElement this.cls,
+ MembersCreator(
+ Compiler this.compiler,
+ ClassElement this.cls,
Iterable<String> this.computedMemberNames,
Map<Name, Member> this.classMembers) {
assert(invariant(cls, cls.isDeclaration,
@@ -184,8 +186,11 @@ abstract class MembersCreator {
DartType type = element.computeType(compiler);
addDeclaredMember(name, type, new FunctionType.synthesized(type));
if (!element.isConst && !element.isFinal) {
- addDeclaredMember(name.setter, type, new FunctionType.synthesized(
- const VoidType(), <DartType>[type]));
+ addDeclaredMember(
+ name.setter,
+ type,
+ new FunctionType.synthesized(
+ const VoidType(), <DartType>[type]));
}
} else if (element.isGetter) {
FunctionType functionType = element.computeType(compiler);
@@ -239,10 +244,8 @@ abstract class MembersCreator {
kind = MessageKind.ABSTRACT_GETTER;
}
reportMessage(interfaceMember.element, MessageKind.ABSTRACT_METHOD, () {
- compiler.reportWarning(interfaceMember.element, kind, {
- 'class': cls.name,
- 'name': name.text
- });
+ compiler.reportWarning(interfaceMember.element, kind,
+ {'class': cls.name, 'name': name.text});
});
} else {
reportWarning(MessageKind singleKind, MessageKind multipleKind,
@@ -250,36 +253,42 @@ abstract class MembersCreator {
[MessageKind implicitlyDeclaredKind]) {
Member inherited = interfaceMember.declarations.first;
reportMessage(interfaceMember, MessageKind.UNIMPLEMENTED_METHOD, () {
- compiler.reportWarning(cls, interfaceMember.declarations.length == 1
- ? singleKind
- : multipleKind, {
+ compiler.reportWarning(
+ cls,
+ interfaceMember.declarations.length == 1
+ ? singleKind
+ : multipleKind,
+ {
'class': cls.name,
'name': name.text,
'method': interfaceMember,
'declarer': inherited.declarer
});
for (Member inherited in interfaceMember.declarations) {
- compiler.reportInfo(inherited.element, inherited.isDeclaredByField
- ? implicitlyDeclaredKind
- : explicitlyDeclaredKind, {
- 'class': inherited.declarer.name,
- 'name': name.text
- });
+ compiler.reportInfo(
+ inherited.element,
+ inherited.isDeclaredByField
+ ? implicitlyDeclaredKind
+ : explicitlyDeclaredKind,
+ {'class': inherited.declarer.name, 'name': name.text});
}
});
}
if (interfaceMember.isSetter) {
- reportWarning(MessageKind.UNIMPLEMENTED_SETTER_ONE,
+ reportWarning(
+ MessageKind.UNIMPLEMENTED_SETTER_ONE,
MessageKind.UNIMPLEMENTED_SETTER,
MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER,
MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER);
} else if (interfaceMember.isGetter) {
- reportWarning(MessageKind.UNIMPLEMENTED_GETTER_ONE,
+ reportWarning(
+ MessageKind.UNIMPLEMENTED_GETTER_ONE,
MessageKind.UNIMPLEMENTED_GETTER,
MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER,
MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER);
} else if (interfaceMember.isMethod) {
- reportWarning(MessageKind.UNIMPLEMENTED_METHOD_ONE,
+ reportWarning(
+ MessageKind.UNIMPLEMENTED_METHOD_ONE,
MessageKind.UNIMPLEMENTED_METHOD,
MessageKind.UNIMPLEMENTED_METHOD_CONT);
}
@@ -321,13 +330,12 @@ abstract class MembersCreator {
while (superclass != null) {
Member superMember = superclass.lookupClassMember(declared.name);
if (superMember != null && superMember.isStatic) {
- reportMessage(superMember, MessageKind.INSTANCE_STATIC_SAME_NAME,
- () {
- compiler.reportWarning(declared.element,
- MessageKind.INSTANCE_STATIC_SAME_NAME, {
- 'memberName': declared.name,
- 'className': superclass.name
- });
+ reportMessage(
+ superMember, MessageKind.INSTANCE_STATIC_SAME_NAME, () {
+ compiler.reportWarning(
+ declared.element,
+ MessageKind.INSTANCE_STATIC_SAME_NAME,
+ {'memberName': declared.name, 'className': superclass.name});
compiler.reportInfo(superMember.element,
MessageKind.INSTANCE_STATIC_SAME_NAME_CONT);
});
@@ -348,8 +356,10 @@ abstract class MembersCreator {
}
reportMessage(inherited.element, MessageKind.NO_STATIC_OVERRIDE, () {
- reportErrorWithContext(declared.element,
- MessageKind.NO_STATIC_OVERRIDE, inherited.element,
+ reportErrorWithContext(
+ declared.element,
+ MessageKind.NO_STATIC_OVERRIDE,
+ inherited.element,
MessageKind.NO_STATIC_OVERRIDE_CONT);
});
}
@@ -367,17 +377,15 @@ abstract class MembersCreator {
}
void reportError(MessageKind errorKind, MessageKind infoKind) {
- reportMessage(inherited.element, MessageKind.INVALID_OVERRIDE_METHOD,
- () {
+ reportMessage(
+ inherited.element, MessageKind.INVALID_OVERRIDE_METHOD, () {
compiler.reportError(declared.element, errorKind, {
'name': declared.name.text,
'class': cls.thisType,
'inheritedClass': inherited.declarer
});
- compiler.reportInfo(inherited.element, infoKind, {
- 'name': declared.name.text,
- 'class': inherited.declarer
- });
+ compiler.reportInfo(inherited.element, infoKind,
+ {'name': declared.name.text, 'class': inherited.declarer});
});
}
@@ -406,29 +414,31 @@ abstract class MembersCreator {
'inheritedType': inherited.type,
'inheritedClass': inherited.declarer
});
- compiler.reportInfo(inherited.element, infoKind, {
- 'name': declared.name.text,
- 'class': inherited.declarer
- });
+ compiler.reportInfo(inherited.element, infoKind,
+ {'name': declared.name.text, 'class': inherited.declarer});
});
}
if (declared.isDeclaredByField) {
if (inherited.isDeclaredByField) {
- reportWarning(inherited.element,
+ reportWarning(
+ inherited.element,
MessageKind.INVALID_OVERRIDE_FIELD,
MessageKind.INVALID_OVERRIDDEN_FIELD);
} else if (inherited.isGetter) {
- reportWarning(inherited,
+ reportWarning(
+ inherited,
MessageKind.INVALID_OVERRIDE_GETTER_WITH_FIELD,
MessageKind.INVALID_OVERRIDDEN_GETTER);
} else if (inherited.isSetter) {
- reportWarning(inherited,
+ reportWarning(
+ inherited,
MessageKind.INVALID_OVERRIDE_SETTER_WITH_FIELD,
MessageKind.INVALID_OVERRIDDEN_SETTER);
}
} else if (declared.isGetter) {
if (inherited.isDeclaredByField) {
- reportWarning(inherited,
+ reportWarning(
+ inherited,
MessageKind.INVALID_OVERRIDE_FIELD_WITH_GETTER,
MessageKind.INVALID_OVERRIDDEN_FIELD);
} else {
@@ -437,7 +447,8 @@ abstract class MembersCreator {
}
} else if (declared.isSetter) {
if (inherited.isDeclaredByField) {
- reportWarning(inherited,
+ reportWarning(
+ inherited,
MessageKind.INVALID_OVERRIDE_FIELD_WITH_SETTER,
MessageKind.INVALID_OVERRIDDEN_FIELD);
} else {
@@ -454,8 +465,10 @@ abstract class MembersCreator {
}
}
- void reportErrorWithContext(Element errorneousElement,
- MessageKind errorMessage, Element contextElement,
+ void reportErrorWithContext(
+ Element errorneousElement,
+ MessageKind errorMessage,
+ Element contextElement,
MessageKind contextMessage) {
compiler.reportError(errorneousElement, errorMessage, {
'memberName': contextElement.name,
@@ -469,7 +482,11 @@ abstract class MembersCreator {
Compiler compiler, ClassMemberMixin cls, String name) {
if (cls.isMemberComputed(name)) return;
LibraryElement library = cls.library;
- _computeClassMember(compiler, cls, name, new Setlet<Name>()
+ _computeClassMember(
+ compiler,
+ cls,
+ name,
+ new Setlet<Name>()
..add(new Name(name, library))
..add(new Name(name, library, isSetter: true)));
}
@@ -515,8 +532,11 @@ class ClassMembersCreator extends MembersCreator {
class InterfaceMembersCreator extends MembersCreator {
final Map<Name, MemberSignature> interfaceMembers;
- InterfaceMembersCreator(Compiler compiler, ClassElement cls,
- Iterable<String> computedMemberNames, Map<Name, Member> classMembers,
+ InterfaceMembersCreator(
+ Compiler compiler,
+ ClassElement cls,
+ Iterable<String> computedMemberNames,
+ Map<Name, Member> classMembers,
Map<Name, MemberSignature> this.interfaceMembers)
: super(compiler, cls, computedMemberNames, classMembers);
@@ -655,10 +675,8 @@ class InterfaceMembersCreator extends MembersCreator {
.add(inherited);
}
if (someAreGetters && !allAreGetters) {
- compiler.reportWarning(cls, MessageKind.INHERIT_GETTER_AND_METHOD, {
- 'class': thisType,
- 'name': name.text
- });
+ compiler.reportWarning(cls, MessageKind.INHERIT_GETTER_AND_METHOD,
+ {'class': thisType, 'name': name.text});
for (Member inherited in inheritedMembers) {
MessageKind kind;
if (inherited.isMethod) {
@@ -673,10 +691,8 @@ class InterfaceMembersCreator extends MembersCreator {
kind = MessageKind.INHERITED_EXPLICIT_GETTER;
}
}
- compiler.reportInfo(inherited.element, kind, {
- 'class': inherited.declarer,
- 'name': name.text
- });
+ compiler.reportInfo(inherited.element, kind,
+ {'class': inherited.declarer, 'name': name.text});
}
interfaceMembers[name] = new ErroneousMember(inheritedMembers);
} else if (subtypesOfAllInherited.length == 1) {
@@ -747,8 +763,11 @@ class InterfaceMembersCreator extends MembersCreator {
List<DartType> namedParameterTypes =
new List.filled(namedParameters.length, dynamic);
FunctionType memberType = new FunctionType.synthesized(
- const DynamicType(), requiredParameterTypes, optionalParameterTypes,
- namedParameters, namedParameterTypes);
+ const DynamicType(),
+ requiredParameterTypes,
+ optionalParameterTypes,
+ namedParameters,
+ namedParameterTypes);
DartType type = memberType;
if (inheritedMembers.first.isGetter || inheritedMembers.first.isSetter) {
type = const DynamicType();
diff --git a/pkg/compiler/lib/src/resolution/constructors.dart b/pkg/compiler/lib/src/resolution/constructors.dart
index 9c7de2e..57149da 100644
--- a/pkg/compiler/lib/src/resolution/constructors.dart
+++ b/pkg/compiler/lib/src/resolution/constructors.dart
@@ -117,8 +117,13 @@ class InitializerResolver {
final bool isImplicitSuperCall = false;
final String className = lookupTarget.name;
- verifyThatConstructorMatchesCall(constructor, calledConstructor,
- selector.callStructure, isImplicitSuperCall, call, className,
+ verifyThatConstructorMatchesCall(
+ constructor,
+ calledConstructor,
+ selector.callStructure,
+ isImplicitSuperCall,
+ call,
+ className,
constructorSelector);
registry.useElement(call, calledConstructor);
@@ -144,17 +149,26 @@ class InitializerResolver {
final String className = lookupTarget.name;
final bool isImplicitSuperCall = true;
- verifyThatConstructorMatchesCall(constructor, calledConstructor,
- CallStructure.NO_ARGS, isImplicitSuperCall, functionNode, className,
+ verifyThatConstructorMatchesCall(
+ constructor,
+ calledConstructor,
+ CallStructure.NO_ARGS,
+ isImplicitSuperCall,
+ functionNode,
+ className,
constructorSelector);
registry.registerImplicitSuperCall(calledConstructor);
registry.registerStaticUse(calledConstructor);
}
}
- void verifyThatConstructorMatchesCall(FunctionElement caller,
- ConstructorElementX lookedupConstructor, CallStructure call,
- bool isImplicitSuperCall, Node diagnosticNode, String className,
+ void verifyThatConstructorMatchesCall(
+ FunctionElement caller,
+ ConstructorElementX lookedupConstructor,
+ CallStructure call,
+ bool isImplicitSuperCall,
+ Node diagnosticNode,
+ String className,
Selector constructorSelector) {
if (lookedupConstructor == null ||
!lookedupConstructor.isGenerativeConstructor) {
@@ -272,9 +286,13 @@ class ConstructorResolver extends CommonResolverVisitor<Element> {
}
ErroneousConstructorElementX failOrReturnErroneousConstructorElement(
- Spannable diagnosticNode, Element enclosing, String name,
- MessageKind kind, Map arguments,
- {bool isError: false, bool missingConstructor: false}) {
+ Spannable diagnosticNode,
+ Element enclosing,
+ String name,
+ MessageKind kind,
+ Map arguments,
+ {bool isError: false,
+ bool missingConstructor: false}) {
if (missingConstructor) {
registry.registerThrowNoSuchMethod();
} else {
@@ -300,10 +318,13 @@ class ConstructorResolver extends CommonResolverVisitor<Element> {
if (result == null) {
String fullConstructorName =
Elements.constructorNameForDiagnostics(cls.name, constructorName);
- return failOrReturnErroneousConstructorElement(diagnosticNode, cls,
- constructorName, MessageKind.CANNOT_FIND_CONSTRUCTOR, {
- 'constructorName': fullConstructorName
- }, missingConstructor: true);
+ return failOrReturnErroneousConstructorElement(
+ diagnosticNode,
+ cls,
+ constructorName,
+ MessageKind.CANNOT_FIND_CONSTRUCTOR,
+ {'constructorName': fullConstructorName},
+ missingConstructor: true);
} else if (inConstContext && !result.isConst) {
error(diagnosticNode, MessageKind.CONSTRUCTOR_IS_NOT_CONST);
}
@@ -334,16 +355,17 @@ class ConstructorResolver extends CommonResolverVisitor<Element> {
// The unnamed constructor may not exist, so [e] may become unresolved.
element = resolveConstructor(cls, diagnosticNode, '');
} else {
- element = failOrReturnErroneousConstructorElement(diagnosticNode,
- element, element.name, MessageKind.NOT_A_TYPE, {
- 'node': diagnosticNode
- });
+ element = failOrReturnErroneousConstructorElement(
+ diagnosticNode,
+ element,
+ element.name,
+ MessageKind.NOT_A_TYPE,
+ {'node': diagnosticNode});
}
} else if (element.isErroneous && element is! ErroneousElementX) {
// Parser error. The error has already been reported.
- element = new ErroneousConstructorElementX(MessageKind.NOT_A_TYPE, {
- 'node': diagnosticNode
- }, element.name, element);
+ element = new ErroneousConstructorElementX(MessageKind.NOT_A_TYPE,
+ {'node': diagnosticNode}, element.name, element);
registry.registerThrowRuntimeError();
}
@@ -385,14 +407,20 @@ class ConstructorResolver extends CommonResolverVisitor<Element> {
element = prefix.lookupLocalMember(name.source);
element = Elements.unwrap(element, compiler, node);
if (element == null) {
- return failOrReturnErroneousConstructorElement(name,
- resolver.enclosingElement, name.source, MessageKind.CANNOT_RESOLVE,
+ return failOrReturnErroneousConstructorElement(
+ name,
+ resolver.enclosingElement,
+ name.source,
+ MessageKind.CANNOT_RESOLVE,
{'name': name});
} else if (!element.isClass) {
- return failOrReturnErroneousConstructorElement(name,
- resolver.enclosingElement, name.source, MessageKind.NOT_A_TYPE, {
- 'node': name
- }, isError: true);
+ return failOrReturnErroneousConstructorElement(
+ name,
+ resolver.enclosingElement,
+ name.source,
+ MessageKind.NOT_A_TYPE,
+ {'node': name},
+ isError: true);
}
} else {
internalError(node.receiver, 'unexpected element $element');
@@ -407,29 +435,38 @@ class ConstructorResolver extends CommonResolverVisitor<Element> {
registry.useElement(node, element);
// TODO(johnniwinther): Change errors to warnings, cf. 11.11.1.
if (element == null) {
- return failOrReturnErroneousConstructorElement(node,
- resolver.enclosingElement, name, MessageKind.CANNOT_RESOLVE, {
- 'name': name
- });
+ return failOrReturnErroneousConstructorElement(
+ node,
+ resolver.enclosingElement,
+ name,
+ MessageKind.CANNOT_RESOLVE,
+ {'name': name});
} else if (element.isErroneous) {
return element;
} else if (element.isTypedef) {
- element = failOrReturnErroneousConstructorElement(node,
- resolver.enclosingElement,
- name, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, {
- 'typedefName': name
- }, isError: true);
+ element = failOrReturnErroneousConstructorElement(
+ node,
+ resolver.enclosingElement,
+ name,
+ MessageKind.CANNOT_INSTANTIATE_TYPEDEF,
+ {'typedefName': name},
+ isError: true);
} else if (element.isTypeVariable) {
- element = failOrReturnErroneousConstructorElement(node,
- resolver.enclosingElement, name,
- MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, {
- 'typeVariableName': name
- }, isError: true);
+ element = failOrReturnErroneousConstructorElement(
+ node,
+ resolver.enclosingElement,
+ name,
+ MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE,
+ {'typeVariableName': name},
+ isError: true);
} else if (!element.isClass && !element.isPrefix) {
- element = failOrReturnErroneousConstructorElement(node,
- resolver.enclosingElement, name, MessageKind.NOT_A_TYPE, {
- 'node': name
- }, isError: true);
+ element = failOrReturnErroneousConstructorElement(
+ node,
+ resolver.enclosingElement,
+ name,
+ MessageKind.NOT_A_TYPE,
+ {'node': name},
+ isError: true);
}
return element;
}
diff --git a/pkg/compiler/lib/src/resolution/enum_creator.dart b/pkg/compiler/lib/src/resolution/enum_creator.dart
index 5283f14..6bc18e0 100644
--- a/pkg/compiler/lib/src/resolution/enum_creator.dart
+++ b/pkg/compiler/lib/src/resolution/enum_creator.dart
@@ -82,8 +82,13 @@ class AstBuilder {
FunctionExpression functionExpression(
Modifiers modifiers, String name, NodeList argumentList, Statement body,
[TypeAnnotation returnType]) {
- return new FunctionExpression(identifier(name), argumentList, body,
- returnType, modifiers, null, // Initializer.
+ return new FunctionExpression(
+ identifier(name),
+ argumentList,
+ body,
+ returnType,
+ modifiers,
+ null, // Initializer.
null, // get/set.
null // Async modifier.
);
@@ -104,9 +109,10 @@ class AstBuilder {
}
LiteralList listLiteral(List<Node> elements, {bool isConst: false}) {
- return new LiteralList(null, new NodeList(
- symbolToken(OPEN_SQUARE_BRACKET_INFO), linkedList(elements),
- symbolToken(CLOSE_SQUARE_BRACKET_INFO), ','),
+ return new LiteralList(
+ null,
+ new NodeList(symbolToken(OPEN_SQUARE_BRACKET_INFO),
+ linkedList(elements), symbolToken(CLOSE_SQUARE_BRACKET_INFO), ','),
isConst ? keywordToken('const') : null);
}
@@ -117,8 +123,11 @@ class AstBuilder {
}
VariableDefinitions initializingFormal(String fieldName) {
- return new VariableDefinitions.forParameter(new NodeList.empty(), null,
- Modifiers.EMPTY, new NodeList.singleton(
+ return new VariableDefinitions.forParameter(
+ new NodeList.empty(),
+ null,
+ Modifiers.EMPTY,
+ new NodeList.singleton(
new Send(identifier('this'), identifier(fieldName))));
}
@@ -142,7 +151,8 @@ class AstBuilder {
}
LiteralMap mapLiteral(List<LiteralMapEntry> entries, {bool isConst: false}) {
- return new LiteralMap(null, // Type arguments.
+ return new LiteralMap(
+ null, // Type arguments.
new NodeList(symbolToken(OPEN_CURLY_BRACKET_INFO), linkedList(entries),
symbolToken(CLOSE_CURLY_BRACKET_INFO), ','),
isConst ? keywordToken('const') : null);
@@ -179,8 +189,10 @@ class EnumCreator {
VariableDefinitions indexDefinition = builder.initializingFormal('index');
FunctionExpression constructorNode = builder.functionExpression(
- builder.modifiers(isConst: true), enumClass.name,
- builder.argumentList([indexDefinition]), builder.emptyStatement());
+ builder.modifiers(isConst: true),
+ enumClass.name,
+ builder.argumentList([indexDefinition]),
+ builder.emptyStatement());
EnumConstructorElementX constructor = new EnumConstructorElementX(
enumClass, builder.modifiers(isConst: true), constructorNode);
@@ -246,13 +258,14 @@ class EnumCreator {
// TODO(johnniwinther): Support return type. Note `String` might be prefixed
// or not imported within the current library.
- FunctionExpression toStringNode =
- builder
- .functionExpression(Modifiers.EMPTY, 'toString', builder
- .argumentList([
- ]), builder.returnStatement(builder.indexGet(
- builder.mapLiteral(mapEntries, isConst: true),
- builder.reference(builder.identifier('index')))));
+ FunctionExpression toStringNode = builder.functionExpression(
+ Modifiers.EMPTY,
+ 'toString',
+ builder.argumentList([]),
+ builder.returnStatement(
+ builder.indexGet(
+ builder.mapLiteral(mapEntries, isConst: true),
+ builder.reference(builder.identifier('index')))));
EnumMethodElementX toString = new EnumMethodElementX(
'toString', enumClass, Modifiers.EMPTY, toStringNode);
diff --git a/pkg/compiler/lib/src/resolution/member_impl.dart b/pkg/compiler/lib/src/resolution/member_impl.dart
index ae5a963..738e7a4 100644
--- a/pkg/compiler/lib/src/resolution/member_impl.dart
+++ b/pkg/compiler/lib/src/resolution/member_impl.dart
@@ -184,8 +184,10 @@ class InheritedAbstractMember extends InheritedMember {
bool get isAbstract => true;
InheritedMember _newInheritedMember(InterfaceType newInstance) {
- return new InheritedAbstractMember(declaration,
- instance.substByContext(newInstance), implementation != null
+ return new InheritedAbstractMember(
+ declaration,
+ instance.substByContext(newInstance),
+ implementation != null
? implementation.inheritFrom(newInstance)
: null);
}
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index a756c4c..205368d 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -55,29 +55,29 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
// TODO(ahe): Find a way to share this with runtime implementation.
- static final RegExp symbolValidationPattern = new RegExp(
- r'^(?:[a-zA-Z$][a-zA-Z$0-9_]*\.)*(?:[a-zA-Z$][a-zA-Z$0-9_]*=?|'
- r'-|'
- r'unary-|'
- r'\[\]=|'
- r'~|'
- r'==|'
- r'\[\]|'
- r'\*|'
- r'/|'
- r'%|'
- r'~/|'
- r'\+|'
- r'<<|'
- r'>>|'
- r'>=|'
- r'>|'
- r'<=|'
- r'<|'
- r'&|'
- r'\^|'
- r'\|'
- r')$');
+ static final RegExp symbolValidationPattern =
+ new RegExp(r'^(?:[a-zA-Z$][a-zA-Z$0-9_]*\.)*(?:[a-zA-Z$][a-zA-Z$0-9_]*=?|'
+ r'-|'
+ r'unary-|'
+ r'\[\]=|'
+ r'~|'
+ r'==|'
+ r'\[\]|'
+ r'\*|'
+ r'/|'
+ r'%|'
+ r'~/|'
+ r'\+|'
+ r'<<|'
+ r'>>|'
+ r'>=|'
+ r'>|'
+ r'<=|'
+ r'<|'
+ r'&|'
+ r'\^|'
+ r'\|'
+ r')$');
ResolverVisitor(
Compiler compiler, Element element, ResolutionRegistry registry,
@@ -117,9 +117,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
if (!inInstanceContext && result.isInstanceMember) {
compiler.reportError(
node, MessageKind.NO_INSTANCE_AVAILABLE, {'name': name});
- return new ErroneousElementX(MessageKind.NO_INSTANCE_AVAILABLE, {
- 'name': name
- }, name, enclosingElement);
+ return new ErroneousElementX(MessageKind.NO_INSTANCE_AVAILABLE,
+ {'name': name}, name, enclosingElement);
} else if (result.isAmbiguous) {
AmbiguousElement ambiguous = result;
compiler.reportError(
@@ -243,10 +242,10 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
// Use the erroneous element.
} else {
if ((element.kind.category & allowedCategory) == 0) {
- element = reportAndCreateErroneousElement(node, name,
- MessageKind.GENERIC,
- // TODO(ahe): Improve error message. Need UX input.
- {'text': "is not an expression $element"});
+ element =
+ reportAndCreateErroneousElement(node, name, MessageKind.GENERIC,
+ // TODO(ahe): Improve error message. Need UX input.
+ {'text': "is not an expression $element"});
}
}
if (!Elements.isUnresolved(element) && element.isClass) {
@@ -417,9 +416,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
{bool inFunctionDeclaration: false}) {
bool doAddToScope = inFunctionDeclaration;
if (!inFunctionDeclaration && node.name != null) {
- compiler.reportError(node.name, MessageKind.NAMED_FUNCTION_EXPRESSION, {
- 'name': node.name
- });
+ compiler.reportError(node.name, MessageKind.NAMED_FUNCTION_EXPRESSION,
+ {'name': node.name});
}
visit(node.returnType);
String name;
@@ -479,9 +477,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
{'argumentCount': selector.argumentCount});
sendStructure = const InvalidAssertStructure();
} else if (selector.namedArgumentCount != 0) {
- error(node.selector, MessageKind.ASSERT_IS_GIVEN_NAMED_ARGUMENTS, {
- 'argumentCount': selector.namedArgumentCount
- });
+ error(node.selector, MessageKind.ASSERT_IS_GIVEN_NAMED_ARGUMENTS,
+ {'argumentCount': selector.namedArgumentCount});
sendStructure = const InvalidAssertStructure();
}
registry.registerAssert(node);
@@ -519,9 +516,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
String name = node.selector.asIdentifier().source;
if (identical(name, 'this')) {
// TODO(ahe): Why is this using GENERIC?
- error(node.selector, MessageKind.GENERIC, {
- 'text': "expected an identifier"
- });
+ error(node.selector, MessageKind.GENERIC,
+ {'text': "expected an identifier"});
return null;
} else if (node.isSuperCall) {
if (node.isOperator) {
@@ -539,9 +535,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
if (currentClass.supertype == null) {
// This is just to guard against internal errors, so no need
// for a real error message.
- error(node.receiver, MessageKind.GENERIC, {
- 'text': "Object has no superclass"
- });
+ error(node.receiver, MessageKind.GENERIC,
+ {'text': "Object has no superclass"});
return null;
}
// TODO(johnniwinther): Ensure correct behavior if currentClass is a
@@ -550,11 +545,11 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
// [target] may be null which means invoking noSuchMethod on
// super.
if (target == null) {
- target = reportAndCreateErroneousElement(node, name,
- MessageKind.NO_SUCH_SUPER_MEMBER, {
- 'className': currentClass.name,
- 'memberName': name
- });
+ target = reportAndCreateErroneousElement(
+ node,
+ name,
+ MessageKind.NO_SUCH_SUPER_MEMBER,
+ {'className': currentClass.name, 'memberName': name});
// We still need to register the invocation, because we might
// call [:super.noSuchMethod:] which calls
// [JSInvocationMirror._invokeOn].
@@ -596,22 +591,22 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
} else if (isPrivateName(name) &&
target.library != enclosingElement.library) {
registry.registerThrowNoSuchMethod();
- return new ElementResult(reportAndCreateErroneousElement(node, name,
- MessageKind.PRIVATE_ACCESS, {
- 'libraryName': target.library.getLibraryOrScriptName(),
- 'name': name
- }));
+ return new ElementResult(reportAndCreateErroneousElement(
+ node, name, MessageKind.PRIVATE_ACCESS, {
+ 'libraryName': target.library.getLibraryOrScriptName(),
+ 'name': name
+ }));
}
} else if (resolvedReceiver.element.isPrefix) {
PrefixElement prefix = resolvedReceiver.element;
target = prefix.lookupLocalMember(name);
if (Elements.isUnresolved(target)) {
registry.registerThrowNoSuchMethod();
- return new ElementResult(reportAndCreateErroneousElement(node, name,
- MessageKind.NO_SUCH_LIBRARY_MEMBER, {
- 'libraryName': prefix.name,
- 'memberName': name
- }));
+ return new ElementResult(reportAndCreateErroneousElement(
+ node,
+ name,
+ MessageKind.NO_SUCH_LIBRARY_MEMBER,
+ {'libraryName': prefix.name, 'memberName': name}));
} else if (target.isAmbiguous) {
registry.registerThrowNoSuchMethod();
AmbiguousElement ambiguous = target;
@@ -802,11 +797,11 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
Element target = currentClass.lookupSuperByName(name);
// [target] may be null which means invoking noSuchMethod on super.
if (target == null) {
- Element error = reportAndCreateErroneousElement(node, name.text,
- MessageKind.NO_SUCH_SUPER_MEMBER, {
- 'className': currentClass.name,
- 'memberName': name
- });
+ Element error = reportAndCreateErroneousElement(
+ node,
+ name.text,
+ MessageKind.NO_SUCH_SUPER_MEMBER,
+ {'className': currentClass.name, 'memberName': name});
if (alternateName != null) {
target = currentClass.lookupSuperByName(alternateName);
}
@@ -1132,10 +1127,10 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
ClassElement cls = target.enclosingClass;
assert(enclosingElement.enclosingClass == cls);
if (!Elements.hasAccessToTypeVariables(enclosingElement)) {
- compiler.reportError(node,
- MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, {
- 'typeVariableName': node.selector
- });
+ compiler.reportError(
+ node,
+ MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER,
+ {'typeVariableName': node.selector});
}
registry.registerClassUsingVariableExpression(cls);
registry.registerTypeVariableExpression();
@@ -1274,11 +1269,11 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
setter = reportAndCreateErroneousElement(node.selector, target.name,
MessageKind.CANNOT_RESOLVE_SETTER, const {});
} else if (node.isSuperCall) {
- setter = reportAndCreateErroneousElement(node.selector, target.name,
- MessageKind.SETTER_NOT_FOUND_IN_SUPER, {
- 'name': target.name,
- 'className': currentClass.name
- });
+ setter = reportAndCreateErroneousElement(
+ node.selector,
+ target.name,
+ MessageKind.SETTER_NOT_FOUND_IN_SUPER,
+ {'name': target.name, 'className': currentClass.name});
registry.registerSuperNoSuchMethod();
} else {
// For instance fields we don't report a warning here because the type
@@ -1332,11 +1327,11 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
if (node.isSuperCall) {
getter = currentClass.lookupSuperByName(getterSelector.memberName);
if (getter == null) {
- target = reportAndCreateErroneousElement(node, selector.name,
- MessageKind.NO_SUCH_SUPER_MEMBER, {
- 'className': currentClass.name,
- 'memberName': selector.name
- });
+ target = reportAndCreateErroneousElement(
+ node,
+ selector.name,
+ MessageKind.NO_SUCH_SUPER_MEMBER,
+ {'className': currentClass.name, 'memberName': selector.name});
registry.registerSuperNoSuchMethod();
}
}
@@ -1409,9 +1404,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
registry.registerStaticUse(compiler.symbolConstructor.declaration);
registry.registerConstSymbol(node.slowNameString);
if (!validateSymbol(node, node.slowNameString, reportError: false)) {
- compiler.reportError(node, MessageKind.UNSUPPORTED_LITERAL_SYMBOL, {
- 'value': node.slowNameString
- });
+ compiler.reportError(node, MessageKind.UNSUPPORTED_LITERAL_SYMBOL,
+ {'value': node.slowNameString});
}
analyzeConstantDeferred(node);
}
@@ -1447,9 +1441,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
compiler.reportError(
expression, MessageKind.CANNOT_RETURN_FROM_CONSTRUCTOR);
} else if (!node.isArrowBody && currentAsyncMarker.isYielding) {
- compiler.reportError(node, MessageKind.RETURN_IN_GENERATOR, {
- 'modifier': currentAsyncMarker
- });
+ compiler.reportError(node, MessageKind.RETURN_IN_GENERATOR,
+ {'modifier': currentAsyncMarker});
}
}
visit(node.expression);
@@ -1504,10 +1497,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
FunctionType constructorType = constructor.computeType(compiler);
bool isSubtype = compiler.types.isSubtype(targetType, constructorType);
if (!isSubtype) {
- warning(node, MessageKind.NOT_ASSIGNABLE, {
- 'fromType': targetType,
- 'toType': constructorType
- });
+ warning(node, MessageKind.NOT_ASSIGNABLE,
+ {'fromType': targetType, 'toType': constructorType});
}
FunctionSignature targetSignature =
@@ -1567,9 +1558,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
}
assert(modifierNode != null);
- compiler.reportError(modifierNode, MessageKind.EXTRANEOUS_MODIFIER, {
- 'modifier': modifier
- });
+ compiler.reportError(modifierNode, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': modifier});
}
if (modifiers.isFinal && (modifiers.isConst || modifiers.isVar)) {
reportExtraModifier('final');
@@ -1668,9 +1658,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
} else {
if (!compiler.mirrorUsageAnalyzerTask
.hasMirrorUsage(enclosingElement)) {
- compiler.reportHint(node.newToken, MessageKind.NON_CONST_BLOAT, {
- 'name': compiler.symbolClass.name
- });
+ compiler.reportHint(node.newToken, MessageKind.NON_CONST_BLOAT,
+ {'name': compiler.symbolClass.name});
}
registry.registerNewSymbol();
}
@@ -2120,36 +2109,36 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
// We only report the bad type on the first class element. All others
// get a "type differs" error.
if (caseType.element == compiler.doubleClass) {
- compiler.reportError(node,
- MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS, {
- 'type': "double"
- });
+ compiler.reportError(
+ node,
+ MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS,
+ {'type': "double"});
} else if (caseType.element == compiler.functionClass) {
compiler.reportError(
node, MessageKind.SWITCH_CASE_FORBIDDEN, {'type': "Function"});
} else if (constant.value.isObject && overridesEquals(caseType)) {
- compiler.reportError(firstCase.expression,
- MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS, {
- 'type': caseType
- });
+ compiler.reportError(
+ firstCase.expression,
+ MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS,
+ {'type': caseType});
}
} else {
if (caseType != firstCaseType) {
if (!hasReportedProblem) {
- compiler.reportError(node,
- MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL, {
- 'type': firstCaseType
- });
- compiler.reportInfo(firstCase.expression,
- MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, {
- 'type': firstCaseType
- });
+ compiler.reportError(
+ node,
+ MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL,
+ {'type': firstCaseType});
+ compiler.reportInfo(
+ firstCase.expression,
+ MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
+ {'type': firstCaseType});
hasReportedProblem = true;
}
- compiler.reportInfo(caseMatch.expression,
- MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, {
- 'type': caseType
- });
+ compiler.reportInfo(
+ caseMatch.expression,
+ MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
+ {'type': caseType});
}
}
}
diff --git a/pkg/compiler/lib/src/resolution/operators.dart b/pkg/compiler/lib/src/resolution/operators.dart
index f304a48..4cfc207 100644
--- a/pkg/compiler/lib/src/resolution/operators.dart
+++ b/pkg/compiler/lib/src/resolution/operators.dart
@@ -274,7 +274,8 @@ class AssignmentOperator {
/// The = operator.
static const AssignmentOperator ASSIGN = const AssignmentOperator._(
- AssignmentOperatorKind.ASSIGN, '=', null, isUserDefinable: false);
+ AssignmentOperatorKind.ASSIGN, '=', null,
+ isUserDefinable: false);
/// The ??= operator.
static const AssignmentOperator IF_NULL = const AssignmentOperator._(
diff --git a/pkg/compiler/lib/src/resolution/resolution_common.dart b/pkg/compiler/lib/src/resolution/resolution_common.dart
index 04a0313..16ea7fb 100644
--- a/pkg/compiler/lib/src/resolution/resolution_common.dart
+++ b/pkg/compiler/lib/src/resolution/resolution_common.dart
@@ -78,28 +78,28 @@ class ResolverTask extends CompilerTask {
element.asyncMarker = AsyncMarker.SYNC_STAR;
}
if (element.isAbstract) {
- compiler.reportError(asyncModifier,
- MessageKind.ASYNC_MODIFIER_ON_ABSTRACT_METHOD, {
- 'modifier': element.asyncMarker
- });
+ compiler.reportError(
+ asyncModifier,
+ MessageKind.ASYNC_MODIFIER_ON_ABSTRACT_METHOD,
+ {'modifier': element.asyncMarker});
} else if (element.isConstructor) {
- compiler.reportError(asyncModifier,
- MessageKind.ASYNC_MODIFIER_ON_CONSTRUCTOR, {
- 'modifier': element.asyncMarker
- });
+ compiler.reportError(
+ asyncModifier,
+ MessageKind.ASYNC_MODIFIER_ON_CONSTRUCTOR,
+ {'modifier': element.asyncMarker});
} else {
if (element.isSetter) {
- compiler.reportError(asyncModifier,
- MessageKind.ASYNC_MODIFIER_ON_SETTER, {
- 'modifier': element.asyncMarker
- });
+ compiler.reportError(
+ asyncModifier,
+ MessageKind.ASYNC_MODIFIER_ON_SETTER,
+ {'modifier': element.asyncMarker});
}
if (functionExpression.body.asReturn() != null &&
element.asyncMarker.isYielding) {
- compiler.reportError(asyncModifier,
- MessageKind.YIELDING_MODIFIER_ON_ARROW_BODY, {
- 'modifier': element.asyncMarker
- });
+ compiler.reportError(
+ asyncModifier,
+ MessageKind.YIELDING_MODIFIER_ON_ARROW_BODY,
+ {'modifier': element.asyncMarker});
}
}
registry.registerAsyncMarker(element);
@@ -130,9 +130,8 @@ class ResolverTask extends CompilerTask {
FunctionElement element, FunctionExpression tree) {
return compiler.withCurrentElement(element, () {
if (element.isExternal && tree.hasBody()) {
- error(element, MessageKind.EXTERNAL_WITH_BODY, {
- 'functionName': element.name
- });
+ error(element, MessageKind.EXTERNAL_WITH_BODY,
+ {'functionName': element.name});
}
if (element.isConstructor) {
if (tree.returnType != null) {
@@ -390,32 +389,34 @@ class ResolverTask extends CompilerTask {
* called by [resolveClass] and [ClassSupertypeResolver].
*/
void loadSupertypes(BaseClassElementX cls, Spannable from) {
- compiler.withCurrentElement(cls, () => measure(() {
- if (cls.supertypeLoadState == STATE_DONE) return;
- if (cls.supertypeLoadState == STATE_STARTED) {
- compiler.reportError(
- from, MessageKind.CYCLIC_CLASS_HIERARCHY, {'className': cls.name});
- cls.supertypeLoadState = STATE_DONE;
- cls.hasIncompleteHierarchy = true;
- cls.allSupertypesAndSelf = compiler.objectClass.allSupertypesAndSelf
- .extendClass(cls.computeType(compiler));
- cls.supertype = cls.allSupertypes.head;
- assert(invariant(from, cls.supertype != null,
- message: 'Missing supertype on cyclic class $cls.'));
- cls.interfaces = const Link<DartType>();
- return;
- }
- cls.supertypeLoadState = STATE_STARTED;
- compiler.withCurrentElement(cls, () {
- // TODO(ahe): Cache the node in cls.
- cls
- .parseNode(compiler)
- .accept(new ClassSupertypeResolver(compiler, cls));
- if (cls.supertypeLoadState != STATE_DONE) {
- cls.supertypeLoadState = STATE_DONE;
- }
- });
- }));
+ compiler.withCurrentElement(
+ cls,
+ () => measure(() {
+ if (cls.supertypeLoadState == STATE_DONE) return;
+ if (cls.supertypeLoadState == STATE_STARTED) {
+ compiler.reportError(from, MessageKind.CYCLIC_CLASS_HIERARCHY,
+ {'className': cls.name});
+ cls.supertypeLoadState = STATE_DONE;
+ cls.hasIncompleteHierarchy = true;
+ cls.allSupertypesAndSelf = compiler.objectClass.allSupertypesAndSelf
+ .extendClass(cls.computeType(compiler));
+ cls.supertype = cls.allSupertypes.head;
+ assert(invariant(from, cls.supertype != null,
+ message: 'Missing supertype on cyclic class $cls.'));
+ cls.interfaces = const Link<DartType>();
+ return;
+ }
+ cls.supertypeLoadState = STATE_STARTED;
+ compiler.withCurrentElement(cls, () {
+ // TODO(ahe): Cache the node in cls.
+ cls
+ .parseNode(compiler)
+ .accept(new ClassSupertypeResolver(compiler, cls));
+ if (cls.supertypeLoadState != STATE_DONE) {
+ cls.supertypeLoadState = STATE_DONE;
+ }
+ });
+ }));
}
// TODO(johnniwinther): Remove this queue when resolution has been split into
@@ -490,19 +491,21 @@ class ResolverTask extends CompilerTask {
void resolveClassInternal(
BaseClassElementX element, ResolutionRegistry registry) {
if (!element.isPatch) {
- compiler.withCurrentElement(element, () => measure(() {
- assert(element.resolutionState == STATE_NOT_STARTED);
- element.resolutionState = STATE_STARTED;
- Node tree = element.parseNode(compiler);
- loadSupertypes(element, tree);
-
- ClassResolverVisitor visitor =
- new ClassResolverVisitor(compiler, element, registry);
- visitor.visit(tree);
- element.resolutionState = STATE_DONE;
- compiler.onClassResolved(element);
- pendingClassesToBePostProcessed.add(element);
- }));
+ compiler.withCurrentElement(
+ element,
+ () => measure(() {
+ assert(element.resolutionState == STATE_NOT_STARTED);
+ element.resolutionState = STATE_STARTED;
+ Node tree = element.parseNode(compiler);
+ loadSupertypes(element, tree);
+
+ ClassResolverVisitor visitor =
+ new ClassResolverVisitor(compiler, element, registry);
+ visitor.visit(tree);
+ element.resolutionState = STATE_DONE;
+ compiler.onClassResolved(element);
+ pendingClassesToBePostProcessed.add(element);
+ }));
if (element.isPatched) {
// Ensure handling patch after origin.
element.patch.ensureResolved(compiler);
@@ -576,10 +579,10 @@ class ResolverTask extends CompilerTask {
int illegalFlags = modifiers.flags & ~Modifiers.FLAG_ABSTRACT;
if (illegalFlags != 0) {
Modifiers illegalModifiers = new Modifiers.withFlags(null, illegalFlags);
- compiler.reportError(modifiers,
- MessageKind.ILLEGAL_MIXIN_APPLICATION_MODIFIERS, {
- 'modifiers': illegalModifiers
- });
+ compiler.reportError(
+ modifiers,
+ MessageKind.ILLEGAL_MIXIN_APPLICATION_MODIFIERS,
+ {'modifiers': illegalModifiers});
}
// In case of cyclic mixin applications, the mixin chain will have
@@ -662,10 +665,10 @@ class ResolverTask extends CompilerTask {
if (mismatchedFlagsBits != 0) {
final mismatchedFlags =
new Modifiers.withFlags(null, mismatchedFlagsBits);
- compiler.reportError(member,
- MessageKind.ILLEGAL_CONSTRUCTOR_MODIFIERS, {
- 'modifiers': mismatchedFlags
- });
+ compiler.reportError(
+ member,
+ MessageKind.ILLEGAL_CONSTRUCTOR_MODIFIERS,
+ {'modifiers': mismatchedFlags});
}
if (member.modifiers.isConst) {
constConstructors.add(member);
@@ -687,10 +690,10 @@ class ResolverTask extends CompilerTask {
if (!constConstructors.isEmpty && !nonFinalInstanceFields.isEmpty) {
Spannable span =
constConstructors.length > 1 ? cls : constConstructors[0];
- compiler.reportError(span,
- MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS, {
- 'className': cls.name
- });
+ compiler.reportError(
+ span,
+ MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS,
+ {'className': cls.name});
if (constConstructors.length > 1) {
for (Element constructor in constConstructors) {
compiler.reportInfo(constructor,
@@ -731,12 +734,10 @@ class ResolverTask extends CompilerTask {
if (!identical(getterFlags, setterFlags)) {
final mismatchedFlags =
new Modifiers.withFlags(null, getterFlags ^ setterFlags);
- compiler.reportError(field.getter, MessageKind.GETTER_MISMATCH, {
- 'modifiers': mismatchedFlags
- });
- compiler.reportError(field.setter, MessageKind.SETTER_MISMATCH, {
- 'modifiers': mismatchedFlags
- });
+ compiler.reportError(field.getter, MessageKind.GETTER_MISMATCH,
+ {'modifiers': mismatchedFlags});
+ compiler.reportError(field.setter, MessageKind.SETTER_MISMATCH,
+ {'modifiers': mismatchedFlags});
}
}
@@ -826,14 +827,13 @@ class ResolverTask extends CompilerTask {
Node errorNode =
node.parameters.nodes.skip(signature.requiredParameterCount).head;
if (signature.optionalParametersAreNamed) {
- compiler.reportError(errorNode, MessageKind.OPERATOR_NAMED_PARAMETERS, {
- 'operatorName': function.name
- });
+ compiler.reportError(errorNode, MessageKind.OPERATOR_NAMED_PARAMETERS,
+ {'operatorName': function.name});
} else {
- compiler.reportError(errorNode,
- MessageKind.OPERATOR_OPTIONAL_PARAMETERS, {
- 'operatorName': function.name
- });
+ compiler.reportError(
+ errorNode,
+ MessageKind.OPERATOR_OPTIONAL_PARAMETERS,
+ {'operatorName': function.name});
}
}
}
@@ -886,35 +886,38 @@ class ResolverTask extends CompilerTask {
}
void resolveMetadataAnnotation(MetadataAnnotationX annotation) {
- compiler.withCurrentElement(annotation.annotatedElement, () => measure(() {
- assert(annotation.resolutionState == STATE_NOT_STARTED);
- annotation.resolutionState = STATE_STARTED;
-
- Node node = annotation.parseNode(compiler);
- Element annotatedElement = annotation.annotatedElement;
- AnalyzableElement context = annotatedElement.analyzableElement;
- ClassElement classElement = annotatedElement.enclosingClass;
- if (classElement != null) {
- // The annotation is resolved in the scope of [classElement].
- classElement.ensureResolved(compiler);
- }
- assert(invariant(node, context != null,
- message: "No context found for metadata annotation "
- "on $annotatedElement."));
- ResolverVisitor visitor = visitorFor(context, useEnclosingScope: true);
- ResolutionRegistry registry = visitor.registry;
- node.accept(visitor);
- // TODO(johnniwinther): Avoid passing the [TreeElements] to
- // [compileMetadata].
- annotation.constant =
- constantCompiler.compileMetadata(annotation, node, registry.mapping);
- // TODO(johnniwinther): Register the relation between the annotation
- // and the annotated element instead. This will allow the backend to
- // retrieve the backend constant and only register metadata on the
- // elements for which it is needed. (Issue 17732).
- registry.registerMetadataConstant(annotation, annotatedElement);
- annotation.resolutionState = STATE_DONE;
- }));
+ compiler.withCurrentElement(
+ annotation.annotatedElement,
+ () => measure(() {
+ assert(annotation.resolutionState == STATE_NOT_STARTED);
+ annotation.resolutionState = STATE_STARTED;
+
+ Node node = annotation.parseNode(compiler);
+ Element annotatedElement = annotation.annotatedElement;
+ AnalyzableElement context = annotatedElement.analyzableElement;
+ ClassElement classElement = annotatedElement.enclosingClass;
+ if (classElement != null) {
+ // The annotation is resolved in the scope of [classElement].
+ classElement.ensureResolved(compiler);
+ }
+ assert(invariant(node, context != null,
+ message: "No context found for metadata annotation "
+ "on $annotatedElement."));
+ ResolverVisitor visitor =
+ visitorFor(context, useEnclosingScope: true);
+ ResolutionRegistry registry = visitor.registry;
+ node.accept(visitor);
+ // TODO(johnniwinther): Avoid passing the [TreeElements] to
+ // [compileMetadata].
+ annotation.constant = constantCompiler.compileMetadata(
+ annotation, node, registry.mapping);
+ // TODO(johnniwinther): Register the relation between the annotation
+ // and the annotated element instead. This will allow the backend to
+ // retrieve the backend constant and only register metadata on the
+ // elements for which it is needed. (Issue 17732).
+ registry.registerMetadataConstant(annotation, annotatedElement);
+ annotation.resolutionState = STATE_DONE;
+ }));
}
error(Spannable node, MessageKind kind, [arguments = const {}]) {
@@ -999,10 +1002,8 @@ abstract class MappingVisitor<T> extends CommonResolverVisitor<T> {
if (element.name == 'yield' ||
element.name == 'async' ||
element.name == 'await') {
- compiler.reportError(node, MessageKind.ASYNC_KEYWORD_AS_IDENTIFIER, {
- 'keyword': element.name,
- 'modifier': currentAsyncMarker
- });
+ compiler.reportError(node, MessageKind.ASYNC_KEYWORD_AS_IDENTIFIER,
+ {'keyword': element.name, 'modifier': currentAsyncMarker});
}
}
}
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor.dart b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
index 522bde1..305effa 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
@@ -115,8 +115,8 @@ abstract class SemanticDeclarationResolvedMixin<R, A>
// TODO(johnniwinther): Support argument.
A arg = null;
- computeVariableStructures(definitions,
- (Node node, VariableStructure structure) {
+ computeVariableStructures(
+ definitions, (Node node, VariableStructure structure) {
if (structure == null) {
return internalError(node, 'No structure for $node');
} else {
@@ -1049,8 +1049,12 @@ abstract class SemanticSendVisitor<R, A> {
/// m(a) => --super[a];
/// }
///
- R visitSuperIndexPrefix(Send node, MethodElement indexFunction,
- MethodElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPrefix(
+ Send node,
+ MethodElement indexFunction,
+ MethodElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg);
/// Postfix operation on an index expression `super[index] operator` where
@@ -1067,8 +1071,12 @@ abstract class SemanticSendVisitor<R, A> {
/// m(a) => super[a]++;
/// }
///
- R visitSuperIndexPostfix(Send node, MethodElement indexFunction,
- MethodElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPostfix(
+ Send node,
+ MethodElement indexFunction,
+ MethodElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg);
/// Prefix operation on an index expression `operator super[index]` where
@@ -1113,9 +1121,13 @@ abstract class SemanticSendVisitor<R, A> {
/// m(a) => --super[a];
/// }
///
- R visitUnresolvedSuperSetterIndexPrefix(Send node,
- MethodElement indexFunction, Element element, Node index,
- IncDecOperator operator, A arg);
+ R visitUnresolvedSuperSetterIndexPrefix(
+ Send node,
+ MethodElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg);
/// Postfix operation on an index expression `super[index] operator` where
/// 'operator []' is implemented on a superclass by [indexFunction] and
@@ -1129,9 +1141,13 @@ abstract class SemanticSendVisitor<R, A> {
/// m(a) => super[a]++;
/// }
///
- R visitUnresolvedSuperSetterIndexPostfix(Send node,
- MethodElement indexFunction, Element element, Node index,
- IncDecOperator operator, A arg);
+ R visitUnresolvedSuperSetterIndexPostfix(
+ Send node,
+ MethodElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg);
/// Prefix operation on an index expression `super[index] operator` where
/// both 'operator []' and 'operator []=' are unresolved and the operation is
@@ -1332,9 +1348,14 @@ abstract class SemanticSendVisitor<R, A> {
/// For instance:
/// m(receiver, rhs) => receiver.foo += rhs;
///
- R visitDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg);
+ R visitDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg);
/// Compound assignment expression of [rhs] with [operator] of the property on
/// a possibly null [receiver] whose getter and setter are defined by
@@ -1343,9 +1364,14 @@ abstract class SemanticSendVisitor<R, A> {
/// For instance:
/// m(receiver, rhs) => receiver?.foo += rhs;
///
- R visitIfNotNullDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg);
+ R visitIfNotNullDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg);
/// Compound assignment expression of [rhs] with [operator] of the property on
/// `this` whose getter and setter are defined by [getterSelector] and
@@ -1799,8 +1825,13 @@ abstract class SemanticSendVisitor<R, A> {
/// m(index, rhs) => super[index] += rhs;
/// }
///
- R visitSuperCompoundIndexSet(SendSet node, MethodElement getter,
- MethodElement setter, Node index, AssignmentOperator operator, Node rhs,
+ R visitSuperCompoundIndexSet(
+ SendSet node,
+ MethodElement getter,
+ MethodElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg);
/// Compound index assignment of [rhs] with [operator] to [index] on a super
@@ -1814,8 +1845,13 @@ abstract class SemanticSendVisitor<R, A> {
/// m() => super[1] += 42;
/// }
///
- R visitUnresolvedSuperGetterCompoundIndexSet(Send node, Element element,
- MethodElement setter, Node index, AssignmentOperator operator, Node rhs,
+ R visitUnresolvedSuperGetterCompoundIndexSet(
+ Send node,
+ Element element,
+ MethodElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg);
/// Compound index assignment of [rhs] with [operator] to [index] on a super
@@ -1830,8 +1866,13 @@ abstract class SemanticSendVisitor<R, A> {
/// m() => super[1] += 42;
/// }
///
- R visitUnresolvedSuperSetterCompoundIndexSet(Send node, MethodElement getter,
- Element element, Node index, AssignmentOperator operator, Node rhs,
+ R visitUnresolvedSuperSetterCompoundIndexSet(
+ Send node,
+ MethodElement getter,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg);
/// Compound index assignment of [rhs] with [operator] to [index] on a super
@@ -1854,8 +1895,12 @@ abstract class SemanticSendVisitor<R, A> {
/// For instance:
/// m(receiver) => ++receiver.foo;
///
- R visitDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg);
/// Prefix expression with [operator] of the property on a possibly null
@@ -1865,8 +1910,12 @@ abstract class SemanticSendVisitor<R, A> {
/// For instance:
/// m(receiver) => ++receiver?.foo;
///
- R visitIfNotNullDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg);
/// Prefix expression with [operator] on a [parameter].
@@ -2206,8 +2255,12 @@ abstract class SemanticSendVisitor<R, A> {
/// For instance:
/// m(receiver) => receiver.foo++;
///
- R visitDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg);
/// Postfix expression with [operator] of the property on a possibly null
@@ -2217,8 +2270,12 @@ abstract class SemanticSendVisitor<R, A> {
/// For instance:
/// m(receiver) => receiver?.foo++;
///
- R visitIfNotNullDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg);
/// Postfix expression with [operator] on a [parameter].
@@ -2930,9 +2987,13 @@ abstract class SemanticSendVisitor<R, A> {
///
/// where [type] is `C<int>`.
///
- R visitGenerativeConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg);
+ R visitGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
/// Invocation of a redirecting generative [constructor] on [type] with
/// [arguments].
@@ -2946,9 +3007,13 @@ abstract class SemanticSendVisitor<R, A> {
///
/// where [type] is `C<int>`.
///
- R visitRedirectingGenerativeConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg);
+ R visitRedirectingGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
/// Invocation of a factory [constructor] on [type] with [arguments].
///
@@ -2961,9 +3026,13 @@ abstract class SemanticSendVisitor<R, A> {
///
/// where [type] is `C<int>`.
///
- R visitFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg);
+ R visitFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
/// Invocation of a factory [constructor] on [type] with [arguments] where
/// [effectiveTarget] and [effectiveTargetType] are the constructor effective
@@ -2980,10 +3049,15 @@ abstract class SemanticSendVisitor<R, A> {
/// where [type] is `C<double>`, [effectiveTarget] is `C.b` and
/// [effectiveTargetType] is `C<C<int>>`.
///
- R visitRedirectingFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type,
- ConstructorElement effectiveTarget, InterfaceType effectiveTargetType,
- NodeList arguments, CallStructure callStructure, A arg);
+ R visitRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ ConstructorElement effectiveTarget,
+ InterfaceType effectiveTargetType,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
/// Invocation of an unresolved [constructor] on [type] with [arguments].
///
@@ -3030,9 +3104,13 @@ abstract class SemanticSendVisitor<R, A> {
///
/// where [type] is the malformed type `Unresolved`.
///
- R visitAbstractClassConstructorInvoke(NewExpression node,
- ConstructorElement element, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg);
+ R visitAbstractClassConstructorInvoke(
+ NewExpression node,
+ ConstructorElement element,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
/// Invocation of a factory [constructor] on [type] with [arguments] where
/// [effectiveTarget] and [effectiveTargetType] are the constructor effective
@@ -3046,9 +3124,13 @@ abstract class SemanticSendVisitor<R, A> {
/// m1() => new C(true, 42);
/// m2() => new C.a(true, 42);
///
- R visitUnresolvedRedirectingFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg);
+ R visitUnresolvedRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
}
abstract class SemanticDeclarationVisitor<R, A> {
@@ -3210,8 +3292,12 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// For instance `a` in
/// m([a = 42]) {}
///
- R visitOptionalParameterDeclaration(VariableDefinitions node, Node definition,
- ParameterElement parameter, ConstantExpression defaultValue, int index,
+ R visitOptionalParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ ConstantExpression defaultValue,
+ int index,
A arg);
/// A declaration of a named [parameter] in a constructor, method or function
@@ -3246,9 +3332,13 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// C([this.a = 42]);
/// }
///
- R visitOptionalInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement parameter,
- ConstantExpression defaultValue, int index, A arg);
+ R visitOptionalInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ ConstantExpression defaultValue,
+ int index,
+ A arg);
/// A declaration of a named [parameter] as an initializing formal in a
/// constructor with the explicit [defaultValue]. If no default value is
@@ -3260,9 +3350,12 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// C({this.a: 42});
/// }
///
- R visitNamedInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement parameter,
- ConstantExpression defaultValue, A arg);
+ R visitNamedInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ ConstantExpression defaultValue,
+ A arg);
/// A declaration of a local [variable] with the explicit [initializer]. If
/// no initializer is declared, [initializer] is `null`.
@@ -3343,9 +3436,13 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// C(a) : this.a = a, super();
/// }
///
- R visitGenerativeConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- NodeList initializers, Node body, A arg);
+ R visitGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ Node body,
+ A arg);
/// A declaration of a redirecting generative [constructor] with
/// [initializers] containing the redirecting constructor invocation.
@@ -3356,9 +3453,12 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// C._();
/// }
///
- R visitRedirectingGenerativeConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- NodeList initializers, A arg);
+ R visitRedirectingGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ A arg);
/// A declaration of a factory [constructor].
///
@@ -3383,9 +3483,12 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// where `C` has the redirection target `C.a` of type `C<int>` and `C.a` has
/// the redirection target `C.b` of type `C<C<T>>`.
///
- R visitRedirectingFactoryConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- InterfaceType redirectionType, ConstructorElement redirectionTarget,
+ R visitRedirectingFactoryConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ InterfaceType redirectionType,
+ ConstructorElement redirectionTarget,
A arg);
/// An initializer of [field] with [initializer] as found in constructor
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart b/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
index 01cc123..aa7b293 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
@@ -59,14 +59,22 @@ abstract class PrefixBulkMixin<R, A>
}
@override
- R visitDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
return bulkHandlePrefix(node, arg);
}
- R visitIfNotNullDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
return bulkHandlePrefix(node, arg);
}
@@ -138,8 +146,12 @@ abstract class PrefixBulkMixin<R, A>
}
@override
- R visitSuperIndexPrefix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
return bulkHandlePrefix(node, arg);
}
@@ -331,15 +343,23 @@ abstract class PostfixBulkMixin<R, A>
}
@override
- R visitDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
return bulkHandlePostfix(node, arg);
}
@override
- R visitIfNotNullDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
return bulkHandlePostfix(node, arg);
}
@@ -410,8 +430,12 @@ abstract class PostfixBulkMixin<R, A>
}
@override
- R visitSuperIndexPostfix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPostfix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
return bulkHandlePostfix(node, arg);
}
@@ -608,16 +632,26 @@ abstract class CompoundBulkMixin<R, A>
}
@override
- R visitDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg) {
+ R visitDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
return bulkHandleCompound(node, arg);
}
@override
- R visitIfNotNullDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg) {
+ R visitIfNotNullDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
return bulkHandleCompound(node, arg);
}
@@ -1368,23 +1402,38 @@ abstract class IndexSetBulkMixin<R, A>
}
@override
- R visitSuperCompoundIndexSet(SendSet node, FunctionElement getter,
- FunctionElement setter, Node index, AssignmentOperator operator, Node rhs,
+ R visitSuperCompoundIndexSet(
+ SendSet node,
+ FunctionElement getter,
+ FunctionElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
- R visitUnresolvedSuperGetterCompoundIndexSet(SendSet node, Element element,
- MethodElement setter, Node index, AssignmentOperator operator, Node rhs,
+ R visitUnresolvedSuperGetterCompoundIndexSet(
+ SendSet node,
+ Element element,
+ MethodElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
- R visitUnresolvedSuperSetterCompoundIndexSet(SendSet node,
- MethodElement getter, Element element, Node index,
- AssignmentOperator operator, Node rhs, A arg) {
+ R visitUnresolvedSuperSetterCompoundIndexSet(
+ SendSet node,
+ MethodElement getter,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
return bulkHandleIndexSet(node, arg);
}
@@ -1576,8 +1625,13 @@ abstract class SuperBulkMixin<R, A>
}
@override
- R visitSuperCompoundIndexSet(SendSet node, FunctionElement getter,
- FunctionElement setter, Node index, AssignmentOperator operator, Node rhs,
+ R visitSuperCompoundIndexSet(
+ SendSet node,
+ FunctionElement getter,
+ FunctionElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
return bulkHandleSuper(node, arg);
}
@@ -1793,9 +1847,13 @@ abstract class NewBulkMixin<R, A>
}
@override
- R visitAbstractClassConstructorInvoke(NewExpression node,
- ConstructorElement element, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitAbstractClassConstructorInvoke(
+ NewExpression node,
+ ConstructorElement element,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return bulkHandleNew(node, arg);
}
@@ -1806,31 +1864,48 @@ abstract class NewBulkMixin<R, A>
}
@override
- R visitGenerativeConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return bulkHandleNew(node, arg);
}
@override
- R visitRedirectingGenerativeConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitRedirectingGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return bulkHandleNew(node, arg);
}
@override
- R visitFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return bulkHandleNew(node, arg);
}
@override
- R visitRedirectingFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type,
- ConstructorElement effectiveTarget, InterfaceType effectiveTargetType,
- NodeList arguments, CallStructure callStructure, A arg) {
+ R visitRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ ConstructorElement effectiveTarget,
+ InterfaceType effectiveTargetType,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return bulkHandleNew(node, arg);
}
@@ -1847,9 +1922,13 @@ abstract class NewBulkMixin<R, A>
}
@override
- R visitUnresolvedRedirectingFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitUnresolvedRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return bulkHandleNew(node, arg);
}
}
@@ -1891,9 +1970,12 @@ abstract class ParameterBulkMixin<R, A>
}
@override
- R visitNamedInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement parameter,
- ConstantExpression defaultValue, A arg) {
+ R visitNamedInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ ConstantExpression defaultValue,
+ A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
@@ -1904,15 +1986,23 @@ abstract class ParameterBulkMixin<R, A>
}
@override
- R visitOptionalInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement parameter,
- ConstantExpression defaultValue, int index, A arg) {
+ R visitOptionalInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ ConstantExpression defaultValue,
+ int index,
+ A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
@override
- R visitOptionalParameterDeclaration(VariableDefinitions node, Node definition,
- ParameterElement parameter, ConstantExpression defaultValue, int index,
+ R visitOptionalParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ ConstantExpression defaultValue,
+ int index,
A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
@@ -1941,24 +2031,34 @@ abstract class ConstructorBulkMixin<R, A>
}
@override
- R visitGenerativeConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- NodeList initializers, Node body, A arg) {
+ R visitGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ Node body,
+ A arg) {
return bulkHandleConstructorDeclaration(node, arg);
}
@override
- R visitRedirectingFactoryConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- InterfaceType redirectionType, ConstructorElement redirectionTarget,
+ R visitRedirectingFactoryConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ InterfaceType redirectionType,
+ ConstructorElement redirectionTarget,
A arg) {
return bulkHandleConstructorDeclaration(node, arg);
}
@override
- R visitRedirectingGenerativeConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- NodeList initializers, A arg) {
+ R visitRedirectingGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ A arg) {
return bulkHandleConstructorDeclaration(node, arg);
}
}
@@ -2485,18 +2585,28 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg) {
+ R visitDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
apply(receiver, arg);
apply(rhs, arg);
return null;
}
@override
- R visitIfNotNullDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg) {
+ R visitIfNotNullDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
apply(receiver, arg);
apply(rhs, arg);
return null;
@@ -2533,32 +2643,48 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
apply(receiver, arg);
return null;
}
@override
- R visitIfNotNullDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
apply(receiver, arg);
return null;
}
@override
- R visitDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
apply(receiver, arg);
return null;
}
@override
- R visitIfNotNullDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
apply(receiver, arg);
return null;
@@ -2895,8 +3021,13 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitSuperCompoundIndexSet(SendSet node, FunctionElement getter,
- FunctionElement setter, Node index, AssignmentOperator operator, Node rhs,
+ R visitSuperCompoundIndexSet(
+ SendSet node,
+ FunctionElement getter,
+ FunctionElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
apply(rhs, arg);
return null;
@@ -3390,8 +3521,13 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitUnresolvedSuperGetterCompoundIndexSet(SendSet node, Element element,
- MethodElement setter, Node index, AssignmentOperator operator, Node rhs,
+ R visitUnresolvedSuperGetterCompoundIndexSet(
+ SendSet node,
+ Element element,
+ MethodElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
apply(index, arg);
apply(rhs, arg);
@@ -3399,9 +3535,14 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitUnresolvedSuperSetterCompoundIndexSet(SendSet node,
- MethodElement getter, Element element, Node index,
- AssignmentOperator operator, Node rhs, A arg) {
+ R visitUnresolvedSuperSetterCompoundIndexSet(
+ SendSet node,
+ MethodElement getter,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
apply(index, arg);
apply(rhs, arg);
return null;
@@ -3487,16 +3628,24 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitSuperIndexPostfix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPostfix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
apply(index, arg);
return null;
}
@override
- R visitSuperIndexPrefix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
apply(index, arg);
return null;
@@ -3509,8 +3658,12 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitUnresolvedClassConstructorInvoke(NewExpression node,
- Element constructor, DartType type, NodeList arguments, Selector selector,
+ R visitUnresolvedClassConstructorInvoke(
+ NewExpression node,
+ Element constructor,
+ DartType type,
+ NodeList arguments,
+ Selector selector,
A arg) {
apply(arguments, arg);
return null;
@@ -3524,50 +3677,75 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitGenerativeConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitRedirectingFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type,
- ConstructorElement effectiveTarget, InterfaceType effectiveTargetType,
- NodeList arguments, CallStructure callStructure, A arg) {
+ R visitRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ ConstructorElement effectiveTarget,
+ InterfaceType effectiveTargetType,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitRedirectingGenerativeConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitRedirectingGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitAbstractClassConstructorInvoke(NewExpression node,
- ConstructorElement element, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitAbstractClassConstructorInvoke(
+ NewExpression node,
+ ConstructorElement element,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitUnresolvedRedirectingFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitUnresolvedRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
apply(arguments, arg);
return null;
}
@@ -3895,9 +4073,13 @@ class TraversalDeclarationMixin<R, A>
}
@override
- R visitGenerativeConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- NodeList initializers, Node body, A arg) {
+ R visitGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ Node body,
+ A arg) {
applyParameters(parameters, arg);
applyInitializers(initializers, arg);
apply(body, arg);
@@ -3921,18 +4103,24 @@ class TraversalDeclarationMixin<R, A>
}
@override
- R visitRedirectingFactoryConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- InterfaceType redirectionType, ConstructorElement redirectionTarget,
+ R visitRedirectingFactoryConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ InterfaceType redirectionType,
+ ConstructorElement redirectionTarget,
A arg) {
applyParameters(parameters, arg);
return null;
}
@override
- R visitRedirectingGenerativeConstructorDeclaration(FunctionExpression node,
- ConstructorElement constructor, NodeList parameters,
- NodeList initializers, A arg) {
+ R visitRedirectingGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ A arg) {
applyParameters(parameters, arg);
applyInitializers(initializers, arg);
return null;
@@ -3999,8 +4187,12 @@ class TraversalDeclarationMixin<R, A>
}
@override
- R visitOptionalParameterDeclaration(VariableDefinitions node, Node definition,
- ParameterElement parameter, ConstantExpression defaultValue, int index,
+ R visitOptionalParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ ConstantExpression defaultValue,
+ int index,
A arg) {
return null;
}
@@ -4012,8 +4204,11 @@ class TraversalDeclarationMixin<R, A>
}
@override
- R visitInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement initializingFormal, int index,
+ R visitInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement initializingFormal,
+ int index,
A arg) {
return null;
}
@@ -4025,9 +4220,12 @@ class TraversalDeclarationMixin<R, A>
}
@override
- R visitNamedInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement initializingFormal,
- ConstantExpression defaultValue, A arg) {
+ R visitNamedInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement initializingFormal,
+ ConstantExpression defaultValue,
+ A arg) {
return null;
}
@@ -4038,9 +4236,13 @@ class TraversalDeclarationMixin<R, A>
}
@override
- R visitOptionalInitializingFormalDeclaration(VariableDefinitions node,
- Node definition, InitializingFormalElement initializingFormal,
- ConstantExpression defaultValue, int index, A arg) {
+ R visitOptionalInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement initializingFormal,
+ ConstantExpression defaultValue,
+ int index,
+ A arg) {
return null;
}
@@ -4406,13 +4608,15 @@ abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
R handleStaticGetterSetterPostfixPrefix(Send node, FunctionElement getter,
- FunctionElement setter, IncDecOperator operator, A arg, {bool isPrefix});
+ FunctionElement setter, IncDecOperator operator, A arg,
+ {bool isPrefix});
R handleStaticMethodSetterCompound(Send node, FunctionElement method,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
R handleStaticMethodSetterPostfixPrefix(Send node, FunctionElement getter,
- FunctionElement setter, IncDecOperator operator, A arg, {bool isPrefix});
+ FunctionElement setter, IncDecOperator operator, A arg,
+ {bool isPrefix});
R handleFinalStaticFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg);
@@ -4432,13 +4636,15 @@ abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
R handleUnresolvedStaticGetterPostfixPrefix(Send node, Element element,
- FunctionElement setter, IncDecOperator operator, A arg, {bool isPrefix});
+ FunctionElement setter, IncDecOperator operator, A arg,
+ {bool isPrefix});
R handleUnresolvedStaticSetterCompound(Send node, FunctionElement getter,
Element element, AssignmentOperator operator, Node rhs, A arg);
R handleUnresolvedStaticSetterPostfixPrefix(Send node, FunctionElement getter,
- Element element, IncDecOperator operator, A arg, {bool isPrefix});
+ Element element, IncDecOperator operator, A arg,
+ {bool isPrefix});
@override
R visitStaticFieldCompound(Send node, FieldElement field,
@@ -4471,14 +4677,16 @@ abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
R visitStaticGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleStaticGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: false);
+ node, getter, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitStaticGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleStaticGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: true);
+ node, getter, setter, operator, arg,
+ isPrefix: true);
}
@override
@@ -4492,14 +4700,16 @@ abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
R visitStaticMethodSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleStaticMethodSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: false);
+ node, getter, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitStaticMethodSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleStaticMethodSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: true);
+ node, getter, setter, operator, arg,
+ isPrefix: true);
}
@override
@@ -4533,14 +4743,16 @@ abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
R visitTopLevelGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleStaticGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: false);
+ node, getter, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitTopLevelGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleStaticGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: true);
+ node, getter, setter, operator, arg,
+ isPrefix: true);
}
@override
@@ -4554,14 +4766,16 @@ abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
R visitTopLevelMethodSetterPostfix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleStaticMethodSetterPostfixPrefix(
- node, method, setter, operator, arg, isPrefix: false);
+ node, method, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitTopLevelMethodSetterPrefix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleStaticMethodSetterPostfixPrefix(
- node, method, setter, operator, arg, isPrefix: true);
+ node, method, setter, operator, arg,
+ isPrefix: true);
}
@override
@@ -4615,14 +4829,16 @@ abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
R visitUnresolvedStaticGetterPostfix(Send node, Element element,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleUnresolvedStaticGetterPostfixPrefix(
- node, element, setter, operator, arg, isPrefix: false);
+ node, element, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitUnresolvedStaticGetterPrefix(Send node, Element element,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleUnresolvedStaticGetterPostfixPrefix(
- node, element, setter, operator, arg, isPrefix: true);
+ node, element, setter, operator, arg,
+ isPrefix: true);
}
@override
@@ -4636,14 +4852,16 @@ abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
R visitUnresolvedStaticSetterPostfix(Send node, FunctionElement getter,
Element element, IncDecOperator operator, A arg) {
return handleUnresolvedStaticSetterPostfixPrefix(
- node, getter, element, operator, arg, isPrefix: false);
+ node, getter, element, operator, arg,
+ isPrefix: false);
}
@override
R visitUnresolvedStaticSetterPrefix(Send node, FunctionElement getter,
Element element, IncDecOperator operator, A arg) {
return handleUnresolvedStaticSetterPostfixPrefix(
- node, getter, element, operator, arg, isPrefix: true);
+ node, getter, element, operator, arg,
+ isPrefix: true);
}
}
@@ -4927,33 +5145,52 @@ abstract class BaseImplementationOfDynamicCompoundsMixin<R, A>
R handleDynamicCompound(Send node, Node receiver, AssignmentOperator operator,
Node rhs, Selector getterSelector, Selector setterSelector, A arg);
- R handleDynamicPostfixPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
- A arg, {bool isPrefix});
+ R handleDynamicPostfixPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg,
+ {bool isPrefix});
R handleDynamicIndexPostfixPrefix(
Send node, Node receiver, Node index, IncDecOperator operator, A arg,
{bool isPrefix});
@override
- R visitDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg) {
+ R visitDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
return handleDynamicCompound(
node, receiver, operator, rhs, getterSelector, setterSelector, arg);
}
@override
- R visitIfNotNullDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg) {
+ R visitIfNotNullDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
return handleDynamicCompound(
node, receiver, operator, rhs, getterSelector, setterSelector, arg);
}
@override
- R visitDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
return handleDynamicPostfixPrefix(
node, receiver, operator, getterSelector, setterSelector, arg,
@@ -4961,8 +5198,12 @@ abstract class BaseImplementationOfDynamicCompoundsMixin<R, A>
}
@override
- R visitIfNotNullDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
return handleDynamicPostfixPrefix(
node, receiver, operator, getterSelector, setterSelector, arg,
@@ -4970,8 +5211,12 @@ abstract class BaseImplementationOfDynamicCompoundsMixin<R, A>
}
@override
- R visitDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
return handleDynamicPostfixPrefix(
node, receiver, operator, getterSelector, setterSelector, arg,
@@ -4979,8 +5224,12 @@ abstract class BaseImplementationOfDynamicCompoundsMixin<R, A>
}
@override
- R visitIfNotNullDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
return handleDynamicPostfixPrefix(
node, receiver, operator, getterSelector, setterSelector, arg,
@@ -5107,14 +5356,24 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
implements SemanticSendVisitor<R, A> {
/// Handle a super compounds, like `super.foo += 42` or `--super.bar`.
- R handleSuperCompounds(SendSet node, Element getter,
- CompoundGetter getterKind, Element setter, CompoundSetter setterKind,
- CompoundRhs rhs, A arg);
+ R handleSuperCompounds(
+ SendSet node,
+ Element getter,
+ CompoundGetter getterKind,
+ Element setter,
+ CompoundSetter setterKind,
+ CompoundRhs rhs,
+ A arg);
/// Handle a static or top level compounds, like `foo += 42` or `--bar`.
- R handleStaticCompounds(SendSet node, Element getter,
- CompoundGetter getterKind, Element setter, CompoundSetter setterKind,
- CompoundRhs rhs, A arg);
+ R handleStaticCompounds(
+ SendSet node,
+ Element getter,
+ CompoundGetter getterKind,
+ Element setter,
+ CompoundSetter setterKind,
+ CompoundRhs rhs,
+ A arg);
/// Handle a local compounds, like `foo += 42` or `--bar`. If [isSetterValid]
/// is false [local] is unassignable.
@@ -5137,27 +5396,49 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
R handleDynamicCompounds(Send node, Node receiver, CompoundRhs rhs,
Selector getterSelector, Selector setterSelector, A arg);
- R visitDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg) {
- return handleDynamicCompounds(node, receiver,
- new AssignmentCompound(operator, rhs), getterSelector, setterSelector,
+ R visitDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new AssignmentCompound(operator, rhs),
+ getterSelector,
+ setterSelector,
arg);
}
- R visitIfNotNullDynamicPropertyCompound(Send node, Node receiver,
- AssignmentOperator operator, Node rhs, Selector getterSelector,
- Selector setterSelector, A arg) {
- return handleDynamicCompounds(node, receiver,
- new AssignmentCompound(operator, rhs), getterSelector, setterSelector,
+ R visitIfNotNullDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new AssignmentCompound(operator, rhs),
+ getterSelector,
+ setterSelector,
arg);
}
@override
R visitThisPropertyCompound(Send node, AssignmentOperator operator, Node rhs,
Selector getterSelector, Selector setterSelector, A arg) {
- return handleDynamicCompounds(node, null,
- new AssignmentCompound(operator, rhs), getterSelector, setterSelector,
+ return handleDynamicCompounds(
+ node,
+ null,
+ new AssignmentCompound(operator, rhs),
+ getterSelector,
+ setterSelector,
arg);
}
@@ -5327,20 +5608,36 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
node, constant, new AssignmentCompound(operator, rhs), arg);
}
- R visitDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return handleDynamicCompounds(node, receiver,
- new IncDecCompound(CompoundKind.PREFIX, operator), getterSelector,
- setterSelector, arg);
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
- R visitIfNotNullDynamicPropertyPrefix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return handleDynamicCompounds(node, receiver,
- new IncDecCompound(CompoundKind.PREFIX, operator), getterSelector,
- setterSelector, arg);
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
@@ -5369,103 +5666,167 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
R visitThisPropertyPrefix(Send node, IncDecOperator operator,
Selector getterSelector, Selector setterSelector, A arg) {
- return handleDynamicCompounds(node, null,
- new IncDecCompound(CompoundKind.PREFIX, operator), getterSelector,
- setterSelector, arg);
+ return handleDynamicCompounds(
+ node,
+ null,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
R visitStaticFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, field, CompoundGetter.FIELD, field,
- CompoundSetter.FIELD, new IncDecCompound(CompoundKind.PREFIX, operator),
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
arg);
}
@override
R visitStaticGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.GETTER, setter,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
R visitStaticMethodSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.METHOD, setter,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.METHOD,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitTopLevelFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, field, CompoundGetter.FIELD, field,
- CompoundSetter.FIELD, new IncDecCompound(CompoundKind.PREFIX, operator),
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
arg);
}
@override
R visitTopLevelGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.GETTER, setter,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitTopLevelMethodSetterPrefix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, method, CompoundGetter.METHOD, setter,
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitSuperFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, field, CompoundGetter.FIELD, field,
- CompoundSetter.FIELD, new IncDecCompound(CompoundKind.PREFIX, operator),
+ return handleSuperCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
arg);
}
@override
R visitSuperFieldFieldPrefix(Send node, FieldElement readField,
FieldElement writtenField, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, readField, CompoundGetter.FIELD,
- writtenField, CompoundSetter.FIELD,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ return handleSuperCompounds(
+ node,
+ readField,
+ CompoundGetter.FIELD,
+ writtenField,
+ CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitSuperFieldSetterPrefix(Send node, FieldElement field,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, field, CompoundGetter.FIELD, setter,
+ return handleSuperCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
R visitSuperGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, getter, CompoundGetter.GETTER, setter,
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitSuperGetterFieldPrefix(Send node, FunctionElement getter,
FieldElement field, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, getter, CompoundGetter.GETTER, field,
- CompoundSetter.FIELD, new IncDecCompound(CompoundKind.PREFIX, operator),
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ field,
+ CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
arg);
}
@override
R visitSuperMethodSetterPrefix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, method, CompoundGetter.METHOD, setter,
+ return handleSuperCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
@@ -5497,21 +5858,37 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
}
@override
- R visitDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return handleDynamicCompounds(node, receiver,
- new IncDecCompound(CompoundKind.POSTFIX, operator), getterSelector,
- setterSelector, arg);
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
- R visitIfNotNullDynamicPropertyPostfix(Send node, Node receiver,
- IncDecOperator operator, Selector getterSelector, Selector setterSelector,
+ R visitIfNotNullDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return handleDynamicCompounds(node, receiver,
- new IncDecCompound(CompoundKind.POSTFIX, operator), getterSelector,
- setterSelector, arg);
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
@@ -5540,103 +5917,167 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
R visitThisPropertyPostfix(Send node, IncDecOperator operator,
Selector getterSelector, Selector setterSelector, A arg) {
- return handleDynamicCompounds(node, null,
- new IncDecCompound(CompoundKind.POSTFIX, operator), getterSelector,
- setterSelector, arg);
+ return handleDynamicCompounds(
+ node,
+ null,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
R visitStaticFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.FIELD,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitStaticGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.GETTER, setter,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
R visitStaticMethodSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.METHOD, setter,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.METHOD,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitTopLevelFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.FIELD,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitTopLevelGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.GETTER, setter,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitTopLevelMethodSetterPostfix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, method, CompoundGetter.METHOD, setter,
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitSuperFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleSuperCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.FIELD,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitSuperFieldFieldPostfix(Send node, FieldElement readField,
FieldElement writtenField, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, readField, CompoundGetter.FIELD,
- writtenField, CompoundSetter.FIELD,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ return handleSuperCompounds(
+ node,
+ readField,
+ CompoundGetter.FIELD,
+ writtenField,
+ CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitSuperFieldSetterPostfix(Send node, FieldElement field,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, field, CompoundGetter.FIELD, setter,
+ return handleSuperCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
R visitSuperGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, getter, CompoundGetter.GETTER, setter,
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitSuperGetterFieldPostfix(Send node, FunctionElement getter,
FieldElement field, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, getter, CompoundGetter.GETTER, field,
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ field,
CompoundSetter.FIELD,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitSuperMethodSetterPostfix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, method, CompoundGetter.METHOD, setter,
+ return handleSuperCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ setter,
CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
@@ -5670,128 +6111,208 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
@override
R visitUnresolvedStaticGetterPostfix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitUnresolvedTopLevelGetterPostfix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitUnresolvedStaticSetterPostfix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.GETTER, element,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitUnresolvedTopLevelSetterPostfix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.GETTER, element,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitStaticMethodPostfix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, method, CompoundGetter.METHOD, method,
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitTopLevelMethodPostfix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, method, CompoundGetter.METHOD, method,
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitUnresolvedPostfix(
Send node, Element element, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- element, CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitUnresolvedStaticGetterPrefix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitUnresolvedTopLevelGetterPrefix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitUnresolvedStaticSetterPrefix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.GETTER, element,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitUnresolvedTopLevelSetterPrefix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, getter, CompoundGetter.GETTER, element,
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitStaticMethodPrefix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, method, CompoundGetter.METHOD, method,
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitTopLevelMethodPrefix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, method, CompoundGetter.METHOD, method,
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitUnresolvedPrefix(
Send node, Element element, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- element, CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitUnresolvedStaticGetterCompound(Send node, Element element,
MethodElement setter, AssignmentOperator operator, Node rhs, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER, new AssignmentCompound(operator, rhs),
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
arg);
}
@override
R visitUnresolvedTopLevelGetterCompound(Send node, Element element,
MethodElement setter, AssignmentOperator operator, Node rhs, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER, new AssignmentCompound(operator, rhs),
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
arg);
}
@@ -5826,8 +6347,13 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
@override
R visitUnresolvedCompound(Send node, Element element,
AssignmentOperator operator, Node rhs, A arg) {
- return handleStaticCompounds(node, element, CompoundGetter.UNRESOLVED,
- element, CompoundSetter.INVALID, new AssignmentCompound(operator, rhs),
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
arg);
}
@@ -5866,41 +6392,66 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
@override
R visitFinalStaticFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitFinalStaticFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitSuperFieldFieldCompound(Send node, FieldElement readField,
FieldElement writtenField, AssignmentOperator operator, Node rhs, A arg) {
- return handleSuperCompounds(node, readField, CompoundGetter.FIELD,
- writtenField, CompoundSetter.FIELD,
- new AssignmentCompound(operator, rhs), arg);
+ return handleSuperCompounds(
+ node,
+ readField,
+ CompoundGetter.FIELD,
+ writtenField,
+ CompoundSetter.FIELD,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
R visitFinalSuperFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleSuperCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitFinalSuperFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleSuperCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
@@ -5913,81 +6464,131 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
@override
R visitSuperMethodPostfix(
Send node, FunctionElement method, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, method, CompoundGetter.METHOD, method,
+ return handleSuperCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitSuperMethodPrefix(
Send node, FunctionElement method, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, method, CompoundGetter.METHOD, method,
+ return handleSuperCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitFinalTopLevelFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitFinalTopLevelFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
- return handleStaticCompounds(node, field, CompoundGetter.FIELD, field,
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitUnresolvedSuperCompound(Send node, Element element,
AssignmentOperator operator, Node rhs, A arg) {
- return handleSuperCompounds(node, element, CompoundGetter.UNRESOLVED,
- element, CompoundSetter.INVALID, new AssignmentCompound(operator, rhs),
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
arg);
}
@override
R visitUnresolvedSuperPostfix(
Send node, Element element, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, element, CompoundGetter.UNRESOLVED,
- element, CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitUnresolvedSuperPrefix(
Send node, Element element, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, element, CompoundGetter.UNRESOLVED,
- element, CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
R visitUnresolvedSuperGetterCompound(Send node, Element element,
MethodElement setter, AssignmentOperator operator, Node rhs, A arg) {
- return handleSuperCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER, new AssignmentCompound(operator, rhs),
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
arg);
}
@override
R visitUnresolvedSuperGetterPostfix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitUnresolvedSuperGetterPrefix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, element, CompoundGetter.UNRESOLVED,
- setter, CompoundSetter.SETTER,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
@@ -6000,17 +6601,27 @@ abstract class BaseImplementationOfCompoundsMixin<R, A>
@override
R visitUnresolvedSuperSetterPostfix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, getter, CompoundGetter.GETTER, element,
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
R visitUnresolvedSuperSetterPrefix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
- return handleSuperCompounds(node, getter, CompoundGetter.GETTER, element,
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
CompoundSetter.INVALID,
- new IncDecCompound(CompoundKind.PREFIX, operator), arg);
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
}
@@ -6031,17 +6642,26 @@ abstract class BaseImplementationOfIndexCompoundsMixin<R, A>
{bool isGetterValid, bool isSetterValid});
@override
- R visitSuperCompoundIndexSet(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, AssignmentOperator operator,
- Node rhs, A arg) {
+ R visitSuperCompoundIndexSet(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
return handleSuperIndexCompounds(node, indexFunction, indexSetFunction,
index, new AssignmentCompound(operator, rhs), arg,
isGetterValid: true, isSetterValid: true);
}
@override
- R visitSuperIndexPostfix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPostfix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
return handleSuperIndexCompounds(node, indexFunction, indexSetFunction,
index, new IncDecCompound(CompoundKind.POSTFIX, operator), arg,
@@ -6049,8 +6669,12 @@ abstract class BaseImplementationOfIndexCompoundsMixin<R, A>
}
@override
- R visitSuperIndexPrefix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
return handleSuperIndexCompounds(node, indexFunction, indexSetFunction,
index, new IncDecCompound(CompoundKind.PREFIX, operator), arg,
@@ -6058,18 +6682,28 @@ abstract class BaseImplementationOfIndexCompoundsMixin<R, A>
}
@override
- R visitUnresolvedSuperGetterCompoundIndexSet(Send node, Element indexFunction,
- FunctionElement indexSetFunction, Node index, AssignmentOperator operator,
- Node rhs, A arg) {
+ R visitUnresolvedSuperGetterCompoundIndexSet(
+ Send node,
+ Element indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
return handleSuperIndexCompounds(node, indexFunction, indexSetFunction,
index, new AssignmentCompound(operator, rhs), arg,
isGetterValid: false, isSetterValid: true);
}
@override
- R visitUnresolvedSuperSetterCompoundIndexSet(Send node,
- FunctionElement indexFunction, Element indexSetFunction, Node index,
- AssignmentOperator operator, Node rhs, A arg) {
+ R visitUnresolvedSuperSetterCompoundIndexSet(
+ Send node,
+ FunctionElement indexFunction,
+ Element indexSetFunction,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
return handleSuperIndexCompounds(node, indexFunction, indexSetFunction,
index, new AssignmentCompound(operator, rhs), arg,
isGetterValid: true, isSetterValid: false);
@@ -6084,8 +6718,12 @@ abstract class BaseImplementationOfIndexCompoundsMixin<R, A>
}
@override
- R visitUnresolvedSuperGetterIndexPostfix(Send node, Element element,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitUnresolvedSuperGetterIndexPostfix(
+ Send node,
+ Element element,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
return handleSuperIndexCompounds(node, element, indexSetFunction, index,
new IncDecCompound(CompoundKind.POSTFIX, operator), arg,
@@ -6093,8 +6731,12 @@ abstract class BaseImplementationOfIndexCompoundsMixin<R, A>
}
@override
- R visitUnresolvedSuperGetterIndexPrefix(Send node, Element element,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitUnresolvedSuperGetterIndexPrefix(
+ Send node,
+ Element element,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
return handleSuperIndexCompounds(node, element, indexSetFunction, index,
new IncDecCompound(CompoundKind.PREFIX, operator), arg,
@@ -6102,18 +6744,26 @@ abstract class BaseImplementationOfIndexCompoundsMixin<R, A>
}
@override
- R visitUnresolvedSuperSetterIndexPostfix(Send node,
- MethodElement indexFunction, Element element, Node index,
- IncDecOperator operator, A arg) {
+ R visitUnresolvedSuperSetterIndexPostfix(
+ Send node,
+ MethodElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
return handleSuperIndexCompounds(node, indexFunction, element, index,
new IncDecCompound(CompoundKind.POSTFIX, operator), arg,
isGetterValid: true, isSetterValid: false);
}
@override
- R visitUnresolvedSuperSetterIndexPrefix(Send node,
- MethodElement indexFunction, Element element, Node index,
- IncDecOperator operator, A arg) {
+ R visitUnresolvedSuperSetterIndexPrefix(
+ Send node,
+ MethodElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
return handleSuperIndexCompounds(node, indexFunction, element, index,
new IncDecCompound(CompoundKind.PREFIX, operator), arg,
isGetterValid: true, isSetterValid: false);
@@ -6169,28 +6819,42 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
{bool isPrefix});
R handleSuperFieldSetterPostfixPrefix(Send node, FieldElement field,
- FunctionElement setter, IncDecOperator operator, A arg, {bool isPrefix});
+ FunctionElement setter, IncDecOperator operator, A arg,
+ {bool isPrefix});
R handleSuperGetterFieldPostfixPrefix(Send node, FunctionElement getter,
- FieldElement field, IncDecOperator operator, A arg, {bool isPrefix});
+ FieldElement field, IncDecOperator operator, A arg,
+ {bool isPrefix});
R handleSuperGetterSetterPostfixPrefix(Send node, FunctionElement getter,
- FunctionElement setter, IncDecOperator operator, A arg, {bool isPrefix});
+ FunctionElement setter, IncDecOperator operator, A arg,
+ {bool isPrefix});
R handleSuperMethodSetterPostfixPrefix(Send node, FunctionElement method,
- FunctionElement setter, IncDecOperator operator, A arg, {bool isPrefix});
+ FunctionElement setter, IncDecOperator operator, A arg,
+ {bool isPrefix});
- R handleSuperIndexPostfixPrefix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
- A arg, {bool isPrefix});
+ R handleSuperIndexPostfixPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
R handleUnresolvedSuperGetterIndexPostfixPrefix(Send node, Element element,
MethodElement setter, Node index, IncDecOperator operator, A arg,
{bool isPrefix});
- R handleUnresolvedSuperSetterIndexPostfixPrefix(Send node,
- FunctionElement indexFunction, Element element, Node index,
- IncDecOperator operator, A arg, {bool isPrefix});
+ R handleUnresolvedSuperSetterIndexPostfixPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
R handleUnresolvedSuperIndexPostfixPrefix(
Send node, Element element, Node index, IncDecOperator operator, A arg,
@@ -6209,23 +6873,27 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
{bool isPrefix});
R handleUnresolvedSuperGetterPostfixPrefix(Send node, Element element,
- MethodElement setter, IncDecOperator operator, A arg, {bool isPrefix});
+ MethodElement setter, IncDecOperator operator, A arg,
+ {bool isPrefix});
R handleUnresolvedSuperSetterPostfixPrefix(Send node, MethodElement getter,
- Element element, IncDecOperator operator, A arg, {bool isPrefix});
+ Element element, IncDecOperator operator, A arg,
+ {bool isPrefix});
@override
R visitSuperFieldFieldPostfix(Send node, FieldElement readField,
FieldElement writtenField, IncDecOperator operator, A arg) {
return handleSuperFieldFieldPostfixPrefix(
- node, readField, writtenField, operator, arg, isPrefix: false);
+ node, readField, writtenField, operator, arg,
+ isPrefix: false);
}
@override
R visitSuperFieldFieldPrefix(Send node, FieldElement readField,
FieldElement writtenField, IncDecOperator operator, A arg) {
return handleSuperFieldFieldPostfixPrefix(
- node, readField, writtenField, operator, arg, isPrefix: true);
+ node, readField, writtenField, operator, arg,
+ isPrefix: true);
}
@override
@@ -6246,61 +6914,73 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
R visitSuperFieldSetterPostfix(Send node, FieldElement field,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleSuperFieldSetterPostfixPrefix(
- node, field, setter, operator, arg, isPrefix: false);
+ node, field, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitSuperFieldSetterPrefix(Send node, FieldElement field,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleSuperFieldSetterPostfixPrefix(
- node, field, setter, operator, arg, isPrefix: true);
+ node, field, setter, operator, arg,
+ isPrefix: true);
}
@override
R visitSuperGetterFieldPostfix(Send node, FunctionElement getter,
FieldElement field, IncDecOperator operator, A arg) {
return handleSuperGetterFieldPostfixPrefix(
- node, getter, field, operator, arg, isPrefix: false);
+ node, getter, field, operator, arg,
+ isPrefix: false);
}
@override
R visitSuperGetterFieldPrefix(Send node, FunctionElement getter,
FieldElement field, IncDecOperator operator, A arg) {
return handleSuperGetterFieldPostfixPrefix(
- node, getter, field, operator, arg, isPrefix: true);
+ node, getter, field, operator, arg,
+ isPrefix: true);
}
@override
R visitSuperGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleSuperGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: false);
+ node, getter, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitSuperGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleSuperGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: true);
+ node, getter, setter, operator, arg,
+ isPrefix: true);
}
@override
R visitSuperMethodSetterPostfix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleSuperMethodSetterPostfixPrefix(
- node, method, setter, operator, arg, isPrefix: false);
+ node, method, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitSuperMethodSetterPrefix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return handleSuperMethodSetterPostfixPrefix(
- node, method, setter, operator, arg, isPrefix: true);
+ node, method, setter, operator, arg,
+ isPrefix: true);
}
@override
- R visitSuperIndexPostfix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPostfix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
return handleSuperIndexPostfixPrefix(
node, indexFunction, indexSetFunction, index, operator, arg,
@@ -6308,8 +6988,12 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
}
@override
- R visitSuperIndexPrefix(Send node, FunctionElement indexFunction,
- FunctionElement indexSetFunction, Node index, IncDecOperator operator,
+ R visitSuperIndexPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
return handleSuperIndexPostfixPrefix(
node, indexFunction, indexSetFunction, index, operator, arg,
@@ -6320,44 +7004,58 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
R visitUnresolvedSuperGetterIndexPostfix(Send node, Element element,
MethodElement setter, Node index, IncDecOperator operator, A arg) {
return handleUnresolvedSuperGetterIndexPostfixPrefix(
- node, element, setter, index, operator, arg, isPrefix: false);
+ node, element, setter, index, operator, arg,
+ isPrefix: false);
}
@override
R visitUnresolvedSuperGetterIndexPrefix(Send node, Element element,
MethodElement setter, Node index, IncDecOperator operator, A arg) {
return handleUnresolvedSuperGetterIndexPostfixPrefix(
- node, element, setter, index, operator, arg, isPrefix: true);
+ node, element, setter, index, operator, arg,
+ isPrefix: true);
}
@override
- R visitUnresolvedSuperSetterIndexPostfix(Send node,
- MethodElement indexFunction, Element element, Node index,
- IncDecOperator operator, A arg) {
+ R visitUnresolvedSuperSetterIndexPostfix(
+ Send node,
+ MethodElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
return handleUnresolvedSuperSetterIndexPostfixPrefix(
- node, indexFunction, element, index, operator, arg, isPrefix: false);
+ node, indexFunction, element, index, operator, arg,
+ isPrefix: false);
}
@override
- R visitUnresolvedSuperSetterIndexPrefix(Send node,
- MethodElement indexFunction, Element element, Node index,
- IncDecOperator operator, A arg) {
+ R visitUnresolvedSuperSetterIndexPrefix(
+ Send node,
+ MethodElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
return handleUnresolvedSuperSetterIndexPostfixPrefix(
- node, indexFunction, element, index, operator, arg, isPrefix: true);
+ node, indexFunction, element, index, operator, arg,
+ isPrefix: true);
}
@override
R visitUnresolvedSuperIndexPostfix(
Send node, Element element, Node index, IncDecOperator operator, A arg) {
return handleUnresolvedSuperIndexPostfixPrefix(
- node, element, index, operator, arg, isPrefix: false);
+ node, element, index, operator, arg,
+ isPrefix: false);
}
@override
R visitUnresolvedSuperIndexPrefix(
Send node, Element element, Node index, IncDecOperator operator, A arg) {
return handleUnresolvedSuperIndexPostfixPrefix(
- node, element, index, operator, arg, isPrefix: true);
+ node, element, index, operator, arg,
+ isPrefix: true);
}
@override
@@ -6406,28 +7104,32 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
R visitUnresolvedSuperGetterPostfix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
return handleUnresolvedSuperGetterPostfixPrefix(
- node, element, setter, operator, arg, isPrefix: false);
+ node, element, setter, operator, arg,
+ isPrefix: false);
}
@override
R visitUnresolvedSuperGetterPrefix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
return handleUnresolvedSuperGetterPostfixPrefix(
- node, element, setter, operator, arg, isPrefix: true);
+ node, element, setter, operator, arg,
+ isPrefix: true);
}
@override
R visitUnresolvedSuperSetterPostfix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
return handleUnresolvedSuperSetterPostfixPrefix(
- node, getter, element, operator, arg, isPrefix: false);
+ node, getter, element, operator, arg,
+ isPrefix: false);
}
@override
R visitUnresolvedSuperSetterPrefix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
return handleUnresolvedSuperSetterPostfixPrefix(
- node, getter, element, operator, arg, isPrefix: true);
+ node, getter, element, operator, arg,
+ isPrefix: true);
}
}
@@ -6441,34 +7143,51 @@ abstract class BaseImplementationOfNewMixin<R, A>
R handleConstructorInvoke(NewExpression node, ConstructorElement constructor,
DartType type, NodeList arguments, CallStructure callStructure, A arg);
- R visitGenerativeConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return handleConstructorInvoke(
node, constructor, type, arguments, callStructure, arg);
}
@override
- R visitRedirectingGenerativeConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitRedirectingGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return handleConstructorInvoke(
node, constructor, type, arguments, callStructure, arg);
}
@override
- R visitFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return handleConstructorInvoke(
node, constructor, type, arguments, callStructure, arg);
}
@override
- R visitRedirectingFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type,
- ConstructorElement effectiveTarget, InterfaceType effectiveTargetType,
- NodeList arguments, CallStructure callStructure, A arg) {
+ R visitRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ ConstructorElement effectiveTarget,
+ InterfaceType effectiveTargetType,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return handleConstructorInvoke(
node, constructor, type, arguments, callStructure, arg);
}
@@ -6488,17 +7207,25 @@ abstract class BaseImplementationOfNewMixin<R, A>
}
@override
- R visitAbstractClassConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitAbstractClassConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return handleConstructorInvoke(
node, constructor, type, arguments, callStructure, arg);
}
@override
- R visitUnresolvedRedirectingFactoryConstructorInvoke(NewExpression node,
- ConstructorElement constructor, InterfaceType type, NodeList arguments,
- CallStructure callStructure, A arg) {
+ R visitUnresolvedRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
return handleConstructorInvoke(
node, constructor, type, arguments, callStructure, arg);
}
diff --git a/pkg/compiler/lib/src/resolution/send_resolver.dart b/pkg/compiler/lib/src/resolution/send_resolver.dart
index 1be5538..37aefbf 100644
--- a/pkg/compiler/lib/src/resolution/send_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/send_resolver.dart
@@ -87,7 +87,8 @@ abstract class SendResolverMixin {
}
AccessSemantics handleStaticallyResolvedAccess(
- Send node, Element element, Element getter, {bool isCompound}) {
+ Send node, Element element, Element getter,
+ {bool isCompound}) {
if (element == null) {
assert(invariant(node, isCompound,
message: "Non-compound static access without element."));
@@ -548,7 +549,8 @@ abstract class SendResolverMixin {
effectiveTarget.isErroneous ||
(mustBeConstant && !effectiveTarget.isConst)) {
return new ConstructorAccessSemantics(
- ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY, constructor,
+ ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY,
+ constructor,
type);
}
ConstructorAccessSemantics effectiveTargetSemantics =
@@ -556,11 +558,15 @@ abstract class SendResolverMixin {
effectiveTarget, constructor.computeEffectiveTargetType(type));
if (effectiveTargetSemantics.isErroneous) {
return new RedirectingFactoryConstructorAccessSemantics(
- ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY, constructor,
- type, effectiveTargetSemantics);
+ ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY,
+ constructor,
+ type,
+ effectiveTargetSemantics);
}
return new RedirectingFactoryConstructorAccessSemantics(
- ConstructorAccessKind.REDIRECTING_FACTORY, constructor, type,
+ ConstructorAccessKind.REDIRECTING_FACTORY,
+ constructor,
+ type,
effectiveTargetSemantics);
} else if (constructor.isFactoryConstructor) {
return new ConstructorAccessSemantics(
@@ -757,7 +763,8 @@ abstract class DeclarationResolverMixin {
ConstructorElement constructor = element;
ConstructorKind kind = computeConstructorKind(constructor);
if (kind == ConstructorKind.REDIRECTING_FACTORY) {
- return new RedirectingFactoryConstructorDeclStructure(constructor,
+ return new RedirectingFactoryConstructorDeclStructure(
+ constructor,
elements.getType(node.body),
constructor.immediateRedirectionTarget);
} else {
@@ -816,7 +823,8 @@ abstract class DeclarationResolverMixin {
return new ThisConstructorInvokeStructure(
element, elements.getSelector(node));
} else if (Initializers.isSuperConstructorCall(node)) {
- return new SuperConstructorInvokeStructure(element,
+ return new SuperConstructorInvokeStructure(
+ element,
elements.analyzedElement.enclosingClass.supertype,
elements.getSelector(node));
}
diff --git a/pkg/compiler/lib/src/resolution/send_structure.dart b/pkg/compiler/lib/src/resolution/send_structure.dart
index f8c994a..37d5317 100644
--- a/pkg/compiler/lib/src/resolution/send_structure.dart
+++ b/pkg/compiler/lib/src/resolution/send_structure.dart
@@ -155,25 +155,34 @@ class InvokeStructure<R, A> implements SendStructure<R, A> {
return visitor.visitDynamicPropertyInvoke(
node, node.receiver, node.argumentsNode, selector, arg);
case AccessKind.LOCAL_FUNCTION:
- return visitor.visitLocalFunctionInvoke(node, semantics.element,
+ return visitor.visitLocalFunctionInvoke(
+ node,
+ semantics.element,
node.argumentsNode,
// TODO(johnniwinther): Store the call selector instead of the
// selector using the name of the function.
- callStructure, arg);
+ callStructure,
+ arg);
case AccessKind.LOCAL_VARIABLE:
case AccessKind.FINAL_LOCAL_VARIABLE:
- return visitor.visitLocalVariableInvoke(node, semantics.element,
+ return visitor.visitLocalVariableInvoke(
+ node,
+ semantics.element,
node.argumentsNode,
// TODO(johnniwinther): Store the call selector instead of the
// selector using the name of the variable.
- callStructure, arg);
+ callStructure,
+ arg);
case AccessKind.PARAMETER:
case AccessKind.FINAL_PARAMETER:
- return visitor.visitParameterInvoke(node, semantics.element,
+ return visitor.visitParameterInvoke(
+ node,
+ semantics.element,
node.argumentsNode,
// TODO(johnniwinther): Store the call selector instead of the
// selector using the name of the parameter.
- callStructure, arg);
+ callStructure,
+ arg);
case AccessKind.STATIC_FIELD:
case AccessKind.FINAL_STATIC_FIELD:
return visitor.visitStaticFieldInvoke(
@@ -758,13 +767,21 @@ class IndexPrefixStructure<R, A> implements SendStructure<R, A> {
return visitor.visitSuperIndexPrefix(node, compoundSemantics.getter,
compoundSemantics.setter, node.arguments.single, operator, arg);
case CompoundAccessKind.UNRESOLVED_SUPER_GETTER:
- return visitor.visitUnresolvedSuperGetterIndexPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter,
- node.arguments.single, operator, arg);
+ return visitor.visitUnresolvedSuperGetterIndexPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ node.arguments.single,
+ operator,
+ arg);
case CompoundAccessKind.UNRESOLVED_SUPER_SETTER:
- return visitor.visitUnresolvedSuperSetterIndexPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter,
- node.arguments.single, operator, arg);
+ return visitor.visitUnresolvedSuperSetterIndexPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ node.arguments.single,
+ operator,
+ arg);
default:
// This is not a valid case.
break;
@@ -811,17 +828,29 @@ class IndexPostfixStructure<R, A> implements SendStructure<R, A> {
CompoundAccessSemantics compoundSemantics = semantics;
switch (compoundSemantics.compoundAccessKind) {
case CompoundAccessKind.SUPER_GETTER_SETTER:
- return visitor.visitSuperIndexPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter,
- node.arguments.single, operator, arg);
+ return visitor.visitSuperIndexPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ node.arguments.single,
+ operator,
+ arg);
case CompoundAccessKind.UNRESOLVED_SUPER_GETTER:
- return visitor.visitUnresolvedSuperGetterIndexPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter,
- node.arguments.single, operator, arg);
+ return visitor.visitUnresolvedSuperGetterIndexPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ node.arguments.single,
+ operator,
+ arg);
case CompoundAccessKind.UNRESOLVED_SUPER_SETTER:
- return visitor.visitUnresolvedSuperSetterIndexPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter,
- node.arguments.single, operator, arg);
+ return visitor.visitUnresolvedSuperSetterIndexPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ node.arguments.single,
+ operator,
+ arg);
default:
// This is not a valid case.
break;
@@ -858,12 +887,22 @@ class CompoundStructure<R, A> implements SendStructure<R, A> {
switch (semantics.kind) {
case AccessKind.DYNAMIC_PROPERTY:
if (node.isConditional) {
- return visitor.visitIfNotNullDynamicPropertyCompound(node,
- node.receiver, operator, node.arguments.single, getterSelector,
- setterSelector, arg);
+ return visitor.visitIfNotNullDynamicPropertyCompound(
+ node,
+ node.receiver,
+ operator,
+ node.arguments.single,
+ getterSelector,
+ setterSelector,
+ arg);
}
- return visitor.visitDynamicPropertyCompound(node, node.receiver,
- operator, node.arguments.single, getterSelector, setterSelector,
+ return visitor.visitDynamicPropertyCompound(
+ node,
+ node.receiver,
+ operator,
+ node.arguments.single,
+ getterSelector,
+ setterSelector,
arg);
case AccessKind.LOCAL_FUNCTION:
return visitor.visitLocalFunctionCompound(
@@ -959,64 +998,120 @@ class CompoundStructure<R, A> implements SendStructure<R, A> {
CompoundAccessSemantics compoundSemantics = semantics;
switch (compoundSemantics.compoundAccessKind) {
case CompoundAccessKind.STATIC_GETTER_SETTER:
- return visitor.visitStaticGetterSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitStaticGetterSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.STATIC_METHOD_SETTER:
- return visitor.visitStaticMethodSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitStaticMethodSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.UNRESOLVED_STATIC_GETTER:
- return visitor.visitUnresolvedStaticGetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitUnresolvedStaticGetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.UNRESOLVED_STATIC_SETTER:
- return visitor.visitUnresolvedStaticSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitUnresolvedStaticSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.TOPLEVEL_GETTER_SETTER:
- return visitor.visitTopLevelGetterSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitTopLevelGetterSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.TOPLEVEL_METHOD_SETTER:
- return visitor.visitTopLevelMethodSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitTopLevelMethodSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.UNRESOLVED_TOPLEVEL_GETTER:
- return visitor.visitUnresolvedTopLevelGetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitUnresolvedTopLevelGetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.UNRESOLVED_TOPLEVEL_SETTER:
- return visitor.visitUnresolvedTopLevelSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitUnresolvedTopLevelSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.SUPER_FIELD_FIELD:
// TODO(johnniwinther): Handle this.
break;
case CompoundAccessKind.SUPER_GETTER_SETTER:
- return visitor.visitSuperGetterSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitSuperGetterSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.SUPER_GETTER_FIELD:
- return visitor.visitSuperGetterFieldCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitSuperGetterFieldCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.SUPER_METHOD_SETTER:
- return visitor.visitSuperMethodSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitSuperMethodSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.SUPER_FIELD_SETTER:
- return visitor.visitSuperFieldSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitSuperFieldSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.UNRESOLVED_SUPER_GETTER:
- return visitor.visitUnresolvedSuperGetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitUnresolvedSuperGetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
case CompoundAccessKind.UNRESOLVED_SUPER_SETTER:
- return visitor.visitUnresolvedSuperSetterCompound(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
- node.arguments.single, arg);
+ return visitor.visitUnresolvedSuperSetterCompound(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
+ node.arguments.single,
+ arg);
}
break;
}
@@ -1051,24 +1146,43 @@ class CompoundIndexSetStructure<R, A> implements SendStructure<R, A> {
return visitor.visitCompoundIndexSet(node, node.receiver,
node.arguments.first, operator, node.arguments.tail.head, arg);
case AccessKind.UNRESOLVED_SUPER:
- return visitor.visitUnresolvedSuperCompoundIndexSet(node,
- semantics.element, node.arguments.first, operator,
- node.arguments.tail.head, arg);
+ return visitor.visitUnresolvedSuperCompoundIndexSet(
+ node,
+ semantics.element,
+ node.arguments.first,
+ operator,
+ node.arguments.tail.head,
+ arg);
case AccessKind.COMPOUND:
CompoundAccessSemantics compoundSemantics = semantics;
switch (compoundSemantics.compoundAccessKind) {
case CompoundAccessKind.SUPER_GETTER_SETTER:
- return visitor.visitSuperCompoundIndexSet(node,
- compoundSemantics.getter, compoundSemantics.setter,
- node.arguments.first, operator, node.arguments.tail.head, arg);
+ return visitor.visitSuperCompoundIndexSet(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ node.arguments.first,
+ operator,
+ node.arguments.tail.head,
+ arg);
case CompoundAccessKind.UNRESOLVED_SUPER_GETTER:
- return visitor.visitUnresolvedSuperGetterCompoundIndexSet(node,
- compoundSemantics.getter, compoundSemantics.setter,
- node.arguments.first, operator, node.arguments.tail.head, arg);
+ return visitor.visitUnresolvedSuperGetterCompoundIndexSet(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ node.arguments.first,
+ operator,
+ node.arguments.tail.head,
+ arg);
case CompoundAccessKind.UNRESOLVED_SUPER_SETTER:
- return visitor.visitUnresolvedSuperSetterCompoundIndexSet(node,
- compoundSemantics.getter, compoundSemantics.setter,
- node.arguments.first, operator, node.arguments.tail.head, arg);
+ return visitor.visitUnresolvedSuperSetterCompoundIndexSet(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ node.arguments.first,
+ operator,
+ node.arguments.tail.head,
+ arg);
default:
// This is not a valid case.
break;
@@ -1206,68 +1320,116 @@ class PrefixStructure<R, A> implements SendStructure<R, A> {
CompoundAccessSemantics compoundSemantics = semantics;
switch (compoundSemantics.compoundAccessKind) {
case CompoundAccessKind.STATIC_GETTER_SETTER:
- return visitor.visitStaticGetterSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitStaticGetterSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.STATIC_METHOD_SETTER:
- return visitor.visitStaticMethodSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitStaticMethodSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_STATIC_GETTER:
- return visitor.visitUnresolvedStaticGetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedStaticGetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_STATIC_SETTER:
- return visitor.visitUnresolvedStaticSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedStaticSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.STATIC_METHOD_SETTER:
- return visitor.visitStaticMethodSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitStaticMethodSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.TOPLEVEL_GETTER_SETTER:
- return visitor.visitTopLevelGetterSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitTopLevelGetterSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.TOPLEVEL_METHOD_SETTER:
- return visitor.visitTopLevelMethodSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitTopLevelMethodSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_TOPLEVEL_GETTER:
- return visitor.visitUnresolvedTopLevelGetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedTopLevelGetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_TOPLEVEL_SETTER:
- return visitor.visitUnresolvedTopLevelSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedTopLevelSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_FIELD_FIELD:
- return visitor.visitSuperFieldFieldPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperFieldFieldPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_GETTER_SETTER:
- return visitor.visitSuperGetterSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperGetterSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_GETTER_FIELD:
- return visitor.visitSuperGetterFieldPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperGetterFieldPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_METHOD_SETTER:
- return visitor.visitSuperMethodSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperMethodSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_FIELD_SETTER:
- return visitor.visitSuperFieldSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperFieldSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_SUPER_GETTER:
- return visitor.visitUnresolvedSuperGetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedSuperGetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_SUPER_SETTER:
- return visitor.visitUnresolvedSuperSetterPrefix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedSuperSetterPrefix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
}
}
@@ -1399,64 +1561,109 @@ class PostfixStructure<R, A> implements SendStructure<R, A> {
CompoundAccessSemantics compoundSemantics = semantics;
switch (compoundSemantics.compoundAccessKind) {
case CompoundAccessKind.STATIC_GETTER_SETTER:
- return visitor.visitStaticGetterSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitStaticGetterSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_STATIC_GETTER:
- return visitor.visitUnresolvedStaticGetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedStaticGetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_STATIC_SETTER:
- return visitor.visitUnresolvedStaticSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedStaticSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.STATIC_METHOD_SETTER:
- return visitor.visitStaticMethodSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitStaticMethodSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.TOPLEVEL_GETTER_SETTER:
- return visitor.visitTopLevelGetterSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitTopLevelGetterSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.TOPLEVEL_METHOD_SETTER:
- return visitor.visitTopLevelMethodSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitTopLevelMethodSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_TOPLEVEL_GETTER:
- return visitor.visitUnresolvedTopLevelGetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedTopLevelGetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_TOPLEVEL_SETTER:
- return visitor.visitUnresolvedTopLevelSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedTopLevelSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_FIELD_FIELD:
- return visitor.visitSuperFieldFieldPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperFieldFieldPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_GETTER_SETTER:
- return visitor.visitSuperGetterSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperGetterSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_GETTER_FIELD:
- return visitor.visitSuperGetterFieldPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperGetterFieldPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_METHOD_SETTER:
- return visitor.visitSuperMethodSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperMethodSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.SUPER_FIELD_SETTER:
- return visitor.visitSuperFieldSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitSuperFieldSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_SUPER_GETTER:
- return visitor.visitUnresolvedSuperGetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedSuperGetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
case CompoundAccessKind.UNRESOLVED_SUPER_SETTER:
- return visitor.visitUnresolvedSuperSetterPostfix(node,
- compoundSemantics.getter, compoundSemantics.setter, operator,
+ return visitor.visitUnresolvedSuperSetterPostfix(
+ node,
+ compoundSemantics.getter,
+ compoundSemantics.setter,
+ operator,
arg);
}
}
@@ -1489,37 +1696,61 @@ class NewInvokeStructure<R, A> extends NewStructure<R, A> {
return visitor.visitGenerativeConstructorInvoke(node, semantics.element,
semantics.type, node.send.argumentsNode, callStructure, arg);
case ConstructorAccessKind.REDIRECTING_GENERATIVE:
- return visitor.visitRedirectingGenerativeConstructorInvoke(node,
- semantics.element, semantics.type, node.send.argumentsNode,
- callStructure, arg);
+ return visitor.visitRedirectingGenerativeConstructorInvoke(
+ node,
+ semantics.element,
+ semantics.type,
+ node.send.argumentsNode,
+ callStructure,
+ arg);
case ConstructorAccessKind.FACTORY:
return visitor.visitFactoryConstructorInvoke(node, semantics.element,
semantics.type, node.send.argumentsNode, callStructure, arg);
case ConstructorAccessKind.REDIRECTING_FACTORY:
- return visitor.visitRedirectingFactoryConstructorInvoke(node,
- semantics.element, semantics.type,
+ return visitor.visitRedirectingFactoryConstructorInvoke(
+ node,
+ semantics.element,
+ semantics.type,
semantics.effectiveTargetSemantics.element,
- semantics.effectiveTargetSemantics.type, node.send.argumentsNode,
- callStructure, arg);
+ semantics.effectiveTargetSemantics.type,
+ node.send.argumentsNode,
+ callStructure,
+ arg);
case ConstructorAccessKind.ABSTRACT:
- return visitor.visitAbstractClassConstructorInvoke(node,
- semantics.element, semantics.type, node.send.argumentsNode,
- callStructure, arg);
+ return visitor.visitAbstractClassConstructorInvoke(
+ node,
+ semantics.element,
+ semantics.type,
+ node.send.argumentsNode,
+ callStructure,
+ arg);
case ConstructorAccessKind.UNRESOLVED_CONSTRUCTOR:
return visitor.visitUnresolvedConstructorInvoke(node, semantics.element,
semantics.type, node.send.argumentsNode, selector, arg);
case ConstructorAccessKind.UNRESOLVED_TYPE:
- return visitor.visitUnresolvedClassConstructorInvoke(node,
- semantics.element, semantics.type, node.send.argumentsNode,
- selector, arg);
+ return visitor.visitUnresolvedClassConstructorInvoke(
+ node,
+ semantics.element,
+ semantics.type,
+ node.send.argumentsNode,
+ selector,
+ arg);
case ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR:
- return visitor.errorNonConstantConstructorInvoke(node,
- semantics.element, semantics.type, node.send.argumentsNode,
- callStructure, arg);
+ return visitor.errorNonConstantConstructorInvoke(
+ node,
+ semantics.element,
+ semantics.type,
+ node.send.argumentsNode,
+ callStructure,
+ arg);
case ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY:
- return visitor.visitUnresolvedRedirectingFactoryConstructorInvoke(node,
- semantics.element, semantics.type, node.send.argumentsNode,
- callStructure, arg);
+ return visitor.visitUnresolvedRedirectingFactoryConstructorInvoke(
+ node,
+ semantics.element,
+ semantics.type,
+ node.send.argumentsNode,
+ callStructure,
+ arg);
}
throw new SpannableAssertionFailure(
node, "Unhandled constructor invocation kind: ${semantics.kind}");
diff --git a/pkg/compiler/lib/src/resolution/signatures.dart b/pkg/compiler/lib/src/resolution/signatures.dart
index 0bfa88b..307152b 100644
--- a/pkg/compiler/lib/src/resolution/signatures.dart
+++ b/pkg/compiler/lib/src/resolution/signatures.dart
@@ -88,8 +88,11 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
void computeParameterType(FormalElementX element,
[VariableElement fieldElement]) {
void computeFunctionType(FunctionExpression functionExpression) {
- FunctionSignature functionSignature = SignatureResolver.analyze(compiler,
- functionExpression.parameters, functionExpression.returnType, element,
+ FunctionSignature functionSignature = SignatureResolver.analyze(
+ compiler,
+ functionExpression.parameters,
+ functionExpression.returnType,
+ element,
registry,
defaultValuesError: MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT);
element.functionSignatureCache = functionSignature;
@@ -259,10 +262,15 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
* real parameters implementing the [ParameterElement] interface. Otherwise,
* the parameters will only implement [FormalElement].
*/
- static FunctionSignature analyze(Compiler compiler, NodeList formalParameters,
- Node returnNode, FunctionTypedElement element,
- ResolutionRegistry registry, {MessageKind defaultValuesError,
- bool createRealParameters: false, bool isFunctionExpression: false}) {
+ static FunctionSignature analyze(
+ Compiler compiler,
+ NodeList formalParameters,
+ Node returnNode,
+ FunctionTypedElement element,
+ ResolutionRegistry registry,
+ {MessageKind defaultValuesError,
+ bool createRealParameters: false,
+ bool isFunctionExpression: false}) {
SignatureResolver visitor = new SignatureResolver(
compiler, element, registry,
defaultValuesError: defaultValuesError,
@@ -283,7 +291,8 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
}
} else {
if (element.isGetter) {
- if (!identical(formalParameters.endToken.next.stringValue,
+ if (!identical(
+ formalParameters.endToken.next.stringValue,
// TODO(ahe): Remove the check for native keyword.
'native')) {
compiler.reportError(formalParameters, MessageKind.EXTRA_FORMALS);
@@ -368,9 +377,13 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
optionalParameterTypes =
optionalParameterTypesBuilder.toLink().toList(growable: false);
}
- FunctionType type = new FunctionType(element.declaration, returnType,
- parameterTypes.toLink().toList(growable: false), optionalParameterTypes,
- namedParameters, namedParameterTypes);
+ FunctionType type = new FunctionType(
+ element.declaration,
+ returnType,
+ parameterTypes.toLink().toList(growable: false),
+ optionalParameterTypes,
+ namedParameters,
+ namedParameterTypes);
return new FunctionSignatureX(
requiredParameters: parameters,
optionalParameters: visitor.optionalParameters,
diff --git a/pkg/compiler/lib/src/resolution/type_resolver.dart b/pkg/compiler/lib/src/resolution/type_resolver.dart
index 2eaaa43..f44c725 100644
--- a/pkg/compiler/lib/src/resolution/type_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/type_resolver.dart
@@ -55,10 +55,11 @@ class TypeResolver {
bool hasTypeArgumentMismatch =
resolveTypeArguments(visitor, node, const <DartType>[], arguments);
if (hasTypeArgumentMismatch) {
- return new MalformedType(new ErroneousElementX(
- MessageKind.TYPE_ARGUMENT_COUNT_MISMATCH, {
- 'type': node
- }, typeName.source, visitor.enclosingElement), type, arguments);
+ return new MalformedType(
+ new ErroneousElementX(MessageKind.TYPE_ARGUMENT_COUNT_MISMATCH,
+ {'type': node}, typeName.source, visitor.enclosingElement),
+ type,
+ arguments);
}
return type;
}
@@ -139,7 +140,8 @@ class TypeResolver {
bool hasTypeArgumentMismatch =
resolveTypeArguments(visitor, node, cls.typeVariables, arguments);
if (hasTypeArgumentMismatch) {
- type = new BadInterfaceType(cls.declaration,
+ type = new BadInterfaceType(
+ cls.declaration,
new InterfaceType.forUserProvidedBadType(
cls.declaration, arguments));
} else {
@@ -180,9 +182,9 @@ class TypeResolver {
!Elements.hasAccessToTypeVariables(visitor.enclosingElement)) {
registry.registerThrowRuntimeError();
type = reportFailureAndCreateType(
- MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, {
- 'typeVariableName': node
- }, userProvidedBadType: element.computeType(compiler));
+ MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER,
+ {'typeVariableName': node},
+ userProvidedBadType: element.computeType(compiler));
} else {
type = element.computeType(compiler);
}
diff --git a/pkg/compiler/lib/src/resolution/typedefs.dart b/pkg/compiler/lib/src/resolution/typedefs.dart
index 9366e4d..90ef01e 100644
--- a/pkg/compiler/lib/src/resolution/typedefs.dart
+++ b/pkg/compiler/lib/src/resolution/typedefs.dart
@@ -62,9 +62,8 @@ class TypedefCyclicVisitor extends BaseDartTypeVisitor {
hasCyclicReference = true;
if (seenTypedefsCount == 1) {
// Direct cyclicity.
- compiler.reportError(element, MessageKind.CYCLIC_TYPEDEF, {
- 'typedefName': element.name
- });
+ compiler.reportError(element, MessageKind.CYCLIC_TYPEDEF,
+ {'typedefName': element.name});
} else if (seenTypedefsCount == 2) {
// Cyclicity through one other typedef.
compiler.reportError(element, MessageKind.CYCLIC_TYPEDEF_ONE, {
@@ -83,9 +82,10 @@ class TypedefCyclicVisitor extends BaseDartTypeVisitor {
}
}
ErroneousElementX erroneousElement = new ErroneousElementX(
- MessageKind.CYCLIC_TYPEDEF, {
- 'typedefName': element.name
- }, element.name, element);
+ MessageKind.CYCLIC_TYPEDEF,
+ {'typedefName': element.name},
+ element.name,
+ element);
element.alias =
new MalformedType(erroneousElement, typedefElement.alias);
element.hasBeenCheckedForCycles = true;
diff --git a/pkg/compiler/lib/src/resolved_visitor.dart b/pkg/compiler/lib/src/resolved_visitor.dart
index 82694ae..98fd2d4 100644
--- a/pkg/compiler/lib/src/resolved_visitor.dart
+++ b/pkg/compiler/lib/src/resolved_visitor.dart
@@ -235,8 +235,10 @@ abstract class NewResolvedVisitor<R> extends BaseResolvedVisitor<R>
@override
R visitSend(Send node) {
- assert(checkResolvedKind(node,
- _oldDispatch(node, const ResolvedKindComputer()), _newDispatch(
+ assert(checkResolvedKind(
+ node,
+ _oldDispatch(node, const ResolvedKindComputer()),
+ _newDispatch(
node, const ResolvedKindComputer(), _resolvedKindDispatcher)));
return _newDispatch(node, this, this);
}
@@ -377,8 +379,11 @@ class ResolvedSemanticDispatcher<R> extends Object
}
@override
- R visitStaticSetterInvoke(Send node, FunctionElement setter,
- NodeList arguments, CallStructure callStructure,
+ R visitStaticSetterInvoke(
+ Send node,
+ FunctionElement setter,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitStaticSend(node);
}
@@ -390,8 +395,11 @@ class ResolvedSemanticDispatcher<R> extends Object
}
@override
- R visitSuperSetterInvoke(Send node, FunctionElement setter,
- NodeList arguments, CallStructure callStructure,
+ R visitSuperSetterInvoke(
+ Send node,
+ FunctionElement setter,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitSuperSend(node);
}
@@ -403,8 +411,11 @@ class ResolvedSemanticDispatcher<R> extends Object
}
@override
- R visitTopLevelSetterInvoke(Send node, FunctionElement setter,
- NodeList arguments, CallStructure callStructure,
+ R visitTopLevelSetterInvoke(
+ Send node,
+ FunctionElement setter,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitStaticSend(node);
}
@@ -540,22 +551,31 @@ class ResolvedSemanticDispatcher<R> extends Object
}
@override
- R visitParameterInvoke(Send node, ParameterElement parameter,
- NodeList arguments, CallStructure callStructure,
+ R visitParameterInvoke(
+ Send node,
+ ParameterElement parameter,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitClosureSend(node);
}
@override
- R visitLocalVariableInvoke(Send node, LocalVariableElement variable,
- NodeList arguments, CallStructure callStructure,
+ R visitLocalVariableInvoke(
+ Send node,
+ LocalVariableElement variable,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitClosureSend(node);
}
@override
- R visitLocalFunctionInvoke(Send node, LocalFunctionElement function,
- NodeList arguments, CallStructure callStructure,
+ R visitLocalFunctionInvoke(
+ Send node,
+ LocalFunctionElement function,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitClosureSend(node);
}
@@ -591,29 +611,41 @@ class ResolvedSemanticDispatcher<R> extends Object
}
@override
- R visitClassTypeLiteralInvoke(Send node, ConstantExpression constant,
- NodeList arguments, CallStructure callStructure,
+ R visitClassTypeLiteralInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitTypeLiteralSend(node);
}
@override
- R visitTypedefTypeLiteralInvoke(Send node, ConstantExpression constant,
- NodeList arguments, CallStructure callStructure,
+ R visitTypedefTypeLiteralInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitTypeLiteralSend(node);
}
@override
- R visitDynamicTypeLiteralInvoke(Send node, ConstantExpression constant,
- NodeList arguments, CallStructure callStructure,
+ R visitDynamicTypeLiteralInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitTypeLiteralSend(node);
}
@override
- R visitTypeVariableTypeLiteralInvoke(Send node, TypeVariableElement element,
- NodeList arguments, CallStructure callStructure,
+ R visitTypeVariableTypeLiteralInvoke(
+ Send node,
+ TypeVariableElement element,
+ NodeList arguments,
+ CallStructure callStructure,
ResolvedKindVisitor<R> visitor) {
return visitor.visitTypeLiteralSend(node);
}
diff --git a/pkg/compiler/lib/src/scanner/class_element_parser.dart b/pkg/compiler/lib/src/scanner/class_element_parser.dart
index c8f7ba3..4e2c4ec 100644
--- a/pkg/compiler/lib/src/scanner/class_element_parser.dart
+++ b/pkg/compiler/lib/src/scanner/class_element_parser.dart
@@ -63,8 +63,15 @@ class PartialClassElement extends ClassElementX with PartialElement {
NodeList interfaces = listener.makeNodeList(0, null, null, ",");
Token extendsKeyword = null;
NodeList body = listener.makeNodeList(0, beginToken, endToken, null);
- cachedNode = new ClassNode(Modifiers.EMPTY, name, typeParameters,
- supertype, interfaces, beginToken, extendsKeyword, body,
+ cachedNode = new ClassNode(
+ Modifiers.EMPTY,
+ name,
+ typeParameters,
+ supertype,
+ interfaces,
+ beginToken,
+ extendsKeyword,
+ body,
endToken);
hasParseError = true;
}
@@ -134,10 +141,10 @@ class MemberListener extends NodeListener {
return Elements.constructOperatorName(operator.source, isUnary);
} else {
if (receiver == null || receiver.source != enclosingClass.name) {
- listener.reportError(send.receiver,
- MessageKind.INVALID_CONSTRUCTOR_NAME, {
- 'name': enclosingClass.name
- });
+ listener.reportError(
+ send.receiver,
+ MessageKind.INVALID_CONSTRUCTOR_NAME,
+ {'name': enclosingClass.name});
}
return selector.source;
}
@@ -172,10 +179,10 @@ class MemberListener extends NodeListener {
Identifier singleIdentifierName = method.name.asIdentifier();
if (singleIdentifierName != null && singleIdentifierName.source == name) {
if (name != enclosingClass.name) {
- listener.reportError(singleIdentifierName,
- MessageKind.INVALID_UNNAMED_CONSTRUCTOR_NAME, {
- 'name': enclosingClass.name
- });
+ listener.reportError(
+ singleIdentifierName,
+ MessageKind.INVALID_UNNAMED_CONSTRUCTOR_NAME,
+ {'name': enclosingClass.name});
}
}
ElementKind kind = ElementKind.FUNCTION;
diff --git a/pkg/compiler/lib/src/scanner/listener.dart b/pkg/compiler/lib/src/scanner/listener.dart
index 5cf615e..f23e667 100644
--- a/pkg/compiler/lib/src/scanner/listener.dart
+++ b/pkg/compiler/lib/src/scanner/listener.dart
@@ -373,8 +373,12 @@ class Listener {
void handleSuperExpression(Token token) {}
- void handleSwitchCase(int labelCount, int expressionCount,
- Token defaultKeyword, int statementCount, Token firstToken,
+ void handleSwitchCase(
+ int labelCount,
+ int expressionCount,
+ Token defaultKeyword,
+ int statementCount,
+ Token firstToken,
Token endToken) {}
void handleThisExpression(Token token) {}
@@ -570,9 +574,8 @@ class Listener {
}
reportError(token, kind, arguments);
} else if (token is UnsupportedNullAwareToken) {
- reportError(token, MessageKind.NULL_AWARE_OPERATORS_DISABLED, {
- 'operator': token.operator
- });
+ reportError(token, MessageKind.NULL_AWARE_OPERATORS_DISABLED,
+ {'operator': token.operator});
} else if (token is UnmatchedToken) {
String begin = token.begin.value;
String end = closeBraceFor(begin);
@@ -679,7 +682,8 @@ class ElementListener extends Listener {
}
StringNode uri = popLiteralString();
addLibraryTag(new Import(importKeyword, uri, prefix, combinators,
- popMetadata(compilationUnitElement), isDeferred: isDeferred));
+ popMetadata(compilationUnitElement),
+ isDeferred: isDeferred));
}
void endEnum(Token enumKeyword, Token endBrace, int count) {
@@ -797,8 +801,13 @@ class ElementListener extends Listener {
NodeList typeParameters = popNode();
Identifier name = popNode();
NamedMixinApplication namedMixinApplication = new NamedMixinApplication(
- name, typeParameters, modifiers, mixinApplication, interfaces,
- classKeyword, endToken);
+ name,
+ typeParameters,
+ modifiers,
+ mixinApplication,
+ interfaces,
+ classKeyword,
+ endToken);
int id = idGenerator();
Element enclosing = compilationUnitElement;
@@ -842,10 +851,14 @@ class ElementListener extends Listener {
buildFieldElement, beginToken, endToken, hasParseError);
}
- void buildFieldElements(Modifiers modifiers, NodeList variables,
+ void buildFieldElements(
+ Modifiers modifiers,
+ NodeList variables,
Element enclosingElement,
void buildFieldElement(Identifier name, VariableList fields),
- Token beginToken, Token endToken, bool hasParseError) {
+ Token beginToken,
+ Token endToken,
+ bool hasParseError) {
VariableList fields =
new PartialFieldList(beginToken, endToken, modifiers, hasParseError);
for (Link<Node> variableNodes = variables.nodes;
@@ -938,9 +951,10 @@ class ElementListener extends Listener {
}
return token;
} else {
- reportFatalError(token, MessageKind.MISSING_TOKEN_BEFORE_THIS
- .message({'token': string}, true)
- .toString());
+ reportFatalError(
+ token,
+ MessageKind.MISSING_TOKEN_BEFORE_THIS.message({'token': string}, true)
+ .toString());
}
return skipToEof(token);
}
@@ -1004,9 +1018,8 @@ class ElementListener extends Listener {
Token expectedIdentifier(Token token) {
if (token is KeywordToken) {
- reportError(token, MessageKind.EXPECTED_IDENTIFIER_NOT_RESERVED_WORD, {
- 'keyword': token.value
- });
+ reportError(token, MessageKind.EXPECTED_IDENTIFIER_NOT_RESERVED_WORD,
+ {'keyword': token.value});
} else if (token is ErrorToken) {
reportErrorToken(token);
return synthesizeIdentifier(token);
@@ -1199,7 +1212,8 @@ class ElementListener extends Listener {
for (int i = 0; i < count; i++) {
LiteralString string = popNode();
DartString validation = stringValidator.validateInterpolationPart(
- string.token, quoting, isFirst: false, isLast: isLast);
+ string.token, quoting,
+ isFirst: false, isLast: isLast);
// Replace the unvalidated LiteralString with a new LiteralString
// object that has the validation result included.
string = new LiteralString(string.token, validation);
@@ -1210,7 +1224,8 @@ class ElementListener extends Listener {
LiteralString string = popNode();
DartString validation = stringValidator.validateInterpolationPart(
- string.token, quoting, isFirst: true, isLast: isLast);
+ string.token, quoting,
+ isFirst: true, isLast: isLast);
string = new LiteralString(string.token, validation);
if (isLast) {
pushNode(string);
@@ -1507,16 +1522,12 @@ class NodeListener extends ElementListener {
pushNode(new Send(receiver, new Operator(token), arguments));
}
if (identical(tokenString, '===')) {
- listener.reportError(token, MessageKind.UNSUPPORTED_EQ_EQ_EQ, {
- 'lhs': receiver,
- 'rhs': argument
- });
+ listener.reportError(token, MessageKind.UNSUPPORTED_EQ_EQ_EQ,
+ {'lhs': receiver, 'rhs': argument});
}
if (identical(tokenString, '!==')) {
- listener.reportError(token, MessageKind.UNSUPPORTED_BANG_EQ_EQ, {
- 'lhs': receiver,
- 'rhs': argument
- });
+ listener.reportError(token, MessageKind.UNSUPPORTED_BANG_EQ_EQ,
+ {'lhs': receiver, 'rhs': argument});
}
}
@@ -2077,8 +2088,11 @@ abstract class PartialFunctionMixin implements BaseFunctionElementX {
this.beginToken = beginToken;
this.getOrSet = getOrSet;
this.endToken = endToken;
- _position = ElementX.findNameToken(beginToken, modifiers.isFactory ||
- identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR), name,
+ _position = ElementX.findNameToken(
+ beginToken,
+ modifiers.isFactory ||
+ identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR),
+ name,
enclosingElement.name);
}
@@ -2140,7 +2154,8 @@ class PartialMethodElement extends MethodElementX
with PartialElement, PartialFunctionMixin
implements PartialFunctionElement {
PartialMethodElement(String name, Token beginToken, Token endToken,
- Modifiers modifiers, Element enclosing, {bool hasBody: true})
+ Modifiers modifiers, Element enclosing,
+ {bool hasBody: true})
: super(name, ElementKind.FUNCTION, modifiers, enclosing, hasBody) {
init(beginToken, null, endToken);
}
@@ -2152,7 +2167,8 @@ class PartialMethodElement extends MethodElementX
PartialMethodElement copyWithEnclosing(Element enclosing) {
return new PartialMethodElement(
- name, beginToken, endToken, modifiers, enclosing, hasBody: hasBody);
+ name, beginToken, endToken, modifiers, enclosing,
+ hasBody: hasBody);
}
}
diff --git a/pkg/compiler/lib/src/scanner/parser.dart b/pkg/compiler/lib/src/scanner/parser.dart
index bac542a..0756a0d 100644
--- a/pkg/compiler/lib/src/scanner/parser.dart
+++ b/pkg/compiler/lib/src/scanner/parser.dart
@@ -632,14 +632,18 @@ class Parser {
}
Token parseTypeArgumentsOpt(Token token) {
- return parseStuff(token, (t) => listener.beginTypeArguments(t),
+ return parseStuff(
+ token,
+ (t) => listener.beginTypeArguments(t),
(t) => parseType(t),
(c, bt, et) => listener.endTypeArguments(c, bt, et),
(t) => listener.handleNoTypeArguments(t));
}
Token parseTypeVariablesOpt(Token token) {
- return parseStuff(token, (t) => listener.beginTypeVariables(t),
+ return parseStuff(
+ token,
+ (t) => listener.beginTypeVariables(t),
(t) => parseTypeVariable(t),
(c, bt, et) => listener.endTypeVariables(c, bt, et),
(t) => listener.handleNoTypeVariables(t));
@@ -781,7 +785,8 @@ class Parser {
modifierList.firstWhere(isVarFinalOrConst, orElse: () => null);
if (allowStatic && staticModifier == null) {
staticModifier = modifierList.firstWhere(
- (modifier) => optional('static', modifier), orElse: () => null);
+ (modifier) => optional('static', modifier),
+ orElse: () => null);
if (staticModifier != null) {
modifierCount++;
parseModifier(staticModifier);
@@ -835,9 +840,8 @@ class Parser {
} else {
parseType(type);
if (isVar) {
- listener.reportError(modifiers.head, MessageKind.EXTRANEOUS_MODIFIER, {
- 'modifier': modifiers.head
- });
+ listener.reportError(modifiers.head, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': modifiers.head});
}
}
@@ -1235,26 +1239,23 @@ class Parser {
modifierCount++;
externalModifier = modifier;
if (modifierCount != allowedModifierCount) {
- listener.reportError(modifier, MessageKind.EXTRANEOUS_MODIFIER, {
- 'modifier': modifier
- });
+ listener.reportError(modifier, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': modifier});
}
allowedModifierCount++;
} else if (staticModifier == null && optional('static', modifier)) {
modifierCount++;
staticModifier = modifier;
if (modifierCount != allowedModifierCount) {
- listener.reportError(modifier, MessageKind.EXTRANEOUS_MODIFIER, {
- 'modifier': modifier
- });
+ listener.reportError(modifier, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': modifier});
}
} else if (constModifier == null && optional('const', modifier)) {
modifierCount++;
constModifier = modifier;
if (modifierCount != allowedModifierCount) {
- listener.reportError(modifier, MessageKind.EXTRANEOUS_MODIFIER, {
- 'modifier': modifier
- });
+ listener.reportError(modifier, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': modifier});
}
} else {
listener.reportError(
@@ -1273,9 +1274,8 @@ class Parser {
token = parseOperatorName(name);
if (staticModifier != null) {
// TODO(ahe): Consider a more specific error message.
- listener.reportError(staticModifier, MessageKind.EXTRANEOUS_MODIFIER, {
- 'modifier': staticModifier
- });
+ listener.reportError(staticModifier, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': staticModifier});
}
} else {
token = parseIdentifier(name);
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index a4fea67..36ddbfb 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -294,8 +294,8 @@ class LocalsHandler {
directLocals[scopeData.boxElement] = box;
// Make sure that accesses to the boxed locals go into the box. We also
// need to make sure that parameters are copied into the box if necessary.
- scopeData.forEachCapturedVariable((LocalVariableElement from,
- BoxFieldElement to) {
+ scopeData.forEachCapturedVariable(
+ (LocalVariableElement from, BoxFieldElement to) {
// The [from] can only be a parameter for function-scopes and not
// loop scopes.
if (from.isParameter && !element.isGenerativeConstructorBody) {
@@ -1170,8 +1170,10 @@ class SsaBuilder extends NewResolvedVisitor {
/**
* Returns a complete argument list for a call of [function].
*/
- List<HInstruction> completeSendArgumentsList(FunctionElement function,
- Selector selector, List<HInstruction> providedArguments,
+ List<HInstruction> completeSendArgumentsList(
+ FunctionElement function,
+ Selector selector,
+ List<HInstruction> providedArguments,
ast.Node currentNode) {
assert(invariant(function, function.isImplementation));
assert(providedArguments != null);
@@ -1416,9 +1418,10 @@ class SsaBuilder extends NewResolvedVisitor {
if (element.isInstanceMember &&
!element.isGenerativeConstructorBody &&
(selector.mask == null || selector.mask.isNullable)) {
- addWithPosition(new HFieldGet(
- null, providedArguments[0], backend.dynamicType,
- isAssignable: false), currentNode);
+ addWithPosition(
+ new HFieldGet(null, providedArguments[0], backend.dynamicType,
+ isAssignable: false),
+ currentNode);
}
List<HInstruction> compiledArguments = completeSendArgumentsList(
function, selector, providedArguments, currentNode);
@@ -1572,13 +1575,18 @@ class SsaBuilder extends NewResolvedVisitor {
// null check.
if (name == '==') {
if (!backend.operatorEqHandlesNullArgument(functionElement)) {
- handleIf(function, () {
- HParameterValue parameter = parameters.values.first;
- push(new HIdentity(parameter, graph.addConstantNull(compiler), null,
- backend.boolType));
- }, () {
- closeAndGotoExit(new HReturn(graph.addConstantBool(false, compiler)));
- }, null);
+ handleIf(
+ function,
+ () {
+ HParameterValue parameter = parameters.values.first;
+ push(new HIdentity(parameter, graph.addConstantNull(compiler),
+ null, backend.boolType));
+ },
+ () {
+ closeAndGotoExit(
+ new HReturn(graph.addConstantBool(false, compiler)));
+ },
+ null);
}
}
function.body.accept(this);
@@ -1783,9 +1791,12 @@ class SsaBuilder extends NewResolvedVisitor {
*
* Invariant: [constructors] must contain only implementation elements.
*/
- void inlineSuperOrRedirect(ConstructorElement callee,
- List<HInstruction> compiledArguments, List<FunctionElement> constructors,
- Map<Element, HInstruction> fieldValues, FunctionElement caller) {
+ void inlineSuperOrRedirect(
+ ConstructorElement callee,
+ List<HInstruction> compiledArguments,
+ List<FunctionElement> constructors,
+ Map<Element, HInstruction> fieldValues,
+ FunctionElement caller) {
callee = callee.implementation;
compiler.withCurrentElement(callee, () {
constructors.add(callee);
@@ -1875,7 +1886,8 @@ class SsaBuilder extends NewResolvedVisitor {
* Invariant: The [constructor] and elements in [constructors] must all be
* implementation elements.
*/
- void buildInitializers(ConstructorElement constructor,
+ void buildInitializers(
+ ConstructorElement constructor,
List<FunctionElement> constructors,
Map<Element, HInstruction> fieldValues) {
assert(invariant(constructor, constructor.isImplementation));
@@ -1887,7 +1899,10 @@ class SsaBuilder extends NewResolvedVisitor {
Element target = constructor.definingConstructor.implementation;
bool match = CallStructure.addForwardingElementArgumentsToList(
- constructor, arguments, target, compileArgument,
+ constructor,
+ arguments,
+ target,
+ compileArgument,
handleConstantForOptionalParameter);
if (!match) {
if (compiler.elementHasCompileTimeError(constructor)) {
@@ -1958,7 +1973,9 @@ class SsaBuilder extends NewResolvedVisitor {
superClass, "No default constructor available.");
}
List<HInstruction> arguments = CallStructure.NO_ARGS.makeArgumentsList(
- const Link<ast.Node>(), target.implementation, null,
+ const Link<ast.Node>(),
+ target.implementation,
+ null,
handleConstantForOptionalParameter);
inlineSuperOrRedirect(
target, arguments, constructors, fieldValues, constructor);
@@ -1975,8 +1992,8 @@ class SsaBuilder extends NewResolvedVisitor {
void buildFieldInitializers(
ClassElement classElement, Map<Element, HInstruction> fieldValues) {
assert(invariant(classElement, classElement.isImplementation));
- classElement.forEachInstanceField((ClassElement enclosingClass,
- VariableElement member) {
+ classElement.forEachInstanceField(
+ (ClassElement enclosingClass, VariableElement member) {
if (compiler.elementHasCompileTimeError(member)) return;
compiler.withCurrentElement(member, () {
TreeElements definitions = member.treeElements;
@@ -2058,8 +2075,8 @@ class SsaBuilder extends NewResolvedVisitor {
List<HInstruction> constructorArguments = <HInstruction>[];
List<Element> fields = <Element>[];
- classElement.forEachInstanceField((ClassElement enclosingClass,
- VariableElement member) {
+ classElement.forEachInstanceField(
+ (ClassElement enclosingClass, VariableElement member) {
HInstruction value = fieldValues[member];
if (value == null) {
// Uninitialized native fields are pre-initialized by the native
@@ -2071,7 +2088,8 @@ class SsaBuilder extends NewResolvedVisitor {
DartType type = localsHandler.substInContext(member.type);
constructorArguments.add(potentiallyCheckOrTrustType(value, type));
}
- }, includeSuperAndInjectedMembers: true);
+ },
+ includeSuperAndInjectedMembers: true);
InterfaceType type = classElement.thisType;
TypeMask ssaType =
@@ -2341,11 +2359,14 @@ class SsaBuilder extends NewResolvedVisitor {
/// Check that [type] is valid in the context of `localsHandler.contextClass`.
/// This should only be called in assertions.
bool assertTypeInContext(DartType type, [Spannable spannable]) {
- return invariant(spannable == null ? CURRENT_ELEMENT_SPANNABLE : spannable,
+ return invariant(
+ spannable == null ? CURRENT_ELEMENT_SPANNABLE : spannable,
() {
- ClassElement contextClass = Types.getClassContext(type);
- return contextClass == null || contextClass == localsHandler.contextClass;
- }, message: "Type '$type' is not valid context of "
+ ClassElement contextClass = Types.getClassContext(type);
+ return contextClass == null ||
+ contextClass == localsHandler.contextClass;
+ },
+ message: "Type '$type' is not valid context of "
"${localsHandler.contextClass}.");
}
@@ -2707,13 +2728,17 @@ class SsaBuilder extends NewResolvedVisitor {
List<LabelDefinition> labels = jumpHandler.labels();
JumpTarget target = elements.getTargetDefinition(loop);
if (!labels.isEmpty) {
- beginBodyBlock.setBlockFlow(new HLabeledBlockInformation(
- new HSubGraphBlockInformation(bodyGraph), jumpHandler.labels(),
- isContinue: true), updateBlock);
+ beginBodyBlock.setBlockFlow(
+ new HLabeledBlockInformation(
+ new HSubGraphBlockInformation(bodyGraph), jumpHandler.labels(),
+ isContinue: true),
+ updateBlock);
} else if (target != null && target.isContinueTarget) {
- beginBodyBlock.setBlockFlow(new HLabeledBlockInformation.implicit(
- new HSubGraphBlockInformation(bodyGraph), target,
- isContinue: true), updateBlock);
+ beginBodyBlock.setBlockFlow(
+ new HLabeledBlockInformation.implicit(
+ new HSubGraphBlockInformation(bodyGraph), target,
+ isContinue: true),
+ updateBlock);
}
localsHandler.enterLoopUpdates(loop);
@@ -2738,7 +2763,8 @@ class SsaBuilder extends NewResolvedVisitor {
HLoopBlockInformation.loopType(loop),
wrapExpressionGraph(initializerGraph),
wrapExpressionGraph(conditionExpression),
- wrapStatementGraph(bodyGraph), wrapExpressionGraph(updateGraph),
+ wrapStatementGraph(bodyGraph),
+ wrapExpressionGraph(updateGraph),
conditionBlock.loopInformation.target,
conditionBlock.loopInformation.labels,
sourceInformationBuilder.buildLoop(loop));
@@ -2775,7 +2801,8 @@ class SsaBuilder extends NewResolvedVisitor {
conditionEndBlock.remove(conditionEndBlock.last);
HIfBlockInformation info = new HIfBlockInformation(
wrapExpressionGraph(conditionExpression),
- wrapStatementGraph(bodyGraph), wrapStatementGraph(elseGraph));
+ wrapStatementGraph(bodyGraph),
+ wrapStatementGraph(elseGraph));
conditionEndBlock.setBlockFlow(info, current);
HIf ifBlock = conditionEndBlock.last;
@@ -2844,9 +2871,14 @@ class SsaBuilder extends NewResolvedVisitor {
visit(node.condition);
return popBoolified();
}
- handleLoop(node, () {}, buildCondition, () {}, () {
- visit(node.body);
- });
+ handleLoop(
+ node,
+ () {},
+ buildCondition,
+ () {},
+ () {
+ visit(node.body);
+ });
}
visitDoWhile(ast.DoWhile node) {
@@ -2946,9 +2978,11 @@ class SsaBuilder extends NewResolvedVisitor {
loopEntryBlock.postProcessLoopHeader();
SubGraph bodyGraph = new SubGraph(loopEntryBlock, bodyExitBlock);
HLoopBlockInformation loopBlockInfo = new HLoopBlockInformation(
- HLoopBlockInformation.DO_WHILE_LOOP, null,
+ HLoopBlockInformation.DO_WHILE_LOOP,
+ null,
wrapExpressionGraph(conditionExpression),
- wrapStatementGraph(bodyGraph), null,
+ wrapStatementGraph(bodyGraph),
+ null,
loopEntryBlock.loopInformation.target,
loopEntryBlock.loopInformation.labels,
sourceInformationBuilder.buildLoop(node));
@@ -3053,17 +3087,21 @@ class SsaBuilder extends NewResolvedVisitor {
@override
void visitLogicalAnd(ast.Send node, ast.Node left, ast.Node right, _) {
SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this, node);
- branchBuilder.handleLogicalAndOrWithLeftNode(left, () {
- visit(right);
- }, isAnd: true);
+ branchBuilder.handleLogicalAndOrWithLeftNode(
+ left,
+ () {
+ visit(right);
+ }, isAnd: true);
}
@override
void visitLogicalOr(ast.Send node, ast.Node left, ast.Node right, _) {
SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this, node);
- branchBuilder.handleLogicalAndOrWithLeftNode(left, () {
- visit(right);
- }, isAnd: false);
+ branchBuilder.handleLogicalAndOrWithLeftNode(
+ left,
+ () {
+ visit(right);
+ }, isAnd: false);
}
@override
@@ -3295,10 +3333,12 @@ class SsaBuilder extends NewResolvedVisitor {
// t1 || t1.x
HInstruction expression;
SsaBranchBuilder brancher = new SsaBranchBuilder(this, node);
- brancher.handleConditional(() {
+ brancher.handleConditional(
+ () {
expression = visitAndPop(receiver);
pushCheckNull(expression);
- }, () => stack.add(expression),
+ },
+ () => stack.add(expression),
() => generateInstanceGetterWithCompiledReceiver(
node, elements.getSelector(node), expression));
}
@@ -3372,10 +3412,12 @@ class SsaBuilder extends NewResolvedVisitor {
// else
// result = e.x = e2
HInstruction receiver;
- brancher.handleConditional(() {
+ brancher.handleConditional(
+ () {
receiver = pushReceiver();
pushCheckNull(receiver);
- }, () => stack.add(receiver),
+ },
+ () => stack.add(receiver),
() => generateInstanceSetterWithCompiledReceiver(
send, receiver, pushValue(),
selector: selector, location: location));
@@ -3476,11 +3518,12 @@ class SsaBuilder extends NewResolvedVisitor {
bool first = true;
List<js.Expression> templates = <js.Expression>[];
for (DartType argument in interface.typeArguments) {
- templates.add(rti.getTypeRepresentationWithPlaceholders(argument,
+ templates.add(rti.getTypeRepresentationWithPlaceholders(
+ argument,
(variable) {
- HInstruction runtimeType = addTypeVariableReference(variable);
- inputs.add(runtimeType);
- }, firstPlaceholderIndex: inputs.length));
+ HInstruction runtimeType = addTypeVariableReference(variable);
+ inputs.add(runtimeType);
+ }, firstPlaceholderIndex: inputs.length));
}
// TODO(sra): This is a fresh template each time. We can't let the
// template manager build them.
@@ -3778,26 +3821,23 @@ class SsaBuilder extends NewResolvedVisitor {
ast.Node argument;
switch (arguments.length) {
case 0:
- compiler.reportError(node, MessageKind.GENERIC, {
- 'text': 'Error: Expected one argument to JS_GET_FLAG.'
- });
+ compiler.reportError(node, MessageKind.GENERIC,
+ {'text': 'Error: Expected one argument to JS_GET_FLAG.'});
return;
case 1:
argument = arguments[0];
break;
default:
for (int i = 1; i < arguments.length; i++) {
- compiler.reportError(arguments[i], MessageKind.GENERIC, {
- 'text': 'Error: Extra argument to JS_GET_FLAG.'
- });
+ compiler.reportError(arguments[i], MessageKind.GENERIC,
+ {'text': 'Error: Extra argument to JS_GET_FLAG.'});
}
return;
}
ast.LiteralString string = argument.asLiteralString();
if (string == null) {
- compiler.reportError(argument, MessageKind.GENERIC, {
- 'text': 'Error: Expected a literal string.'
- });
+ compiler.reportError(argument, MessageKind.GENERIC,
+ {'text': 'Error: Expected a literal string.'});
}
String name = string.dartString.slowToString();
bool value = false;
@@ -3809,9 +3849,8 @@ class SsaBuilder extends NewResolvedVisitor {
value = compiler.useContentSecurityPolicy;
break;
default:
- compiler.reportError(node, MessageKind.GENERIC, {
- 'text': 'Error: Unknown internal flag "$name".'
- });
+ compiler.reportError(node, MessageKind.GENERIC,
+ {'text': 'Error: Unknown internal flag "$name".'});
}
stack.add(graph.addConstantBool(value, compiler));
}
@@ -3821,18 +3860,16 @@ class SsaBuilder extends NewResolvedVisitor {
ast.Node argument;
switch (arguments.length) {
case 0:
- compiler.reportError(node, MessageKind.GENERIC, {
- 'text': 'Error: Expected one argument to JS_GET_NAME.'
- });
+ compiler.reportError(node, MessageKind.GENERIC,
+ {'text': 'Error: Expected one argument to JS_GET_NAME.'});
return;
case 1:
argument = arguments[0];
break;
default:
for (int i = 1; i < arguments.length; i++) {
- compiler.reportError(arguments[i], MessageKind.GENERIC, {
- 'text': 'Error: Extra argument to JS_GET_NAME.'
- });
+ compiler.reportError(arguments[i], MessageKind.GENERIC,
+ {'text': 'Error: Extra argument to JS_GET_NAME.'});
}
return;
}
@@ -3840,9 +3877,8 @@ class SsaBuilder extends NewResolvedVisitor {
if (element == null ||
element is! FieldElement ||
element.enclosingClass != backend.jsGetNameEnum) {
- compiler.reportError(argument, MessageKind.GENERIC, {
- 'text': 'Error: Expected a JsGetName enum value.'
- });
+ compiler.reportError(argument, MessageKind.GENERIC,
+ {'text': 'Error: Expected a JsGetName enum value.'});
}
EnumClassElement enumClass = element.enclosingClass;
int index = enumClass.enumValues.indexOf(element);
@@ -3854,18 +3890,16 @@ class SsaBuilder extends NewResolvedVisitor {
List<ast.Node> arguments = node.arguments.toList();
ast.Node argument;
if (arguments.length < 2) {
- compiler.reportError(node, MessageKind.GENERIC, {
- 'text': 'Error: Expected at least two arguments to JS_BUILTIN.'
- });
+ compiler.reportError(node, MessageKind.GENERIC,
+ {'text': 'Error: Expected at least two arguments to JS_BUILTIN.'});
}
Element builtinElement = elements[arguments[1]];
if (builtinElement == null ||
(builtinElement is! FieldElement) ||
builtinElement.enclosingClass != backend.jsBuiltinEnum) {
- compiler.reportError(argument, MessageKind.GENERIC, {
- 'text': 'Error: Expected a JsBuiltin enum value.'
- });
+ compiler.reportError(argument, MessageKind.GENERIC,
+ {'text': 'Error: Expected a JsBuiltin enum value.'});
}
EnumClassElement enumClass = builtinElement.enclosingClass;
int index = enumClass.enumValues.indexOf(builtinElement);
@@ -3895,9 +3929,8 @@ class SsaBuilder extends NewResolvedVisitor {
switch (arguments.length) {
case 0:
case 1:
- compiler.reportError(node, MessageKind.GENERIC, {
- 'text': 'Error: Expected two arguments to JS_EMBEDDED_GLOBAL.'
- });
+ compiler.reportError(node, MessageKind.GENERIC,
+ {'text': 'Error: Expected two arguments to JS_EMBEDDED_GLOBAL.'});
return;
case 2:
// The type has been extracted earlier. We are only interested in the
@@ -3906,9 +3939,8 @@ class SsaBuilder extends NewResolvedVisitor {
break;
default:
for (int i = 2; i < arguments.length; i++) {
- compiler.reportError(arguments[i], MessageKind.GENERIC, {
- 'text': 'Error: Extra argument to JS_EMBEDDED_GLOBAL.'
- });
+ compiler.reportError(arguments[i], MessageKind.GENERIC,
+ {'text': 'Error: Extra argument to JS_EMBEDDED_GLOBAL.'});
}
return;
}
@@ -4001,9 +4033,12 @@ class SsaBuilder extends NewResolvedVisitor {
}
registry.registerStaticUse(element);
- push(new HForeignCode(js.js.expressionTemplateYielding(
- backend.emitter.staticFunctionAccess(element)), backend.dynamicType,
- <HInstruction>[], nativeBehavior: native.NativeBehavior.PURE));
+ push(new HForeignCode(
+ js.js.expressionTemplateYielding(
+ backend.emitter.staticFunctionAccess(element)),
+ backend.dynamicType,
+ <HInstruction>[],
+ nativeBehavior: native.NativeBehavior.PURE));
return params;
}
@@ -4109,8 +4144,9 @@ class SsaBuilder extends NewResolvedVisitor {
PrefixElement prefixElement = deferredLoader.enclosingElement;
String loadId =
compiler.deferredLoadTask.importDeferName[prefixElement.deferredImport];
- var inputs =
- [graph.addConstantString(new ast.DartString.literal(loadId), compiler)];
+ var inputs = [
+ graph.addConstantString(new ast.DartString.literal(loadId), compiler)
+ ];
push(new HInvokeStatic(loadFunction, inputs, backend.nonNullType,
targetCanThrow: false));
}
@@ -4155,13 +4191,16 @@ class SsaBuilder extends NewResolvedVisitor {
ConstantValue kindConstant =
constantSystem.createInt(selector.invocationMirrorKind);
- pushInvokeStatic(null, createInvocationMirror, [
- graph.addConstant(nameConstant, compiler),
- graph.addConstant(internalNameConstant, compiler),
- graph.addConstant(kindConstant, compiler),
- argumentsInstruction,
- argumentNamesInstruction
- ], typeMask: backend.dynamicType);
+ pushInvokeStatic(
+ null,
+ createInvocationMirror,
+ [
+ graph.addConstant(nameConstant, compiler),
+ graph.addConstant(internalNameConstant, compiler),
+ graph.addConstant(kindConstant, compiler),
+ argumentsInstruction,
+ argumentNamesInstruction
+ ], typeMask: backend.dynamicType);
var inputs = <HInstruction>[pop()];
push(buildInvokeSuper(compiler.noSuchMethodSelector, element, inputs));
@@ -4354,11 +4393,9 @@ class SsaBuilder extends NewResolvedVisitor {
String substitutionNameString = backend.namer.runtimeTypeName(cls);
HInstruction substitutionName = graph.addConstantString(
new ast.LiteralDartString(substitutionNameString), compiler);
- pushInvokeStatic(null, backend.getGetRuntimeTypeArgument(), [
- target,
- substitutionName,
- index
- ], typeMask: backend.dynamicType);
+ pushInvokeStatic(null, backend.getGetRuntimeTypeArgument(),
+ [target, substitutionName, index],
+ typeMask: backend.dynamicType);
} else {
pushInvokeStatic(
null, backend.getGetTypeArgumentByIndex(), [target, index],
@@ -4441,8 +4478,8 @@ class SsaBuilder extends NewResolvedVisitor {
List<HInstruction> inputs = <HInstruction>[];
- js.Expression template = rti.getTypeRepresentationWithPlaceholders(argument,
- (variable) {
+ js.Expression template =
+ rti.getTypeRepresentationWithPlaceholders(argument, (variable) {
inputs.add(addTypeVariableReference(variable));
});
@@ -4606,8 +4643,11 @@ class SsaBuilder extends NewResolvedVisitor {
TypeMask elementType = computeType(constructor);
if (isFixedListConstructorCall) {
if (!inputs[0].isNumber(compiler)) {
- HTypeConversion conversion = new HTypeConversion(null,
- HTypeConversion.ARGUMENT_TYPE_CHECK, backend.numType, inputs[0],
+ HTypeConversion conversion = new HTypeConversion(
+ null,
+ HTypeConversion.ARGUMENT_TYPE_CHECK,
+ backend.numType,
+ inputs[0],
null);
add(conversion);
inputs[0] = conversion;
@@ -4801,9 +4841,12 @@ class SsaBuilder extends NewResolvedVisitor {
}
@override
- void visitStaticFunctionIncompatibleInvoke(ast.Send node,
- MethodElement function, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ void visitStaticFunctionIncompatibleInvoke(
+ ast.Send node,
+ MethodElement function,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
generateStaticFunctionIncompatibleInvoke(node, function);
}
@@ -4832,9 +4875,12 @@ class SsaBuilder extends NewResolvedVisitor {
}
@override
- void visitTopLevelFunctionIncompatibleInvoke(ast.Send node,
- MethodElement function, ast.NodeList arguments,
- CallStructure callStructure, _) {
+ void visitTopLevelFunctionIncompatibleInvoke(
+ ast.Send node,
+ MethodElement function,
+ ast.NodeList arguments,
+ CallStructure callStructure,
+ _) {
generateStaticFunctionIncompatibleInvoke(node, function);
}
@@ -4983,7 +5029,8 @@ class SsaBuilder extends NewResolvedVisitor {
}
void generateThrowNoSuchMethod(ast.Node diagnosticNode, String methodName,
- {Link<ast.Node> argumentNodes, List<HInstruction> argumentValues,
+ {Link<ast.Node> argumentNodes,
+ List<HInstruction> argumentValues,
List<String> existingArguments}) {
Element helper = backend.getThrowNoSuchMethod();
ConstantValue receiverConstant =
@@ -5297,11 +5344,10 @@ class SsaBuilder extends NewResolvedVisitor {
index = pop();
}
- pushInvokeDynamic(node,
- elements.getGetterSelectorInComplexSendSet(node), [
- receiver,
- index
- ]);
+ pushInvokeDynamic(
+ node,
+ elements.getGetterSelectorInComplexSendSet(node),
+ [receiver, index]);
HInstruction getterInstruction = pop();
if (node.isIfNullAssignment) {
// Compile x[i] ??= e as:
@@ -5335,7 +5381,8 @@ class SsaBuilder extends NewResolvedVisitor {
Link<ast.Node> link = node.arguments;
assert(!link.isEmpty && link.tail.isEmpty);
if (Elements.isInstanceSend(node, elements)) {
- generatePossiblyConditionalInstanceSetter(node,
+ generatePossiblyConditionalInstanceSetter(
+ node,
() => generateInstanceSendReceiver(node),
() => visitAndPop(link.head));
} else {
@@ -5774,10 +5821,8 @@ class SsaBuilder extends NewResolvedVisitor {
visit(node.expression);
HInstruction expression = pop();
- pushInvokeStatic(node, backend.getStreamIteratorConstructor(), [
- expression,
- graph.addConstantNull(compiler)
- ]);
+ pushInvokeStatic(node, backend.getStreamIteratorConstructor(),
+ [expression, graph.addConstantNull(compiler)]);
streamIterator = pop();
void buildInitializer() {}
@@ -6041,7 +6086,8 @@ class SsaBuilder extends NewResolvedVisitor {
if (hasBreak) {
// There was at least one reachable break, so the label is needed.
- entryBlock.setBlockFlow(new HLabeledBlockInformation(
+ entryBlock.setBlockFlow(
+ new HLabeledBlockInformation(
new HSubGraphBlockInformation(bodyGraph), handler.labels()),
joinBlock);
}
@@ -6222,9 +6268,11 @@ class SsaBuilder extends NewResolvedVisitor {
* Builds a switch statement that can handle arbitrary uses of continue
* statements to labeled switch cases.
*/
- void buildComplexSwitchStatement(ast.SwitchStatement node,
+ void buildComplexSwitchStatement(
+ ast.SwitchStatement node,
Map<ast.CaseMatch, ConstantValue> constants,
- Map<ast.SwitchCase, int> caseIndex, bool hasDefault) {
+ Map<ast.SwitchCase, int> caseIndex,
+ bool hasDefault) {
// If the switch statement has switch cases targeted by continue
// statements we create the following encoding:
//
@@ -6320,8 +6368,13 @@ class SsaBuilder extends NewResolvedVisitor {
// Pass a [NullJumpHandler] because the target for the contained break
// is not the generated switch statement but instead the loop generated
// in the call to [handleLoop] below.
- handleSwitch(node, new NullJumpHandler(compiler), buildExpression,
- node.cases, getConstants, (_) => false, // No case is default.
+ handleSwitch(
+ node,
+ new NullJumpHandler(compiler),
+ buildExpression,
+ node.cases,
+ getConstants,
+ (_) => false, // No case is default.
buildSwitchCase);
}
@@ -6356,8 +6409,11 @@ class SsaBuilder extends NewResolvedVisitor {
* considered default for the created switch statement.
* [buildSwitchCase] creates the statements for the switch case.
*/
- void handleSwitch(ast.Node errorNode, JumpHandler jumpHandler,
- HInstruction buildExpression(), var switchCases,
+ void handleSwitch(
+ ast.Node errorNode,
+ JumpHandler jumpHandler,
+ HInstruction buildExpression(),
+ var switchCases,
Iterable<ConstantValue> getConstants(ast.SwitchCase switchCase),
bool isDefaultCase(ast.SwitchCase switchCase),
void buildSwitchCase(ast.SwitchCase switchCase)) {
@@ -6465,8 +6521,10 @@ class SsaBuilder extends NewResolvedVisitor {
HSubExpressionBlockInformation expressionInfo =
new HSubExpressionBlockInformation(
new SubExpression(expressionStart, expressionEnd));
- expressionStart.setBlockFlow(new HSwitchBlockInformation(expressionInfo,
- statements, jumpHandler.target, jumpHandler.labels()), joinBlock);
+ expressionStart.setBlockFlow(
+ new HSwitchBlockInformation(expressionInfo, statements,
+ jumpHandler.target, jumpHandler.labels()),
+ joinBlock);
jumpHandler.close();
}
@@ -6564,10 +6622,13 @@ class SsaBuilder extends NewResolvedVisitor {
// Need to verify.
localsHandler = savedLocals;
open(exitBlock);
- enterBlock.setBlockFlow(new HTryBlockInformation(
- wrapStatementGraph(bodyGraph), null, // No catch-variable.
- null, // No catchGraph.
- wrapStatementGraph(finallyGraph)), exitBlock);
+ enterBlock.setBlockFlow(
+ new HTryBlockInformation(
+ wrapStatementGraph(bodyGraph),
+ null, // No catch-variable.
+ null, // No catchGraph.
+ wrapStatementGraph(finallyGraph)),
+ exitBlock);
inTryStatement = oldInTryStatement;
}
@@ -6673,16 +6734,24 @@ class SsaBuilder extends NewResolvedVisitor {
closeAndGotoExit(new HThrow(exception, isRethrow: true));
} else {
ast.CatchBlock newBlock = link.head;
- handleIf(node, () {
- pushCondition(newBlock);
- }, visitThen, visitElse);
+ handleIf(
+ node,
+ () {
+ pushCondition(newBlock);
+ },
+ visitThen,
+ visitElse);
}
}
ast.CatchBlock firstBlock = link.head;
- handleIf(node, () {
- pushCondition(firstBlock);
- }, visitThen, visitElse);
+ handleIf(
+ node,
+ () {
+ pushCondition(firstBlock);
+ },
+ visitThen,
+ visitElse);
if (!isAborted()) endCatchBlock = close(new HGoto());
rethrowableException = oldRethrowableException;
@@ -6758,8 +6827,8 @@ class SsaBuilder extends NewResolvedVisitor {
// blocks.
localsHandler = savedLocals;
open(exitBlock);
- enterBlock.setBlockFlow(new HTryBlockInformation(
- wrapStatementGraph(bodyGraph), exception,
+ enterBlock.setBlockFlow(
+ new HTryBlockInformation(wrapStatementGraph(bodyGraph), exception,
wrapStatementGraph(catchGraph), wrapStatementGraph(finallyGraph)),
exitBlock);
inTryStatement = oldInTryStatement;
@@ -6782,10 +6851,17 @@ class SsaBuilder extends NewResolvedVisitor {
* [SsaBuilder].
*/
void enterInlinedMethod(FunctionElement function, ast.Node _,
- List<HInstruction> compiledArguments, {InterfaceType instanceType}) {
+ List<HInstruction> compiledArguments,
+ {InterfaceType instanceType}) {
TypesInferrer inferrer = compiler.typesTask.typesInferrer;
- AstInliningState state = new AstInliningState(function, returnLocal,
- returnType, elements, stack, localsHandler, inTryStatement,
+ AstInliningState state = new AstInliningState(
+ function,
+ returnLocal,
+ returnType,
+ elements,
+ stack,
+ localsHandler,
+ inTryStatement,
allInlinedFunctionsCalledOnce && inferrer.isCalledOnce(function));
inliningStack.add(state);
@@ -7052,9 +7128,15 @@ class AstInliningState extends InliningState {
final bool inTryStatement;
final bool allFunctionsCalledOnce;
- AstInliningState(FunctionElement function, this.oldReturnLocal,
- this.oldReturnType, this.oldElements, this.oldStack,
- this.oldLocalsHandler, this.inTryStatement, this.allFunctionsCalledOnce)
+ AstInliningState(
+ FunctionElement function,
+ this.oldReturnLocal,
+ this.oldReturnType,
+ this.oldElements,
+ this.oldStack,
+ this.oldLocalsHandler,
+ this.inTryStatement,
+ this.allFunctionsCalledOnce)
: super(function);
}
@@ -7239,7 +7321,9 @@ class SsaBranchBuilder {
Link<ast.Node> link = send.argumentsNode.nodes;
assert(link.tail.isEmpty);
ast.Node middle = link.head;
- handleLogicalAndOrWithLeftNode(newLeft, () =>
+ handleLogicalAndOrWithLeftNode(
+ newLeft,
+ () =>
handleLogicalAndOrWithLeftNode(middle, visitRight, isAnd: isAnd),
isAnd: isAnd);
} else {
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 8a98c2b..6944307 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -246,8 +246,10 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
SsaLiveIntervalBuilder intervalBuilder = new SsaLiveIntervalBuilder(
compiler, generateAtUseSite, controlFlowOperators);
intervalBuilder.visitGraph(graph);
- SsaVariableAllocator allocator = new SsaVariableAllocator(compiler,
- intervalBuilder.liveInstructions, intervalBuilder.liveIntervals,
+ SsaVariableAllocator allocator = new SsaVariableAllocator(
+ compiler,
+ intervalBuilder.liveInstructions,
+ intervalBuilder.liveIntervals,
generateAtUseSite);
allocator.visitGraph(graph);
variableNames = allocator.names;
@@ -1623,8 +1625,10 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
visitInvokeClosure(HInvokeClosure node) {
Selector call = new Selector.callClosureFrom(node.selector);
use(node.receiver);
- push(js.propertyCall(pop(), backend.namer.invocationName(call),
- visitArguments(node.inputs)), node);
+ push(
+ js.propertyCall(pop(), backend.namer.invocationName(call),
+ visitArguments(node.inputs)),
+ node);
registry.registerDynamicInvocation(call);
}
@@ -1659,10 +1663,10 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
// some small loop, almost as fast as loops with no concurrent
// modification check.
push(js.js('# || (0, #)(#)', [
- arguments[0],
- backend.emitter.staticFunctionAccess(throwFunction),
- arguments[1]
- ]));
+ arguments[0],
+ backend.emitter.staticFunctionAccess(throwFunction),
+ arguments[1]
+ ]));
} else {
registry.registerStaticInvocation(element);
push(backend.emitter.staticFunctionAccess(element));
@@ -1705,19 +1709,22 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
assert(invariant(node, compiler.hasIncrementalSupport));
methodName = backend.namer.instanceMethodName(superMethod);
}
- push(js.js('#.#.call(#)', [
- backend.emitter.prototypeAccess(superClass,
- hasBeenInstantiated: true),
- methodName,
- visitArguments(node.inputs, start: 0)
- ]), node);
+ push(
+ js.js('#.#.call(#)', [
+ backend.emitter.prototypeAccess(superClass,
+ hasBeenInstantiated: true),
+ methodName,
+ visitArguments(node.inputs, start: 0)
+ ]),
+ node);
} else {
use(node.receiver);
- push(js.js('#.#(#)', [
- pop(),
- backend.namer.aliasedSuperMemberPropertyName(superMethod),
- visitArguments(node.inputs, start: 1)
- ]), // Skip receiver argument.
+ push(
+ js.js('#.#(#)', [
+ pop(),
+ backend.namer.aliasedSuperMemberPropertyName(superMethod),
+ visitArguments(node.inputs, start: 1)
+ ]), // Skip receiver argument.
node);
}
}
@@ -2388,7 +2395,8 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
checkType(input, interceptor, type, negative: negative);
String combiner = negative ? '&&' : '||';
String combiner2 = negative ? '||' : '&&';
- push(new js.Binary(combiner,
+ push(new js.Binary(
+ combiner,
new js.Binary(combiner, numberTest, stringTest),
new js.Binary(combiner2, objectTest, pop())));
}
@@ -2678,12 +2686,8 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
js.Expression receiver = pop();
js.Expression helper =
backend.emitter.staticFunctionAccess(helperElement);
- push(js.js(r'#(#.$builtinTypeInfo && #.$builtinTypeInfo[#])', [
- helper,
- receiver,
- receiver,
- js.js.number(index)
- ]));
+ push(js.js(r'#(#.$builtinTypeInfo && #.$builtinTypeInfo[#])',
+ [helper, receiver, receiver, js.js.number(index)]));
} else {
backend.emitter.registerReadTypeVariable(element);
push(js.js(
@@ -2691,10 +2695,10 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
} else {
push(js.js('#(#)', [
- backend.emitter.staticFunctionAccess(
- backend.findHelper('convertRtiToRuntimeType')),
- pop()
- ]));
+ backend.emitter.staticFunctionAccess(
+ backend.findHelper('convertRtiToRuntimeType')),
+ pop()
+ ]));
}
}
diff --git a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
index 7adc2f5..bb3b3ab 100644
--- a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
+++ b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
@@ -380,12 +380,11 @@ class SsaSimplifyInterceptors extends HBaseVisitor
instruction = new HInvokeDynamicGetter(selector, node.element,
<HInstruction>[constant, node.inputs[1]], node.instructionType);
} else if (selector.isSetter) {
- instruction = new HInvokeDynamicSetter(selector, node.element,
- <HInstruction>[
- constant,
- node.inputs[1],
- node.inputs[2]
- ], node.instructionType);
+ instruction = new HInvokeDynamicSetter(
+ selector,
+ node.element,
+ <HInstruction>[constant, node.inputs[1], node.inputs[2]],
+ node.instructionType);
} else {
List<HInstruction> inputs = new List<HInstruction>.from(node.inputs);
inputs[0] = constant;
diff --git a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
index 602ab95..53b5da4 100644
--- a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
+++ b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
@@ -235,7 +235,8 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
String name, Selector selector, Compiler compiler) {
if (selector.name == name) return selector;
JavaScriptBackend backend = compiler.backend;
- Selector newSelector = new Selector(SelectorKind.CALL,
+ Selector newSelector = new Selector(
+ SelectorKind.CALL,
new Name(name, backend.interceptorsLibrary),
new CallStructure(selector.argumentCount));
return selector.mask == null
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index c501c88..66dcb88 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -1588,11 +1588,9 @@ class HFieldGet extends HFieldAccess {
}
class HFieldSet extends HFieldAccess {
- HFieldSet(Element element, HInstruction receiver, HInstruction value) : super(
- element, <HInstruction>[
- receiver,
- value
- ], const TypeMask.nonNullEmpty()) {
+ HFieldSet(Element element, HInstruction receiver, HInstruction value)
+ : super(element, <HInstruction>[receiver, value],
+ const TypeMask.nonNullEmpty()) {
sideEffects.clearAllSideEffects();
sideEffects.clearAllDependencies();
sideEffects.setChangesInstanceProperty();
@@ -1683,11 +1681,9 @@ class HLocalGet extends HLocalAccess {
}
class HLocalSet extends HLocalAccess {
- HLocalSet(Local variable, HLocalValue local, HInstruction value) : super(
- variable, <HInstruction>[
- local,
- value
- ], const TypeMask.nonNullEmpty());
+ HLocalSet(Local variable, HLocalValue local, HInstruction value)
+ : super(variable, <HInstruction>[local, value],
+ const TypeMask.nonNullEmpty());
accept(HVisitor visitor) => visitor.visitLocalSet(this);
@@ -1714,7 +1710,8 @@ class HForeignCode extends HForeign {
native.NativeThrowBehavior throwBehavior;
HForeignCode(this.codeTemplate, TypeMask type, List<HInstruction> inputs,
- {this.isStatement: false, SideEffects effects,
+ {this.isStatement: false,
+ SideEffects effects,
native.NativeBehavior nativeBehavior,
native.NativeThrowBehavior throwBehavior})
: this.nativeBehavior = nativeBehavior,
@@ -2451,11 +2448,8 @@ class HIndexAssign extends HInstruction {
final Selector selector;
HIndexAssign(HInstruction receiver, HInstruction index, HInstruction value,
this.selector)
- : super(<HInstruction>[
- receiver,
- index,
- value
- ], const TypeMask.nonNullEmpty()) {
+ : super(<HInstruction>[receiver, index, value],
+ const TypeMask.nonNullEmpty()) {
sideEffects.clearAllSideEffects();
sideEffects.clearAllDependencies();
sideEffects.setChangesIndex();
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 805a19d..e1d6c83 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -368,10 +368,12 @@ class SsaInstructionSimplifier extends HBaseVisitor
new TypedSelector(receiverType, node.selector, compiler.world);
Element element = compiler.world.locateSingleElement(selector);
// TODO(ngeoffray): Also fold if it's a getter or variable.
- if (element != null && element.isFunction
+ if (element != null &&
+ element.isFunction
// If we found out that the only target is a [:noSuchMethod:],
// we just ignore it.
- && element.name == selector.name) {
+ &&
+ element.name == selector.name) {
FunctionElement method = element;
if (method.isNative) {
@@ -898,9 +900,10 @@ class SsaInstructionSimplifier extends HBaseVisitor
if (node.usedBy.length > 1) return node;
}
- HInstruction folded = graph.addConstant(constantSystem.createString(
- new ast.DartString.concat(
- leftString.primitiveValue, rightString.primitiveValue)), compiler);
+ HInstruction folded = graph.addConstant(
+ constantSystem.createString(new ast.DartString.concat(
+ leftString.primitiveValue, rightString.primitiveValue)),
+ compiler);
if (prefix == null) return folded;
return new HStringConcat(prefix, folded, node.node, backend.stringType);
}
@@ -1355,7 +1358,8 @@ class SsaDeadPhiEliminator implements OptimizationPhase {
next = current.next;
if (!livePhis.contains(current)
// TODO(ahe): Not sure the following is correct.
- && current.usedBy.isEmpty) {
+ &&
+ current.usedBy.isEmpty) {
block.removePhi(current);
}
current = next;
@@ -1430,8 +1434,9 @@ class SsaGlobalValueNumberer implements OptimizationPhase {
void visitGraph(HGraph graph) {
computeChangesFlags(graph);
moveLoopInvariantCode(graph);
- List<GvnWorkItem> workQueue =
- <GvnWorkItem>[new GvnWorkItem(graph.entry, new ValueSet())];
+ List<GvnWorkItem> workQueue = <GvnWorkItem>[
+ new GvnWorkItem(graph.entry, new ValueSet())
+ ];
do {
GvnWorkItem item = workQueue.removeLast();
visitBasicBlock(item.block, item.valueSet, workQueue);
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index ba5101f..b02a1f5 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -241,7 +241,9 @@ class SsaTypePropagator extends HBaseVisitor implements OptimizationPhase {
HInstruction receiver = instruction.inputs[1];
if (receiver.isNumber(compiler)) return false;
if (receiver.isNumberOrNull(compiler)) {
- convertInput(instruction, receiver,
+ convertInput(
+ instruction,
+ receiver,
receiver.instructionType.nonNullable(),
HTypeConversion.RECEIVER_TYPE_CHECK);
return true;
@@ -320,17 +322,19 @@ class SsaTypePropagator extends HBaseVisitor implements OptimizationPhase {
// We cannot do the following optimization now, because we have
// to wait for the type propagation to be stable. The receiver
// of [instruction] might move from number to dynamic.
- pendingOptimizations.putIfAbsent(instruction, () => () {
- Selector selector = instruction.selector;
- if (selector.isOperator && selector.name != '==') {
- if (checkReceiver(instruction)) {
- addAllUsersBut(instruction, instruction.inputs[1]);
- }
- if (!selector.isUnaryOperator && checkArgument(instruction)) {
- addAllUsersBut(instruction, instruction.inputs[2]);
- }
- }
- });
+ pendingOptimizations.putIfAbsent(
+ instruction,
+ () => () {
+ Selector selector = instruction.selector;
+ if (selector.isOperator && selector.name != '==') {
+ if (checkReceiver(instruction)) {
+ addAllUsersBut(instruction, instruction.inputs[1]);
+ }
+ if (!selector.isUnaryOperator && checkArgument(instruction)) {
+ addAllUsersBut(instruction, instruction.inputs[2]);
+ }
+ }
+ });
}
HInstruction receiver = instruction.getDartReceiver(compiler);
diff --git a/pkg/compiler/lib/src/ssa/value_range_analyzer.dart b/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
index 8955e10..bbb96b2 100644
--- a/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
+++ b/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
@@ -471,9 +471,9 @@ class Range {
* Checks if the given values are unknown, and creates a
* range that does not have any unknown values.
*/
- Range.normalize(Value low, Value up, info) : this(low == const UnknownValue()
- ? const MinIntValue()
- : low, up == const UnknownValue() ? const MaxIntValue() : up, info);
+ Range.normalize(Value low, Value up, info)
+ : this(low == const UnknownValue() ? const MinIntValue() : low,
+ up == const UnknownValue() ? const MaxIntValue() : up, info);
Range union(Range other) {
return info.newNormalizedRange(
@@ -827,8 +827,9 @@ class SsaValueRangeAnalyzer extends HBaseVisitor implements OptimizationPhase {
Range handleBinaryOperation(HBinaryArithmetic instruction) {
if (!instruction.isInteger(compiler)) return info.newUnboundRange();
- return instruction.operation(constantSystem).apply(
- ranges[instruction.left], ranges[instruction.right]);
+ return instruction
+ .operation(constantSystem)
+ .apply(ranges[instruction.left], ranges[instruction.right]);
}
Range visitAdd(HAdd add) {
diff --git a/pkg/compiler/lib/src/tree/nodes.dart b/pkg/compiler/lib/src/tree/nodes.dart
index acbfb40..cf369b7 100644
--- a/pkg/compiler/lib/src/tree/nodes.dart
+++ b/pkg/compiler/lib/src/tree/nodes.dart
@@ -239,8 +239,15 @@ class ClassNode extends Node {
final Token extendsKeyword;
final Token endToken;
- ClassNode(this.modifiers, this.name, this.typeParameters, this.superclass,
- this.interfaces, this.beginToken, this.extendsKeyword, this.body,
+ ClassNode(
+ this.modifiers,
+ this.name,
+ this.typeParameters,
+ this.superclass,
+ this.interfaces,
+ this.beginToken,
+ this.extendsKeyword,
+ this.body,
this.endToken);
ClassNode asClassNode() => this;
@@ -361,7 +368,10 @@ class Send extends Expression with StoredTreeElementMixin {
Link<Node> get arguments => argumentsNode.nodes;
- Send([this.receiver, this.selector, this.argumentsNode,
+ Send(
+ [this.receiver,
+ this.selector,
+ this.argumentsNode,
this.isConditional = false]);
Send.postfix(this.receiver, this.selector,
[Node argument = null, this.isConditional = false])
@@ -1948,7 +1958,8 @@ class Import extends LibraryDependency {
final bool isDeferred;
Import(this.importKeyword, StringNode uri, this.prefix, NodeList combinators,
- Link<MetadataAnnotation> metadata, {this.isDeferred})
+ Link<MetadataAnnotation> metadata,
+ {this.isDeferred})
: super(uri, combinators, metadata);
bool get isImport => true;
diff --git a/pkg/compiler/lib/src/tree/prettyprint.dart b/pkg/compiler/lib/src/tree/prettyprint.dart
index eed27f4..db1ef01 100644
--- a/pkg/compiler/lib/src/tree/prettyprint.dart
+++ b/pkg/compiler/lib/src/tree/prettyprint.dart
@@ -121,10 +121,8 @@ class PrettyPrinter extends Indentation implements Visitor {
}
visitAsyncModifier(AsyncModifier node) {
- openAndCloseNode(node, "AsyncModifier", {
- 'asyncToken': node.asyncToken,
- 'starToken': node.starToken
- });
+ openAndCloseNode(node, "AsyncModifier",
+ {'asyncToken': node.asyncToken, 'starToken': node.starToken});
}
visitBlock(Block node) {
@@ -152,9 +150,8 @@ class PrettyPrinter extends Indentation implements Visitor {
}
visitClassNode(ClassNode node) {
- openNode(node, "ClassNode", {
- "extendsKeyword": tokenToStringOrNull(node.extendsKeyword)
- });
+ openNode(node, "ClassNode",
+ {"extendsKeyword": tokenToStringOrNull(node.extendsKeyword)});
visitChildNode(node.name, "name");
visitChildNode(node.superclass, "superclass");
visitChildNode(node.interfaces, "interfaces");
@@ -205,9 +202,8 @@ class PrettyPrinter extends Indentation implements Visitor {
}
visitFunctionExpression(FunctionExpression node) {
- openNode(node, "FunctionExpression", {
- "getOrSet": tokenToStringOrNull(node.getOrSet)
- });
+ openNode(node, "FunctionExpression",
+ {"getOrSet": tokenToStringOrNull(node.getOrSet)});
visitChildNode(node.modifiers, "modifiers");
visitChildNode(node.returnType, "returnType");
visitChildNode(node.name, "name");
@@ -254,9 +250,8 @@ class PrettyPrinter extends Indentation implements Visitor {
tokenToStringOrNull(Token token) => token == null ? null : token.stringValue;
visitLiteralList(LiteralList node) {
- openNode(node, "LiteralList", {
- "constKeyword": tokenToStringOrNull(node.constKeyword)
- });
+ openNode(node, "LiteralList",
+ {"constKeyword": tokenToStringOrNull(node.constKeyword)});
visitChildNode(node.typeArguments, "typeArguments");
visitChildNode(node.elements, "elements");
closeNode();
@@ -447,10 +442,8 @@ class PrettyPrinter extends Indentation implements Visitor {
}
visitCombinator(Combinator node) {
- openNode(node, "Combinator", {
- "isShow": "${node.isShow}",
- "isHide": "${node.isHide}"
- });
+ openNode(node, "Combinator",
+ {"isShow": "${node.isShow}", "isHide": "${node.isHide}"});
closeNode();
}
diff --git a/pkg/compiler/lib/src/tree/unparser.dart b/pkg/compiler/lib/src/tree/unparser.dart
index 55e4bc4..4007fbd 100644
--- a/pkg/compiler/lib/src/tree/unparser.dart
+++ b/pkg/compiler/lib/src/tree/unparser.dart
@@ -699,8 +699,10 @@ class Unparser extends Indentation implements Visitor {
indentLess();
}
- unparseImportTag(String uri, {String prefix,
- List<String> shows: const <String>[], bool isDeferred: false}) {
+ unparseImportTag(String uri,
+ {String prefix,
+ List<String> shows: const <String>[],
+ bool isDeferred: false}) {
String deferredString = isDeferred ? ' deferred' : '';
String prefixString = prefix == null ? '' : ' as $prefix';
String showString = shows.isEmpty ? '' : ' show ${shows.join(", ")}';
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
index ac724be..db1e8b6 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
@@ -588,11 +588,12 @@ class Builder implements cps_ir.Visitor<Node> {
}
Expression visitLiteralMap(cps_ir.LiteralMap node) {
- return new LiteralMap(node.type, new List<LiteralMapEntry>.generate(
- node.entries.length, (int index) {
- return new LiteralMapEntry(getVariableUse(node.entries[index].key),
- getVariableUse(node.entries[index].value));
- }));
+ return new LiteralMap(
+ node.type,
+ new List<LiteralMapEntry>.generate(node.entries.length, (int index) {
+ return new LiteralMapEntry(getVariableUse(node.entries[index].key),
+ getVariableUse(node.entries[index].value));
+ }));
}
FunctionDefinition makeSubFunction(cps_ir.FunctionDefinition function) {
diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart
index 5d736b5..e0feb76 100644
--- a/pkg/compiler/lib/src/typechecker.dart
+++ b/pkg/compiler/lib/src/typechecker.dart
@@ -430,44 +430,39 @@ class TypeCheckerVisitor extends Visitor<DartType> {
typePromotion.addHint(typePromotion.node, MessageKind.POTENTIAL_MUTATION,
{'variableName': variableName, 'shownType': typePromotion.type});
for (Node mutation in potentialMutationsIn) {
- typePromotion.addInfo(mutation, MessageKind.POTENTIAL_MUTATION_HERE, {
- 'variableName': variableName
- });
+ typePromotion.addInfo(mutation, MessageKind.POTENTIAL_MUTATION_HERE,
+ {'variableName': variableName});
}
}
List<Node> potentialMutationsInClosures =
elements.getPotentialMutationsInClosure(variable);
if (!potentialMutationsInClosures.isEmpty) {
- typePromotion.addHint(typePromotion.node,
- MessageKind.POTENTIAL_MUTATION_IN_CLOSURE, {
- 'variableName': variableName,
- 'shownType': typePromotion.type
- });
+ typePromotion.addHint(
+ typePromotion.node,
+ MessageKind.POTENTIAL_MUTATION_IN_CLOSURE,
+ {'variableName': variableName, 'shownType': typePromotion.type});
for (Node mutation in potentialMutationsInClosures) {
- typePromotion.addInfo(mutation,
- MessageKind.POTENTIAL_MUTATION_IN_CLOSURE_HERE, {
- 'variableName': variableName
- });
+ typePromotion.addInfo(
+ mutation,
+ MessageKind.POTENTIAL_MUTATION_IN_CLOSURE_HERE,
+ {'variableName': variableName});
}
}
if (checkAccesses) {
List<Node> accesses = elements.getAccessesByClosureIn(node, variable);
List<Node> mutations = elements.getPotentialMutations(variable);
if (!accesses.isEmpty && !mutations.isEmpty) {
- typePromotion.addHint(typePromotion.node,
- MessageKind.ACCESSED_IN_CLOSURE, {
- 'variableName': variableName,
- 'shownType': typePromotion.type
- });
+ typePromotion.addHint(
+ typePromotion.node,
+ MessageKind.ACCESSED_IN_CLOSURE,
+ {'variableName': variableName, 'shownType': typePromotion.type});
for (Node access in accesses) {
- typePromotion.addInfo(access, MessageKind.ACCESSED_IN_CLOSURE_HERE, {
- 'variableName': variableName
- });
+ typePromotion.addInfo(access, MessageKind.ACCESSED_IN_CLOSURE_HERE,
+ {'variableName': variableName});
}
for (Node mutation in mutations) {
- typePromotion.addInfo(mutation, MessageKind.POTENTIAL_MUTATION_HERE, {
- 'variableName': variableName
- });
+ typePromotion.addInfo(mutation, MessageKind.POTENTIAL_MUTATION_HERE,
+ {'variableName': variableName});
}
}
}
@@ -518,15 +513,11 @@ class TypeCheckerVisitor extends Visitor<DartType> {
{bool isConst: false}) {
if (!types.isAssignable(from, to)) {
if (compiler.enableTypeAssertions && isConst) {
- compiler.reportError(spannable, MessageKind.NOT_ASSIGNABLE, {
- 'fromType': from,
- 'toType': to
- });
+ compiler.reportError(spannable, MessageKind.NOT_ASSIGNABLE,
+ {'fromType': from, 'toType': to});
} else {
- reportTypeWarning(spannable, MessageKind.NOT_ASSIGNABLE, {
- 'fromType': from,
- 'toType': to
- });
+ reportTypeWarning(spannable, MessageKind.NOT_ASSIGNABLE,
+ {'fromType': from, 'toType': to});
}
return false;
}
@@ -800,25 +791,19 @@ class TypeCheckerVisitor extends Visitor<DartType> {
if (!foundPrivateMember) {
switch (memberKind) {
case MemberKind.METHOD:
- reportTypeWarning(node, MessageKind.METHOD_NOT_FOUND, {
- 'className': receiverType.name,
- 'memberName': name
- });
+ reportTypeWarning(node, MessageKind.METHOD_NOT_FOUND,
+ {'className': receiverType.name, 'memberName': name});
break;
case MemberKind.OPERATOR:
- reportTypeWarning(node, MessageKind.OPERATOR_NOT_FOUND, {
- 'className': receiverType.name,
- 'memberName': name
- });
+ reportTypeWarning(node, MessageKind.OPERATOR_NOT_FOUND,
+ {'className': receiverType.name, 'memberName': name});
break;
case MemberKind.GETTER:
if (lookupMemberSignature(memberName.setter, interface) != null) {
// A setter is present so warn explicitly about the missing
// getter.
- reportTypeWarning(node, MessageKind.GETTER_NOT_FOUND, {
- 'className': receiverType.name,
- 'memberName': name
- });
+ reportTypeWarning(node, MessageKind.GETTER_NOT_FOUND,
+ {'className': receiverType.name, 'memberName': name});
} else if (name == 'await') {
Map arguments = {'className': receiverType.name};
String functionName = executableContext.name;
@@ -831,17 +816,13 @@ class TypeCheckerVisitor extends Visitor<DartType> {
}
reportTypeWarning(node, kind, arguments);
} else {
- reportTypeWarning(node, MessageKind.MEMBER_NOT_FOUND, {
- 'className': receiverType.name,
- 'memberName': name
- });
+ reportTypeWarning(node, MessageKind.MEMBER_NOT_FOUND,
+ {'className': receiverType.name, 'memberName': name});
}
break;
case MemberKind.SETTER:
- reportTypeWarning(node, MessageKind.SETTER_NOT_FOUND, {
- 'className': receiverType.name,
- 'memberName': name
- });
+ reportTypeWarning(node, MessageKind.SETTER_NOT_FOUND,
+ {'className': receiverType.name, 'memberName': name});
break;
}
}
@@ -877,9 +858,8 @@ class TypeCheckerVisitor extends Visitor<DartType> {
error = true;
// TODO(johnniwinther): Provide better information on the called
// function.
- reportTypeWarning(argument, MessageKind.NAMED_ARGUMENT_NOT_FOUND, {
- 'argumentName': argumentName
- });
+ reportTypeWarning(argument, MessageKind.NAMED_ARGUMENT_NOT_FOUND,
+ {'argumentName': argumentName});
DartType argumentType = analyze(argument);
if (argumentTypes != null) argumentTypes.addLast(argumentType);
@@ -923,9 +903,8 @@ class TypeCheckerVisitor extends Visitor<DartType> {
error = true;
// TODO(johnniwinther): Provide better information on the called
// function.
- reportTypeWarning(send, MessageKind.MISSING_ARGUMENT, {
- 'argumentType': parameterTypes.current
- });
+ reportTypeWarning(send, MessageKind.MISSING_ARGUMENT,
+ {'argumentType': parameterTypes.current});
}
if (error) {
// TODO(johnniwinther): Improve access to declaring element and handle
@@ -934,9 +913,8 @@ class TypeCheckerVisitor extends Visitor<DartType> {
if (element == null) {
element = type.element;
} else if (type.isTypedef) {
- reportTypeInfo(element, MessageKind.THIS_IS_THE_DECLARATION, {
- 'name': element.name
- });
+ reportTypeInfo(element, MessageKind.THIS_IS_THE_DECLARATION,
+ {'name': element.name});
element = type.element;
}
if (element != null) {
@@ -1175,8 +1153,8 @@ class TypeCheckerVisitor extends Visitor<DartType> {
if (!types.isMoreSpecific(shownType, knownType)) {
String variableName = variable.name;
if (!types.isSubtype(shownType, knownType)) {
- typePromotion.addHint(node,
- MessageKind.NOT_MORE_SPECIFIC_SUBTYPE, {
+ typePromotion.addHint(
+ node, MessageKind.NOT_MORE_SPECIFIC_SUBTYPE, {
'variableName': variableName,
'shownType': shownType,
'knownType': knownType
@@ -1185,8 +1163,8 @@ class TypeCheckerVisitor extends Visitor<DartType> {
DartType shownTypeSuggestion =
computeMoreSpecificType(shownType, knownType);
if (shownTypeSuggestion != null) {
- typePromotion.addHint(node,
- MessageKind.NOT_MORE_SPECIFIC_SUGGESTION, {
+ typePromotion.addHint(
+ node, MessageKind.NOT_MORE_SPECIFIC_SUGGESTION, {
'variableName': variableName,
'shownType': shownType,
'shownTypeSuggestion': shownTypeSuggestion,
@@ -1213,9 +1191,12 @@ class TypeCheckerVisitor extends Visitor<DartType> {
} else if (node.isOperator) {
final Node receiver = node.receiver;
final DartType receiverType = analyze(receiver);
- if (identical(name, '==') || identical(name, '!=')
+ if (identical(name, '==') ||
+ identical(name, '!=')
// TODO(johnniwinther): Remove these.
- || identical(name, '===') || identical(name, '!==')) {
+ ||
+ identical(name, '===') ||
+ identical(name, '!==')) {
// Analyze argument.
analyze(node.arguments.head);
return boolType;
@@ -1250,24 +1231,27 @@ class TypeCheckerVisitor extends Visitor<DartType> {
if (identical(name, '-') && node.arguments.isEmpty) {
operatorName = 'unary-';
}
- assert(invariant(node, identical(name, '+') ||
- identical(name, '=') ||
- identical(name, '-') ||
- identical(name, '*') ||
- identical(name, '/') ||
- identical(name, '%') ||
- identical(name, '~/') ||
- identical(name, '|') ||
- identical(name, '&') ||
- identical(name, '^') ||
- identical(name, '~') ||
- identical(name, '<<') ||
- identical(name, '>>') ||
- identical(name, '<') ||
- identical(name, '>') ||
- identical(name, '<=') ||
- identical(name, '>=') ||
- identical(name, '[]'), message: 'Unexpected operator $name'));
+ assert(invariant(
+ node,
+ identical(name, '+') ||
+ identical(name, '=') ||
+ identical(name, '-') ||
+ identical(name, '*') ||
+ identical(name, '/') ||
+ identical(name, '%') ||
+ identical(name, '~/') ||
+ identical(name, '|') ||
+ identical(name, '&') ||
+ identical(name, '^') ||
+ identical(name, '~') ||
+ identical(name, '<<') ||
+ identical(name, '>>') ||
+ identical(name, '<') ||
+ identical(name, '>') ||
+ identical(name, '<=') ||
+ identical(name, '>=') ||
+ identical(name, '[]'),
+ message: 'Unexpected operator $name'));
// TODO(karlklose): handle `void` in expression context by calling
// [analyzeNonVoid] instead of [analyze].
diff --git a/pkg/compiler/lib/src/types/container_type_mask.dart b/pkg/compiler/lib/src/types/container_type_mask.dart
index c82b1f7..d4a7742 100644
--- a/pkg/compiler/lib/src/types/container_type_mask.dart
+++ b/pkg/compiler/lib/src/types/container_type_mask.dart
@@ -70,11 +70,14 @@ class ContainerTypeMask extends ForwardingTypeMask {
elementType.union(other.elementType, classWorld);
int newLength = (length == other.length) ? length : null;
TypeMask newForwardTo = forwardTo.union(other.forwardTo, classWorld);
- return new ContainerTypeMask(newForwardTo,
+ return new ContainerTypeMask(
+ newForwardTo,
allocationNode == other.allocationNode ? allocationNode : null,
allocationElement == other.allocationElement
? allocationElement
- : null, newElementType, newLength);
+ : null,
+ newElementType,
+ newLength);
} else {
return forwardTo.union(other, classWorld);
}
diff --git a/pkg/compiler/lib/src/types/flat_type_mask.dart b/pkg/compiler/lib/src/types/flat_type_mask.dart
index 64ed3f6..214e31a 100644
--- a/pkg/compiler/lib/src/types/flat_type_mask.dart
+++ b/pkg/compiler/lib/src/types/flat_type_mask.dart
@@ -527,10 +527,10 @@ class FlatTypeMask implements TypeMask {
// If the class is used as a mixin, we have to check if the element
// can be hit from any of the mixin applications.
Iterable<ClassElement> mixinUses = classWorld.mixinUsesOf(self);
- return mixinUses.any((mixinApplication) => hasElementIn(
- mixinApplication, selector, element) ||
- other.isSubclassOf(mixinApplication) ||
- classWorld.hasAnySubclassThatMixes(mixinApplication, other));
+ return mixinUses.any((mixinApplication) =>
+ hasElementIn(mixinApplication, selector, element) ||
+ other.isSubclassOf(mixinApplication) ||
+ classWorld.hasAnySubclassThatMixes(mixinApplication, other));
}
}
diff --git a/pkg/compiler/lib/src/types/map_type_mask.dart b/pkg/compiler/lib/src/types/map_type_mask.dart
index 2638835..ccc5029 100644
--- a/pkg/compiler/lib/src/types/map_type_mask.dart
+++ b/pkg/compiler/lib/src/types/map_type_mask.dart
@@ -82,11 +82,14 @@ class MapTypeMask extends ForwardingTypeMask {
TypeMask newValueType =
other.typeMap.values.fold(keyType, (p, n) => p.union(n, classWorld));
TypeMask newForwardTo = forwardTo.union(other.forwardTo, classWorld);
- MapTypeMask newMapTypeMask = new MapTypeMask(newForwardTo,
+ MapTypeMask newMapTypeMask = new MapTypeMask(
+ newForwardTo,
allocationNode == other.allocationNode ? allocationNode : null,
allocationElement == other.allocationElement
? allocationElement
- : null, newKeyType, newValueType);
+ : null,
+ newKeyType,
+ newValueType);
return newMapTypeMask;
} else {
return forwardTo.union(other, classWorld);
diff --git a/pkg/compiler/lib/src/universe/function_set.dart b/pkg/compiler/lib/src/universe/function_set.dart
index ba286bc..161dcdf 100644
--- a/pkg/compiler/lib/src/universe/function_set.dart
+++ b/pkg/compiler/lib/src/universe/function_set.dart
@@ -172,7 +172,8 @@ class FunctionSetNode {
mask.needsNoSuchMethodHandling(selector, classWorld)) {
FunctionSetQuery noSuchMethodQuery = noSuchMethods.query(
new TypedSelector(mask, compiler.noSuchMethodSelector, classWorld),
- compiler, null);
+ compiler,
+ null);
if (!noSuchMethodQuery.functions.isEmpty) {
if (functions == null) {
functions = new Setlet<Element>.from(noSuchMethodQuery.functions);
@@ -208,16 +209,18 @@ class FullFunctionSetQuery extends FunctionSetQuery {
TypeMask computeMask(ClassWorld classWorld) {
assert(classWorld.hasAnySubclass(classWorld.objectClass));
if (_mask != null) return _mask;
- return _mask = new TypeMask.unionOf(functions.expand((element) {
- ClassElement cls = element.enclosingClass;
- return [cls]..addAll(classWorld.mixinUsesOf(cls));
- }).map((cls) {
- if (classWorld.backend.isNullImplementation(cls)) {
- return const TypeMask.empty();
- } else {
- return new TypeMask.nonNullSubclass(cls.declaration, classWorld);
- }
- }), classWorld);
+ return _mask = new TypeMask.unionOf(
+ functions.expand((element) {
+ ClassElement cls = element.enclosingClass;
+ return [cls]..addAll(classWorld.mixinUsesOf(cls));
+ }).map((cls) {
+ if (classWorld.backend.isNullImplementation(cls)) {
+ return const TypeMask.empty();
+ } else {
+ return new TypeMask.nonNullSubclass(cls.declaration, classWorld);
+ }
+ }),
+ classWorld);
}
FullFunctionSetQuery(functions) : super(functions);
diff --git a/pkg/compiler/lib/src/universe/universe.dart b/pkg/compiler/lib/src/universe/universe.dart
index 74655fb..f0bac52 100644
--- a/pkg/compiler/lib/src/universe/universe.dart
+++ b/pkg/compiler/lib/src/universe/universe.dart
@@ -143,11 +143,13 @@ class Universe {
// classes; a native abstract class may have non-abstract subclasses
// not declared to the program. Instances of these classes are
// indistinguishable from the abstract class.
- || cls.isNative
+ ||
+ cls.isNative
// Likewise, if this registration comes from the mirror system,
// all bets are off.
// TODO(herhut): Track classes required by mirrors seperately.
- || byMirrors) {
+ ||
+ byMirrors) {
_directlyInstantiatedClasses.add(cls);
}
@@ -206,7 +208,9 @@ class Universe {
if (element is ClassElement) {
assert(invariant(element, element.thisType.isRaw,
message: 'Generic classes not supported (${element.thisType}).'));
- _instantiatedTypes..remove(element.rawType)..remove(element.thisType);
+ _instantiatedTypes
+ ..remove(element.rawType)
+ ..remove(element.thisType);
}
}
@@ -214,10 +218,10 @@ class Universe {
// by using a map.
List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) {
// Return new list to guard against concurrent modifications.
- return new List<LocalFunctionElement>.from(allClosures
- .where((LocalFunctionElement closure) {
- return closure.executableContext == element;
- }));
+ return new List<LocalFunctionElement>.from(
+ allClosures.where((LocalFunctionElement closure) {
+ return closure.executableContext == element;
+ }));
}
}
@@ -345,7 +349,8 @@ class CallStructure {
*
* Invariant: [element] must be the implementation element.
*/
- /*<T>*/ List /*<T>*/ makeArgumentsList(Link<Node> arguments,
+ /*<T>*/ List /*<T>*/ makeArgumentsList(
+ Link<Node> arguments,
FunctionElement element,
/*T*/ compileArgument(Node argument),
/*T*/ compileDefaultValue(ParameterElement element)) {
@@ -403,7 +408,9 @@ class CallStructure {
* signature of the [callee], [:false:] otherwise.
*/
static /*<T>*/ bool addForwardingElementArgumentsToList(
- ConstructorElement caller, List /*<T>*/ list, ConstructorElement callee,
+ ConstructorElement caller,
+ List /*<T>*/ list,
+ ConstructorElement callee,
/*T*/ compileArgument(ParameterElement element),
/*T*/ compileConstant(ParameterElement element)) {
FunctionSignature signature = caller.functionSignature;
@@ -607,7 +614,8 @@ class Selector {
SelectorKind.GETTER, selector.memberName.getter, CallStructure.NO_ARGS);
factory Selector.setter(String name, LibraryElement library) => new Selector(
- SelectorKind.SETTER, new Name(name, library, isSetter: true),
+ SelectorKind.SETTER,
+ new Name(name, library, isSetter: true),
CallStructure.ONE_ARG);
factory Selector.unaryOperator(String name) => new Selector(
@@ -639,7 +647,8 @@ class Selector {
factory Selector.callConstructor(String name, LibraryElement library,
[int arity = 0, List<String> namedArguments]) => new Selector(
- SelectorKind.CALL, new Name(name, library),
+ SelectorKind.CALL,
+ new Name(name, library),
new CallStructure(arity, namedArguments));
factory Selector.callDefaultConstructor() => new Selector(
diff --git a/pkg/compiler/lib/src/use_unused_api.dart b/pkg/compiler/lib/src/use_unused_api.dart
index f32d3a2..f56a038 100644
--- a/pkg/compiler/lib/src/use_unused_api.dart
+++ b/pkg/compiler/lib/src/use_unused_api.dart
@@ -82,10 +82,12 @@ useApi() {
api.ReadStringFromUri uri;
}
-void useConstant(constants.ConstantValue constant,
+void useConstant(
+ constants.ConstantValue constant,
constants.ConstantExpression expression,
constants.ConstructedConstantExpression constructedConstant,
- constants.ConstantSystem cs, constants.Environment env) {
+ constants.ConstantSystem cs,
+ constants.Environment env) {
constant.isObject;
cs.isBool(constant);
constructedConstant.computeInstanceType();
diff --git a/pkg/compiler/lib/src/util/util.dart b/pkg/compiler/lib/src/util/util.dart
index 6a2f3f8..c2673de 100644
--- a/pkg/compiler/lib/src/util/util.dart
+++ b/pkg/compiler/lib/src/util/util.dart
@@ -201,9 +201,14 @@ int computeHashCode(part1, [part2, part3, part4, part5]) {
0x3fffffff;
}
-String modifiersToString({bool isStatic: false, bool isAbstract: false,
- bool isFinal: false, bool isVar: false, bool isConst: false,
- bool isFactory: false, bool isExternal: false}) {
+String modifiersToString(
+ {bool isStatic: false,
+ bool isAbstract: false,
+ bool isFinal: false,
+ bool isVar: false,
+ bool isConst: false,
+ bool isFactory: false,
+ bool isExternal: false}) {
LinkBuilder<String> builder = new LinkBuilder<String>();
if (isStatic) builder.addLast('static');
if (isAbstract) builder.addLast('abstract');
diff --git a/pkg/compiler/lib/src/warnings.dart b/pkg/compiler/lib/src/warnings.dart
index c1c0886..60a85c4 100644
--- a/pkg/compiler/lib/src/warnings.dart
+++ b/pkg/compiler/lib/src/warnings.dart
@@ -119,29 +119,31 @@ class MessageKind {
static const MessageKind MEMBER_NOT_FOUND = const MessageKind(
"No member named '#{memberName}' in class '#{className}'.");
- static const MessageKind AWAIT_MEMBER_NOT_FOUND = const MessageKind(
- "No member named 'await' in class '#{className}'.",
- howToFix: "Did you mean to add the 'async' marker "
- "to '#{functionName}'?", examples: const [
- """
+ static const MessageKind AWAIT_MEMBER_NOT_FOUND =
+ const MessageKind("No member named 'await' in class '#{className}'.",
+ howToFix: "Did you mean to add the 'async' marker "
+ "to '#{functionName}'?",
+ examples: const [
+ """
class A {
m() => await -3;
}
main() => new A().m();
"""
- ]);
+ ]);
static const MessageKind AWAIT_MEMBER_NOT_FOUND_IN_CLOSURE =
const MessageKind("No member named 'await' in class '#{className}'.",
howToFix: "Did you mean to add the 'async' marker "
- "to the enclosing function?", examples: const [
- """
+ "to the enclosing function?",
+ examples: const [
+ """
class A {
m() => () => await -3;
}
main() => new A().m();
"""
- ]);
+ ]);
static const MessageKind METHOD_NOT_FOUND = const MessageKind(
"No method named '#{memberName}' in class '#{className}'.");
@@ -170,9 +172,9 @@ main() => new A().m();
static const MessageKind NO_SUPER_AVAILABLE =
const MessageKind("'super' is only available in instance methods.");
- static const MessageKind PRIVATE_ACCESS = const MessageKind(
- "'#{name}' is declared private within library "
- "'#{libraryName}'.");
+ static const MessageKind PRIVATE_ACCESS =
+ const MessageKind("'#{name}' is declared private within library "
+ "'#{libraryName}'.");
static const MessageKind THIS_IS_THE_DECLARATION =
const MessageKind("This is the declaration of '#{name}'.");
@@ -188,28 +190,29 @@ main() => new A().m();
howToFix: "Did you mean to add the 'async' marker "
"to '#{functionName}'?",
examples: const [
- "main() => await -3;",
- "foo() => await -3; main() => foo();"
- ]);
+ "main() => await -3;",
+ "foo() => await -3; main() => foo();"
+ ]);
- static const MessageKind CANNOT_RESOLVE_AWAIT_IN_CLOSURE = const MessageKind(
- "Cannot resolve '#{name}'.",
- howToFix: "Did you mean to add the 'async' marker "
- "to the enclosing function?",
- examples: const ["main() { (() => await -3)(); }",]);
+ static const MessageKind CANNOT_RESOLVE_AWAIT_IN_CLOSURE =
+ const MessageKind("Cannot resolve '#{name}'.",
+ howToFix: "Did you mean to add the 'async' marker "
+ "to the enclosing function?",
+ examples: const ["main() { (() => await -3)(); }",]);
static const MessageKind CANNOT_RESOLVE_IN_INITIALIZER = const MessageKind(
"Cannot resolve '#{name}'. It would be implicitly looked up on this "
"instance, but instances are not available in initializers.",
howToFix: "Try correcting the unresolved reference or move the "
- "initialization to a constructor body.", examples: const [
- """
+ "initialization to a constructor body.",
+ examples: const [
+ """
class A {
var test = unresolvedName;
}
main() => new A();
"""
- ]);
+ ]);
static const MessageKind CANNOT_RESOLVE_CONSTRUCTOR =
const MessageKind("Cannot resolve constructor '#{constructorName}'.");
@@ -219,7 +222,7 @@ main() => new A();
" for implicit super call.",
howToFix: "Try explicitly invoking a constructor of the super class",
examples: const [
- """
+ """
class A {
A.foo() {}
}
@@ -228,7 +231,7 @@ class B extends A {
}
main() => new B();
"""
- ]);
+ ]);
static const MessageKind INVALID_UNNAMED_CONSTRUCTOR_NAME =
const MessageKind("Unnamed constructor name must be '#{name}'.");
@@ -239,10 +242,11 @@ main() => new B();
static const MessageKind CANNOT_RESOLVE_TYPE =
const MessageKind("Cannot resolve type '#{typeName}'.");
- static const MessageKind DUPLICATE_DEFINITION = const MessageKind(
- "Duplicate definition of '#{name}'.",
- howToFix: "Try to rename or remove this definition.", examples: const [
- """
+ static const MessageKind DUPLICATE_DEFINITION =
+ const MessageKind("Duplicate definition of '#{name}'.",
+ howToFix: "Try to rename or remove this definition.",
+ examples: const [
+ """
class C {
void f() {}
int get f => 1;
@@ -253,7 +257,7 @@ main() {
}
"""
- ]);
+ ]);
static const MessageKind EXISTING_DEFINITION =
const MessageKind("Existing definition of '#{name}'.");
@@ -266,87 +270,89 @@ main() {
"from library '#{hidingUri}'.",
howToFix: "Try adding 'hide #{name}' to the import of '#{hiddenUri}'.",
examples: const [
- const {
- 'main.dart': """
+ const {
+ 'main.dart': """
import 'dart:async'; // This imports a class Future.
import 'future.dart';
void main() => new Future();""",
- 'future.dart': """
+ 'future.dart': """
library future;
class Future {}"""
- },
- const {
- 'main.dart': """
+ },
+ const {
+ 'main.dart': """
import 'future.dart';
import 'dart:async'; // This imports a class Future.
void main() => new Future();""",
- 'future.dart': """
+ 'future.dart': """
library future;
class Future {}"""
- },
- const {
- 'main.dart': """
+ },
+ const {
+ 'main.dart': """
import 'export.dart';
import 'dart:async'; // This imports a class Future.
void main() => new Future();""",
- 'future.dart': """
+ 'future.dart': """
library future;
class Future {}""",
- 'export.dart': """
+ 'export.dart': """
library export;
export 'future.dart';"""
- },
- const {
- 'main.dart': """
+ },
+ const {
+ 'main.dart': """
import 'future.dart' as prefix;
import 'dart:async' as prefix; // This imports a class Future.
void main() => new prefix.Future();""",
- 'future.dart': """
+ 'future.dart': """
library future;
class Future {}"""
- }
- ]);
+ }
+ ]);
static const MessageKind HIDDEN_IMPLICIT_IMPORT = const MessageKind(
"'#{name}' from library '#{hiddenUri}' is hidden by '#{name}' "
- "from library '#{hidingUri}'.", howToFix: "Try adding an explicit "
- "'import \"#{hiddenUri}\" hide #{name}'.", examples: const [
- const {
- 'main.dart': """
+ "from library '#{hidingUri}'.",
+ howToFix: "Try adding an explicit "
+ "'import \"#{hiddenUri}\" hide #{name}'.",
+ examples: const [
+ const {
+ 'main.dart': """
// This hides the implicit import of class Type from dart:core.
import 'type.dart';
void main() => new Type();""",
- 'type.dart': """
+ 'type.dart': """
library type;
class Type {}"""
- },
- const {
- 'conflictsWithDart.dart': """
+ },
+ const {
+ 'conflictsWithDart.dart': """
library conflictsWithDart;
class Duration {
static var x = 100;
}
""",
- 'conflictsWithDartAsWell.dart': """
+ 'conflictsWithDartAsWell.dart': """
library conflictsWithDartAsWell;
class Duration {
static var x = 100;
}
""",
- 'main.dart': r"""
+ 'main.dart': r"""
library testDartConflicts;
import 'conflictsWithDart.dart';
@@ -356,23 +362,23 @@ main() {
print("Hail Caesar ${Duration.x}");
}
"""
- }
- ]);
+ }
+ ]);
- static const MessageKind DUPLICATE_EXPORT = const MessageKind(
- "Duplicate export of '#{name}'.",
- howToFix: "Trying adding 'hide #{name}' to one of the exports.",
- examples: const [
- const {
- 'main.dart': """
+ static const MessageKind DUPLICATE_EXPORT =
+ const MessageKind("Duplicate export of '#{name}'.",
+ howToFix: "Trying adding 'hide #{name}' to one of the exports.",
+ examples: const [
+ const {
+ 'main.dart': """
export 'decl1.dart';
export 'decl2.dart';
main() {}""",
- 'decl1.dart': "class Class {}",
- 'decl2.dart': "class Class {}"
- }
- ]);
+ 'decl1.dart': "class Class {}",
+ 'decl2.dart': "class Class {}"
+ }
+ ]);
static const MessageKind DUPLICATE_EXPORT_CONT =
const MessageKind("This is another export of '#{name}'.");
@@ -431,16 +437,17 @@ main() {}""",
static const MessageKind REDIRECTING_CONSTRUCTOR_HAS_BODY =
const MessageKind("Redirecting constructor can't have a body.");
- static const MessageKind CONST_CONSTRUCTOR_HAS_BODY = const MessageKind(
- "Const constructor or factory can't have a body.",
- howToFix: "Remove the 'const' keyword or the body", examples: const [
- """
+ static const MessageKind CONST_CONSTRUCTOR_HAS_BODY =
+ const MessageKind("Const constructor or factory can't have a body.",
+ howToFix: "Remove the 'const' keyword or the body",
+ examples: const [
+ """
class C {
const C() {}
}
main() => new C();"""
- ]);
+ ]);
static const MessageKind REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER =
const MessageKind(
@@ -471,8 +478,9 @@ main() => new C();"""
const MessageKind(
"Can't declare constructor 'const' on class #{className} "
"because the class contains non-final instance fields.",
- howToFix: "Try making all fields final.", examples: const [
- """
+ howToFix: "Try making all fields final.",
+ examples: const [
+ """
class C {
// 'a' must be declared final to allow for the const constructor.
var a;
@@ -480,7 +488,7 @@ class C {
}
main() => new C(0);"""
- ]);
+ ]);
static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD =
const MessageKind("This non-final field prevents using const "
@@ -518,9 +526,9 @@ main() => new C(0);"""
static const MessageKind OPTIONAL_PARAMETER_IN_CATCH =
const MessageKind("Cannot use optional parameters in catch.");
- static const MessageKind THROW_WITHOUT_EXPRESSION = const MessageKind(
- "Cannot use re-throw outside of catch block "
- "(expression expected after 'throw').");
+ static const MessageKind THROW_WITHOUT_EXPRESSION =
+ const MessageKind("Cannot use re-throw outside of catch block "
+ "(expression expected after 'throw').");
static const MessageKind UNBOUND_LABEL =
const MessageKind("Cannot resolve label '#{labelName}'.");
@@ -553,11 +561,12 @@ main() => new C(0);"""
const MessageKind("Cannot refer to type variable '#{typeVariableName}' "
"within a static member.");
- static const MessageKind TYPE_VARIABLE_IN_CONSTANT = const MessageKind(
- "Constant expressions can't refer to type variables.",
- howToFix: "Try removing the type variable or replacing it with a "
- "concrete type.", examples: const [
- """
+ static const MessageKind TYPE_VARIABLE_IN_CONSTANT =
+ const MessageKind("Constant expressions can't refer to type variables.",
+ howToFix: "Try removing the type variable or replacing it with a "
+ "concrete type.",
+ examples: const [
+ """
class C<T> {
const C();
@@ -566,19 +575,20 @@ class C<T> {
void main() => new C().m(null);
"""
- ]);
+ ]);
static const MessageKind INVALID_TYPE_VARIABLE_BOUND = const MessageKind(
"'#{typeArgument}' is not a subtype of bound '#{bound}' for "
"type variable '#{typeVariable}' of type '#{thisType}'.",
- howToFix: "Try to change or remove the type argument.", examples: const [
- """
+ howToFix: "Try to change or remove the type argument.",
+ examples: const [
+ """
class C<T extends num> {}
// 'String' is not a valid instantiation of T with bound num.'.
main() => new C<String>();
"""
- ]);
+ ]);
static const MessageKind INVALID_USE_OF_SUPER =
const MessageKind("'super' not allowed here.");
@@ -631,79 +641,85 @@ main() => new C<String>();
"Non-optional parameters can't have a default value.",
howToFix: "Try removing the default value or making the parameter optional.",
examples: const [
- """
+ """
main() {
foo(a: 1) => print(a);
foo(2);
}""",
- """
+ """
main() {
foo(a = 1) => print(a);
foo(2);
}"""
- ]);
+ ]);
static const MessageKind NAMED_PARAMETER_WITH_EQUALS = const MessageKind(
"Named optional parameters can't use '=' to specify a default "
- "value.", howToFix: "Try replacing '=' with ':'.", examples: const [
- """
+ "value.",
+ howToFix: "Try replacing '=' with ':'.",
+ examples: const [
+ """
main() {
foo({a = 1}) => print(a);
foo(a: 2);
}"""
- ]);
+ ]);
static const MessageKind POSITIONAL_PARAMETER_WITH_EQUALS = const MessageKind(
"Positional optional parameters can't use ':' to specify a "
"default value.",
- howToFix: "Try replacing ':' with '='.", examples: const [
- """
+ howToFix: "Try replacing ':' with '='.",
+ examples: const [
+ """
main() {
foo([a: 1]) => print(a);
foo(2);
}"""
- ]);
+ ]);
static const MessageKind TYPEDEF_FORMAL_WITH_DEFAULT = const MessageKind(
"A parameter of a typedef can't specify a default value.",
- howToFix: "Try removing the default value.", examples: const [
- """
+ howToFix: "Try removing the default value.",
+ examples: const [
+ """
typedef void F([int arg = 0]);
main() {
F f;
}""",
- """
+ """
typedef void F({int arg: 0});
main() {
F f;
}"""
- ]);
+ ]);
static const MessageKind FUNCTION_TYPE_FORMAL_WITH_DEFAULT =
const MessageKind(
"A function type parameter can't specify a default value.",
- howToFix: "Try removing the default value.", examples: const [
- """
+ howToFix: "Try removing the default value.",
+ examples: const [
+ """
foo(f(int i, [a = 1])) {}
main() {
foo(1, 2);
}""",
- """
+ """
foo(f(int i, {a: 1})) {}
main() {
foo(1, a: 2);
}"""
- ]);
+ ]);
static const MessageKind REDIRECTING_FACTORY_WITH_DEFAULT = const MessageKind(
"A parameter of a redirecting factory constructor can't specify a "
"default value.",
- howToFix: "Try removing the default value.", examples: const [
- """
+ howToFix: "Try removing the default value.",
+ examples: const [
+ """
class A {
A([a]);
factory A.foo([a = 1]) = A;
@@ -712,7 +728,7 @@ class A {
main() {
new A.foo(1);
}""",
- """
+ """
class A {
A({a});
factory A.foo({a: 1}) = A;
@@ -721,75 +737,79 @@ class A {
main() {
new A.foo(a: 1);
}"""
- ]);
+ ]);
- static const MessageKind FORMAL_DECLARED_CONST = const MessageKind(
- "A formal parameter can't be declared const.",
- howToFix: "Try removing 'const'.", examples: const [
- """
+ static const MessageKind FORMAL_DECLARED_CONST =
+ const MessageKind("A formal parameter can't be declared const.",
+ howToFix: "Try removing 'const'.",
+ examples: const [
+ """
foo(const x) {}
main() => foo(42);
""",
- """
+ """
foo({const x}) {}
main() => foo(42);
""",
- """
+ """
foo([const x]) {}
main() => foo(42);
"""
- ]);
+ ]);
- static const MessageKind FORMAL_DECLARED_STATIC = const MessageKind(
- "A formal parameter can't be declared static.",
- howToFix: "Try removing 'static'.", examples: const [
- """
+ static const MessageKind FORMAL_DECLARED_STATIC =
+ const MessageKind("A formal parameter can't be declared static.",
+ howToFix: "Try removing 'static'.",
+ examples: const [
+ """
foo(static x) {}
main() => foo(42);
""",
- """
+ """
foo({static x}) {}
main() => foo(42);
""",
- """
+ """
foo([static x]) {}
main() => foo(42);
"""
- ]);
+ ]);
- static const MessageKind FINAL_FUNCTION_TYPE_PARAMETER = const MessageKind(
- "A function type parameter can't be declared final.",
- howToFix: "Try removing 'final'.", examples: const [
- """
+ static const MessageKind FINAL_FUNCTION_TYPE_PARAMETER =
+ const MessageKind("A function type parameter can't be declared final.",
+ howToFix: "Try removing 'final'.",
+ examples: const [
+ """
foo(final int x(int a)) {}
main() => foo((y) => 42);
""",
- """
+ """
foo({final int x(int a)}) {}
main() => foo((y) => 42);
""",
- """
+ """
foo([final int x(int a)]) {}
main() => foo((y) => 42);
"""
- ]);
+ ]);
static const MessageKind VAR_FUNCTION_TYPE_PARAMETER = const MessageKind(
"A function type parameter can't be declared with 'var'.",
- howToFix: "Try removing 'var'.", examples: const [
- """
+ howToFix: "Try removing 'var'.",
+ examples: const [
+ """
foo(var int x(int a)) {}
main() => foo((y) => 42);
""",
- """
+ """
foo({var int x(int a)}) {}
main() => foo((y) => 42);
""",
- """
+ """
foo([var int x(int a)]) {}
main() => foo((y) => 42);
"""
- ]);
+ ]);
static const MessageKind CANNOT_INSTANTIATE_TYPE_VARIABLE = const MessageKind(
"Cannot instantiate type variable '#{typeVariableName}'.");
@@ -797,30 +817,31 @@ main() => foo((y) => 42);
static const MessageKind CYCLIC_TYPE_VARIABLE = const MessageKind(
"Type variable '#{typeVariableName}' is a supertype of itself.");
- static const CYCLIC_TYPEDEF = const MessageKind(
- "A typedef can't refer to itself.",
- howToFix: "Try removing all references to '#{typedefName}' "
- "in the definition of '#{typedefName}'.", examples: const [
- """
+ static const CYCLIC_TYPEDEF =
+ const MessageKind("A typedef can't refer to itself.",
+ howToFix: "Try removing all references to '#{typedefName}' "
+ "in the definition of '#{typedefName}'.",
+ examples: const [
+ """
typedef F F(); // The return type 'F' is a self-reference.
main() { F f = null; }"""
- ]);
+ ]);
static const CYCLIC_TYPEDEF_ONE = const MessageKind(
"A typedef can't refer to itself through another typedef.",
howToFix: "Try removing all references to "
"'#{otherTypedefName}' in the definition of '#{typedefName}'.",
examples: const [
- """
+ """
typedef G F(); // The return type 'G' is a self-reference through typedef 'G'.
typedef F G(); // The return type 'F' is a self-reference through typedef 'F'.
main() { F f = null; }""",
- """
+ """
typedef G F(); // The return type 'G' creates a self-reference.
typedef H G(); // The return type 'H' creates a self-reference.
typedef H(F f); // The argument type 'F' creates a self-reference.
main() { F f = null; }"""
- ]);
+ ]);
static const MessageKind CLASS_NAME_EXPECTED =
const MessageKind("Class name expected.");
@@ -836,128 +857,136 @@ main() { F f = null; }"""
"Class '#{className}' can't extend the type '#{malformedType}' because "
"it is malformed.",
howToFix: "Try correcting the malformed type annotation or removing the "
- "'extends' clause.", examples: const [
- """
+ "'extends' clause.",
+ examples: const [
+ """
class A extends Malformed {}
main() => new A();"""
- ]);
+ ]);
static const MessageKind CANNOT_IMPLEMENT_MALFORMED = const MessageKind(
"Class '#{className}' can't implement the type '#{malformedType}' "
"because it is malformed.",
howToFix: "Try correcting the malformed type annotation or removing the "
- "type from the 'implements' clause.", examples: const [
- """
+ "type from the 'implements' clause.",
+ examples: const [
+ """
class A implements Malformed {}
main() => new A();"""
- ]);
+ ]);
static const MessageKind CANNOT_MIXIN_MALFORMED = const MessageKind(
"Class '#{className}' can't mixin the type '#{malformedType}' because it "
"is malformed.",
howToFix: "Try correcting the malformed type annotation or removing the "
- "type from the 'with' clause.", examples: const [
- """
+ "type from the 'with' clause.",
+ examples: const [
+ """
class A extends Object with Malformed {}
main() => new A();"""
- ]);
+ ]);
- static const MessageKind CANNOT_MIXIN = const MessageKind(
- "The type '#{type}' can't be mixed in.",
- howToFix: "Try removing '#{type}' from the 'with' clause.",
- examples: const [
- """
+ static const MessageKind CANNOT_MIXIN =
+ const MessageKind("The type '#{type}' can't be mixed in.",
+ howToFix: "Try removing '#{type}' from the 'with' clause.",
+ examples: const [
+ """
class C extends Object with String {}
main() => new C();
""",
- """
+ """
typedef C = Object with String;
main() => new C();
"""
- ]);
+ ]);
static const MessageKind CANNOT_EXTEND_ENUM = const MessageKind(
"Class '#{className}' can't extend the type '#{enumType}' because "
"it is declared by an enum.",
howToFix: "Try making '#{enumType}' a normal class or removing the "
- "'extends' clause.", examples: const [
- """
+ "'extends' clause.",
+ examples: const [
+ """
enum Enum { A }
class B extends Enum {}
main() => new B();"""
- ]);
+ ]);
static const MessageKind CANNOT_IMPLEMENT_ENUM = const MessageKind(
"Class '#{className}' can't implement the type '#{enumType}' "
"because it is declared by an enum.",
howToFix: "Try making '#{enumType}' a normal class or removing the "
- "type from the 'implements' clause.", examples: const [
- """
+ "type from the 'implements' clause.",
+ examples: const [
+ """
enum Enum { A }
class B implements Enum {}
main() => new B();"""
- ]);
+ ]);
static const MessageKind CANNOT_MIXIN_ENUM = const MessageKind(
"Class '#{className}' can't mixin the type '#{enumType}' because it "
"is declared by an enum.",
howToFix: "Try making '#{enumType}' a normal class or removing the "
- "type from the 'with' clause.", examples: const [
- """
+ "type from the 'with' clause.",
+ examples: const [
+ """
enum Enum { A }
class B extends Object with Enum {}
main() => new B();"""
- ]);
+ ]);
- static const MessageKind CANNOT_INSTANTIATE_ENUM = const MessageKind(
- "Enum type '#{enumName}' cannot be instantiated.",
- howToFix: "Try making '#{enumType}' a normal class or use an enum "
- "constant.", examples: const [
- """
+ static const MessageKind CANNOT_INSTANTIATE_ENUM =
+ const MessageKind("Enum type '#{enumName}' cannot be instantiated.",
+ howToFix: "Try making '#{enumType}' a normal class or use an enum "
+ "constant.",
+ examples: const [
+ """
enum Enum { A }
main() => new Enum(0);""",
- """
+ """
enum Enum { A }
main() => const Enum(0);"""
- ]);
+ ]);
- static const MessageKind EMPTY_ENUM_DECLARATION = const MessageKind(
- "Enum '#{enumName}' must contain at least one value.",
- howToFix: "Try adding an enum constant or making #{enumName} a "
- "normal class.", examples: const [
- """
+ static const MessageKind EMPTY_ENUM_DECLARATION =
+ const MessageKind("Enum '#{enumName}' must contain at least one value.",
+ howToFix: "Try adding an enum constant or making #{enumName} a "
+ "normal class.",
+ examples: const [
+ """
enum Enum {}
main() { Enum e; }"""
- ]);
+ ]);
static const MessageKind MISSING_ENUM_CASES = const MessageKind(
"Missing enum constants in switch statement: #{enumValues}.",
howToFix: "Try adding the missing constants or a default case.",
examples: const [
- """
+ """
enum Enum { A, B }
main() {
switch (Enum.A) {
case Enum.B: break;
}
}""",
- """
+ """
enum Enum { A, B, C }
main() {
switch (Enum.A) {
case Enum.B: break;
}
}"""
- ]);
+ ]);
static const MessageKind DUPLICATE_EXTENDS_IMPLEMENTS =
const MessageKind("'#{type}' can not be both extended and implemented.");
- static const MessageKind DUPLICATE_IMPLEMENTS = const MessageKind(
- "'#{type}' must not occur more than once "
- "in the implements clause.");
+ static const MessageKind DUPLICATE_IMPLEMENTS =
+ const MessageKind("'#{type}' must not occur more than once "
+ "in the implements clause.");
static const MessageKind MULTI_INHERITANCE = const MessageKind(
"Dart2js does not currently support inheritance of the same class with "
@@ -994,13 +1023,13 @@ main() {
"Static member cannot override instance member '#{memberName}' of "
"'#{className}'.");
- static const MessageKind NO_STATIC_OVERRIDE_CONT = const MessageKind(
- "This is the instance member that cannot be overridden "
- "by a static member.");
+ static const MessageKind NO_STATIC_OVERRIDE_CONT =
+ const MessageKind("This is the instance member that cannot be overridden "
+ "by a static member.");
- static const MessageKind INSTANCE_STATIC_SAME_NAME = const MessageKind(
- "Instance member '#{memberName}' and static member of "
- "superclass '#{className}' have the same name.");
+ static const MessageKind INSTANCE_STATIC_SAME_NAME =
+ const MessageKind("Instance member '#{memberName}' and static member of "
+ "superclass '#{className}' have the same name.");
static const MessageKind INSTANCE_STATIC_SAME_NAME_CONT =
const MessageKind("This is the static member with the same name.");
@@ -1128,11 +1157,11 @@ main() {
static const MessageKind CONSTRUCTOR_WITH_RETURN_TYPE =
const MessageKind("Cannot have return type for constructor.");
- static const MessageKind CANNOT_RETURN_FROM_CONSTRUCTOR = const MessageKind(
- "Constructors can't return values.",
- howToFix: "Remove the return statement or use a factory constructor.",
- examples: const [
- """
+ static const MessageKind CANNOT_RETURN_FROM_CONSTRUCTOR =
+ const MessageKind("Constructors can't return values.",
+ howToFix: "Remove the return statement or use a factory constructor.",
+ examples: const [
+ """
class C {
C() {
return 1;
@@ -1140,7 +1169,7 @@ class C {
}
main() => new C();"""
- ]);
+ ]);
static const MessageKind ILLEGAL_FINAL_METHOD_MODIFIER =
const MessageKind("Cannot have final modifier on method.");
@@ -1149,13 +1178,13 @@ main() => new C();"""
"Cannot have const modifier on non-static field.",
howToFix: "Try adding a static modifier, or removing the const modifier.",
examples: const [
- """
+ """
class C {
const int a = 1;
}
main() => new C();"""
- ]);
+ ]);
static const MessageKind ILLEGAL_CONSTRUCTOR_MODIFIERS =
const MessageKind("Illegal constructor modifiers: '#{modifiers}'.");
@@ -1172,9 +1201,9 @@ main() => new C();"""
static const MessageKind ILLEGAL_MIXIN_CONSTRUCTOR = const MessageKind(
"Class used as mixin cannot have non-factory constructor.");
- static const MessageKind ILLEGAL_MIXIN_CYCLE = const MessageKind(
- "Class used as mixin introduces mixin cycle: "
- "'#{mixinName1}' <-> '#{mixinName2}'.");
+ static const MessageKind ILLEGAL_MIXIN_CYCLE =
+ const MessageKind("Class used as mixin introduces mixin cycle: "
+ "'#{mixinName1}' <-> '#{mixinName2}'.");
static const MessageKind ILLEGAL_MIXIN_WITH_SUPER = const MessageKind(
"Cannot use class '#{className}' as a mixin because it uses "
@@ -1195,9 +1224,9 @@ main() => new C();"""
static const MessageKind ASSIGNING_METHOD =
const MessageKind("Cannot assign a value to a method.");
- static const MessageKind ASSIGNING_METHOD_IN_SUPER = const MessageKind(
- "Cannot assign a value to method '#{name}' "
- "in superclass '#{superclassName}'.");
+ static const MessageKind ASSIGNING_METHOD_IN_SUPER =
+ const MessageKind("Cannot assign a value to method '#{name}' "
+ "in superclass '#{superclassName}'.");
static const MessageKind ASSIGNING_TYPE =
const MessageKind("Cannot assign a value to a type.");
@@ -1214,9 +1243,9 @@ main() => new C();"""
howToFix: "Try removing 'void' keyword or replace it with 'var', 'final',"
" or a type.",
examples: const [
- "void x; main() {}",
- "foo(void x) {} main() { foo(null); }",
- ]);
+ "void x; main() {}",
+ "foo(void x) {} main() { foo(null); }",
+ ]);
static const MessageKind NULL_NOT_ALLOWED =
const MessageKind("`null` can't be used here.");
@@ -1227,55 +1256,56 @@ main() => new C();"""
static const MessageKind IMPORT_PART_OF = const MessageKind(
"The imported library must not have a 'part-of' directive.",
howToFix: "Try removing the 'part-of' directive or replacing the "
- "import of the library with a 'part' directive.", examples: const [
- const {
- 'main.dart': """
+ "import of the library with a 'part' directive.",
+ examples: const [
+ const {
+ 'main.dart': """
library library;
import 'part.dart';
main() {}
""",
- 'part.dart': """
+ 'part.dart': """
part of library;
"""
- }
- ]);
+ }
+ ]);
- static const MessageKind LIBRARY_NAME_MISMATCH = const MessageKind(
- "Expected part of library name '#{libraryName}'.",
- howToFix: "Try changing the directive to 'part of #{libraryName};'.",
- examples: const [
- const {
- 'main.dart': """
+ static const MessageKind LIBRARY_NAME_MISMATCH =
+ const MessageKind("Expected part of library name '#{libraryName}'.",
+ howToFix: "Try changing the directive to 'part of #{libraryName};'.",
+ examples: const [
+ const {
+ 'main.dart': """
library lib.foo;
part 'part.dart';
main() {}
""",
- 'part.dart': """
+ 'part.dart': """
part of lib.bar;
"""
- }
- ]);
+ }
+ ]);
static const MessageKind MISSING_LIBRARY_NAME = const MessageKind(
"Library has no name. Part directive expected library name "
"to be '#{libraryName}'.",
howToFix: "Try adding 'library #{libraryName};' to the library.",
examples: const [
- const {
- 'main.dart': """
+ const {
+ 'main.dart': """
part 'part.dart';
main() {}
""",
- 'part.dart': """
+ 'part.dart': """
part of lib.foo;
"""
- }
- ]);
+ }
+ ]);
static const MessageKind THIS_IS_THE_PART_OF_TAG =
const MessageKind("This is the part of directive.");
@@ -1289,9 +1319,9 @@ part of lib.foo;
static const MessageKind DUPLICATED_LIBRARY_NAME =
const MessageKind("Duplicated library name '#{libraryName}'.");
- static const MessageKind DUPLICATED_RESOURCE = const MessageKind(
- "The resource '#{resourceUri}' is loaded through both "
- "'#{canonicalUri1}' and '#{canonicalUri2}'.");
+ static const MessageKind DUPLICATED_RESOURCE =
+ const MessageKind("The resource '#{resourceUri}' is loaded through both "
+ "'#{canonicalUri1}' and '#{canonicalUri2}'.");
static const MessageKind DUPLICATED_LIBRARY_RESOURCE = const MessageKind(
"The library '#{libraryName}' in '#{resourceUri}' is loaded through "
@@ -1306,12 +1336,13 @@ Length: #{length}''');
static const MessageKind TOP_LEVEL_VARIABLE_DECLARED_STATIC =
const MessageKind("Top-level variable cannot be declared static.");
- static const MessageKind REFERENCE_IN_INITIALIZATION = const MessageKind(
- "Variable '#{variableName}' is referenced during its "
- "initialization.",
- howToFix: "If you are trying to reference a shadowed variable, rename"
- " one of the variables.", examples: const [
- """
+ static const MessageKind REFERENCE_IN_INITIALIZATION =
+ const MessageKind("Variable '#{variableName}' is referenced during its "
+ "initialization.",
+ howToFix: "If you are trying to reference a shadowed variable, rename"
+ " one of the variables.",
+ examples: const [
+ """
foo(t) {
var t = t;
return t;
@@ -1319,17 +1350,18 @@ foo(t) {
main() => foo(1);
"""
- ]);
+ ]);
- static const MessageKind CONST_WITHOUT_INITIALIZER = const MessageKind(
- "A constant variable must be initialized.",
- howToFix: "Try adding an initializer or "
- "removing the 'const' modifier.", examples: const [
- """
+ static const MessageKind CONST_WITHOUT_INITIALIZER =
+ const MessageKind("A constant variable must be initialized.",
+ howToFix: "Try adding an initializer or "
+ "removing the 'const' modifier.",
+ examples: const [
+ """
void main() {
const c; // This constant variable must be initialized.
}"""
- ]);
+ ]);
static const MessageKind FINAL_WITHOUT_INITIALIZER = const MessageKind(
"A final variable must be initialized.",
@@ -1339,19 +1371,21 @@ void main() {
static const MessageKind MEMBER_USES_CLASS_NAME = const MessageKind(
"Member variable can't have the same name as the class it is "
- "declared in.", howToFix: "Try renaming the variable.", examples: const [
- """
+ "declared in.",
+ howToFix: "Try renaming the variable.",
+ examples: const [
+ """
class A { var A; }
main() {
var a = new A();
a.A = 1;
}
""",
- """
+ """
class A { static var A; }
main() => A.A = 1;
"""
- ]);
+ ]);
static const MessageKind WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT =
const MessageKind(
@@ -1418,7 +1452,8 @@ main() => A.A = 1;
static const MessageKind PRIVATE_NAMED_PARAMETER = const MessageKind(
"Named optional parameter can't have a library private name.",
howToFix: "Try removing the '_' or making the parameter positional or "
- "required.", examples: const ["""foo({int _p}) {} main() => foo();"""]);
+ "required.",
+ examples: const ["""foo({int _p}) {} main() => foo();"""]);
static const MessageKind UNSUPPORTED_LITERAL_SYMBOL = const MessageKind(
"Symbol literal '##{value}' is currently unsupported by dart2js.");
@@ -1440,9 +1475,9 @@ main() => A.A = 1;
static const MessageKind IMPORTED_HERE =
const MessageKind("'#{name}' is imported here.");
- static const MessageKind OVERRIDE_EQUALS_NOT_HASH_CODE = const MessageKind(
- "The class '#{class}' overrides 'operator==', "
- "but not 'get hashCode'.");
+ static const MessageKind OVERRIDE_EQUALS_NOT_HASH_CODE =
+ const MessageKind("The class '#{class}' overrides 'operator==', "
+ "but not 'get hashCode'.");
static const MessageKind INTERNAL_LIBRARY_FROM = const MessageKind(
"Internal library '#{resolvedUri}' is not accessible from "
@@ -1454,39 +1489,41 @@ main() => A.A = 1;
static const MessageKind LIBRARY_NOT_FOUND =
const MessageKind("Library not found '#{resolvedUri}'.");
- static const MessageKind UNSUPPORTED_EQ_EQ_EQ = const MessageKind(
- "'===' is not an operator. "
- "Did you mean '#{lhs} == #{rhs}' or 'identical(#{lhs}, #{rhs})'?");
+ static const MessageKind UNSUPPORTED_EQ_EQ_EQ =
+ const MessageKind("'===' is not an operator. "
+ "Did you mean '#{lhs} == #{rhs}' or 'identical(#{lhs}, #{rhs})'?");
- static const MessageKind UNSUPPORTED_BANG_EQ_EQ = const MessageKind(
- "'!==' is not an operator. "
- "Did you mean '#{lhs} != #{rhs}' or '!identical(#{lhs}, #{rhs})'?");
+ static const MessageKind UNSUPPORTED_BANG_EQ_EQ =
+ const MessageKind("'!==' is not an operator. "
+ "Did you mean '#{lhs} != #{rhs}' or '!identical(#{lhs}, #{rhs})'?");
static const MessageKind UNSUPPORTED_PREFIX_PLUS = const MessageKind(
"'+' is not a prefix operator. ",
howToFix: "Try removing '+'.",
examples: const ["main() => +2; // No longer a valid way to write '2'"]);
- static const MessageKind UNSUPPORTED_THROW_WITHOUT_EXP = const MessageKind(
- "No expression after 'throw'. "
- "Did you mean 'rethrow'?");
+ static const MessageKind UNSUPPORTED_THROW_WITHOUT_EXP =
+ const MessageKind("No expression after 'throw'. "
+ "Did you mean 'rethrow'?");
- static const MessageKind DEPRECATED_TYPEDEF_MIXIN_SYNTAX = const MessageKind(
- "'typedef' not allowed here. ",
- howToFix: "Try replacing 'typedef' with 'class'.", examples: const [
- """
+ static const MessageKind DEPRECATED_TYPEDEF_MIXIN_SYNTAX =
+ const MessageKind("'typedef' not allowed here. ",
+ howToFix: "Try replacing 'typedef' with 'class'.",
+ examples: const [
+ """
class B { }
class M1 { }
typedef C = B with M1; // Need to replace 'typedef' with 'class'.
main() { new C(); }
"""
- ]);
+ ]);
static const MessageKind MIRRORS_EXPECTED_STRING = const MessageKind(
"Can't use '#{name}' here because it's an instance of '#{type}' "
"and a 'String' value is expected.",
- howToFix: "Did you forget to add quotes?", examples: const [
- """
+ howToFix: "Did you forget to add quotes?",
+ examples: const [
+ """
// 'Foo' is a type literal, not a string.
@MirrorsUsed(symbols: const [Foo])
import 'dart:mirrors';
@@ -1495,26 +1532,28 @@ class Foo {}
main() {}
"""
- ]);
+ ]);
static const MessageKind MIRRORS_EXPECTED_STRING_OR_TYPE = const MessageKind(
"Can't use '#{name}' here because it's an instance of '#{type}' "
"and a 'String' or 'Type' value is expected.",
- howToFix: "Did you forget to add quotes?", examples: const [
- """
+ howToFix: "Did you forget to add quotes?",
+ examples: const [
+ """
// 'main' is a method, not a class.
@MirrorsUsed(targets: const [main])
import 'dart:mirrors';
main() {}
"""
- ]);
+ ]);
static const MessageKind MIRRORS_EXPECTED_STRING_OR_LIST = const MessageKind(
"Can't use '#{name}' here because it's an instance of '#{type}' "
"and a 'String' or 'List' value is expected.",
- howToFix: "Did you forget to add quotes?", examples: const [
- """
+ howToFix: "Did you forget to add quotes?",
+ examples: const [
+ """
// 'Foo' is not a string.
@MirrorsUsed(symbols: Foo)
import 'dart:mirrors';
@@ -1523,131 +1562,140 @@ class Foo {}
main() {}
"""
- ]);
+ ]);
static const MessageKind MIRRORS_EXPECTED_STRING_TYPE_OR_LIST =
const MessageKind(
"Can't use '#{name}' here because it's an instance of '#{type}' "
"but a 'String', 'Type', or 'List' value is expected.",
- howToFix: "Did you forget to add quotes?", examples: const [
- """
+ howToFix: "Did you forget to add quotes?",
+ examples: const [
+ """
// '1' is not a string.
@MirrorsUsed(targets: 1)
import 'dart:mirrors';
main() {}
"""
- ]);
+ ]);
static const MessageKind MIRRORS_CANNOT_RESOLVE_IN_CURRENT_LIBRARY =
const MessageKind("Can't find '#{name}' in the current library.",
// TODO(ahe): The closest identifiers in edit distance would be nice.
- howToFix: "Did you forget to add an import?", examples: const [
- """
+ howToFix: "Did you forget to add an import?",
+ examples: const [
+ """
// 'window' is not in scope because dart:html isn't imported.
@MirrorsUsed(targets: 'window')
import 'dart:mirrors';
main() {}
"""
- ]);
+ ]);
static const MessageKind MIRRORS_CANNOT_RESOLVE_IN_LIBRARY =
const MessageKind("Can't find '#{name}' in the library '#{library}'.",
// TODO(ahe): The closest identifiers in edit distance would be nice.
- howToFix: "Is '#{name}' spelled right?", examples: const [
- """
+ howToFix: "Is '#{name}' spelled right?",
+ examples: const [
+ """
// 'List' is misspelled.
@MirrorsUsed(targets: 'dart.core.Lsit')
import 'dart:mirrors';
main() {}
"""
- ]);
+ ]);
- static const MessageKind MIRRORS_CANNOT_FIND_IN_ELEMENT = const MessageKind(
- "Can't find '#{name}' in '#{element}'.",
- // TODO(ahe): The closest identifiers in edit distance would be nice.
- howToFix: "Is '#{name}' spelled right?", examples: const [
- """
+ static const MessageKind MIRRORS_CANNOT_FIND_IN_ELEMENT =
+ const MessageKind("Can't find '#{name}' in '#{element}'.",
+ // TODO(ahe): The closest identifiers in edit distance would be nice.
+ howToFix: "Is '#{name}' spelled right?",
+ examples: const [
+ """
// 'addAll' is misspelled.
@MirrorsUsed(targets: 'dart.core.List.addAl')
import 'dart:mirrors';
main() {}
"""
- ]);
+ ]);
- static const MessageKind INVALID_URI = const MessageKind(
- "'#{uri}' is not a valid URI.",
- howToFix: DONT_KNOW_HOW_TO_FIX, examples: const [
- """
+ static const MessageKind INVALID_URI =
+ const MessageKind("'#{uri}' is not a valid URI.",
+ howToFix: DONT_KNOW_HOW_TO_FIX,
+ examples: const [
+ """
// can't have a '[' in a URI
import '../../Udyn[mic ils/expect.dart';
main() {}
"""
- ]);
+ ]);
- static const MessageKind READ_SCRIPT_ERROR = const MessageKind(
- "Can't read '#{uri}' (#{exception}).",
- // Don't know how to fix since the underlying error is unknown.
- howToFix: DONT_KNOW_HOW_TO_FIX, examples: const [
- """
+ static const MessageKind READ_SCRIPT_ERROR =
+ const MessageKind("Can't read '#{uri}' (#{exception}).",
+ // Don't know how to fix since the underlying error is unknown.
+ howToFix: DONT_KNOW_HOW_TO_FIX,
+ examples: const [
+ """
// 'foo.dart' does not exist.
import 'foo.dart';
main() {}
"""
- ]);
+ ]);
static const MessageKind READ_SELF_ERROR = const MessageKind("#{exception}",
// Don't know how to fix since the underlying error is unknown.
howToFix: DONT_KNOW_HOW_TO_FIX);
- static const MessageKind EXTRANEOUS_MODIFIER = const MessageKind(
- "Can't have modifier '#{modifier}' here.",
- howToFix: "Try removing '#{modifier}'.", examples: const [
- "var String foo; main(){}",
- // "var get foo; main(){}",
- "var set foo; main(){}",
- "var final foo; main(){}",
- "var var foo; main(){}",
- "var const foo; main(){}",
- "var abstract foo; main(){}",
- "var static foo; main(){}",
- "var external foo; main(){}",
- "get var foo; main(){}",
- "set var foo; main(){}",
- "final var foo; main(){}",
- "var var foo; main(){}",
- "const var foo; main(){}",
- "abstract var foo; main(){}",
- "static var foo; main(){}",
- "external var foo; main(){}"
- ]);
-
- static const MessageKind EXTRANEOUS_MODIFIER_REPLACE = const MessageKind(
- "Can't have modifier '#{modifier}' here.",
- howToFix: "Try replacing modifier '#{modifier}' with 'var', 'final',"
- " or a type.", examples: const [
- // "get foo; main(){}",
- "set foo; main(){}",
- "abstract foo; main(){}",
- "static foo; main(){}",
- "external foo; main(){}"
- ]);
+ static const MessageKind EXTRANEOUS_MODIFIER =
+ const MessageKind("Can't have modifier '#{modifier}' here.",
+ howToFix: "Try removing '#{modifier}'.",
+ examples: const [
+ "var String foo; main(){}",
+ // "var get foo; main(){}",
+ "var set foo; main(){}",
+ "var final foo; main(){}",
+ "var var foo; main(){}",
+ "var const foo; main(){}",
+ "var abstract foo; main(){}",
+ "var static foo; main(){}",
+ "var external foo; main(){}",
+ "get var foo; main(){}",
+ "set var foo; main(){}",
+ "final var foo; main(){}",
+ "var var foo; main(){}",
+ "const var foo; main(){}",
+ "abstract var foo; main(){}",
+ "static var foo; main(){}",
+ "external var foo; main(){}"
+ ]);
+
+ static const MessageKind EXTRANEOUS_MODIFIER_REPLACE =
+ const MessageKind("Can't have modifier '#{modifier}' here.",
+ howToFix: "Try replacing modifier '#{modifier}' with 'var', 'final',"
+ " or a type.",
+ examples: const [
+ // "get foo; main(){}",
+ "set foo; main(){}",
+ "abstract foo; main(){}",
+ "static foo; main(){}",
+ "external foo; main(){}"
+ ]);
static const MessageKind ABSTRACT_CLASS_INSTANTIATION = const MessageKind(
"Can't instantiate abstract class.",
howToFix: DONT_KNOW_HOW_TO_FIX,
examples: const ["abstract class A {} main() { new A(); }"]);
- static const MessageKind BODY_EXPECTED = const MessageKind(
- "Expected a function body or '=>'.",
- // TODO(ahe): In some scenarios, we can suggest removing the 'static'
- // keyword.
- howToFix: "Try adding {}.", examples: const ["main();"]);
+ static const MessageKind BODY_EXPECTED =
+ const MessageKind("Expected a function body or '=>'.",
+ // TODO(ahe): In some scenarios, we can suggest removing the 'static'
+ // keyword.
+ howToFix: "Try adding {}.",
+ examples: const ["main();"]);
static const MessageKind MIRROR_BLOAT = const MessageKind(
"#{count} methods retained for use by dart:mirrors out of #{total}"
@@ -1692,50 +1740,54 @@ main() {}
howToFix: "Consider deleting it.",
examples: const ["typedef DeadCode(); main() {}"]);
- static const MessageKind ABSTRACT_METHOD = const MessageKind(
- "The method '#{name}' has no implementation in "
- "class '#{class}'.",
- howToFix: "Try adding a body to '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ static const MessageKind ABSTRACT_METHOD =
+ const MessageKind("The method '#{name}' has no implementation in "
+ "class '#{class}'.",
+ howToFix: "Try adding a body to '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
class Class {
method();
}
main() => new Class().method();
"""
- ]);
-
- static const MessageKind ABSTRACT_GETTER = const MessageKind(
- "The getter '#{name}' has no implementation in "
- "class '#{class}'.",
- howToFix: "Try adding a body to '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ ]);
+
+ static const MessageKind ABSTRACT_GETTER =
+ const MessageKind("The getter '#{name}' has no implementation in "
+ "class '#{class}'.",
+ howToFix: "Try adding a body to '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
class Class {
get getter;
}
main() => new Class();
"""
- ]);
-
- static const MessageKind ABSTRACT_SETTER = const MessageKind(
- "The setter '#{name}' has no implementation in "
- "class '#{class}'.",
- howToFix: "Try adding a body to '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ ]);
+
+ static const MessageKind ABSTRACT_SETTER =
+ const MessageKind("The setter '#{name}' has no implementation in "
+ "class '#{class}'.",
+ howToFix: "Try adding a body to '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
class Class {
set setter(_);
}
main() => new Class();
"""
- ]);
+ ]);
static const MessageKind INHERIT_GETTER_AND_METHOD = const MessageKind(
"The class '#{class}' can't inherit both getters and methods "
"by the named '#{name}'.",
- howToFix: DONT_KNOW_HOW_TO_FIX, examples: const [
- """
+ howToFix: DONT_KNOW_HOW_TO_FIX,
+ examples: const [
+ """
class A {
get member => null;
}
@@ -1746,7 +1798,7 @@ class Class implements A, B {
}
main() => new Class();
"""
- ]);
+ ]);
static const MessageKind INHERITED_METHOD = const MessageKind(
"The inherited method '#{name}' is declared here in class "
@@ -1760,32 +1812,34 @@ main() => new Class();
"The inherited getter '#{name}' is implicitly declared by this "
"field in class '#{class}'.");
- static const MessageKind UNIMPLEMENTED_METHOD_ONE = const MessageKind(
- "'#{class}' doesn't implement '#{method}' "
- "declared in '#{declarer}'.",
- howToFix: "Try adding an implementation of '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ static const MessageKind UNIMPLEMENTED_METHOD_ONE =
+ const MessageKind("'#{class}' doesn't implement '#{method}' "
+ "declared in '#{declarer}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
abstract class I {
m();
}
class C implements I {}
main() => new C();
""",
- """
+ """
abstract class I {
m();
}
class C extends I {}
main() => new C();
"""
- ]);
+ ]);
- static const MessageKind UNIMPLEMENTED_METHOD = const MessageKind(
- "'#{class}' doesn't implement '#{method}'.",
- howToFix: "Try adding an implementation of '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ static const MessageKind UNIMPLEMENTED_METHOD =
+ const MessageKind("'#{class}' doesn't implement '#{method}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
abstract class I {
m();
}
@@ -1800,7 +1854,7 @@ main() {
new C();
}
""",
- """
+ """
abstract class I {
m();
}
@@ -1815,17 +1869,18 @@ main() {
new C();
}
"""
- ]);
+ ]);
static const MessageKind UNIMPLEMENTED_METHOD_CONT = const MessageKind(
"The method '#{name}' is declared here in class '#{class}'.");
- static const MessageKind UNIMPLEMENTED_SETTER_ONE = const MessageKind(
- "'#{class}' doesn't implement the setter '#{name}' "
- "declared in '#{declarer}'.",
- howToFix: "Try adding an implementation of '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ static const MessageKind UNIMPLEMENTED_SETTER_ONE =
+ const MessageKind("'#{class}' doesn't implement the setter '#{name}' "
+ "declared in '#{declarer}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
abstract class I {
set m(_);
}
@@ -1838,13 +1893,14 @@ main() {
new C();
}
"""
- ]);
+ ]);
- static const MessageKind UNIMPLEMENTED_SETTER = const MessageKind(
- "'#{class}' doesn't implement the setter '#{name}'.",
- howToFix: "Try adding an implementation of '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ static const MessageKind UNIMPLEMENTED_SETTER =
+ const MessageKind("'#{class}' doesn't implement the setter '#{name}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
abstract class I {
set m(_);
}
@@ -1854,7 +1910,7 @@ abstract class J {
class C implements I, J {}
main() => new C();
""",
- """
+ """
abstract class I {
set m(_);
}
@@ -1864,7 +1920,7 @@ abstract class J {
class C extends I implements J {}
main() => new C();
"""
- ]);
+ ]);
static const MessageKind UNIMPLEMENTED_EXPLICIT_SETTER = const MessageKind(
"The setter '#{name}' is declared here in class '#{class}'.");
@@ -1873,32 +1929,34 @@ main() => new C();
"The setter '#{name}' is implicitly declared by this field "
"in class '#{class}'.");
- static const MessageKind UNIMPLEMENTED_GETTER_ONE = const MessageKind(
- "'#{class}' doesn't implement the getter '#{name}' "
- "declared in '#{declarer}'.",
- howToFix: "Try adding an implementation of '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ static const MessageKind UNIMPLEMENTED_GETTER_ONE =
+ const MessageKind("'#{class}' doesn't implement the getter '#{name}' "
+ "declared in '#{declarer}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
abstract class I {
get m;
}
class C implements I {}
main() => new C();
""",
- """
+ """
abstract class I {
get m;
}
class C extends I {}
main() => new C();
"""
- ]);
+ ]);
- static const MessageKind UNIMPLEMENTED_GETTER = const MessageKind(
- "'#{class}' doesn't implement the getter '#{name}'.",
- howToFix: "Try adding an implementation of '#{name}' or declaring "
- "'#{class}' to be 'abstract'.", examples: const [
- """
+ static const MessageKind UNIMPLEMENTED_GETTER =
+ const MessageKind("'#{class}' doesn't implement the getter '#{name}'.",
+ howToFix: "Try adding an implementation of '#{name}' or declaring "
+ "'#{class}' to be 'abstract'.",
+ examples: const [
+ """
abstract class I {
get m;
}
@@ -1908,7 +1966,7 @@ abstract class J {
class C implements I, J {}
main() => new C();
""",
- """
+ """
abstract class I {
get m;
}
@@ -1918,7 +1976,7 @@ abstract class J {
class C extends I implements J {}
main() => new C();
"""
- ]);
+ ]);
static const MessageKind UNIMPLEMENTED_EXPLICIT_GETTER = const MessageKind(
"The getter '#{name}' is declared here in class '#{class}'.");
@@ -1930,63 +1988,66 @@ main() => new C();
static const MessageKind EQUAL_MAP_ENTRY_KEY = const MessageKind(
"An entry with the same key already exists in the map.",
howToFix: "Try removing the previous entry or changing the key in one "
- "of the entries.", examples: const [
- """
+ "of the entries.",
+ examples: const [
+ """
main() {
var m = const {'foo': 1, 'foo': 2};
}"""
- ]);
+ ]);
- static const MessageKind BAD_INPUT_CHARACTER = const MessageKind(
- "Character U+#{characterHex} isn't allowed here.",
- howToFix: DONT_KNOW_HOW_TO_FIX, examples: const [
- """
+ static const MessageKind BAD_INPUT_CHARACTER =
+ const MessageKind("Character U+#{characterHex} isn't allowed here.",
+ howToFix: DONT_KNOW_HOW_TO_FIX,
+ examples: const [
+ """
main() {
String x = ç;
}
"""
- ]);
+ ]);
- static const MessageKind UNTERMINATED_STRING = const MessageKind(
- "String must end with #{quote}.",
- howToFix: DONT_KNOW_HOW_TO_FIX, examples: const [
- """
+ static const MessageKind UNTERMINATED_STRING =
+ const MessageKind("String must end with #{quote}.",
+ howToFix: DONT_KNOW_HOW_TO_FIX,
+ examples: const [
+ """
main() {
return '
;
}
""",
- """
+ """
main() {
return \"
;
}
""",
- """
+ """
main() {
return r'
;
}
""",
- """
+ """
main() {
return r\"
;
}
""",
- """
+ """
main() => '''
""",
- """
+ """
main() => \"\"\"
""",
- """
+ """
main() => r'''
""",
- """
+ """
main() => r\"\"\"
"""
- ]);
+ ]);
static const MessageKind UNMATCHED_TOKEN = const MessageKind(
"Can't find '#{end}' to match '#{begin}'.",
@@ -2005,60 +2066,62 @@ main() => r\"\"\"
"Numbers in exponential notation should always contain an exponent"
" (an integer number with an optional sign).",
howToFix: "Make sure there is an exponent, and remove any whitespace "
- "before it.", examples: const [
- """
+ "before it.",
+ examples: const [
+ """
main() {
var i = 1e;
}
"""
- ]);
+ ]);
static const MessageKind HEX_DIGIT_EXPECTED = const MessageKind(
"A hex digit (0-9 or A-F) must follow '0x'.",
howToFix: DONT_KNOW_HOW_TO_FIX, // Seems obvious from the error message.
examples: const [
- """
+ """
main() {
var i = 0x;
}
"""
- ]);
+ ]);
static const MessageKind MALFORMED_STRING_LITERAL = const MessageKind(
r"A '$' has special meaning inside a string, and must be followed by an"
" identifier or an expression in curly braces ({}).",
howToFix: r"Try adding a backslash (\) to escape the '$'.",
examples: const [
- r"""
+ r"""
main() {
return '$';
}
""",
- r'''
+ r'''
main() {
return "$";
}
''',
- r"""
+ r"""
main() {
return '''$''';
}
""",
- r'''
+ r'''
main() {
return """$""";
}
'''
- ]);
+ ]);
- static const MessageKind UNTERMINATED_COMMENT = const MessageKind(
- "Comment starting with '/*' must end with '*/'.",
- howToFix: DONT_KNOW_HOW_TO_FIX, examples: const [
- r"""
+ static const MessageKind UNTERMINATED_COMMENT =
+ const MessageKind("Comment starting with '/*' must end with '*/'.",
+ howToFix: DONT_KNOW_HOW_TO_FIX,
+ examples: const [
+ r"""
main() {
}
/*"""
- ]);
+ ]);
static const MessageKind MISSING_TOKEN_BEFORE_THIS = const MessageKind(
"Expected '#{token}' before this.",
@@ -2072,16 +2135,17 @@ main() {
"Expected '#{token}' after this.",
// See [MISSING_TOKEN_BEFORE_THIS], we don't have enough information to
// give a good suggestion.
- howToFix: DONT_KNOW_HOW_TO_FIX, examples: const [
- "main(x) {x}",
- """
+ howToFix: DONT_KNOW_HOW_TO_FIX,
+ examples: const [
+ "main(x) {x}",
+ """
class S1 {}
class S2 {}
class S3 {}
class A = S1 with S2, S3
main() => new A();
"""
- ]);
+ ]);
static const MessageKind CONSIDER_ANALYZE_ALL = const MessageKind(
"Could not find '#{main}'. Nothing will be analyzed.",
@@ -2096,15 +2160,15 @@ main() => new A();
* be an empty file. */
);
- static const MessageKind MAIN_NOT_A_FUNCTION = const MessageKind(
- "'#{main}' is not a function.",
- howToFix: DONT_KNOW_HOW_TO_FIX, /* Don't state the obvious. */
- examples: const ['var main;']);
+ static const MessageKind MAIN_NOT_A_FUNCTION =
+ const MessageKind("'#{main}' is not a function.",
+ howToFix: DONT_KNOW_HOW_TO_FIX, /* Don't state the obvious. */
+ examples: const ['var main;']);
- static const MessageKind MAIN_WITH_EXTRA_PARAMETER = const MessageKind(
- "'#{main}' cannot have more than two parameters.",
- howToFix: DONT_KNOW_HOW_TO_FIX, /* Don't state the obvious. */
- examples: const ['main(a, b, c) {}']);
+ static const MessageKind MAIN_WITH_EXTRA_PARAMETER =
+ const MessageKind("'#{main}' cannot have more than two parameters.",
+ howToFix: DONT_KNOW_HOW_TO_FIX, /* Don't state the obvious. */
+ examples: const ['main(a, b, c) {}']);
static const MessageKind COMPILER_CRASHED =
const MessageKind("The compiler crashed when compiling this element.");
@@ -2129,17 +2193,17 @@ Please include the following information:
below as well as the source location above).
''');
- static const MessageKind POTENTIAL_MUTATION = const MessageKind(
- "Variable '#{variableName}' is not known to be of type "
- "'#{shownType}' because it is potentially mutated in the scope for "
- "promotion.");
+ static const MessageKind POTENTIAL_MUTATION =
+ const MessageKind("Variable '#{variableName}' is not known to be of type "
+ "'#{shownType}' because it is potentially mutated in the scope for "
+ "promotion.");
static const MessageKind POTENTIAL_MUTATION_HERE = const MessageKind(
"Variable '#{variableName}' is potentially mutated here.");
- static const MessageKind POTENTIAL_MUTATION_IN_CLOSURE = const MessageKind(
- "Variable '#{variableName}' is not known to be of type "
- "'#{shownType}' because it is potentially mutated within a closure.");
+ static const MessageKind POTENTIAL_MUTATION_IN_CLOSURE =
+ const MessageKind("Variable '#{variableName}' is not known to be of type "
+ "'#{shownType}' because it is potentially mutated within a closure.");
static const MessageKind POTENTIAL_MUTATION_IN_CLOSURE_HERE =
const MessageKind(
@@ -2154,15 +2218,15 @@ Please include the following information:
static const MessageKind ACCESSED_IN_CLOSURE_HERE = const MessageKind(
"Variable '#{variableName}' is accessed in a closure here.");
- static const MessageKind NOT_MORE_SPECIFIC = const MessageKind(
- "Variable '#{variableName}' is not shown to have type "
- "'#{shownType}' because '#{shownType}' is not more specific than the "
- "known type '#{knownType}' of '#{variableName}'.");
+ static const MessageKind NOT_MORE_SPECIFIC =
+ const MessageKind("Variable '#{variableName}' is not shown to have type "
+ "'#{shownType}' because '#{shownType}' is not more specific than the "
+ "known type '#{knownType}' of '#{variableName}'.");
- static const MessageKind NOT_MORE_SPECIFIC_SUBTYPE = const MessageKind(
- "Variable '#{variableName}' is not shown to have type "
- "'#{shownType}' because '#{shownType}' is not a subtype of the "
- "known type '#{knownType}' of '#{variableName}'.");
+ static const MessageKind NOT_MORE_SPECIFIC_SUBTYPE =
+ const MessageKind("Variable '#{variableName}' is not shown to have type "
+ "'#{shownType}' because '#{shownType}' is not a subtype of the "
+ "known type '#{knownType}' of '#{variableName}'.");
static const MessageKind NOT_MORE_SPECIFIC_SUGGESTION = const MessageKind(
"Variable '#{variableName}' is not shown to have type "
@@ -2190,25 +2254,27 @@ Please include the following information:
howToFix: "Try replacing 'sync' with 'sync*'.",
examples: const ["main() sync {}"]);
- static const MessageKind INVALID_AWAIT_FOR = const MessageKind(
- "'await' is only supported on for-in loops.",
- options: const ['--enable-async'],
- howToFix: "Try rewriting the loop as a for-in loop or removing the "
- "'await' keyword.", examples: const [
- """
+ static const MessageKind INVALID_AWAIT_FOR =
+ const MessageKind("'await' is only supported on for-in loops.",
+ options: const ['--enable-async'],
+ howToFix: "Try rewriting the loop as a for-in loop or removing the "
+ "'await' keyword.",
+ examples: const [
+ """
main() async* {
await for (int i = 0; i < 10; i++) {}
}
"""
- ]);
+ ]);
static const MessageKind ASYNC_MODIFIER_ON_ABSTRACT_METHOD =
const MessageKind(
"The modifier '#{modifier}' is not allowed on an abstract method.",
options: const ['--enable-async'],
howToFix: "Try removing the '#{modifier}' modifier or adding a "
- "body to the method.", examples: const [
- """
+ "body to the method.",
+ examples: const [
+ """
abstract class A {
method() async;
}
@@ -2220,37 +2286,37 @@ main() {
a.method();
}
"""
- ]);
+ ]);
static const MessageKind ASYNC_MODIFIER_ON_CONSTRUCTOR = const MessageKind(
"The modifier '#{modifier}' is not allowed on constructors.",
options: const ['--enable-async'],
howToFix: "Try removing the '#{modifier}' modifier.",
examples: const [
- """
+ """
class A {
A() async;
}
main() => new A();""",
- """
+ """
class A {
A();
factory A.a() async* {}
}
main() => new A.a();"""
- ]);
+ ]);
- static const MessageKind ASYNC_MODIFIER_ON_SETTER = const MessageKind(
- "The modifier '#{modifier}' is not allowed on setters.",
- options: const ['--enable-async'],
- howToFix: "Try removing the '#{modifier}' modifier.",
- examples: const [
- """
+ static const MessageKind ASYNC_MODIFIER_ON_SETTER =
+ const MessageKind("The modifier '#{modifier}' is not allowed on setters.",
+ options: const ['--enable-async'],
+ howToFix: "Try removing the '#{modifier}' modifier.",
+ examples: const [
+ """
class A {
set foo(v) async {}
}
main() => new A().foo = 0;"""
- ]);
+ ]);
static const MessageKind YIELDING_MODIFIER_ON_ARROW_BODY = const MessageKind(
"The modifier '#{modifier}' is not allowed on methods implemented "
@@ -2266,125 +2332,129 @@ main() => new A().foo = 0;"""
"with '#{modifier}'.",
options: const ['--enable-async'],
howToFix: "Try removing the '#{modifier}' modifier or renaming the "
- "identifier.", examples: const [
- """
+ "identifier.",
+ examples: const [
+ """
main() async {
var await;
}""",
- """
+ """
main() async* {
var yield;
}""",
- """
+ """
main() sync* {
var yield;
}"""
- ]);
+ ]);
static const MessageKind RETURN_IN_GENERATOR = const MessageKind(
"'return' with a value is not allowed in a method body using the "
"'#{modifier}' modifier.",
howToFix: "Try removing the value, replacing 'return' with 'yield' "
- "or changing the method body modifier.", examples: const [
- """
+ "or changing the method body modifier.",
+ examples: const [
+ """
foo() async* { return 0; }
main() => foo();
""",
- """
+ """
foo() sync* { return 0; }
main() => foo();
"""
- ]);
+ ]);
- static const MessageKind NATIVE_NOT_SUPPORTED = const MessageKind(
- "'native' modifier is not supported.",
- howToFix: "Try removing the 'native' implementation or analyzing the "
- "code with the --allow-native-extensions option.", examples: const [
- """
+ static const MessageKind NATIVE_NOT_SUPPORTED =
+ const MessageKind("'native' modifier is not supported.",
+ howToFix: "Try removing the 'native' implementation or analyzing the "
+ "code with the --allow-native-extensions option.",
+ examples: const [
+ """
main() native "Main";
"""
- ]);
+ ]);
- static const MessageKind DART_EXT_NOT_SUPPORTED = const MessageKind(
- "The 'dart-ext' scheme is not supported.",
- howToFix: "Try analyzing the code with the --allow-native-extensions "
- "option.", examples: const [
- """
+ static const MessageKind DART_EXT_NOT_SUPPORTED =
+ const MessageKind("The 'dart-ext' scheme is not supported.",
+ howToFix: "Try analyzing the code with the --allow-native-extensions "
+ "option.",
+ examples: const [
+ """
import 'dart-ext:main';
main() {}
"""
- ]);
+ ]);
static const MessageKind LIBRARY_TAG_MUST_BE_FIRST = const MessageKind(
"The library declaration should come before other declarations.",
howToFix: "Try moving the declaration to the top of the file.",
examples: const [
- """
+ """
import 'dart:core';
library foo;
main() {}
""",
- ]);
+ ]);
- static const MessageKind ONLY_ONE_LIBRARY_TAG = const MessageKind(
- "There can only be one library declaration.",
- howToFix: "Try removing all other library declarations.",
- examples: const [
- """
+ static const MessageKind ONLY_ONE_LIBRARY_TAG =
+ const MessageKind("There can only be one library declaration.",
+ howToFix: "Try removing all other library declarations.",
+ examples: const [
+ """
library foo;
library bar;
main() {}
""",
- """
+ """
library foo;
import 'dart:core';
library bar;
main() {}
""",
- ]);
+ ]);
- static const MessageKind IMPORT_BEFORE_PARTS = const MessageKind(
- "Import declarations should come before parts.",
- howToFix: "Try moving this import further up in the file.",
- examples: const [
- const <String, String>{
- 'main.dart': """
+ static const MessageKind IMPORT_BEFORE_PARTS =
+ const MessageKind("Import declarations should come before parts.",
+ howToFix: "Try moving this import further up in the file.",
+ examples: const [
+ const <String, String>{
+ 'main.dart': """
library test.main;
part 'part.dart';
import 'dart:core';
main() {}
""",
- 'part.dart': """
+ 'part.dart': """
part of test.main;
""",
- }
- ]);
+ }
+ ]);
- static const MessageKind EXPORT_BEFORE_PARTS = const MessageKind(
- "Export declarations should come before parts.",
- howToFix: "Try moving this export further up in the file.",
- examples: const [
- const <String, String>{
- 'main.dart': """
+ static const MessageKind EXPORT_BEFORE_PARTS =
+ const MessageKind("Export declarations should come before parts.",
+ howToFix: "Try moving this export further up in the file.",
+ examples: const [
+ const <String, String>{
+ 'main.dart': """
library test.main;
part 'part.dart';
export 'dart:core';
main() {}
""",
- 'part.dart': """
+ 'part.dart': """
part of test.main;
""",
- }
- ]);
+ }
+ ]);
//////////////////////////////////////////////////////////////////////////////
// Patch errors start.
//////////////////////////////////////////////////////////////////////////////
- static const MessageKind PATCH_RETURN_TYPE_MISMATCH = const MessageKind(
- "Patch return type '#{patchReturnType}' does not match "
- "'#{originReturnType}' on origin method '#{methodName}'.");
+ static const MessageKind PATCH_RETURN_TYPE_MISMATCH =
+ const MessageKind("Patch return type '#{patchReturnType}' does not match "
+ "'#{originReturnType}' on origin method '#{methodName}'.");
static const MessageKind PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH =
const MessageKind("Required parameter count of patch method "
@@ -2404,10 +2474,10 @@ part of test.main;
"Patch method parameter '#{patchParameter}' does not match "
"'#{originParameter}' on origin method '#{methodName}'.");
- static const MessageKind PATCH_PARAMETER_TYPE_MISMATCH = const MessageKind(
- "Patch method parameter '#{parameterName}' type "
- "'#{patchParameterType}' does not match '#{originParameterType}' on "
- "origin method '#{methodName}'.");
+ static const MessageKind PATCH_PARAMETER_TYPE_MISMATCH =
+ const MessageKind("Patch method parameter '#{parameterName}' type "
+ "'#{patchParameterType}' does not match '#{originParameterType}' on "
+ "origin method '#{methodName}'.");
static const MessageKind PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION =
const MessageKind("External method without an implementation.");
@@ -2456,28 +2526,28 @@ part of test.main;
static const MessageKind PATCH_NO_SETTER =
const MessageKind("No setter found for setter patch '#{setterName}'.");
- static const MessageKind PATCH_NON_CONSTRUCTOR = const MessageKind(
- "Cannot patch non-constructor with constructor patch "
- "'#{constructorName}'.");
+ static const MessageKind PATCH_NON_CONSTRUCTOR =
+ const MessageKind("Cannot patch non-constructor with constructor patch "
+ "'#{constructorName}'.");
- static const MessageKind PATCH_NON_FUNCTION = const MessageKind(
- "Cannot patch non-function with function patch "
- "'#{functionName}'.");
+ static const MessageKind PATCH_NON_FUNCTION =
+ const MessageKind("Cannot patch non-function with function patch "
+ "'#{functionName}'.");
static const MessageKind EXTERNAL_WITH_BODY = const MessageKind(
"External function '#{functionName}' cannot have a function body.",
options: const ["--output-type=dart"],
howToFix: "Try removing the 'external' modifier or the function body.",
examples: const [
- """
+ """
external foo() => 0;
main() => foo();
""",
- """
+ """
external foo() {}
main() => foo();
"""
- ]);
+ ]);
//////////////////////////////////////////////////////////////////////////////
// Patch errors end.
@@ -2516,7 +2586,8 @@ $IMPORT_EXPERIMENTAL_MIRRORS_PADDING#{importChain}
static const MessageKind DIRECTLY_THROWING_NSM = const MessageKind(
"This 'noSuchMethod' implementation is guaranteed to throw an "
"exception. The generated code will be smaller if it is "
- "rewritten.", howToFix: "Rewrite to "
+ "rewritten.",
+ howToFix: "Rewrite to "
"'noSuchMethod(Invocation i) => super.noSuchMethod(i);'.");
static const MessageKind COMPLEX_THROWING_NSM = const MessageKind(
@@ -2559,7 +2630,9 @@ class Message {
arguments.forEach((key, value) {
message = message.replaceAll('#{${key}}', convertToString(value));
});
- assert(invariant(CURRENT_ELEMENT_SPANNABLE, kind == MessageKind.GENERIC ||
+ assert(invariant(
+ CURRENT_ELEMENT_SPANNABLE,
+ kind == MessageKind.GENERIC ||
!message.contains(new RegExp(r'#\{.+\}')),
message: 'Missing arguments in error message: "$message"'));
if (!terse && kind.hasHowToFix) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment