| OLD | NEW |
| 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 import 'package:analyzer/src/generated/resolver.dart'; |
| 11 | 12 |
| 12 /** | 13 /** |
| 13 * Container for the elements and AST nodes which have been determined by | 14 * Container for the elements and AST nodes which have been determined by |
| 14 * tree shaking to be reachable by the program being compiled. | 15 * tree shaking to be reachable by the program being compiled. |
| 15 */ | 16 */ |
| 16 class ClosedWorld { | 17 class ClosedWorld { |
| 18 /// The core types of this world. |
| 19 final TypeProvider typeProvider; |
| 20 |
| 17 /// Returns the main function of this closed world compilation. | 21 /// Returns the main function of this closed world compilation. |
| 18 final FunctionElement mainFunction; | 22 final FunctionElement mainFunction; |
| 19 | 23 |
| 20 // TODO(paulberry): is it a problem to hold on to all the AST's for the | 24 // TODO(paulberry): is it a problem to hold on to all the AST's for the |
| 21 // duration of tree shaking & CPS generation? | 25 // duration of tree shaking & CPS generation? |
| 22 | 26 |
| 23 /** | 27 /** |
| 24 * Methods, toplevel functions, etc. that are reachable. | 28 * Methods, toplevel functions, etc. that are reachable. |
| 25 */ | 29 */ |
| 26 Map<ExecutableElement, Declaration> executableElements = | 30 Map<ExecutableElement, Declaration> executableElements = |
| (...skipping 15 matching lines...) Expand all Loading... |
| 42 | 46 |
| 43 /** | 47 /** |
| 44 * Classes that are instantiated from reachable code. | 48 * Classes that are instantiated from reachable code. |
| 45 * | 49 * |
| 46 * TODO(paulberry): Also keep track of classes that are reachable but not | 50 * TODO(paulberry): Also keep track of classes that are reachable but not |
| 47 * instantiated (because they are extended or mixed in) | 51 * instantiated (because they are extended or mixed in) |
| 48 */ | 52 */ |
| 49 Map<ClassElement, ClassDeclaration> instantiatedClasses = | 53 Map<ClassElement, ClassDeclaration> instantiatedClasses = |
| 50 new HashMap<ClassElement, ClassDeclaration>(); | 54 new HashMap<ClassElement, ClassDeclaration>(); |
| 51 | 55 |
| 52 ClosedWorld(this.mainFunction); | 56 ClosedWorld(this.typeProvider, this.mainFunction); |
| 53 } | 57 } |
| OLD | NEW |