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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/dart_printer.dart

Issue 366853007: dart2dart: Support for inner functions in new IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: SVN rebase Created 6 years, 5 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 // TODO(asgerf): Include metadata. 5 // TODO(asgerf): Include metadata.
6 // TODO(asgerf): Include cascade operator. 6 // TODO(asgerf): Include cascade operator.
7 library dart_printer; 7 library dart_printer;
8 8
9 import '../dart2jslib.dart' as dart2js; 9 import '../dart2jslib.dart' as dart2js;
10 import '../tree/tree.dart' as tree; 10 import '../tree/tree.dart' as tree;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 final String name; 233 final String name;
234 final Expression initializer; 234 final Expression initializer;
235 235
236 elements.Element element; 236 elements.Element element;
237 237
238 VariableDeclaration(this.name, [this.initializer]); 238 VariableDeclaration(this.name, [this.initializer]);
239 } 239 }
240 240
241 241
242 class FunctionDeclaration extends Statement { 242 class FunctionDeclaration extends Statement {
243 final TypeAnnotation returnType; 243 final FunctionExpression function;
244 final Parameters parameters;
245 final String name;
246 final Statement body;
247 244
248 FunctionDeclaration(this.name, 245 TypeAnnotation get returnType => function.returnType;
249 this.parameters, 246 Parameters get parameters => function.parameters;
250 this.body, 247 String get name => function.name;
251 [ this.returnType ]); 248 Statement get body => function.body;
249
250 FunctionDeclaration(this.function);
252 } 251 }
253 252
254 class Parameters extends Node { 253 class Parameters extends Node {
255 final List<Parameter> requiredParameters; 254 final List<Parameter> requiredParameters;
256 final List<Parameter> optionalParameters; 255 final List<Parameter> optionalParameters;
257 final bool hasNamedParameters; 256 final bool hasNamedParameters;
258 257
259 Parameters(this.requiredParameters, 258 Parameters(this.requiredParameters,
260 [ this.optionalParameters, 259 [ this.optionalParameters,
261 this.hasNamedParameters = false ]); 260 this.hasNamedParameters = false ]);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 /// True if this is a function parameter. 295 /// True if this is a function parameter.
297 bool get isFunction => parameters != null; 296 bool get isFunction => parameters != null;
298 297
299 // TODO(asgerf): Support modifiers on parameters (final, ...). 298 // TODO(asgerf): Support modifiers on parameters (final, ...).
300 } 299 }
301 300
302 // EXPRESSIONS 301 // EXPRESSIONS
303 302
304 class FunctionExpression extends Expression { 303 class FunctionExpression extends Expression {
305 final TypeAnnotation returnType; 304 final TypeAnnotation returnType;
306 final String name; 305 String name;
307 final Parameters parameters; 306 final Parameters parameters;
308 final Statement body; 307 final Statement body;
309 308
310 elements.FunctionElement element; 309 elements.FunctionElement element;
311 310
312 FunctionExpression(this.parameters, 311 FunctionExpression(this.parameters,
313 this.body, 312 this.body,
314 { this.name, 313 { this.name,
315 this.returnType }) { 314 this.returnType }) {
316 // Function must have a name if it has a return type 315 // Function must have a name if it has a return type
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 final StringChunk previous; 1532 final StringChunk previous;
1534 final tree.StringQuoting quoting; 1533 final tree.StringQuoting quoting;
1535 num cost; 1534 num cost;
1536 1535
1537 OpenStringChunk(this.previous, this.quoting, this.cost); 1536 OpenStringChunk(this.previous, this.quoting, this.cost);
1538 1537
1539 StringChunk end(int endIndex) { 1538 StringChunk end(int endIndex) {
1540 return new StringChunk(previous, quoting, endIndex); 1539 return new StringChunk(previous, quoting, endIndex);
1541 } 1540 }
1542 } 1541 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698