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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.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: 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
Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
index 16db33f6435e91afe5a9bdfa3d447dd39f2db998..d71ad086913c7c355b94b702f3e8a053dbd2c45f 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
@@ -34,8 +34,8 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
return namer.nameParameter(node);
}
- String visitClosureVariable(ClosureVariable node) {
- return namer.nameClosureVariable(node);
+ String visitMutableVariable(MutableVariable node) {
+ return namer.nameMutableVariable(node);
}
/// Main entry point for creating a [String] from a [Node]. All recursive
@@ -101,6 +101,13 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
return '$indentation($LetCont ($conts)\n$body)';
}
+ String visitLetMutable(LetMutable node) {
+ String name = visit(node.variable);
+ String value = access(node.value);
+ String body = indentBlock(() => visit(node.body));
+ return '$indentation(LetMutable ($name $value)\n$body)';
+ }
+
String formatArguments(Invoke node) {
int positionalArgumentCount = node.selector.positionalArgumentCount;
List<String> args = new List<String>();
@@ -194,16 +201,14 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
return '(Unexpected Continuation)';
}
- String visitGetClosureVariable(GetClosureVariable node) {
- namer.nameClosureVariableIfAbsent(node.variable.definition);
- return '(GetClosureVariable ${access(node.variable)})';
+ String visitGetMutableVariable(GetMutableVariable node) {
+ return '(${node.runtimeType} ${access(node.variable)})';
asgerf 2015/02/03 10:27:31 What karl said about runtimeType, unless we're cer
Kevin Millikin (Google) 2015/02/03 14:11:49 I had thought that the entire file was unused, but
}
- String visitSetClosureVariable(SetClosureVariable node) {
- namer.nameClosureVariableIfAbsent(node.variable.definition);
+ String visitSetMutableVariable(SetMutableVariable node) {
String value = access(node.value);
String body = indentBlock(() => visit(node.body));
- return '$indentation(SetClosureVariable ${access(node.variable)} '
+ return '$indentation(${node.runtimeType} ${access(node.variable)} '
'$value\n$body)';
}
@@ -226,9 +231,9 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
}
String visitDeclareFunction(DeclareFunction node) {
+ String name = visit(node.variable);
String function = indentBlock(() => visit(node.definition));
String body = indentBlock(() => visit(node.body));
- String name = namer.getName(node.variable.definition);
return '$indentation(DeclareFunction $name =\n'
'$function in\n'
'$body)';
@@ -348,17 +353,11 @@ class _Namer {
return _names[parameter] = parameter.hint.name;
}
- String nameClosureVariable(ClosureVariable variable) {
+ String nameMutableVariable(MutableVariable variable) {
assert(!_names.containsKey(variable));
return _names[variable] = variable.hint.name;
}
- String nameClosureVariableIfAbsent(ClosureVariable variable) {
karlklose 2015/02/03 09:56:16 is this dead code now?
Kevin Millikin (Google) 2015/02/03 14:11:49 Yes.
- if (!_names.containsKey(variable)) {
- _names[variable] = variable.hint.name;
- }
- }
-
String nameContinuation(Continuation node) {
assert(!_names.containsKey(node));
return _names[node] = 'k${_continuationCounter++}';

Powered by Google App Engine
This is Rietveld 408576698