| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 const SourceString('DART_CLOSURE_TO_JS'), library), this); | 497 const SourceString('DART_CLOSURE_TO_JS'), library), this); |
| 498 } | 498 } |
| 499 | 499 |
| 500 // TODO(karlklose,floitsch): move this to the javascript backend. | 500 // TODO(karlklose,floitsch): move this to the javascript backend. |
| 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:html_common' |
| 507 || libraryName == 'dart:mirrors' | 508 || libraryName == 'dart:mirrors' |
| 508 || libraryName == 'dart:isolate' | 509 || libraryName == 'dart:isolate' |
| 509 || libraryName == 'dart:math' | 510 || libraryName == 'dart:math' |
| 510 || libraryName == 'dart:html' | 511 || libraryName == 'dart:html' |
| 511 || libraryName == 'dart:html_common' | 512 || libraryName == 'dart:indexed_db' |
| 512 || libraryName == 'dart:svg' | 513 || libraryName == 'dart:svg' |
| 513 || libraryName == 'dart:web_audio') { | 514 || libraryName == 'dart:web_audio') { |
| 514 if (nativeTest | 515 if (nativeTest |
| 515 || libraryName == 'dart:html' | 516 || libraryName == 'dart:html' |
| 516 || libraryName == 'dart:html_common' | 517 || libraryName == 'dart:html_common' |
| 518 || libraryName == 'dart:indexed_db' |
| 517 || libraryName == 'dart:svg' | 519 || libraryName == 'dart:svg' |
| 518 || libraryName == 'dart:mirrors') { | 520 || libraryName == 'dart:mirrors') { |
| 519 // dart:html and dart:svg need access to convertDartClosureToJS and | 521 // dart:html and dart:svg need access to convertDartClosureToJS and |
| 520 // annotation classes. | 522 // annotation classes. |
| 521 // dart:mirrors needs access to the Primitives class. | 523 // dart:mirrors needs access to the Primitives class. |
| 522 importHelperLibrary(library); | 524 importHelperLibrary(library); |
| 523 } | 525 } |
| 524 library.addToScope(findHelper(const SourceString('JS')), this); | 526 library.addToScope(findHelper(const SourceString('JS')), this); |
| 525 Element jsIndexingBehaviorInterface = | 527 Element jsIndexingBehaviorInterface = |
| 526 findHelper(const SourceString('JavaScriptIndexingBehavior')); | 528 findHelper(const SourceString('JavaScriptIndexingBehavior')); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 944 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
| 943 // information on assertion errors. | 945 // information on assertion errors. |
| 944 if (condition is Function){ | 946 if (condition is Function){ |
| 945 condition = condition(); | 947 condition = condition(); |
| 946 } | 948 } |
| 947 if (spannable == null || !condition) { | 949 if (spannable == null || !condition) { |
| 948 throw new SpannableAssertionFailure(spannable, message); | 950 throw new SpannableAssertionFailure(spannable, message); |
| 949 } | 951 } |
| 950 return true; | 952 return true; |
| 951 } | 953 } |
| OLD | NEW |