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:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 import 'dart2jslib.dart' hide SourceString; | 8 import 'dart2jslib.dart' hide SourceString; |
9 import 'dart_types.dart'; | 9 import 'dart_types.dart'; |
10 import 'elements/elements.dart'; | 10 import 'elements/elements.dart'; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 void maybeEnableNative(Compiler compiler, | 489 void maybeEnableNative(Compiler compiler, |
490 LibraryElement library) { | 490 LibraryElement library) { |
491 String libraryName = library.canonicalUri.toString(); | 491 String libraryName = library.canonicalUri.toString(); |
492 if (library.entryCompilationUnit.script.name.contains( | 492 if (library.entryCompilationUnit.script.name.contains( |
493 'dart/tests/compiler/dart2js_native') | 493 'dart/tests/compiler/dart2js_native') |
494 || libraryName == 'dart:async' | 494 || libraryName == 'dart:async' |
495 || libraryName == 'dart:html' | 495 || libraryName == 'dart:html' |
496 || libraryName == 'dart:html_common' | 496 || libraryName == 'dart:html_common' |
497 || libraryName == 'dart:indexed_db' | 497 || libraryName == 'dart:indexed_db' |
| 498 || libraryName == 'dart:js' |
498 || libraryName == 'dart:svg' | 499 || libraryName == 'dart:svg' |
499 || libraryName == 'dart:typed_data' | 500 || libraryName == 'dart:typed_data' |
500 || libraryName == 'dart:web_audio' | 501 || libraryName == 'dart:web_audio' |
501 || libraryName == 'dart:web_gl' | 502 || libraryName == 'dart:web_gl' |
502 || libraryName == 'dart:web_sql') { | 503 || libraryName == 'dart:web_sql') { |
503 library.canUseNative = true; | 504 library.canUseNative = true; |
504 } | 505 } |
505 } | 506 } |
506 | 507 |
507 class SideEffectsVisitor extends js.BaseVisitor { | 508 class SideEffectsVisitor extends js.BaseVisitor { |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 'native "..." syntax is restricted to functions with zero parameters', | 1019 'native "..." syntax is restricted to functions with zero parameters', |
1019 node: nativeBody); | 1020 node: nativeBody); |
1020 } | 1021 } |
1021 LiteralString jsCode = nativeBody.asLiteralString(); | 1022 LiteralString jsCode = nativeBody.asLiteralString(); |
1022 builder.push(new HForeign.statement( | 1023 builder.push(new HForeign.statement( |
1023 new js.LiteralStatement(jsCode.dartString.slowToString()), | 1024 new js.LiteralStatement(jsCode.dartString.slowToString()), |
1024 <HInstruction>[], | 1025 <HInstruction>[], |
1025 new SideEffects())); | 1026 new SideEffects())); |
1026 } | 1027 } |
1027 } | 1028 } |
OLD | NEW |