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("../../../../lib/uri/uri.dart"); | 7 #import("../../../../lib/uri/uri.dart"); |
8 | 8 |
9 #import("../../../leg/elements/elements.dart"); | 9 #import("../../../leg/elements/elements.dart"); |
10 #import("../../../leg/io/io.dart", prefix: 'io'); | |
11 #import("../../../leg/leg.dart"); | 10 #import("../../../leg/leg.dart"); |
12 #import("../../../leg/tree/tree.dart"); | 11 #import("../../../leg/tree/tree.dart"); |
13 #import("../../../leg/util/util.dart"); | 12 #import("../../../leg/util/util.dart"); |
14 #import("parser_helper.dart"); | 13 #import("parser_helper.dart"); |
15 | 14 |
16 class WarningMessage { | 15 class WarningMessage { |
17 Node node; | 16 Node node; |
18 Message message; | 17 Message message; |
19 WarningMessage(this.node, this.message); | 18 WarningMessage(this.node, this.message); |
20 | 19 |
(...skipping 29 matching lines...) Expand all Loading... |
50 List<WarningMessage> warnings; | 49 List<WarningMessage> warnings; |
51 List<WarningMessage> errors; | 50 List<WarningMessage> errors; |
52 final Map<String, String> sources; | 51 final Map<String, String> sources; |
53 Node parsedTree; | 52 Node parsedTree; |
54 WorkItem lastBailoutWork; | 53 WorkItem lastBailoutWork; |
55 | 54 |
56 MockCompiler([String coreSource = DEFAULT_CORELIB, | 55 MockCompiler([String coreSource = DEFAULT_CORELIB, |
57 String helperSource = DEFAULT_HELPERLIB]) | 56 String helperSource = DEFAULT_HELPERLIB]) |
58 : warnings = [], errors = [], | 57 : warnings = [], errors = [], |
59 sources = new Map<String, String>(), | 58 sources = new Map<String, String>(), |
60 super.withCurrentDirectory(io.getCurrentDirectory()) { | 59 super() { |
61 Uri uri = new Uri(scheme: "source"); | 60 Uri uri = new Uri(scheme: "source"); |
62 var script = new Script(uri, new MockFile(coreSource)); | 61 var script = new Script(uri, new MockFile(coreSource)); |
63 coreLibrary = new LibraryElement(script); | 62 coreLibrary = new LibraryElement(script); |
64 parseScript(coreSource, coreLibrary); | 63 parseScript(coreSource, coreLibrary); |
65 script = new Script(uri, new MockFile(helperSource)); | 64 script = new Script(uri, new MockFile(helperSource)); |
66 jsHelperLibrary = new LibraryElement(script); | 65 jsHelperLibrary = new LibraryElement(script); |
67 parseScript(helperSource, jsHelperLibrary); | 66 parseScript(helperSource, jsHelperLibrary); |
68 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); | 67 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); |
69 mainApp = mockLibrary(this, ""); | 68 mainApp = mockLibrary(this, ""); |
70 initializeSpecialClasses(); | 69 initializeSpecialClasses(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 importLibrary(library, compiler.coreLibrary, compiler); | 186 importLibrary(library, compiler.coreLibrary, compiler); |
188 return library; | 187 return library; |
189 } | 188 } |
190 | 189 |
191 class StringScript extends Script { | 190 class StringScript extends Script { |
192 final String code; | 191 final String code; |
193 StringScript(this.code) : super(null, null); | 192 StringScript(this.code) : super(null, null); |
194 String get text() => code; | 193 String get text() => code; |
195 String get name() => "mock script"; | 194 String get name() => "mock script"; |
196 } | 195 } |
OLD | NEW |