| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 List<WarningMessage> errors; | 67 List<WarningMessage> errors; |
| 68 final Map<String, SourceFile> sourceFiles; | 68 final Map<String, SourceFile> sourceFiles; |
| 69 Node parsedTree; | 69 Node parsedTree; |
| 70 | 70 |
| 71 MockCompiler([String coreSource = DEFAULT_CORELIB, | 71 MockCompiler([String coreSource = DEFAULT_CORELIB, |
| 72 String helperSource = DEFAULT_HELPERLIB, | 72 String helperSource = DEFAULT_HELPERLIB, |
| 73 String interceptorsSource = DEFAULT_INTERCEPTORSLIB]) | 73 String interceptorsSource = DEFAULT_INTERCEPTORSLIB]) |
| 74 : warnings = [], errors = [], | 74 : warnings = [], errors = [], |
| 75 sourceFiles = new Map<String, SourceFile>(), | 75 sourceFiles = new Map<String, SourceFile>(), |
| 76 super() { | 76 super() { |
| 77 Uri uri = new Uri(scheme: "source"); | 77 Uri uri = new Uri.fromComponents(scheme: "source"); |
| 78 var script = new Script(uri, new MockFile(coreSource)); | 78 var script = new Script(uri, new MockFile(coreSource)); |
| 79 coreLibrary = new LibraryElement(script); | 79 coreLibrary = new LibraryElement(script); |
| 80 parseScript(coreSource, coreLibrary); | 80 parseScript(coreSource, coreLibrary); |
| 81 | 81 |
| 82 script = new Script(uri, new MockFile(helperSource)); | 82 script = new Script(uri, new MockFile(helperSource)); |
| 83 jsHelperLibrary = new LibraryElement(script); | 83 jsHelperLibrary = new LibraryElement(script); |
| 84 parseScript(helperSource, jsHelperLibrary); | 84 parseScript(helperSource, jsHelperLibrary); |
| 85 | 85 |
| 86 script = new Script(uri, new MockFile(interceptorsSource)); | 86 script = new Script(uri, new MockFile(interceptorsSource)); |
| 87 interceptorsLibrary = new LibraryElement(script); | 87 interceptorsLibrary = new LibraryElement(script); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 Compiler compiler) { | 192 Compiler compiler) { |
| 193 for (Link<Element> link = imported.topLevelElements; !link.isEmpty(); | 193 for (Link<Element> link = imported.topLevelElements; !link.isEmpty(); |
| 194 link = link.tail) { | 194 link = link.tail) { |
| 195 compiler.withCurrentElement(link.head, () { | 195 compiler.withCurrentElement(link.head, () { |
| 196 target.define(link.head, compiler); | 196 target.define(link.head, compiler); |
| 197 }); | 197 }); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 LibraryElement mockLibrary(Compiler compiler, String source) { | 201 LibraryElement mockLibrary(Compiler compiler, String source) { |
| 202 Uri uri = new Uri(scheme: "source"); | 202 Uri uri = new Uri.fromComponents(scheme: "source"); |
| 203 var library = new LibraryElement(new Script(uri, new MockFile(source))); | 203 var library = new LibraryElement(new Script(uri, new MockFile(source))); |
| 204 importLibrary(library, compiler.coreLibrary, compiler); | 204 importLibrary(library, compiler.coreLibrary, compiler); |
| 205 return library; | 205 return library; |
| 206 } | 206 } |
| OLD | NEW |