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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 const SourceString('DART_CLOSURE_TO_JS'), library), this); | 498 const SourceString('DART_CLOSURE_TO_JS'), library), this); |
499 } | 499 } |
500 | 500 |
501 // TODO(karlklose,floitsch): move this to the javascript backend. | 501 // TODO(karlklose,floitsch): move this to the javascript backend. |
502 /** Enable the 'JS' helper for a library if needed. */ | 502 /** Enable the 'JS' helper for a library if needed. */ |
503 void maybeEnableJSHelper(LibraryElement library) { | 503 void maybeEnableJSHelper(LibraryElement library) { |
504 String libraryName = library.uri.toString(); | 504 String libraryName = library.uri.toString(); |
505 bool nativeTest = library.entryCompilationUnit.script.name.contains( | 505 bool nativeTest = library.entryCompilationUnit.script.name.contains( |
506 'dart/tests/compiler/dart2js_native'); | 506 'dart/tests/compiler/dart2js_native'); |
507 if (nativeTest | 507 if (nativeTest |
| 508 || libraryName == 'dart:html_common' |
508 || libraryName == 'dart:mirrors' | 509 || libraryName == 'dart:mirrors' |
509 || libraryName == 'dart:isolate' | 510 || libraryName == 'dart:isolate' |
510 || libraryName == 'dart:math' | 511 || libraryName == 'dart:math' |
511 || libraryName == 'dart:html' | 512 || libraryName == 'dart:html' |
512 || libraryName == 'dart:html_common' | 513 || libraryName == 'dart:indexed_db' |
513 || libraryName == 'dart:svg' | 514 || libraryName == 'dart:svg' |
514 || libraryName == 'dart:web_audio') { | 515 || libraryName == 'dart:web_audio') { |
515 if (nativeTest | 516 if (nativeTest |
516 || libraryName == 'dart:html' | 517 || libraryName == 'dart:html' |
517 || libraryName == 'dart:html_common' | 518 || libraryName == 'dart:html_common' |
| 519 || libraryName == 'dart:indexed_db' |
518 || libraryName == 'dart:svg' | 520 || libraryName == 'dart:svg' |
519 || libraryName == 'dart:mirrors') { | 521 || libraryName == 'dart:mirrors') { |
520 // dart:html and dart:svg need access to convertDartClosureToJS and | 522 // dart:html and dart:svg need access to convertDartClosureToJS and |
521 // annotation classes. | 523 // annotation classes. |
522 // dart:mirrors needs access to the Primitives class. | 524 // dart:mirrors needs access to the Primitives class. |
523 importHelperLibrary(library); | 525 importHelperLibrary(library); |
524 } | 526 } |
525 library.addToScope(findHelper(const SourceString('JS')), this); | 527 library.addToScope(findHelper(const SourceString('JS')), this); |
526 Element jsIndexingBehaviorInterface = | 528 Element jsIndexingBehaviorInterface = |
527 findHelper(const SourceString('JavaScriptIndexingBehavior')); | 529 findHelper(const SourceString('JavaScriptIndexingBehavior')); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 945 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
944 // information on assertion errors. | 946 // information on assertion errors. |
945 if (condition is Function){ | 947 if (condition is Function){ |
946 condition = condition(); | 948 condition = condition(); |
947 } | 949 } |
948 if (spannable == null || !condition) { | 950 if (spannable == null || !condition) { |
949 throw new SpannableAssertionFailure(spannable, message); | 951 throw new SpannableAssertionFailure(spannable, message); |
950 } | 952 } |
951 return true; | 953 return true; |
952 } | 954 } |
OLD | NEW |