| 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++}';
|
|
|