Index: pkg/compiler/lib/src/ssa/nodes.dart |
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart |
index e5a6c7004327a5aa572019a39b0eb195d61dcb3f..d7be40ce86e154d05bd3188e2e6d6c6c29920e6e 100644 |
--- a/pkg/compiler/lib/src/ssa/nodes.dart |
+++ b/pkg/compiler/lib/src/ssa/nodes.dart |
@@ -1713,37 +1713,44 @@ abstract class HForeign extends HInstruction { |
class HForeignCode extends HForeign { |
final js.Template codeTemplate; |
final bool isStatement; |
- final bool _canThrow; |
final native.NativeBehavior nativeBehavior; |
+ native.NativeThrowBehavior throwBehavior; |
HForeignCode(this.codeTemplate, |
- TypeMask type, |
- List<HInstruction> inputs, |
- {this.isStatement: false, |
- SideEffects effects, |
- native.NativeBehavior nativeBehavior, |
- canThrow: false}) |
+ TypeMask type, |
+ List<HInstruction> inputs, |
+ {this.isStatement: false, |
+ SideEffects effects, |
+ native.NativeBehavior nativeBehavior, |
+ native.NativeThrowBehavior throwBehavior}) |
: this.nativeBehavior = nativeBehavior, |
- this._canThrow = canThrow, |
+ this.throwBehavior = throwBehavior, |
super(type, inputs) { |
- if(codeTemplate == null) throw this; |
+ assert(codeTemplate != null); |
if (effects == null && nativeBehavior != null) { |
effects = nativeBehavior.sideEffects; |
} |
+ if (this.throwBehavior == null) { |
+ this.throwBehavior = (nativeBehavior == null) |
+ ? native.NativeThrowBehavior.MAY |
+ : nativeBehavior.throwBehavior; |
+ } |
+ assert(this.throwBehavior != null); |
+ |
if (effects != null) sideEffects.add(effects); |
} |
- HForeignCode.statement(codeTemplate, List<HInstruction> inputs, |
- SideEffects effects, |
- native.NativeBehavior nativeBehavior, |
- TypeMask type) |
+ HForeignCode.statement(js.Template codeTemplate, List<HInstruction> inputs, |
+ SideEffects effects, |
+ native.NativeBehavior nativeBehavior, |
+ TypeMask type) |
: this(codeTemplate, type, inputs, isStatement: true, |
effects: effects, nativeBehavior: nativeBehavior); |
accept(HVisitor visitor) => visitor.visitForeignCode(this); |
bool isJsStatement() => isStatement; |
- bool canThrow() => _canThrow || super.canThrow(); |
+ bool canThrow() => throwBehavior.canThrow; |
} |
class HForeignNew extends HForeign { |