| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 void importCoreLibrary(LibraryElement library) { | 174 void importCoreLibrary(LibraryElement library) { |
| 175 scanner.importLibrary(library, coreLibrary, null); | 175 scanner.importLibrary(library, coreLibrary, null); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // The mock library doesn't need any patches. | 178 // The mock library doesn't need any patches. |
| 179 Uri resolvePatchUri(String dartLibraryName) => null; | 179 Uri resolvePatchUri(String dartLibraryName) => null; |
| 180 | 180 |
| 181 Script readScript(Uri uri, [ScriptTag node]) { | 181 Script readScript(Uri uri, [ScriptTag node]) { |
| 182 SourceFile sourceFile = sourceFiles[uri.toString()]; | 182 SourceFile sourceFile = sourceFiles[uri.toString()]; |
| 183 if (sourceFile === null) throw new IllegalArgumentException(uri); | 183 if (sourceFile === null) throw new ArgumentError(uri); |
| 184 return new Script(uri, sourceFile); | 184 return new Script(uri, sourceFile); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 void compareWarningKinds(String text, expectedWarnings, foundWarnings) { | 188 void compareWarningKinds(String text, expectedWarnings, foundWarnings) { |
| 189 var fail = (message) => Expect.fail('$text: $message'); | 189 var fail = (message) => Expect.fail('$text: $message'); |
| 190 Iterator<MessageKind> expected = expectedWarnings.iterator(); | 190 Iterator<MessageKind> expected = expectedWarnings.iterator(); |
| 191 Iterator<WarningMessage> found = foundWarnings.iterator(); | 191 Iterator<WarningMessage> found = foundWarnings.iterator(); |
| 192 while (expected.hasNext() && found.hasNext()) { | 192 while (expected.hasNext() && found.hasNext()) { |
| 193 Expect.equals(expected.next(), found.next().message.kind); | 193 Expect.equals(expected.next(), found.next().message.kind); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 214 }); | 214 }); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 LibraryElement mockLibrary(Compiler compiler, String source) { | 218 LibraryElement mockLibrary(Compiler compiler, String source) { |
| 219 Uri uri = new Uri.fromComponents(scheme: "source"); | 219 Uri uri = new Uri.fromComponents(scheme: "source"); |
| 220 var library = new LibraryElement(new Script(uri, new MockFile(source))); | 220 var library = new LibraryElement(new Script(uri, new MockFile(source))); |
| 221 importLibrary(library, compiler.coreLibrary, compiler); | 221 importLibrary(library, compiler.coreLibrary, compiler); |
| 222 return library; | 222 return library; |
| 223 } | 223 } |
| OLD | NEW |