| 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 'dart:uri'; | 8 import 'dart:uri'; |
| 9 import 'dart2jslib.dart' hide SourceString; | 9 import 'dart2jslib.dart' hide SourceString; |
| 10 import 'dart_types.dart'; | 10 import 'dart_types.dart'; |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void maybeEnableNative(Compiler compiler, | 475 void maybeEnableNative(Compiler compiler, |
| 476 LibraryElement library) { | 476 LibraryElement library) { |
| 477 String libraryName = library.canonicalUri.toString(); | 477 String libraryName = library.canonicalUri.toString(); |
| 478 if (library.entryCompilationUnit.script.name.contains( | 478 if (library.entryCompilationUnit.script.name.contains( |
| 479 'dart/tests/compiler/dart2js_native') | 479 'dart/tests/compiler/dart2js_native') |
| 480 || libraryName == 'dart:async' | 480 || libraryName == 'dart:async' |
| 481 || libraryName == 'dart:html' | 481 || libraryName == 'dart:html' |
| 482 || libraryName == 'dart:html_common' | 482 || libraryName == 'dart:html_common' |
| 483 || libraryName == 'dart:indexed_db' | 483 || libraryName == 'dart:indexed_db' |
| 484 || libraryName == 'dart:svg' | 484 || libraryName == 'dart:svg' |
| 485 || libraryName == 'dart:typeddata' |
| 485 || libraryName == 'dart:web_audio' | 486 || libraryName == 'dart:web_audio' |
| 486 || libraryName == 'dart:web_sql') { | 487 || libraryName == 'dart:web_sql') { |
| 487 library.canUseNative = true; | 488 library.canUseNative = true; |
| 488 } | 489 } |
| 489 } | 490 } |
| 490 | 491 |
| 491 /** | 492 /** |
| 492 * A summary of the behavior of a native element. | 493 * A summary of the behavior of a native element. |
| 493 * | 494 * |
| 494 * Native code can return values of one type and cause native subtypes of | 495 * Native code can return values of one type and cause native subtypes of |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 } else { | 900 } else { |
| 900 if (parameters.parameterCount != 0) { | 901 if (parameters.parameterCount != 0) { |
| 901 compiler.cancel( | 902 compiler.cancel( |
| 902 'native "..." syntax is restricted to functions with zero parameters', | 903 'native "..." syntax is restricted to functions with zero parameters', |
| 903 node: nativeBody); | 904 node: nativeBody); |
| 904 } | 905 } |
| 905 LiteralString jsCode = nativeBody.asLiteralString(); | 906 LiteralString jsCode = nativeBody.asLiteralString(); |
| 906 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 907 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
| 907 } | 908 } |
| 908 } | 909 } |
| OLD | NEW |