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

Side by Side Diff: pkg/analyzer2dart/lib/src/closed_world.dart

Issue 548253003: First end-to-end capability in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 3 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 analyzer2dart.closedWorld; 5 library analyzer2dart.closedWorld;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
11 11
12 /** 12 /**
13 * Container for the elements and AST nodes which have been determined by 13 * Container for the elements and AST nodes which have been determined by
14 * tree shaking to be reachable by the program being compiled. 14 * tree shaking to be reachable by the program being compiled.
15 */ 15 */
16 class ClosedWorld { 16 class ClosedWorld {
17 /// Returns the main function of this closed world compilation.
18 final FunctionElement mainFunction;
19
17 // TODO(paulberry): is it a problem to hold on to all the AST's for the 20 // TODO(paulberry): is it a problem to hold on to all the AST's for the
18 // duration of tree shaking & CPS generation? 21 // duration of tree shaking & CPS generation?
19 22
20 /** 23 /**
21 * Methods, toplevel functions, etc. that are reachable. 24 * Methods, toplevel functions, etc. that are reachable.
22 */ 25 */
23 Map<ExecutableElement, Declaration> executableElements = 26 Map<ExecutableElement, Declaration> executableElements =
24 new HashMap<ExecutableElement, Declaration>(); 27 new HashMap<ExecutableElement, Declaration>();
25 28
26 /** 29 /**
27 * Fields that are reachable. 30 * Fields that are reachable.
28 */ 31 */
29 Map<FieldElement, VariableDeclaration> fields = 32 Map<FieldElement, VariableDeclaration> fields =
30 new HashMap<FieldElement, VariableDeclaration>(); 33 new HashMap<FieldElement, VariableDeclaration>();
31 34
32 /** 35 /**
33 * Classes that are instantiated from reachable code. 36 * Classes that are instantiated from reachable code.
34 * 37 *
35 * TODO(paulberry): Also keep track of classes that are reachable but not 38 * TODO(paulberry): Also keep track of classes that are reachable but not
36 * instantiated (because they are extended or mixed in) 39 * instantiated (because they are extended or mixed in)
37 */ 40 */
38 Map<ClassElement, ClassDeclaration> instantiatedClasses = 41 Map<ClassElement, ClassDeclaration> instantiatedClasses =
39 new HashMap<ClassElement, ClassDeclaration>(); 42 new HashMap<ClassElement, ClassDeclaration>();
40 43
41 ClosedWorld(); 44 ClosedWorld(this.mainFunction);
42 } 45 }
OLDNEW
« no previous file with comments | « pkg/analyzer2dart/bin/analyzer2dart.dart ('k') | pkg/analyzer2dart/lib/src/converted_world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698