| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 448 |
| 449 void maybeEnableNative(Compiler compiler, | 449 void maybeEnableNative(Compiler compiler, |
| 450 LibraryElement library, | 450 LibraryElement library, |
| 451 Uri uri) { | 451 Uri uri) { |
| 452 String libraryName = uri.toString(); | 452 String libraryName = uri.toString(); |
| 453 if (library.entryCompilationUnit.script.name.contains( | 453 if (library.entryCompilationUnit.script.name.contains( |
| 454 'dart/tests/compiler/dart2js_native') | 454 'dart/tests/compiler/dart2js_native') |
| 455 || libraryName == 'dart:isolate' | 455 || libraryName == 'dart:isolate' |
| 456 || libraryName == 'dart:html' | 456 || libraryName == 'dart:html' |
| 457 || libraryName == 'dart:html_common' | 457 || libraryName == 'dart:html_common' |
| 458 || libraryName == 'dart:indexed_db' |
| 458 || libraryName == 'dart:svg' | 459 || libraryName == 'dart:svg' |
| 459 || libraryName == 'dart:web_audio') { | 460 || libraryName == 'dart:web_audio') { |
| 460 library.canUseNative = true; | 461 library.canUseNative = true; |
| 461 } | 462 } |
| 462 } | 463 } |
| 463 | 464 |
| 464 /** | 465 /** |
| 465 * A summary of the behavior of a native element. | 466 * A summary of the behavior of a native element. |
| 466 * | 467 * |
| 467 * Native code can return values of one type and cause native subtypes of | 468 * Native code can return values of one type and cause native subtypes of |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 builder.add(new HForeign( | 901 builder.add(new HForeign( |
| 901 new DartString.literal('${parameter.name.slowToString()} = #'), | 902 new DartString.literal('${parameter.name.slowToString()} = #'), |
| 902 const LiteralDartString('void'), | 903 const LiteralDartString('void'), |
| 903 <HInstruction>[jsClosure])); | 904 <HInstruction>[jsClosure])); |
| 904 } | 905 } |
| 905 }); | 906 }); |
| 906 LiteralString jsCode = nativeBody.asLiteralString(); | 907 LiteralString jsCode = nativeBody.asLiteralString(); |
| 907 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 908 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
| 908 } | 909 } |
| 909 } | 910 } |
| OLD | NEW |