| OLD | NEW | 
|---|
| 1 // Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Analysis to determine how to generate code for `LookupMap`s. | 5 /// Analysis to determine how to generate code for `LookupMap`s. | 
| 6 library compiler.src.js_backend.lookup_map_analysis; | 6 library compiler.src.js_backend.lookup_map_analysis; | 
| 7 | 7 | 
| 8 import '../common.dart'; | 8 import '../common.dart'; | 
| 9 import '../common/registry.dart' show Registry; | 9 import '../common/registry.dart' show Registry; | 
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 61 /// | 61 /// | 
| 62 ///   * Include all generic-type arguments, if the program uses type | 62 ///   * Include all generic-type arguments, if the program uses type | 
| 63 ///   variables in expressions such as `class A<T> { Type get extract => T }`. | 63 ///   variables in expressions such as `class A<T> { Type get extract => T }`. | 
| 64 /// | 64 /// | 
| 65 // TODO(sigmund): add support for const expressions, currently this | 65 // TODO(sigmund): add support for const expressions, currently this | 
| 66 // implementation only supports Type literals. To support const expressions we | 66 // implementation only supports Type literals. To support const expressions we | 
| 67 // need to change some of the invariants below (e.g. we can no longer use the | 67 // need to change some of the invariants below (e.g. we can no longer use the | 
| 68 // ClassElement of a type to refer to keys we need to discover). | 68 // ClassElement of a type to refer to keys we need to discover). | 
| 69 // TODO(sigmund): detect uses of mirrors | 69 // TODO(sigmund): detect uses of mirrors | 
| 70 class LookupMapAnalysis { | 70 class LookupMapAnalysis { | 
|  | 71   static final Uri PACKAGE_LOOKUP_MAP = | 
|  | 72       new Uri(scheme: 'package', path: 'lookup_map/lookup_map.dart'); | 
|  | 73 | 
| 71   /// Reference to [JavaScriptBackend] to be able to enqueue work when we | 74   /// Reference to [JavaScriptBackend] to be able to enqueue work when we | 
| 72   /// discover that a key in a map is potentially used. | 75   /// discover that a key in a map is potentially used. | 
| 73   final JavaScriptBackend backend; | 76   final JavaScriptBackend backend; | 
| 74 | 77 | 
| 75   /// Reference the diagnostic reporting system for logging and reporting issues | 78   /// Reference the diagnostic reporting system for logging and reporting issues | 
| 76   /// to the end-user. | 79   /// to the end-user. | 
| 77   final DiagnosticReporter reporter; | 80   final DiagnosticReporter reporter; | 
| 78 | 81 | 
| 79   /// The resolved [VariableElement] associated with the top-level `_version`. | 82   /// The resolved [VariableElement] associated with the top-level `_version`. | 
| 80   VariableElement lookupMapVersionVariable; | 83   VariableElement lookupMapVersionVariable; | 
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 432       } | 435       } | 
| 433     } else { | 436     } else { | 
| 434       original.fields[analysis.entriesField] = | 437       original.fields[analysis.entriesField] = | 
| 435           new ListConstantValue(listType, keyValuePairs); | 438           new ListConstantValue(listType, keyValuePairs); | 
| 436     } | 439     } | 
| 437   } | 440   } | 
| 438 } | 441 } | 
| 439 | 442 | 
| 440 final _validLookupMapVersionConstraint = | 443 final _validLookupMapVersionConstraint = | 
| 441     new VersionConstraint.parse('^0.0.1'); | 444     new VersionConstraint.parse('^0.0.1'); | 
| OLD | NEW | 
|---|