| 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 class Null {} | 67 class Null {} |
| 68 class Dynamic_ {} | 68 class Dynamic_ {} |
| 69 bool identical(Object a, Object b) {}'''; | 69 bool identical(Object a, Object b) {}'''; |
| 70 | 70 |
| 71 class MockCompiler extends Compiler { | 71 class MockCompiler extends Compiler { |
| 72 List<WarningMessage> warnings; | 72 List<WarningMessage> warnings; |
| 73 List<WarningMessage> errors; | 73 List<WarningMessage> errors; |
| 74 final Map<String, SourceFile> sourceFiles; | 74 final Map<String, SourceFile> sourceFiles; |
| 75 Node parsedTree; | 75 Node parsedTree; |
| 76 | 76 |
| 77 MockCompiler([String coreSource = DEFAULT_CORELIB, | 77 MockCompiler({String coreSource: DEFAULT_CORELIB, |
| 78 String helperSource = DEFAULT_HELPERLIB, | 78 String helperSource: DEFAULT_HELPERLIB, |
| 79 String interceptorsSource = DEFAULT_INTERCEPTORSLIB, | 79 String interceptorsSource: DEFAULT_INTERCEPTORSLIB, |
| 80 bool enableTypeAssertions = false, | 80 bool enableTypeAssertions: false, |
| 81 bool enableMinification = false]) | 81 bool enableMinification: false}) |
| 82 : warnings = [], errors = [], | 82 : warnings = [], errors = [], |
| 83 sourceFiles = new Map<String, SourceFile>(), | 83 sourceFiles = new Map<String, SourceFile>(), |
| 84 super(enableTypeAssertions: enableTypeAssertions, | 84 super(enableTypeAssertions: enableTypeAssertions, |
| 85 enableMinification: enableMinification) { | 85 enableMinification: enableMinification) { |
| 86 coreLibrary = createLibrary("core", coreSource); | 86 coreLibrary = createLibrary("core", coreSource); |
| 87 // We need to set the assert method to avoid calls with a 'null' | 87 // We need to set the assert method to avoid calls with a 'null' |
| 88 // target being interpreted as a call to assert. | 88 // target being interpreted as a call to assert. |
| 89 jsHelperLibrary = createLibrary("helper", helperSource); | 89 jsHelperLibrary = createLibrary("helper", helperSource); |
| 90 assertMethod = jsHelperLibrary.find(buildSourceString('assert')); | 90 assertMethod = jsHelperLibrary.find(buildSourceString('assert')); |
| 91 interceptorsLibrary = createLibrary("interceptors", interceptorsSource); | 91 interceptorsLibrary = createLibrary("interceptors", interceptorsSource); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 }); | 222 }); |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 LibraryElement mockLibrary(Compiler compiler, String source) { | 226 LibraryElement mockLibrary(Compiler compiler, String source) { |
| 227 Uri uri = new Uri.fromComponents(scheme: "source"); | 227 Uri uri = new Uri.fromComponents(scheme: "source"); |
| 228 var library = new LibraryElement(new Script(uri, new MockFile(source))); | 228 var library = new LibraryElement(new Script(uri, new MockFile(source))); |
| 229 importLibrary(library, compiler.coreLibrary, compiler); | 229 importLibrary(library, compiler.coreLibrary, compiler); |
| 230 return library; | 230 return library; |
| 231 } | 231 } |
| OLD | NEW |