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/compiler.dart' as api; | 9 import '../../../lib/compiler/compiler.dart' as api; |
10 import '../../../lib/compiler/implementation/dart2jslib.dart' hide TreeElementMa
pping; | 10 import '../../../lib/compiler/implementation/dart2jslib.dart' hide TreeElementMa
pping; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 errors.add(diagnostic); | 135 errors.add(diagnostic); |
136 } else { | 136 } else { |
137 warnings.add(diagnostic); | 137 warnings.add(diagnostic); |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 void reportDiagnostic(SourceSpan span, String message, var kind) { | 141 void reportDiagnostic(SourceSpan span, String message, var kind) { |
142 print(message); | 142 print(message); |
143 } | 143 } |
144 | 144 |
145 bool get compilationFailed => !errors.isEmpty(); | 145 bool get compilationFailed => !errors.isEmpty; |
146 | 146 |
147 void clearWarnings() { | 147 void clearWarnings() { |
148 warnings = []; | 148 warnings = []; |
149 } | 149 } |
150 | 150 |
151 void clearErrors() { | 151 void clearErrors() { |
152 errors = []; | 152 errors = []; |
153 } | 153 } |
154 | 154 |
155 TreeElementMapping resolveStatement(String text) { | 155 TreeElementMapping resolveStatement(String text) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 }); | 231 }); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 LibraryElement mockLibrary(Compiler compiler, String source) { | 235 LibraryElement mockLibrary(Compiler compiler, String source) { |
236 Uri uri = new Uri.fromComponents(scheme: "source"); | 236 Uri uri = new Uri.fromComponents(scheme: "source"); |
237 var library = new LibraryElement(new Script(uri, new MockFile(source))); | 237 var library = new LibraryElement(new Script(uri, new MockFile(source))); |
238 importLibrary(library, compiler.coreLibrary, compiler); | 238 importLibrary(library, compiler.coreLibrary, compiler); |
239 return library; | 239 return library; |
240 } | 240 } |
OLD | NEW |