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 part of dart2js; | 5 part of dart2js; |
6 | 6 |
7 /** | 7 /** |
8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
9 * compiled. | 9 * compiled. |
10 */ | 10 */ |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 530 } |
531 } | 531 } |
532 | 532 |
533 // TODO(karlklose,floitsch): move this to the javascript backend. | 533 // TODO(karlklose,floitsch): move this to the javascript backend. |
534 /** Enable the 'JS' helper for a library if needed. */ | 534 /** Enable the 'JS' helper for a library if needed. */ |
535 void maybeEnableJSHelper(LibraryElement library) { | 535 void maybeEnableJSHelper(LibraryElement library) { |
536 String libraryName = library.uri.toString(); | 536 String libraryName = library.uri.toString(); |
537 bool nativeTest = library.entryCompilationUnit.script.name.contains( | 537 bool nativeTest = library.entryCompilationUnit.script.name.contains( |
538 'dart/tests/compiler/dart2js_native'); | 538 'dart/tests/compiler/dart2js_native'); |
539 if (nativeTest | 539 if (nativeTest |
| 540 || libraryName == 'dart:async' |
540 || libraryName == 'dart:mirrors' | 541 || libraryName == 'dart:mirrors' |
541 || libraryName == 'dart:math' | 542 || libraryName == 'dart:math' |
542 || libraryName == 'dart:html' | 543 || libraryName == 'dart:html' |
543 || libraryName == 'dart:html_common' | 544 || libraryName == 'dart:html_common' |
544 || libraryName == 'dart:indexed_db' | 545 || libraryName == 'dart:indexed_db' |
545 || libraryName == 'dart:svg' | 546 || libraryName == 'dart:svg' |
546 || libraryName == 'dart:web_audio') { | 547 || libraryName == 'dart:web_audio') { |
547 if (nativeTest | 548 if (nativeTest |
548 || libraryName == 'dart:html' | 549 || libraryName == 'dart:html' |
549 || libraryName == 'dart:html_common' | 550 || libraryName == 'dart:html_common' |
(...skipping 10 matching lines...) Expand all Loading... |
560 findHelper(const SourceString('JavaScriptIndexingBehavior')); | 561 findHelper(const SourceString('JavaScriptIndexingBehavior')); |
561 if (jsIndexingBehaviorInterface != null) { | 562 if (jsIndexingBehaviorInterface != null) { |
562 library.addToScope(jsIndexingBehaviorInterface, this); | 563 library.addToScope(jsIndexingBehaviorInterface, this); |
563 } | 564 } |
564 } | 565 } |
565 } | 566 } |
566 | 567 |
567 void maybeEnableIsolateHelper(LibraryElement library) { | 568 void maybeEnableIsolateHelper(LibraryElement library) { |
568 String libraryName = library.uri.toString(); | 569 String libraryName = library.uri.toString(); |
569 if (libraryName == 'dart:isolate' | 570 if (libraryName == 'dart:isolate' |
570 || libraryName == 'dart:html') { | 571 || libraryName == 'dart:html' |
| 572 // TODO(floitsch): create a separate async-helper library instead of |
| 573 // importing the isolate-library just for async. |
| 574 || libraryName == 'dart:async') { |
571 importIsolateHelperLibrary(library); | 575 importIsolateHelperLibrary(library); |
572 } | 576 } |
573 } | 577 } |
574 | 578 |
575 void runCompiler(Uri uri) { | 579 void runCompiler(Uri uri) { |
576 log('compiling $uri ($BUILD_ID)'); | 580 log('compiling $uri ($BUILD_ID)'); |
577 scanBuiltinLibraries(); | 581 scanBuiltinLibraries(); |
578 mainApp = libraryLoader.loadLibrary(uri, null, uri); | 582 mainApp = libraryLoader.loadLibrary(uri, null, uri); |
579 libraries.forEach((_, library) { | 583 libraries.forEach((_, library) { |
580 maybeEnableJSHelper(library); | 584 maybeEnableJSHelper(library); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 991 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
988 // information on assertion errors. | 992 // information on assertion errors. |
989 if (condition is Function){ | 993 if (condition is Function){ |
990 condition = condition(); | 994 condition = condition(); |
991 } | 995 } |
992 if (spannable == null || !condition) { | 996 if (spannable == null || !condition) { |
993 throw new SpannableAssertionFailure(spannable, message); | 997 throw new SpannableAssertionFailure(spannable, message); |
994 } | 998 } |
995 return true; | 999 return true; |
996 } | 1000 } |
OLD | NEW |