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