| 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 "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 | 10 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 Uri resolvedUri, Spannable spannable) => resolvedUri; | 261 Uri resolvedUri, Spannable spannable) => resolvedUri; |
| 262 | 262 |
| 263 // The mock library doesn't need any patches. | 263 // The mock library doesn't need any patches. |
| 264 Uri resolvePatchUri(String dartLibraryName) { | 264 Uri resolvePatchUri(String dartLibraryName) { |
| 265 if (dartLibraryName == 'core') { | 265 if (dartLibraryName == 'core') { |
| 266 return PATCH_CORE; | 266 return PATCH_CORE; |
| 267 } | 267 } |
| 268 return null; | 268 return null; |
| 269 } | 269 } |
| 270 | 270 |
| 271 Future<Script> readScript(Spannable node, Uri uri) { | 271 Future<Script> readScript(Uri uri, [Spannable spannable]) { |
| 272 SourceFile sourceFile = sourceFiles[uri.toString()]; | 272 SourceFile sourceFile = sourceFiles[uri.toString()]; |
| 273 if (sourceFile == null) throw new ArgumentError(uri); | 273 if (sourceFile == null) throw new ArgumentError(uri); |
| 274 return new Future.value(new Script(uri, uri, sourceFile)); | 274 return new Future.value(new Script(uri, uri, sourceFile)); |
| 275 } | 275 } |
| 276 | 276 |
| 277 Element lookupElementIn(ScopeContainerElement container, name) { | 277 Element lookupElementIn(ScopeContainerElement container, name) { |
| 278 Element element = container.localLookup(name); | 278 Element element = container.localLookup(name); |
| 279 return element != null | 279 return element != null |
| 280 ? element | 280 ? element |
| 281 : new ErroneousElementX(null, null, name, container); | 281 : new ErroneousElementX(null, null, name, container); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 trustTypeAnnotations: trustTypeAnnotations, | 371 trustTypeAnnotations: trustTypeAnnotations, |
| 372 enableTypeAssertions: enableTypeAssertions, | 372 enableTypeAssertions: enableTypeAssertions, |
| 373 enableUserAssertions: enableUserAssertions, | 373 enableUserAssertions: enableUserAssertions, |
| 374 expectedErrors: expectedErrors, | 374 expectedErrors: expectedErrors, |
| 375 expectedWarnings: expectedWarnings, | 375 expectedWarnings: expectedWarnings, |
| 376 outputProvider: outputProvider); | 376 outputProvider: outputProvider); |
| 377 compiler.registerSource(uri, code); | 377 compiler.registerSource(uri, code); |
| 378 compiler.diagnosticHandler = createHandler(compiler, code); | 378 compiler.diagnosticHandler = createHandler(compiler, code); |
| 379 return compiler; | 379 return compiler; |
| 380 } | 380 } |
| OLD | NEW |