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

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

Issue 787603003: Generative constructors in the new dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, set element for constructors in frontend_ast_to_backend_ast, adjust status-file 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 28 matching lines...) Expand all
39 39
40 /// Main entry point for creating a [String] from a [Node]. All recursive 40 /// Main entry point for creating a [String] from a [Node]. All recursive
41 /// calls must go through this method. 41 /// calls must go through this method.
42 String visit(Node node) { 42 String visit(Node node) {
43 String s = super.visit(node); 43 String s = super.visit(node);
44 return (decorator == null) ? s : decorator(node, s); 44 return (decorator == null) ? s : decorator(node, s);
45 } 45 }
46 46
47 String visitFunctionDefinition(FunctionDefinition node) { 47 String visitFunctionDefinition(FunctionDefinition node) {
48 String name = node.element.name; 48 String name = node.element.name;
49 namer.useReturnName(node.returnContinuation); 49 namer.useReturnName(node.body.returnContinuation);
50 String closureVariables = node.closureVariables.isEmpty 50 String closureVariables = node.closureVariables.isEmpty
51 ? '' 51 ? ''
52 : '{${node.closureVariables.map(namer.defineClosureName).join(' ')}} '; 52 : '{${node.closureVariables.map(namer.defineClosureName).join(' ')}} ';
53 String parameters = node.parameters.map(visit).join(' '); 53 String parameters = node.parameters.map(visit).join(' ');
54 String body = indentBlock(() => visit(node.body)); 54 String body = indentBlock(() => visit(node.body.body));
55 return '$indentation(FunctionDefinition $name $closureVariables' 55 return '$indentation(FunctionDefinition $name $closureVariables'
56 '($parameters return)\n$body)'; 56 '($parameters return)\n$body)';
57 } 57 }
58 58
59 String visitFieldDefinition(FieldDefinition node) { 59 String visitFieldDefinition(FieldDefinition node) {
60 String name = node.element.name; 60 String name = node.element.name;
61 if (node.hasInitializer) { 61 if (node.hasInitializer) {
62 namer.useReturnName(node.returnContinuation); 62 namer.useReturnName(node.body.returnContinuation);
63 String body = indentBlock(() => visit(node.body)); 63 String body = indentBlock(() => visit(node.body.body));
64 return '$indentation(FieldDefinition $name (return)\n' 64 return '$indentation(FieldDefinition $name (return)\n'
65 '$body)'; 65 '$body)';
66 } else { 66 } else {
67 return '$indentation(FieldDefinition $name)'; 67 return '$indentation(FieldDefinition $name)';
68 } 68 }
69 } 69 }
70 70
71 String visitLetPrim(LetPrim node) { 71 String visitLetPrim(LetPrim node) {
72 String name = newValueName(node.primitive); 72 String name = newValueName(node.primitive);
73 String value = visit(node.primitive); 73 String value = visit(node.primitive);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 String useReturnName(Continuation node) { 259 String useReturnName(Continuation node) {
260 assert(!_names.containsKey(node) || _names[node] == 'return'); 260 assert(!_names.containsKey(node) || _names[node] == 'return');
261 return _names[node] = 'return'; 261 return _names[node] = 'return';
262 } 262 }
263 263
264 String getName(Node node) { 264 String getName(Node node) {
265 assert(_names.containsKey(node)); 265 assert(_names.containsKey(node));
266 return _names[node]; 266 return _names[node];
267 } 267 }
268 } 268 }
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