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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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:mirrors' | 491 || libraryName == 'dart:mirrors' |
492 || libraryName == 'dart:isolate' | 492 || libraryName == 'dart:isolate' |
493 || libraryName == 'dart:math' | 493 || libraryName == 'dart:math' |
494 || libraryName == 'dart:html' | 494 || libraryName == 'dart:html' |
495 || libraryName == 'dart:svg') { | 495 || libraryName == 'dart:svg') { |
496 if (libraryName == 'dart:html' || libraryName == 'dart:mirrors') { | 496 if (libraryName == 'dart:html' || |
497 // dart:html needs access to convertDartClosureToJS. | 497 libraryName == 'dart:svg' || |
| 498 libraryName == 'dart:mirrors') { |
| 499 // dart:html and dart:svg need access to convertDartClosureToJS and |
| 500 // annotation classes. |
498 // dart:mirrors needs access to the Primitives class. | 501 // dart:mirrors needs access to the Primitives class. |
499 importHelperLibrary(library); | 502 importHelperLibrary(library); |
500 } | 503 } |
501 library.addToScope(findHelper(const SourceString('JS')), this); | 504 library.addToScope(findHelper(const SourceString('JS')), this); |
502 Element jsIndexingBehaviorInterface = | 505 Element jsIndexingBehaviorInterface = |
503 findHelper(const SourceString('JavaScriptIndexingBehavior')); | 506 findHelper(const SourceString('JavaScriptIndexingBehavior')); |
504 if (jsIndexingBehaviorInterface != null) { | 507 if (jsIndexingBehaviorInterface != null) { |
505 library.addToScope(jsIndexingBehaviorInterface, this); | 508 library.addToScope(jsIndexingBehaviorInterface, this); |
506 } | 509 } |
507 } | 510 } |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 941 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
939 // information on assertion errors. | 942 // information on assertion errors. |
940 if (condition is Function){ | 943 if (condition is Function){ |
941 condition = condition(); | 944 condition = condition(); |
942 } | 945 } |
943 if (spannable == null || !condition) { | 946 if (spannable == null || !condition) { |
944 throw new SpannableAssertionFailure(spannable, message); | 947 throw new SpannableAssertionFailure(spannable, message); |
945 } | 948 } |
946 return true; | 949 return true; |
947 } | 950 } |
OLD | NEW |