Index: pkg/compiler/lib/src/ssa/builder.dart |
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart |
index 068c836ceb74564cd907b764134fc9c43f7f5988..dea6da6f8cc2a35a6ed92750e30cb16b8b7fcd57 100644 |
--- a/pkg/compiler/lib/src/ssa/builder.dart |
+++ b/pkg/compiler/lib/src/ssa/builder.dart |
@@ -1632,15 +1632,9 @@ class SsaBuilder extends ast.Visitor |
var emptyParameters = parameters.values.where((p) => |
p.instructionType.isEmpty && !p.instructionType.isNullable); |
if (emptyParameters.length > 0) { |
- String message = compiler.enableMinification |
- ? 'unreachable' |
- : 'unreachable: ${functionElement} because: ${emptyParameters}'; |
- // TODO(sra): Use a library function that throws a proper error object. |
- push(new HForeignCode( |
- js.js.parseForeignJS('throw "$message"'), |
- backend.dynamicType, |
- <HInstruction>[], |
- isStatement: true)); |
+ addComment('${emptyParameters} inferred as [empty]'); |
+ pushInvokeStatic(function.body, backend.assertUnreachableMethod, []); |
+ pop(); |
return closeFunction(); |
} |
} |
@@ -1648,6 +1642,19 @@ class SsaBuilder extends ast.Visitor |
return closeFunction(); |
} |
+ /// Adds a JavaScript comment to the output. The comment will be omitted in |
+ /// minified mode. Each line in [text] is preceded with `//` and indented. |
+ /// Use sparingly. In order for the comment to be retained it is modeled as |
+ /// having side effects which will inhibit code motion. |
+ // TODO(sra): Figure out how to keep comment anchored without effects. |
+ void addComment(String text) { |
+ add(new HForeignCode( |
+ js.js.statementTemplateYielding(new js.Comment(text)), |
+ backend.dynamicType, |
+ <HInstruction>[], |
+ isStatement: true)); |
+ } |
+ |
HGraph buildCheckedSetter(VariableElement field) { |
openFunction(field, field.node); |
HInstruction thisInstruction = localsHandler.readThis(); |