Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart

Issue 10990060: Added support for exports and re-exports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Status updated. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 tracer.close(); 227 tracer.close();
228 log('compilation succeeded'); 228 log('compilation succeeded');
229 return true; 229 return true;
230 } 230 }
231 231
232 void runCompilerList(List<Uri> uriList) { 232 void runCompilerList(List<Uri> uriList) {
233 scanBuiltinLibraries(); 233 scanBuiltinLibraries();
234 var elementList = <LibraryElement>[]; 234 var elementList = <LibraryElement>[];
235 for (var uri in uriList) { 235 for (var uri in uriList) {
236 elementList.add(scanner.loadLibrary(uri, null, uri)); 236 elementList.add(libraryLoader.loadLibrary(uri, null, uri));
237 } 237 }
238 libraries.forEach((_, library) { 238 libraries.forEach((_, library) {
239 maybeEnableJSHelper(library); 239 maybeEnableJSHelper(library);
240 }); 240 });
241 241
242 world.populate(); 242 world.populate();
243 243
244 log('Resolving...'); 244 log('Resolving...');
245 phase = Compiler.PHASE_RESOLVING; 245 phase = Compiler.PHASE_RESOLVING;
246 backend.enqueueHelpers(enqueuer.resolution); 246 backend.enqueueHelpers(enqueuer.resolution);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 String get qualifiedName => simpleName; 506 String get qualifiedName => simpleName;
512 507
513 void _ensureTypes() { 508 void _ensureTypes() {
514 if (_types == null) { 509 if (_types == null) {
515 _types = <String, InterfaceMirror>{}; 510 _types = <String, InterfaceMirror>{};
516 _library.forEachExport((Element e) { 511 _library.forEachExport((Element e) {
517 if (e.getLibrary() == _library) { 512 if (e.getLibrary() == _library) {
518 if (e.isClass()) { 513 if (e.isClass()) {
519 e.ensureResolved(system.compiler); 514 e.ensureResolved(system.compiler);
520 var type = new Dart2JsInterfaceMirror.fromLibrary(this, e); 515 var type = new Dart2JsInterfaceMirror.fromLibrary(this, e);
521 assert(!_types.containsKey(type.simpleName)); 516 assert(invariant(_library, !_types.containsKey(type.simpleName),
517 message: "Type name '${type.simpleName}' "
518 "is not unique in $_library."));
522 _types[type.simpleName] = type; 519 _types[type.simpleName] = type;
523 } else if (e.isTypedef()) { 520 } else if (e.isTypedef()) {
524 var type = new Dart2JsTypedefMirror.fromLibrary(this, 521 var type = new Dart2JsTypedefMirror.fromLibrary(this,
525 e.computeType(system.compiler)); 522 e.computeType(system.compiler));
526 assert(!_types.containsKey(type.simpleName)); 523 assert(invariant(_library, !_types.containsKey(type.simpleName),
524 message: "Type name '${type.simpleName}' "
525 "is not unique in $_library."));
527 _types[type.simpleName] = type; 526 _types[type.simpleName] = type;
528 } 527 }
529 } 528 }
530 }); 529 });
531 } 530 }
532 } 531 }
533 532
534 void _ensureMembers() { 533 void _ensureMembers() {
535 if (_members == null) { 534 if (_members == null) {
536 _members = <String, MemberMirror>{}; 535 _members = <String, MemberMirror>{};
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 if (node !== null) { 1387 if (node !== null) {
1389 var span = system.compiler.spanFromNode(node, script.uri); 1388 var span = system.compiler.spanFromNode(node, script.uri);
1390 return new Dart2JsLocation(script, span); 1389 return new Dart2JsLocation(script, span);
1391 } else { 1390 } else {
1392 var span = system.compiler.spanFromElement(_variable); 1391 var span = system.compiler.spanFromElement(_variable);
1393 return new Dart2JsLocation(script, span); 1392 return new Dart2JsLocation(script, span);
1394 } 1393 }
1395 } 1394 }
1396 } 1395 }
1397 1396
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698