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