mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
dart2js-kernel: Emit error trap for unimplemented features
The test will fail with an error like the following, rather than proceed with an incorrect null value. R=efortuna@google.com Review URL: https://codereview.chromium.org/2540363002 . TypeError: Cannot read property 'Unhandled ir.FunctionExpression (dynamic x) → dynamic => x' of null
This commit is contained in:
parent
b8d3758dcd
commit
ece7725d90
|
@ -380,8 +380,17 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void defaultExpression(ir.Expression expression) {
|
void defaultExpression(ir.Expression expression) {
|
||||||
// TODO(het): This is only to get tests working
|
// TODO(het): This is only to get tests working.
|
||||||
stack.add(graph.addConstantNull(compiler));
|
String message = 'Unhandled ir.${expression.runtimeType} $expression';
|
||||||
|
HInstruction nullValue = graph.addConstantNull(compiler);
|
||||||
|
HInstruction errorMessage =
|
||||||
|
graph.addConstantString(new DartString.literal(message), compiler);
|
||||||
|
HInstruction trap = new HForeignCode(
|
||||||
|
js.js.parseForeignJS("#.#"),
|
||||||
|
backend.dynamicType,
|
||||||
|
<HInstruction>[nullValue, errorMessage]);
|
||||||
|
trap.sideEffects..setAllSideEffects()..setDependsOnSomething();
|
||||||
|
push(trap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the current source element.
|
/// Returns the current source element.
|
||||||
|
|
Loading…
Reference in a new issue