Chromium Code Reviews| 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('../../../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); | 10 #import('../../../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 _compiler = new LibraryCompiler(provider, handler, | 360 _compiler = new LibraryCompiler(provider, handler, |
| 361 libraryUri, packageUri, <String>[]); | 361 libraryUri, packageUri, <String>[]); |
| 362 var librariesUri = <Uri>[]; | 362 var librariesUri = <Uri>[]; |
| 363 for (Path library in libraries) { | 363 for (Path library in libraries) { |
| 364 librariesUri.add(cwd.resolve(library.toString())); | 364 librariesUri.add(cwd.resolve(library.toString())); |
| 365 // TODO(johnniwinther): Detect file not found | 365 // TODO(johnniwinther): Detect file not found |
| 366 } | 366 } |
| 367 _compiler.runList(librariesUri); | 367 _compiler.runList(librariesUri); |
| 368 } | 368 } |
| 369 | 369 |
| 370 void addLibrary(String path) { | |
| 371 var uri = cwd.resolve(nativeToUriPath(path)); | |
| 372 _compiler.scanner.loadLibrary(uri, null); | |
|
Johnni Winther
2012/09/26 17:03:58
Stale code.
| |
| 373 } | |
| 374 | |
| 375 MirrorSystem get mirrors => new Dart2JsMirrorSystem(_compiler); | 370 MirrorSystem get mirrors => new Dart2JsMirrorSystem(_compiler); |
| 376 | 371 |
| 377 Future<String> compileToJavaScript() => | 372 Future<String> compileToJavaScript() => |
| 378 new Future<String>.immediate(_compiler.assembledCode); | 373 new Future<String>.immediate(_compiler.assembledCode); |
| 379 } | 374 } |
| 380 | 375 |
| 381 | 376 |
| 382 //------------------------------------------------------------------------------ | 377 //------------------------------------------------------------------------------ |
| 383 // Dart2Js specific extensions of mirror interfaces | 378 // Dart2Js specific extensions of mirror interfaces |
| 384 //------------------------------------------------------------------------------ | 379 //------------------------------------------------------------------------------ |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1391 if (node !== null) { | 1386 if (node !== null) { |
| 1392 var span = system.compiler.spanFromNode(node, script.uri); | 1387 var span = system.compiler.spanFromNode(node, script.uri); |
| 1393 return new Dart2JsLocation(script, span); | 1388 return new Dart2JsLocation(script, span); |
| 1394 } else { | 1389 } else { |
| 1395 var span = system.compiler.spanFromElement(_variable); | 1390 var span = system.compiler.spanFromElement(_variable); |
| 1396 return new Dart2JsLocation(script, span); | 1391 return new Dart2JsLocation(script, span); |
| 1397 } | 1392 } |
| 1398 } | 1393 } |
| 1399 } | 1394 } |
| 1400 | 1395 |
| OLD | NEW |