| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 /** | 107 /** |
| 108 * Used internally to create a library from a source text. The created library | 108 * Used internally to create a library from a source text. The created library |
| 109 * is fixed to export its top-level declarations. | 109 * is fixed to export its top-level declarations. |
| 110 */ | 110 */ |
| 111 LibraryElement createLibrary(String name, String source) { | 111 LibraryElement createLibrary(String name, String source) { |
| 112 Uri uri = new Uri.fromComponents(scheme: "source", path: name); | 112 Uri uri = new Uri.fromComponents(scheme: "source", path: name); |
| 113 var script = new Script(uri, new MockFile(source)); | 113 var script = new Script(uri, new MockFile(source)); |
| 114 var library = new LibraryElement(script); | 114 var library = new LibraryElement(script); |
| 115 parseScript(source, library); | 115 parseScript(source, library); |
| 116 library.setExports(library.localScope.getValues()); | 116 library.setExports(library.localScope.values); |
| 117 return library; | 117 return library; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void reportWarning(Node node, var message) { | 120 void reportWarning(Node node, var message) { |
| 121 warnings.add(new WarningMessage(node, message.message)); | 121 warnings.add(new WarningMessage(node, message.message)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void reportError(Node node, var message) { | 124 void reportError(Node node, var message) { |
| 125 if (message is String && message.startsWith("no library name found in")) { | 125 if (message is String && message.startsWith("no library name found in")) { |
| 126 // TODO(ahe): Fix the MockCompiler to not have this problem. | 126 // TODO(ahe): Fix the MockCompiler to not have this problem. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 operator []=(Node node, Element element) { | 250 operator []=(Node node, Element element) { |
| 251 map[node] = element; | 251 map[node] = element; |
| 252 } | 252 } |
| 253 | 253 |
| 254 operator [](Node node) => map[node]; | 254 operator [](Node node) => map[node]; |
| 255 | 255 |
| 256 void remove(Node node) { | 256 void remove(Node node) { |
| 257 map.remove(node); | 257 map.remove(node); |
| 258 } | 258 } |
| 259 } | 259 } |
| OLD | NEW |