OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 mock_compiler; | 5 library mock_compiler; |
6 | 6 |
7 import 'dart:uri'; | 7 import 'dart:uri'; |
8 | 8 |
9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 List<WarningMessage> warnings; | 78 List<WarningMessage> warnings; |
79 List<WarningMessage> errors; | 79 List<WarningMessage> errors; |
80 final Map<String, SourceFile> sourceFiles; | 80 final Map<String, SourceFile> sourceFiles; |
81 Node parsedTree; | 81 Node parsedTree; |
82 | 82 |
83 MockCompiler({String coreSource: DEFAULT_CORELIB, | 83 MockCompiler({String coreSource: DEFAULT_CORELIB, |
84 String helperSource: DEFAULT_HELPERLIB, | 84 String helperSource: DEFAULT_HELPERLIB, |
85 String interceptorsSource: DEFAULT_INTERCEPTORSLIB, | 85 String interceptorsSource: DEFAULT_INTERCEPTORSLIB, |
86 bool enableTypeAssertions: false, | 86 bool enableTypeAssertions: false, |
87 bool enableMinification: false, | 87 bool enableMinification: false, |
88 bool enableConcreteTypeInference: false}) | 88 bool enableConcreteTypeInference: false, |
| 89 bool analyzeAll: false}) |
89 : warnings = [], errors = [], | 90 : warnings = [], errors = [], |
90 sourceFiles = new Map<String, SourceFile>(), | 91 sourceFiles = new Map<String, SourceFile>(), |
91 super(enableTypeAssertions: enableTypeAssertions, | 92 super(enableTypeAssertions: enableTypeAssertions, |
92 enableMinification: enableMinification, | 93 enableMinification: enableMinification, |
93 enableConcreteTypeInference: enableConcreteTypeInference) { | 94 enableConcreteTypeInference: enableConcreteTypeInference, |
| 95 analyzeAll: analyzeAll) { |
94 coreLibrary = createLibrary("core", coreSource); | 96 coreLibrary = createLibrary("core", coreSource); |
95 // We need to set the assert method to avoid calls with a 'null' | 97 // We need to set the assert method to avoid calls with a 'null' |
96 // target being interpreted as a call to assert. | 98 // target being interpreted as a call to assert. |
97 jsHelperLibrary = createLibrary("helper", helperSource); | 99 jsHelperLibrary = createLibrary("helper", helperSource); |
98 importHelperLibrary(coreLibrary); | 100 importHelperLibrary(coreLibrary); |
| 101 libraryLoader.importLibrary(jsHelperLibrary, coreLibrary, null); |
| 102 |
99 assertMethod = jsHelperLibrary.find(buildSourceString('assert')); | 103 assertMethod = jsHelperLibrary.find(buildSourceString('assert')); |
100 interceptorsLibrary = createLibrary("interceptors", interceptorsSource); | 104 interceptorsLibrary = createLibrary("interceptors", interceptorsSource); |
101 | 105 |
102 mainApp = mockLibrary(this, ""); | 106 mainApp = mockLibrary(this, ""); |
103 initializeSpecialClasses(); | 107 initializeSpecialClasses(); |
104 // We need to make sure the Object class is resolved. When registering a | 108 // We need to make sure the Object class is resolved. When registering a |
105 // dynamic invocation the ArgumentTypesRegistry eventually iterates over | 109 // dynamic invocation the ArgumentTypesRegistry eventually iterates over |
106 // the interfaces of the Object class which would be 'null' if the class | 110 // the interfaces of the Object class which would be 'null' if the class |
107 // wasn't resolved. | 111 // wasn't resolved. |
108 objectClass.ensureResolved(this); | 112 objectClass.ensureResolved(this); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 operator []=(Node node, Element element) { | 258 operator []=(Node node, Element element) { |
255 map[node] = element; | 259 map[node] = element; |
256 } | 260 } |
257 | 261 |
258 operator [](Node node) => map[node]; | 262 operator [](Node node) => map[node]; |
259 | 263 |
260 void remove(Node node) { | 264 void remove(Node node) { |
261 map.remove(node); | 265 map.remove(node); |
262 } | 266 } |
263 } | 267 } |
OLD | NEW |