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

Unified Diff: tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart

Issue 898463002: Rename ClosureVariable, use separate IR forms for declaration and assignment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 5 years, 11 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 | « tests/compiler/dart2js/backend_dart/sexpr_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart
diff --git a/tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart b/tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart
index 7527102f7e17030f0bc805853825cf382f3f9cef..1f2f263a989f4217c745fd512af131babba5891c 100644
--- a/tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart
+++ b/tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart
@@ -124,13 +124,14 @@ class SExpressionUnstringifier {
static const String INVOKE_METHOD = "InvokeMethod";
static const String LET_PRIM = "LetPrim";
static const String LET_CONT = "LetCont";
- static const String SET_CLOSURE_VARIABLE = "SetClosureVariable";
+ static const String LET_MUTABLE = "LetMutable";
+ static const String SET_MUTABLE_VARIABLE = "SetMutableVariable";
static const String TYPE_OPERATOR = "TypeOperator";
// Primitives
static const String CONSTANT = "Constant";
static const String CREATE_FUNCTION = "CreateFunction";
- static const String GET_CLOSURE_VARIABLE = "GetClosureVariable";
+ static const String GET_MUTABLE_VARIABLE = "GetMutableVariable";
static const String LITERAL_LIST = "LiteralList";
static const String LITERAL_MAP = "LiteralMap";
static const String REIFY_TYPE_VAR = "ReifyTypeVar";
@@ -230,8 +231,10 @@ class SExpressionUnstringifier {
return parseLetPrim();
case LET_CONT:
return parseLetCont();
- case SET_CLOSURE_VARIABLE:
- return parseSetClosureVariable();
+ case LET_MUTABLE:
+ return parseLetMutable();
+ case SET_MUTABLE_VARIABLE:
+ return parseSetMutableVariable();
case TYPE_OPERATOR:
return parseTypeOperator();
default:
@@ -336,7 +339,7 @@ class SExpressionUnstringifier {
tokens.consumeStart(DECLARE_FUNCTION);
// name =
- ClosureVariable local = getClosureVariable(tokens.read());
+ MutableVariable local = addMutableVariable(tokens.read());
tokens.read("=");
// function in
@@ -490,19 +493,33 @@ class SExpressionUnstringifier {
return new LetCont.many(continuations, body);
}
- /// (SetClosureVariable name value body)
- SetClosureVariable parseSetClosureVariable() {
- tokens.consumeStart(SET_CLOSURE_VARIABLE);
+ /// (LetMutable (name value) body)
+ LetMutable parseLetMutable() {
+ tokens.consumeStart(LET_MUTABLE);
+ tokens.consumeStart();
String name = tokens.read();
- ClosureVariable local = getClosureVariable(name);
+ MutableVariable local = addMutableVariable(name);
+ Primitive value = name2variable[tokens.read()];
+ tokens.consumeEnd();
+
+ Expression body = parseExpression();
+ tokens.consumeEnd();
+ return new LetMutable(local, value)..plug(body);
+ }
+
+ /// (SetMutableVariable name value body)
+ SetMutableVariable parseSetMutableVariable() {
+ tokens.consumeStart(SET_MUTABLE_VARIABLE);
+
+ MutableVariable local = name2variable[tokens.read()];
Primitive value = name2variable[tokens.read()];
assert(value != null);
Expression body = parseExpression();
tokens.consumeEnd();
- return new SetClosureVariable(local, value)
+ return new SetMutableVariable(local, value)
..plug(body);
}
@@ -552,8 +569,8 @@ class SExpressionUnstringifier {
return parseConstant();
case CREATE_FUNCTION:
return parseCreateFunction();
- case GET_CLOSURE_VARIABLE:
- return parseGetClosureVariable();
+ case GET_MUTABLE_VARIABLE:
+ return parseGetMutableVariable();
case LITERAL_LIST:
return parseLiteralList();
case LITERAL_MAP:
@@ -637,24 +654,21 @@ class SExpressionUnstringifier {
return new CreateFunction(def);
}
- ClosureVariable getClosureVariable(String name) {
- if (!name2variable.containsKey(name)) {
- ClosureVariable variable =
- new ClosureVariable(new DummyElement(""), new DummyElement(name));
- name2variable[name] = variable;
- }
- return name2variable[name];
+ MutableVariable addMutableVariable(String name) {
+ assert(!name2variable.containsKey(name));
+ MutableVariable variable =
+ new MutableVariable(new DummyElement(""), new DummyElement(name));
+ name2variable[name] = variable;
+ return variable;
}
- /// (GetClosureVariable name)
- GetClosureVariable parseGetClosureVariable() {
- tokens.consumeStart(GET_CLOSURE_VARIABLE);
-
- String name = tokens.read();
- ClosureVariable local = getClosureVariable(name);
+ /// (GetMutableVariable name)
+ GetMutableVariable parseGetMutableVariable() {
+ tokens.consumeStart(GET_MUTABLE_VARIABLE);
+ MutableVariable local = name2variable[tokens.read()];
tokens.consumeEnd();
- return new GetClosureVariable(local);
+ return new GetMutableVariable(local);
}
/// (LiteralList (values))
« no previous file with comments | « tests/compiler/dart2js/backend_dart/sexpr_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698