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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 library.addToScope(new ForeignElement( | 481 library.addToScope(new ForeignElement( |
482 const SourceString('DART_CLOSURE_TO_JS'), library), this); | 482 const SourceString('DART_CLOSURE_TO_JS'), library), this); |
483 } | 483 } |
484 | 484 |
485 // TODO(karlklose,floitsch): move this to the javascript backend. | 485 // TODO(karlklose,floitsch): move this to the javascript backend. |
486 /** Enable the 'JS' helper for a library if needed. */ | 486 /** Enable the 'JS' helper for a library if needed. */ |
487 void maybeEnableJSHelper(LibraryElement library) { | 487 void maybeEnableJSHelper(LibraryElement library) { |
488 String libraryName = library.uri.toString(); | 488 String libraryName = library.uri.toString(); |
489 if (library.entryCompilationUnit.script.name.contains( | 489 if (library.entryCompilationUnit.script.name.contains( |
490 'dart/tests/compiler/dart2js_native') | 490 'dart/tests/compiler/dart2js_native') |
| 491 || libraryName == 'dart:html_common' |
491 || libraryName == 'dart:mirrors' | 492 || libraryName == 'dart:mirrors' |
492 || libraryName == 'dart:isolate' | 493 || libraryName == 'dart:isolate' |
493 || libraryName == 'dart:math' | 494 || libraryName == 'dart:math' |
494 || libraryName == 'dart:html' | 495 || libraryName == 'dart:html' |
495 || libraryName == 'dart:svg' | 496 || libraryName == 'dart:svg' |
496 || libraryName == 'dart:web_audio') { | 497 || libraryName == 'dart:web_audio') { |
497 if (libraryName == 'dart:html' || libraryName == 'dart:mirrors') { | 498 if (libraryName == 'dart:html' || |
| 499 libraryName == 'dart:html_common' || |
| 500 libraryName == 'dart:mirrors') { |
498 // dart:html needs access to convertDartClosureToJS. | 501 // dart:html needs access to convertDartClosureToJS. |
499 // dart:mirrors needs access to the Primitives class. | 502 // dart:mirrors needs access to the Primitives class. |
500 importHelperLibrary(library); | 503 importHelperLibrary(library); |
501 } | 504 } |
502 library.addToScope(findHelper(const SourceString('JS')), this); | 505 library.addToScope(findHelper(const SourceString('JS')), this); |
503 Element jsIndexingBehaviorInterface = | 506 Element jsIndexingBehaviorInterface = |
504 findHelper(const SourceString('JavaScriptIndexingBehavior')); | 507 findHelper(const SourceString('JavaScriptIndexingBehavior')); |
505 if (jsIndexingBehaviorInterface != null) { | 508 if (jsIndexingBehaviorInterface != null) { |
506 library.addToScope(jsIndexingBehaviorInterface, this); | 509 library.addToScope(jsIndexingBehaviorInterface, this); |
507 } | 510 } |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 942 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
940 // information on assertion errors. | 943 // information on assertion errors. |
941 if (condition is Function){ | 944 if (condition is Function){ |
942 condition = condition(); | 945 condition = condition(); |
943 } | 946 } |
944 if (spannable == null || !condition) { | 947 if (spannable == null || !condition) { |
945 throw new SpannableAssertionFailure(spannable, message); | 948 throw new SpannableAssertionFailure(spannable, message); |
946 } | 949 } |
947 return true; | 950 return true; |
948 } | 951 } |
OLD | NEW |