| Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| index 2065bd64fc186afc3953643c15c560a1c54773bc..925ea87522b3f7cf0274ccb61b3230c39974e147 100644
|
| --- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| +++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| @@ -1290,8 +1290,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| void visitThen(),
|
| void visitElse(),
|
| SourceInformation sourceInformation}) {
|
| - SsaBranchBuilder branchBuilder = new SsaBranchBuilder(
|
| - this, node == null ? node : astAdapter.getNode(node));
|
| + SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this,
|
| + node == null ? node : _elementMap.getSpannable(targetElement, node));
|
| branchBuilder.handleIf(visitCondition, visitThen, visitElse,
|
| sourceInformation: sourceInformation);
|
| }
|
| @@ -1740,7 +1740,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| caseHandlers.add(locals);
|
| });
|
| jumpHandler.forEachContinue((HContinue instruction, LocalsHandler locals) {
|
| - assert(invariant(astAdapter.getNode(switchStatement), false,
|
| + assert(invariant(
|
| + _elementMap.getSpannable(targetElement, switchStatement), false,
|
| message: 'Continue cannot target a switch.'));
|
| });
|
| if (!isAborted()) {
|
| @@ -2298,7 +2299,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| handleJsStringConcat(invocation);
|
| } else {
|
| reporter.internalError(
|
| - astAdapter.getNode(invocation), "Unknown foreign: ${name}");
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| + "Unknown foreign: ${name}");
|
| }
|
| }
|
|
|
| @@ -2318,7 +2320,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| bool bad = false;
|
| if (arguments.types.isNotEmpty) {
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(invocation),
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| MessageKind.GENERIC,
|
| {'text': "Error: '${name()}' does not take type arguments."});
|
| bad = true;
|
| @@ -2327,7 +2329,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| String phrase = pluralizeArguments(minPositional);
|
| if (maxPositional != minPositional) phrase = 'at least $phrase';
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(invocation),
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| MessageKind.GENERIC,
|
| {'text': "Error: Too few arguments. '${name()}' takes $phrase."});
|
| bad = true;
|
| @@ -2336,14 +2338,14 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| String phrase = pluralizeArguments(maxPositional);
|
| if (maxPositional != minPositional) phrase = 'at most $phrase';
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(invocation),
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| MessageKind.GENERIC,
|
| {'text': "Error: Too many arguments. '${name()}' takes $phrase."});
|
| bad = true;
|
| }
|
| if (arguments.named.isNotEmpty) {
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(invocation),
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| MessageKind.GENERIC,
|
| {'text': "Error: '${name()}' does not take named arguments."});
|
| bad = true;
|
| @@ -2363,7 +2365,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| if (!instruction.isConstantString()) {
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(argument), MessageKind.GENERIC, {
|
| + _elementMap.getSpannable(targetElement, argument),
|
| + MessageKind.GENERIC, {
|
| 'text': "Error: Expected String constant as ${adjective}argument "
|
| "to '$methodName'."
|
| });
|
| @@ -2395,7 +2398,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| // for binding to methods.
|
| FunctionEntity target = _commonElements.currentIsolate;
|
| if (target == null) {
|
| - reporter.internalError(astAdapter.getNode(invocation),
|
| + reporter.internalError(
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| 'Isolate library and compiler mismatch.');
|
| }
|
| _pushStaticInvocation(target, <HInstruction>[], commonMasks.dynamicType);
|
| @@ -2420,7 +2424,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| // Call a helper method from the isolate library.
|
| FunctionEntity callInIsolate = _commonElements.callInIsolate;
|
| if (callInIsolate == null) {
|
| - reporter.internalError(astAdapter.getNode(invocation),
|
| + reporter.internalError(
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| 'Isolate library and compiler mismatch.');
|
| }
|
| _pushStaticInvocation(callInIsolate, inputs, commonMasks.dynamicType);
|
| @@ -2467,8 +2472,10 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| }
|
| }
|
|
|
| - reporter.reportErrorMessage(astAdapter.getNode(invocation),
|
| - MessageKind.GENERIC, {'text': "'$name' $problem."});
|
| + reporter.reportErrorMessage(
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| + MessageKind.GENERIC,
|
| + {'text': "'$name' $problem."});
|
| stack.add(graph.addConstantNull(closedWorld)); // Result expected on stack.
|
| return;
|
| }
|
| @@ -2522,7 +2529,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| }
|
|
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(argument),
|
| + _elementMap.getSpannable(targetElement, argument),
|
| MessageKind.GENERIC,
|
| {'text': 'Error: Expected a JsGetName enum value.'});
|
| // Result expected on stack.
|
| @@ -2542,7 +2549,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| native.NativeBehavior nativeBehavior =
|
| astAdapter.getNativeBehavior(invocation);
|
| - assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null,
|
| + assert(invariant(_elementMap.getSpannable(targetElement, invocation),
|
| + nativeBehavior != null,
|
| message: "No NativeBehavior for $invocation"));
|
|
|
| TypeMask ssaType =
|
| @@ -2570,7 +2578,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| }
|
| if (template == null) {
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(nameArgument),
|
| + _elementMap.getSpannable(targetElement, nameArgument),
|
| MessageKind.GENERIC,
|
| {'text': 'Error: Expected a JsBuiltin enum value.'});
|
| // Result expected on stack.
|
| @@ -2586,7 +2594,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| native.NativeBehavior nativeBehavior =
|
| astAdapter.getNativeBehavior(invocation);
|
| - assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null,
|
| + assert(invariant(_elementMap.getSpannable(targetElement, invocation),
|
| + nativeBehavior != null,
|
| message: "No NativeBehavior for $invocation"));
|
|
|
| TypeMask ssaType =
|
| @@ -2606,7 +2615,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| bool value = getFlagValue(name);
|
| if (value == null) {
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(invocation),
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| MessageKind.GENERIC,
|
| {'text': 'Error: Unknown internal flag "$name".'});
|
| } else {
|
| @@ -2638,7 +2647,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| }
|
| }
|
|
|
| - reporter.reportErrorMessage(astAdapter.getNode(invocation),
|
| + reporter.reportErrorMessage(
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
|
| stack.add(graph.addConstantNull(closedWorld));
|
| }
|
| @@ -2652,7 +2662,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| native.NativeBehavior nativeBehavior =
|
| astAdapter.getNativeBehaviorForJsCall(invocation);
|
| - assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null,
|
| + assert(invariant(_elementMap.getSpannable(targetElement, invocation),
|
| + nativeBehavior != null,
|
| message: "No NativeBehavior for $invocation"));
|
|
|
| List<HInstruction> inputs = <HInstruction>[];
|
| @@ -2663,7 +2674,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| if (nativeBehavior.codeTemplate.positionalArgumentCount != inputs.length) {
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(invocation), MessageKind.GENERIC, {
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| + MessageKind.GENERIC, {
|
| 'text': 'Mismatch between number of placeholders'
|
| ' and number of arguments.'
|
| });
|
| @@ -2674,7 +2686,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| if (native.HasCapturedPlaceholders.check(nativeBehavior.codeTemplate.ast)) {
|
| reporter.reportErrorMessage(
|
| - astAdapter.getNode(invocation), MessageKind.JS_PLACEHOLDER_CAPTURE);
|
| + _elementMap.getSpannable(targetElement, invocation),
|
| + MessageKind.JS_PLACEHOLDER_CAPTURE);
|
| }
|
|
|
| TypeMask ssaType =
|
| @@ -3096,7 +3109,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| HInstruction exception = rethrowableException;
|
| if (exception == null) {
|
| exception = graph.addConstantNull(closedWorld);
|
| - reporter.internalError(astAdapter.getNode(rethrowNode),
|
| + reporter.internalError(
|
| + _elementMap.getSpannable(targetElement, rethrowNode),
|
| 'rethrowableException should not be null.');
|
| }
|
| handleInTryStatement();
|
|
|