Chromium Code Reviews| 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("../../../lib/compiler/implementation/elements/elements.dart"); | 9 #import("../../../lib/compiler/implementation/elements/elements.dart"); |
| 10 #import("../../../lib/compiler/implementation/leg.dart"); | 10 #import("../../../lib/compiler/implementation/leg.dart"); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 super(enableTypeAssertions: enableTypeAssertions) { | 83 super(enableTypeAssertions: enableTypeAssertions) { |
| 84 coreLibrary = createLibrary("core", coreSource); | 84 coreLibrary = createLibrary("core", coreSource); |
| 85 // We need to set the assert method to avoid calls with a 'null' | 85 // We need to set the assert method to avoid calls with a 'null' |
| 86 // target being interpreted as a call to assert. | 86 // target being interpreted as a call to assert. |
| 87 jsHelperLibrary = createLibrary("helper", helperSource); | 87 jsHelperLibrary = createLibrary("helper", helperSource); |
| 88 assertMethod = jsHelperLibrary.find(buildSourceString('assert')); | 88 assertMethod = jsHelperLibrary.find(buildSourceString('assert')); |
| 89 interceptorsLibrary = createLibrary("interceptors", interceptorsSource); | 89 interceptorsLibrary = createLibrary("interceptors", interceptorsSource); |
| 90 | 90 |
| 91 mainApp = mockLibrary(this, ""); | 91 mainApp = mockLibrary(this, ""); |
| 92 initializeSpecialClasses(); | 92 initializeSpecialClasses(); |
| 93 objectClass.ensureResolved(this); | |
|
ngeoffray
2012/10/15 12:53:39
Did you find out why you need to do this? Maybe ad
floitsch
2012/10/18 15:59:52
https://codereview.chromium.org/11184042/
| |
| 93 } | 94 } |
| 94 | 95 |
| 95 /** | 96 /** |
| 96 * Used internally to create a library from a source text. The created library | 97 * Used internally to create a library from a source text. The created library |
| 97 * is fixed to export its top-level declarations. | 98 * is fixed to export its top-level declarations. |
| 98 */ | 99 */ |
| 99 LibraryElement createLibrary(String name, String source) { | 100 LibraryElement createLibrary(String name, String source) { |
| 100 Uri uri = new Uri.fromComponents(scheme: "source", path: name); | 101 Uri uri = new Uri.fromComponents(scheme: "source", path: name); |
| 101 var script = new Script(uri, new MockFile(source)); | 102 var script = new Script(uri, new MockFile(source)); |
| 102 var library = new LibraryElement(script); | 103 var library = new LibraryElement(script); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 }); | 220 }); |
| 220 } | 221 } |
| 221 } | 222 } |
| 222 | 223 |
| 223 LibraryElement mockLibrary(Compiler compiler, String source) { | 224 LibraryElement mockLibrary(Compiler compiler, String source) { |
| 224 Uri uri = new Uri.fromComponents(scheme: "source"); | 225 Uri uri = new Uri.fromComponents(scheme: "source"); |
| 225 var library = new LibraryElement(new Script(uri, new MockFile(source))); | 226 var library = new LibraryElement(new Script(uri, new MockFile(source))); |
| 226 importLibrary(library, compiler.coreLibrary, compiler); | 227 importLibrary(library, compiler.coreLibrary, compiler); |
| 227 return library; | 228 return library; |
| 228 } | 229 } |
| OLD | NEW |