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

Side by Side Diff: pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart

Issue 726543002: Add support for local variables(including parameters) to cps->js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 1 month 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 backend_ast_emitter; 5 library backend_ast_emitter;
6 6
7 import '../tree_ir/tree_ir_nodes.dart' as tree; 7 import '../tree_ir/tree_ir_nodes.dart' as tree;
8 import 'backend_ast_nodes.dart'; 8 import 'backend_ast_nodes.dart';
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 : this.parent = parent, 70 : this.parent = parent,
71 usedVariableNames = parent.usedVariableNames; 71 usedVariableNames = parent.usedVariableNames;
72 72
73 FunctionExpression emit(tree.FunctionDefinition definition) { 73 FunctionExpression emit(tree.FunctionDefinition definition) {
74 functionElement = definition.element; 74 functionElement = definition.element;
75 75
76 Parameters parameters = emitRootParameters(definition); 76 Parameters parameters = emitRootParameters(definition);
77 77
78 // Declare parameters. 78 // Declare parameters.
79 for (tree.Variable param in definition.parameters) { 79 for (tree.Variable param in definition.parameters) {
80 variableNames[param] = param.element.name; 80 getVariableName(param);
81 usedVariableNames.add(param.element.name);
82 declaredVariables.add(param); 81 declaredVariables.add(param);
83 } 82 }
84 83
85 Statement body; 84 Statement body;
86 if (definition.isAbstract) { 85 if (definition.isAbstract) {
87 body = new EmptyStatement(); 86 body = new EmptyStatement();
88 } else { 87 } else {
89 firstStatement = definition.body; 88 firstStatement = definition.body;
90 visitStatement(definition.body); 89 visitStatement(definition.body);
91 removeTrailingReturn(); 90 removeTrailingReturn();
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null); 909 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null);
911 910
912 ExecutableElement get executableContext => enclosingElement; 911 ExecutableElement get executableContext => enclosingElement;
913 912
914 ExecutableElement get memberContext => executableContext.memberContext; 913 ExecutableElement get memberContext => executableContext.memberContext;
915 914
916 bool get isLocal => true; 915 bool get isLocal => true;
917 916
918 LibraryElement get implementationLibrary => enclosingElement.library; 917 LibraryElement get implementationLibrary => enclosingElement.library;
919 } 918 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698