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

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

Issue 658103003: Support map and list literals in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 backend_ast_emitter; 5 library backend_ast_emitter;
6 6
7 import 'tree_ir_nodes.dart' as tree; 7 import '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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 name = variable.element == null ? '$prefix$counter' : variable.element.name; 324 name = variable.element == null ? '$prefix$counter' : variable.element.name;
325 while (!usedVariableNames.add(name)) { 325 while (!usedVariableNames.add(name)) {
326 ++counter; 326 ++counter;
327 name = '$prefix$counter'; 327 name = '$prefix$counter';
328 } 328 }
329 variableNames[variable] = name; 329 variableNames[variable] = name;
330 330
331 // Synthesize an element for the variable 331 // Synthesize an element for the variable
332 if (variable.element == null || name != variable.element.name) { 332 if (variable.element == null || name != variable.element.name) {
333 // TODO(johnniwinther): Replace by synthetic [Entity]. 333 // TODO(johnniwinther): Replace by synthetic [Entity].
334 variable.element = new modelx.LocalVariableElementX.synthetic( 334 variable.element = new _SyntheticLocalVariableElement(
335 name, 335 name,
336 functionElement, 336 functionElement,
337 variableList); 337 variableList);
338 } 338 }
339 return name; 339 return name;
340 } 340 }
341 341
342 String getConstantName(VariableElement element) { 342 String getConstantName(VariableElement element) {
343 assert(element.kind == ElementKind.VARIABLE); 343 assert(element.kind == ElementKind.VARIABLE);
344 if (element.enclosingElement != functionElement) { 344 if (element.enclosingElement != functionElement) {
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 } 890 }
891 } 891 }
892 892
893 visitVariable(tree.Variable variable) { 893 visitVariable(tree.Variable variable) {
894 if (shadowedParameters.contains(variable)) { 894 if (shadowedParameters.contains(variable)) {
895 hasShadowedUse.add(variable); 895 hasShadowedUse.add(variable);
896 } 896 }
897 } 897 }
898 898
899 } 899 }
900
901 // TODO(johnniwinther): Remove this when the dart `backend_ast` does not need
902 // [Element] for entities.
903 class _SyntheticLocalVariableElement extends modelx.VariableElementX
904 implements LocalVariableElement {
905
906 _SyntheticLocalVariableElement(String name,
907 ExecutableElement enclosingElement,
908 modelx.VariableList variables)
909 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null);
910
911 ExecutableElement get executableContext => enclosingElement;
912
913 ExecutableElement get memberContext => executableContext.memberContext;
914
915 bool get isLocal => true;
916
917 LibraryElement get implementationLibrary => enclosingElement.library;
918 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698