| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 } | 527 } |
| 528 } | 528 } |
| 529 | 529 |
| 530 // TODO(karlklose,floitsch): move this to the javascript backend. | 530 // TODO(karlklose,floitsch): move this to the javascript backend. |
| 531 /** Enable the 'JS' helper for a library if needed. */ | 531 /** Enable the 'JS' helper for a library if needed. */ |
| 532 void maybeEnableJSHelper(LibraryElement library) { | 532 void maybeEnableJSHelper(LibraryElement library) { |
| 533 String libraryName = library.uri.toString(); | 533 String libraryName = library.uri.toString(); |
| 534 bool nativeTest = library.entryCompilationUnit.script.name.contains( | 534 bool nativeTest = library.entryCompilationUnit.script.name.contains( |
| 535 'dart/tests/compiler/dart2js_native'); | 535 'dart/tests/compiler/dart2js_native'); |
| 536 if (nativeTest | 536 if (nativeTest |
| 537 || libraryName == 'dart:mirrors' |
| 537 || libraryName == 'dart:math' | 538 || libraryName == 'dart:math' |
| 538 || libraryName == 'dart:html' | 539 || libraryName == 'dart:html' |
| 539 || libraryName == 'dart:html_common' | 540 || libraryName == 'dart:html_common' |
| 540 || libraryName == 'dart:indexed_db' | 541 || libraryName == 'dart:indexed_db' |
| 541 || libraryName == 'dart:svg' | 542 || libraryName == 'dart:svg' |
| 542 || libraryName == 'dart:web_audio') { | 543 || libraryName == 'dart:web_audio') { |
| 543 if (nativeTest | 544 if (nativeTest |
| 544 || libraryName == 'dart:html' | 545 || libraryName == 'dart:html' |
| 545 || libraryName == 'dart:html_common' | 546 || libraryName == 'dart:html_common' |
| 546 || libraryName == 'dart:indexed_db' | 547 || libraryName == 'dart:indexed_db' |
| 547 || libraryName == 'dart:svg') { | 548 || libraryName == 'dart:svg' |
| 549 || libraryName == 'dart:mirrors') { |
| 548 // dart:html and dart:svg need access to convertDartClosureToJS and | 550 // dart:html and dart:svg need access to convertDartClosureToJS and |
| 549 // annotation classes. | 551 // annotation classes. |
| 550 // dart:mirrors needs access to the Primitives class. | 552 // dart:mirrors needs access to the Primitives class. |
| 551 importHelperLibrary(library); | 553 importHelperLibrary(library); |
| 552 } | 554 } |
| 553 library.addToScope( | 555 library.addToScope( |
| 554 foreignLibrary.findLocal(const SourceString('JS')), this); | 556 foreignLibrary.findLocal(const SourceString('JS')), this); |
| 555 Element jsIndexingBehaviorInterface = | 557 Element jsIndexingBehaviorInterface = |
| 556 findHelper(const SourceString('JavaScriptIndexingBehavior')); | 558 findHelper(const SourceString('JavaScriptIndexingBehavior')); |
| 557 if (jsIndexingBehaviorInterface != null) { | 559 if (jsIndexingBehaviorInterface != null) { |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 976 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
| 975 // information on assertion errors. | 977 // information on assertion errors. |
| 976 if (condition is Function){ | 978 if (condition is Function){ |
| 977 condition = condition(); | 979 condition = condition(); |
| 978 } | 980 } |
| 979 if (spannable == null || !condition) { | 981 if (spannable == null || !condition) { |
| 980 throw new SpannableAssertionFailure(spannable, message); | 982 throw new SpannableAssertionFailure(spannable, message); |
| 981 } | 983 } |
| 982 return true; | 984 return true; |
| 983 } | 985 } |
| OLD | NEW |