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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 480 |
481 // TODO(karlklose,floitsch): move this to the javascript backend. | 481 // TODO(karlklose,floitsch): move this to the javascript backend. |
482 /** Enable the 'JS' helper for a library if needed. */ | 482 /** Enable the 'JS' helper for a library if needed. */ |
483 void maybeEnableJSHelper(LibraryElement library) { | 483 void maybeEnableJSHelper(LibraryElement library) { |
484 String libraryName = library.uri.toString(); | 484 String libraryName = library.uri.toString(); |
485 if (library.entryCompilationUnit.script.name.contains( | 485 if (library.entryCompilationUnit.script.name.contains( |
486 'dart/tests/compiler/dart2js_native') | 486 'dart/tests/compiler/dart2js_native') |
487 || libraryName == 'dart:mirrors' | 487 || libraryName == 'dart:mirrors' |
488 || libraryName == 'dart:isolate' | 488 || libraryName == 'dart:isolate' |
489 || libraryName == 'dart:math' | 489 || libraryName == 'dart:math' |
490 || libraryName == 'dart:html') { | 490 || libraryName == 'dart:html' |
| 491 || libraryName == 'dart:svg') { |
491 if (libraryName == 'dart:html' || libraryName == 'dart:mirrors') { | 492 if (libraryName == 'dart:html' || libraryName == 'dart:mirrors') { |
492 // dart:html needs access to convertDartClosureToJS. | 493 // dart:html needs access to convertDartClosureToJS. |
493 // dart:mirrors needs access to the Primitives class. | 494 // dart:mirrors needs access to the Primitives class. |
494 importHelperLibrary(library); | 495 importHelperLibrary(library); |
495 } | 496 } |
496 library.addToScope(findHelper(const SourceString('JS')), this); | 497 library.addToScope(findHelper(const SourceString('JS')), this); |
497 Element jsIndexingBehaviorInterface = | 498 Element jsIndexingBehaviorInterface = |
498 findHelper(const SourceString('JavaScriptIndexingBehavior')); | 499 findHelper(const SourceString('JavaScriptIndexingBehavior')); |
499 if (jsIndexingBehaviorInterface != null) { | 500 if (jsIndexingBehaviorInterface != null) { |
500 library.addToScope(jsIndexingBehaviorInterface, this); | 501 library.addToScope(jsIndexingBehaviorInterface, this); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 910 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
910 // information on assertion errors. | 911 // information on assertion errors. |
911 if (condition is Function){ | 912 if (condition is Function){ |
912 condition = condition(); | 913 condition = condition(); |
913 } | 914 } |
914 if (spannable == null || !condition) { | 915 if (spannable == null || !condition) { |
915 throw new SpannableAssertionFailure(spannable, message); | 916 throw new SpannableAssertionFailure(spannable, message); |
916 } | 917 } |
917 return true; | 918 return true; |
918 } | 919 } |
OLD | NEW |