| Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| index 2a4480e135dbdf4d73467d417e313f8e611b956d..e0388d2666f5da106c86665e614b9c33403149ab 100644
|
| --- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| @@ -51,7 +51,7 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| /// Stacks whose top element is the current target of an unlabeled break
|
| /// or continue. For continues, this is the loop node itself.
|
| final tree_ir.FallthroughStack shortBreak = new tree_ir.FallthroughStack();
|
| - final tree_ir.FallthroughStack shortContinue =
|
| + final tree_ir.FallthroughStack shortContinue =
|
| new tree_ir.FallthroughStack();
|
|
|
| Set<tree_ir.Label> usedLabels = new Set<tree_ir.Label>();
|
| @@ -183,14 +183,18 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| visitExpression(node.elseExpression));
|
| }
|
|
|
| - js.Expression buildConstant(ConstantValue constant) {
|
| + js.Expression buildConstant(ConstantValue constant,
|
| + {SourceInformation sourceInformation}) {
|
| registry.registerCompileTimeConstant(constant);
|
| - return glue.constantReference(constant);
|
| + return glue.constantReference(constant)
|
| + .withSourceInformation(sourceInformation);
|
| }
|
|
|
| @override
|
| js.Expression visitConstant(tree_ir.Constant node) {
|
| - return buildConstant(node.value);
|
| + return buildConstant(
|
| + node.value,
|
| + sourceInformation: node.sourceInformation);
|
| }
|
|
|
| js.Expression compileConstant(ParameterElement parameter) {
|
| @@ -213,7 +217,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| registry.registerInstantiatedType(node.type);
|
| FunctionElement target = node.target;
|
| List<js.Expression> arguments = visitExpressionList(node.arguments);
|
| - return buildStaticInvoke(target, arguments);
|
| + return buildStaticInvoke(
|
| + target, arguments, sourceInformation: node.sourceInformation);
|
| }
|
|
|
| void registerMethodInvoke(tree_ir.InvokeMethod node) {
|
| @@ -240,7 +245,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| registerMethodInvoke(node);
|
| return js.propertyCall(visitExpression(node.receiver),
|
| glue.invocationName(node.selector),
|
| - visitExpressionList(node.arguments));
|
| + visitExpressionList(node.arguments))
|
| + .withSourceInformation(node.sourceInformation);
|
| }
|
|
|
| @override
|
| @@ -260,13 +266,15 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| return js.js('#.#(#)',
|
| [visitExpression(node.receiver),
|
| glue.instanceMethodName(node.target),
|
| - visitExpressionList(node.arguments)]);
|
| + visitExpressionList(node.arguments)])
|
| + .withSourceInformation(node.sourceInformation);
|
| }
|
| return js.js('#.#.call(#, #)',
|
| [glue.prototypeAccess(node.target.enclosingClass),
|
| glue.invocationName(node.selector),
|
| visitExpression(node.receiver),
|
| - visitExpressionList(node.arguments)]);
|
| + visitExpressionList(node.arguments)])
|
| + .withSourceInformation(node.sourceInformation);
|
| }
|
|
|
| @override
|
| @@ -425,7 +433,7 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| } else if (isEffectiveBreakTarget(node, shortBreak.target)) {
|
| // Unlabeled break to the break target or to an equivalent break.
|
| shortBreak.use();
|
| - accumulator.add(new js.Break(null));
|
| + accumulator.add(new js.Break(null));
|
| } else {
|
| usedLabels.add(node.target);
|
| accumulator.add(new js.Break(node.target.name));
|
| @@ -547,7 +555,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| registry.registerCompileTimeConstant(new NullConstantValue());
|
| fallthrough.use();
|
| } else {
|
| - accumulator.add(new js.Return(visitExpression(node.value)));
|
| + accumulator.add(new js.Return(visitExpression(node.value))
|
| + .withSourceInformation(node.sourceInformation));
|
| }
|
| }
|
|
|
| @@ -596,7 +605,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| }
|
| js.Expression instance = new js.New(
|
| glue.constructorAccess(classElement),
|
| - visitExpressionList(node.arguments));
|
| + visitExpressionList(node.arguments))
|
| + .withSourceInformation(node.sourceInformation);
|
|
|
| List<tree_ir.Expression> typeInformation = node.typeInformation;
|
| assert(typeInformation.isEmpty ||
|
| @@ -606,7 +616,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| js.Expression typeArguments = new js.ArrayInitializer(
|
| visitExpressionList(typeInformation));
|
| return buildStaticHelperInvocation(helper,
|
| - <js.Expression>[instance, typeArguments]);
|
| + <js.Expression>[instance, typeArguments],
|
| + sourceInformation: node.sourceInformation);
|
| } else {
|
| return instance;
|
| }
|
| @@ -704,19 +715,25 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| visitExpression(node.value)]);
|
| }
|
|
|
| - js.Expression buildStaticHelperInvocation(FunctionElement helper,
|
| - List<js.Expression> arguments) {
|
| + js.Expression buildStaticHelperInvocation(
|
| + FunctionElement helper,
|
| + List<js.Expression> arguments,
|
| + {SourceInformation sourceInformation}) {
|
| registry.registerStaticUse(helper);
|
| - return buildStaticInvoke(helper, arguments);
|
| + return buildStaticInvoke(
|
| + helper, arguments, sourceInformation: sourceInformation);
|
| }
|
|
|
| @override
|
| js.Expression visitReifyRuntimeType(tree_ir.ReifyRuntimeType node) {
|
| - FunctionElement createType = glue.getCreateRuntimeType();
|
| - FunctionElement typeToString = glue.getRuntimeTypeToString();
|
| - return buildStaticHelperInvocation(createType,
|
| - [buildStaticHelperInvocation(typeToString,
|
| - [visitExpression(node.value)])]);
|
| + js.Expression typeToString = buildStaticHelperInvocation(
|
| + glue.getRuntimeTypeToString(),
|
| + [visitExpression(node.value)],
|
| + sourceInformation: node.sourceInformation);
|
| + return buildStaticHelperInvocation(
|
| + glue.getCreateRuntimeType(),
|
| + [typeToString],
|
| + sourceInformation: node.sourceInformation);
|
| }
|
|
|
| @override
|
| @@ -727,11 +744,13 @@ class CodeGenerator extends tree_ir.StatementVisitor
|
| js.Expression typeName = glue.getRuntimeTypeName(context);
|
| return buildStaticHelperInvocation(
|
| glue.getRuntimeTypeArgument(),
|
| - [visitExpression(node.target), typeName, index]);
|
| + [visitExpression(node.target), typeName, index],
|
| + sourceInformation: node.sourceInformation);
|
| } else {
|
| return buildStaticHelperInvocation(
|
| glue.getTypeArgumentByIndex(),
|
| - [visitExpression(node.target), index]);
|
| + [visitExpression(node.target), index],
|
| + sourceInformation: node.sourceInformation);
|
| }
|
| }
|
|
|
|
|