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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree_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: 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 library dart_tree_printer; 5 library dart_tree_printer;
6 6
7 import 'dart_printer.dart'; 7 import 'dart_printer.dart';
8 import '../tree/tree.dart' as tree; 8 import '../tree/tree.dart' as tree;
9 import '../scanner/scannerlib.dart'; 9 import '../scanner/scannerlib.dart';
10 import '../util/util.dart'; 10 import '../util/util.dart';
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 } else { 672 } else {
673 left = makeVariableDeclarations(stmt.leftHandValue); 673 left = makeVariableDeclarations(stmt.leftHandValue);
674 } 674 }
675 return new tree.ForIn( 675 return new tree.ForIn(
676 left, 676 left,
677 makeExpression(stmt.expression), 677 makeExpression(stmt.expression),
678 makeStatement(stmt.body, shortIf: shortIf), 678 makeStatement(stmt.body, shortIf: shortIf),
679 forToken, 679 forToken,
680 inToken); 680 inToken);
681 } else if (stmt is FunctionDeclaration) { 681 } else if (stmt is FunctionDeclaration) {
682 return new tree.FunctionDeclaration(new tree.FunctionExpression( 682 tree.FunctionExpression function = new tree.FunctionExpression(
683 stmt.name != null ? makeIdentifier(stmt.name) : null, 683 stmt.name != null ? makeIdentifier(stmt.name) : null,
684 makeParameters(stmt.parameters), 684 makeParameters(stmt.parameters),
685 makeFunctionBody(stmt.body), 685 makeFunctionBody(stmt.body),
686 stmt.returnType != null ? makeType(stmt.returnType) : null, 686 stmt.returnType != null ? makeType(stmt.returnType) : null,
687 makeEmptyModifiers(), // TODO(asgerf): Function modifiers? 687 makeEmptyModifiers(), // TODO(asgerf): Function modifiers?
688 null, // initializers 688 null, // initializers
689 null)); // get/set 689 null); // get/set
690 setElement(function, stmt.function.element, stmt);
691 return new tree.FunctionDeclaration(function);
690 } else if (stmt is If) { 692 } else if (stmt is If) {
691 if (stmt.elseStatement == null || isEmptyStatement(stmt.elseStatement)) { 693 if (stmt.elseStatement == null || isEmptyStatement(stmt.elseStatement)) {
692 tree.Node node = new tree.If( 694 tree.Node node = new tree.If(
693 parenthesize(makeExpression(stmt.condition)), 695 parenthesize(makeExpression(stmt.condition)),
694 makeStatement(stmt.thenStatement), 696 makeStatement(stmt.thenStatement),
695 null, // else statement 697 null, // else statement
696 ifToken, 698 ifToken,
697 null); // else token 699 null); // else token
698 if (shortIf) 700 if (shortIf)
699 return node; 701 return node;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 printStringChunk(chunk.previous), 1010 printStringChunk(chunk.previous),
1009 node); 1011 node);
1010 } else { 1012 } else {
1011 return node; 1013 return node;
1012 } 1014 }
1013 } 1015 }
1014 return printStringChunk(output.chunk); 1016 return printStringChunk(output.chunk);
1015 } 1017 }
1016 1018
1017 } 1019 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698