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 library native; | 5 library native; |
6 | 6 |
7 import 'dart:uri'; | 7 import 'dart:uri'; |
8 import 'dart2jslib.dart' hide SourceString; | 8 import 'dart2jslib.dart' hide SourceString; |
9 import 'elements/elements.dart'; | 9 import 'elements/elements.dart'; |
10 import 'js_backend/js_backend.dart'; | 10 import 'js_backend/js_backend.dart'; |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 '${unusedClasses.length} native classes omitted.'); | 446 '${unusedClasses.length} native classes omitted.'); |
447 } | 447 } |
448 } | 448 } |
449 | 449 |
450 void maybeEnableNative(Compiler compiler, | 450 void maybeEnableNative(Compiler compiler, |
451 LibraryElement library, | 451 LibraryElement library, |
452 Uri uri) { | 452 Uri uri) { |
453 String libraryName = uri.toString(); | 453 String libraryName = uri.toString(); |
454 if (library.entryCompilationUnit.script.name.contains( | 454 if (library.entryCompilationUnit.script.name.contains( |
455 'dart/tests/compiler/dart2js_native') | 455 'dart/tests/compiler/dart2js_native') |
| 456 || libraryName == 'dart:isolate' |
456 || libraryName == 'dart:html' | 457 || libraryName == 'dart:html' |
457 || libraryName == 'dart:html_common' | 458 || libraryName == 'dart:html_common' |
458 || libraryName == 'dart:indexed_db' | 459 || libraryName == 'dart:indexed_db' |
459 || libraryName == 'dart:svg' | 460 || libraryName == 'dart:svg' |
460 || libraryName == 'dart:web_audio') { | 461 || libraryName == 'dart:web_audio') { |
461 library.canUseNative = true; | 462 library.canUseNative = true; |
462 } | 463 } |
463 } | 464 } |
464 | 465 |
465 /** | 466 /** |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 builder.add(new HForeign( | 889 builder.add(new HForeign( |
889 new DartString.literal('${parameter.name.slowToString()} = #'), | 890 new DartString.literal('${parameter.name.slowToString()} = #'), |
890 const LiteralDartString('void'), | 891 const LiteralDartString('void'), |
891 <HInstruction>[jsClosure])); | 892 <HInstruction>[jsClosure])); |
892 } | 893 } |
893 }); | 894 }); |
894 LiteralString jsCode = nativeBody.asLiteralString(); | 895 LiteralString jsCode = nativeBody.asLiteralString(); |
895 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 896 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
896 } | 897 } |
897 } | 898 } |
OLD | NEW |