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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart

Issue 1068243002: Overhaul tree IR visitor and rename IR classes. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.ir_nodes_sexpr; 5 library dart2js.ir_nodes_sexpr;
6 6
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../util/util.dart'; 8 import '../util/util.dart';
9 import 'cps_ir_nodes.dart'; 9 import 'cps_ir_nodes.dart';
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 String thisParameter = formatThisParameter(node.thisParameter); 55 String thisParameter = formatThisParameter(node.thisParameter);
56 String parameters = node.parameters.map(visit).join(' '); 56 String parameters = node.parameters.map(visit).join(' ');
57 String body = visit(node.body); 57 String body = visit(node.body);
58 return '$indentation' 58 return '$indentation'
59 '(FunctionDefinition $name $thisParameter ($parameters) return\n' 59 '(FunctionDefinition $name $thisParameter ($parameters) return\n'
60 '$body)'; 60 '$body)';
61 } 61 }
62 62
63 String visitFieldDefinition(FieldDefinition node) { 63 String visitFieldDefinition(FieldDefinition node) {
64 String name = node.element.name; 64 String name = node.element.name;
65 if (node.hasInitializer) { 65 if (node.body != null) {
66 String body = visit(node.body); 66 String body = visit(node.body);
67 return '$indentation(FieldDefinition $name () return\n' 67 return '$indentation(FieldDefinition $name () return\n'
68 '$body)'; 68 '$body)';
69 } else { 69 } else {
70 return '$indentation(FieldDefinition $name)'; 70 return '$indentation(FieldDefinition $name)';
71 } 71 }
72 } 72 }
73 73
74 String visitConstructorDefinition(ConstructorDefinition node) { 74 String visitConstructorDefinition(ConstructorDefinition node) {
75 String name = node.element.name; 75 String name = node.element.name;
(...skipping 28 matching lines...) Expand all
104 104
105 String visitSuperInitializer(SuperInitializer node) { 105 String visitSuperInitializer(SuperInitializer node) {
106 String target = node.target.name; 106 String target = node.target.name;
107 String selector = node.selector.name; 107 String selector = node.selector.name;
108 String arguments = 108 String arguments =
109 indentBlock(() => 109 indentBlock(() =>
110 indentBlock(() => node.arguments.map(visit).join('\n'))); 110 indentBlock(() => node.arguments.map(visit).join('\n')));
111 return '$indentation(SuperInitializer $target $selector (\n$arguments)'; 111 return '$indentation(SuperInitializer $target $selector (\n$arguments)';
112 } 112 }
113 113
114 String visitRunnableBody(RunnableBody node) { 114 String visitBody(Body node) {
115 namer.setReturnContinuation(node.returnContinuation); 115 namer.setReturnContinuation(node.returnContinuation);
116 return indentBlock(() => visit(node.body)); 116 return indentBlock(() => visit(node.body));
117 } 117 }
118 118
119 String visitLetPrim(LetPrim node) { 119 String visitLetPrim(LetPrim node) {
120 String name = newValueName(node.primitive); 120 String name = newValueName(node.primitive);
121 String value = visit(node.primitive); 121 String value = visit(node.primitive);
122 String body = indentBlock(() => visit(node.body)); 122 String body = indentBlock(() => visit(node.body));
123 return '$indentation(LetPrim ($name $value)\n$body)'; 123 return '$indentation(LetPrim ($name $value)\n$body)';
124 } 124 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 void setReturnContinuation(Continuation node) { 467 void setReturnContinuation(Continuation node) {
468 assert(!_names.containsKey(node) || _names[node] == 'return'); 468 assert(!_names.containsKey(node) || _names[node] == 'return');
469 _names[node] = 'return'; 469 _names[node] = 'return';
470 } 470 }
471 471
472 String getName(Node node) { 472 String getName(Node node) {
473 assert(_names.containsKey(node)); 473 assert(_names.containsKey(node));
474 return _names[node]; 474 return _names[node];
475 } 475 }
476 } 476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698