| 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 '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
| 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 /** | 130 /** |
| 131 * Used internally to create a library from a source text. The created library | 131 * Used internally to create a library from a source text. The created library |
| 132 * is fixed to export its top-level declarations. | 132 * is fixed to export its top-level declarations. |
| 133 */ | 133 */ |
| 134 LibraryElement createLibrary(String name, String source) { | 134 LibraryElement createLibrary(String name, String source) { |
| 135 Uri uri = new Uri.fromComponents(scheme: "source", path: name); | 135 Uri uri = new Uri.fromComponents(scheme: "source", path: name); |
| 136 var script = new Script(uri, new MockFile(source)); | 136 var script = new Script(uri, new MockFile(source)); |
| 137 var library = new LibraryElement(script); | 137 var library = new LibraryElement(script); |
| 138 parseScript(source, library); | 138 parseScript(source, library); |
| 139 library.setExports(library.localScope.values); | 139 library.setExports(library.localScope.values.toList()); |
| 140 return library; | 140 return library; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void reportWarning(Node node, var message) { | 143 void reportWarning(Node node, var message) { |
| 144 warnings.add(new WarningMessage(node, message.message)); | 144 warnings.add(new WarningMessage(node, message.message)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void reportError(Node node, var message) { | 147 void reportError(Node node, var message) { |
| 148 if (message is String && message.startsWith("no library name found in")) { | 148 if (message is String && message.startsWith("no library name found in")) { |
| 149 // TODO(ahe): Fix the MockCompiler to not have this problem. | 149 // TODO(ahe): Fix the MockCompiler to not have this problem. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 operator []=(Node node, Element element) { | 275 operator []=(Node node, Element element) { |
| 276 map[node] = element; | 276 map[node] = element; |
| 277 } | 277 } |
| 278 | 278 |
| 279 operator [](Node node) => map[node]; | 279 operator [](Node node) => map[node]; |
| 280 | 280 |
| 281 void remove(Node node) { | 281 void remove(Node node) { |
| 282 map.remove(node); | 282 map.remove(node); |
| 283 } | 283 } |
| 284 } | 284 } |
| OLD | NEW |