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

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

Issue 886053003: dart2dart: Remove the list of closureVariables from FunctionDefinitions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Restore inadvertently removed code. 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 a23b683ab93de15589b97b4b087af1c92ed3b04d..16db33f6435e91afe5a9bdfa3d447dd39f2db998 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
@@ -35,7 +35,7 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
}
String visitClosureVariable(ClosureVariable node) {
- return namer.getName(node);
+ return namer.nameClosureVariable(node);
}
/// Main entry point for creating a [String] from a [Node]. All recursive
@@ -48,12 +48,10 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
String visitFunctionDefinition(FunctionDefinition node) {
String name = node.element.name;
namer.setReturnContinuation(node.body.returnContinuation);
- String closureVariables =
- node.closureVariables.map(namer.nameClosureVariable).join(' ');
String parameters = node.parameters.map(visit).join(' ');
String body = indentBlock(() => visit(node.body.body));
- return '$indentation(FunctionDefinition $name ($parameters) return'
- ' ($closureVariables)\n$body)';
+ return '$indentation(FunctionDefinition $name ($parameters) return\n'
+ '$body)';
}
String visitFieldDefinition(FieldDefinition node) {
@@ -197,13 +195,15 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
}
String visitGetClosureVariable(GetClosureVariable node) {
- return '(GetClosureVariable ${visit(node.variable.definition)})';
+ namer.nameClosureVariableIfAbsent(node.variable.definition);
+ return '(GetClosureVariable ${access(node.variable)})';
}
String visitSetClosureVariable(SetClosureVariable node) {
+ namer.nameClosureVariableIfAbsent(node.variable.definition);
String value = access(node.value);
String body = indentBlock(() => visit(node.body));
- return '$indentation(SetClosureVariable ${visit(node.variable.definition)} '
+ return '$indentation(SetClosureVariable ${access(node.variable)} '
'$value\n$body)';
}
@@ -249,7 +249,7 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
String visitGetField(GetField node) {
String object = access(node.object);
- String field = node.field.toString();
+ String field = node.field.name;
return '(GetField $object $field)';
}
@@ -270,7 +270,7 @@ class SExpressionStringifier extends Visitor<String> with Indentation {
}
String visitInterceptor(Interceptor node) {
- return '(Interceptor ${node.input})';
+ return '(Interceptor ${access(node.input)})';
}
}
@@ -353,6 +353,12 @@ class _Namer {
return _names[variable] = variable.hint.name;
}
+ String nameClosureVariableIfAbsent(ClosureVariable variable) {
+ if (!_names.containsKey(variable)) {
+ _names[variable] = variable.hint.name;
+ }
+ }
+
String nameContinuation(Continuation node) {
assert(!_names.containsKey(node));
return _names[node] = 'k${_continuationCounter++}';
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | tests/compiler/dart2js/backend_dart/opt_constprop_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698