Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1092023002: CPS implementation of throw and rethrow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index a0fb612a58386c835b435fd0df6fdb595739bdaa..9985c94238817fc53740c5e4128d485febf25762 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -1764,13 +1764,15 @@ abstract class IrBuilder {
LocalVariableElement exceptionVariable =
catchClauseInfo.exceptionVariable;
ir.Parameter exceptionParameter = new ir.Parameter(exceptionVariable);
- catchBuilder.environment.extend(exceptionVariable, exceptionParameter);
+ catchBuilder.declareLocalVariable(exceptionVariable,
Kevin Millikin (Google) 2015/04/17 09:52:10 It is necessary to 'declare' these parameters in c
+ initialValue: exceptionParameter);
ir.Parameter traceParameter;
LocalVariableElement stackTraceVariable =
catchClauseInfo.stackTraceVariable;
if (stackTraceVariable != null) {
traceParameter = new ir.Parameter(stackTraceVariable);
- catchBuilder.environment.extend(stackTraceVariable, traceParameter);
+ catchBuilder.declareLocalVariable(stackTraceVariable,
+ initialValue: traceParameter);
} else {
// Use a dummy continuation parameter for the stack trace parameter.
// This will ensure that all handlers have two parameters and so they
@@ -1881,6 +1883,23 @@ abstract class IrBuilder {
return false;
}
+ void buildThrow(ir.Primitive value) {
+ assert(isOpen);
+ add(new ir.Throw(value));
+ _current = null;
+ }
+
+ ir.Primitive buildNonTailThrow(ir.Primitive value) {
+ assert(isOpen);
+ return addPrimitive(new ir.NonTailThrow(value));
+ }
+
+ void buildRethrow() {
+ assert(isOpen);
+ add(new ir.Rethrow());
asgerf 2015/04/17 10:33:01 I would imagine this needs a reference to the exce
Kevin Millikin (Google) 2015/04/17 11:17:07 It will be translated by the unsugar pass to 'thro
+ _current = null;
+ }
+
/// Create a negation of [condition].
ir.Primitive buildNegation(ir.Primitive condition) {
// ! e is translated as e ? false : true
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698