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

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

Issue 762213002: Support top-level field declaration and assignment in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years 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 '../util/util.dart'; 7 import '../util/util.dart';
8 import 'cps_ir_nodes.dart'; 8 import 'cps_ir_nodes.dart';
9 9
10 /// A [Decorator] is a function used by [SExpressionStringifier] to augment the 10 /// A [Decorator] is a function used by [SExpressionStringifier] to augment the
(...skipping 27 matching lines...) Expand all
38 String name = node.element.name; 38 String name = node.element.name;
39 namer.useReturnName(node.returnContinuation); 39 namer.useReturnName(node.returnContinuation);
40 String parameters = node.parameters.map(visit).join(' '); 40 String parameters = node.parameters.map(visit).join(' ');
41 String body = indentBlock(() => visit(node.body)); 41 String body = indentBlock(() => visit(node.body));
42 return '$indentation(FunctionDefinition $name ($parameters return)\n' 42 return '$indentation(FunctionDefinition $name ($parameters return)\n'
43 '$body)'; 43 '$body)';
44 } 44 }
45 45
46 String visitFieldDefinition(FieldDefinition node) { 46 String visitFieldDefinition(FieldDefinition node) {
47 String name = node.element.name; 47 String name = node.element.name;
48 namer.useReturnName(node.returnContinuation); 48 if (node.hasInitializer) {
49 String body = indentBlock(() => visit(node.body)); 49 namer.useReturnName(node.returnContinuation);
50 return '$indentation(FieldDefinition $name (return)\n' 50 String body = indentBlock(() => visit(node.body));
51 '$body)'; 51 return '$indentation(FieldDefinition $name (return)\n'
52 '$body)';
53 } else {
54 return '$indentation(FieldDefinition $name)';
55 }
52 } 56 }
53 57
54 String visitLetPrim(LetPrim node) { 58 String visitLetPrim(LetPrim node) {
55 String name = newValueName(node.primitive); 59 String name = newValueName(node.primitive);
56 String value = visit(node.primitive); 60 String value = visit(node.primitive);
57 String body = visit(node.body); 61 String body = visit(node.body);
58 return '$indentation(LetPrim $name $value)\n$body'; 62 return '$indentation(LetPrim $name $value)\n$body';
59 } 63 }
60 64
61 String visitLetCont(LetCont node) { 65 String visitLetCont(LetCont node) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 String useReturnName(Continuation node) { 240 String useReturnName(Continuation node) {
237 assert(!_names.containsKey(node) || _names[node] == 'return'); 241 assert(!_names.containsKey(node) || _names[node] == 'return');
238 return _names[node] = 'return'; 242 return _names[node] = 'return';
239 } 243 }
240 244
241 String getName(Node node) { 245 String getName(Node node) {
242 assert(_names.containsKey(node)); 246 assert(_names.containsKey(node));
243 return _names[node]; 247 return _names[node];
244 } 248 }
245 } 249 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698