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 mirrors_dart2js; | 5 library mirrors_dart2js; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 | 9 |
10 import '../../compiler.dart' as diagnostics; | 10 import '../../compiler.dart' as diagnostics; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 SourceSpan spanFromNode(Node node, [Uri uri]) { | 188 SourceSpan spanFromNode(Node node, [Uri uri]) { |
189 // TODO(johnniwinther): implement this. | 189 // TODO(johnniwinther): implement this. |
190 throw 'unimplemented'; | 190 throw 'unimplemented'; |
191 } | 191 } |
192 | 192 |
193 void reportMessage(SourceSpan span, Diagnostic message, | 193 void reportMessage(SourceSpan span, Diagnostic message, |
194 diagnostics.Diagnostic kind) { | 194 diagnostics.Diagnostic kind) { |
195 // TODO(johnniwinther): implement this. | 195 // TODO(johnniwinther): implement this. |
196 throw 'unimplemented'; | 196 throw 'unimplemented'; |
197 } | 197 } |
| 198 |
| 199 void onDeprecatedFeature(Spannable span, String feature) { |
| 200 // TODO(johnniwinther): implement this? |
| 201 throw 'unimplemented'; |
| 202 } |
198 } | 203 } |
199 | 204 |
200 //------------------------------------------------------------------------------ | 205 //------------------------------------------------------------------------------ |
201 // Compiler extension for apidoc. | 206 // Compiler extension for apidoc. |
202 //------------------------------------------------------------------------------ | 207 //------------------------------------------------------------------------------ |
203 | 208 |
204 /** | 209 /** |
205 * Extension of the compiler that enables the analysis of several libraries with | 210 * Extension of the compiler that enables the analysis of several libraries with |
206 * no particular entry point. | 211 * no particular entry point. |
207 */ | 212 */ |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } else { | 378 } else { |
374 packageUri = libraryUri; | 379 packageUri = libraryUri; |
375 } | 380 } |
376 _compiler = new LibraryCompiler(provider, handler, | 381 _compiler = new LibraryCompiler(provider, handler, |
377 libraryUri, packageUri, <String>[]); | 382 libraryUri, packageUri, <String>[]); |
378 var librariesUri = <Uri>[]; | 383 var librariesUri = <Uri>[]; |
379 for (Path library in libraries) { | 384 for (Path library in libraries) { |
380 librariesUri.add(cwd.resolve(library.toString())); | 385 librariesUri.add(cwd.resolve(library.toString())); |
381 // TODO(johnniwinther): Detect file not found | 386 // TODO(johnniwinther): Detect file not found |
382 } | 387 } |
383 _compiler.runList(librariesUri); | 388 LibraryCompiler libraryCompiler = _compiler; |
| 389 libraryCompiler.runList(librariesUri); |
384 } | 390 } |
385 | 391 |
386 MirrorSystem get mirrors => new Dart2JsMirrorSystem(_compiler); | 392 MirrorSystem get mirrors => new Dart2JsMirrorSystem(_compiler); |
387 | 393 |
388 Future<String> compileToJavaScript() => | 394 Future<String> compileToJavaScript() => |
389 new Future<String>.immediate(_compiler.assembledCode); | 395 new Future<String>.immediate(_compiler.assembledCode); |
390 } | 396 } |
391 | 397 |
392 | 398 |
393 //------------------------------------------------------------------------------ | 399 //------------------------------------------------------------------------------ |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 var node = _variable.variables.parseNode(_diagnosticListener); | 1551 var node = _variable.variables.parseNode(_diagnosticListener); |
1546 if (node != null) { | 1552 if (node != null) { |
1547 var span = mirrors.compiler.spanFromNode(node, script.uri); | 1553 var span = mirrors.compiler.spanFromNode(node, script.uri); |
1548 return new Dart2JsSourceLocation(script, span); | 1554 return new Dart2JsSourceLocation(script, span); |
1549 } else { | 1555 } else { |
1550 var span = mirrors.compiler.spanFromElement(_variable); | 1556 var span = mirrors.compiler.spanFromElement(_variable); |
1551 return new Dart2JsSourceLocation(script, span); | 1557 return new Dart2JsSourceLocation(script, span); |
1552 } | 1558 } |
1553 } | 1559 } |
1554 } | 1560 } |
OLD | NEW |