| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 void maybeEnableNative(Compiler compiler, | 472 void maybeEnableNative(Compiler compiler, |
| 473 LibraryElement library) { | 473 LibraryElement library) { |
| 474 String libraryName = library.canonicalUri.toString(); | 474 String libraryName = library.canonicalUri.toString(); |
| 475 if (library.entryCompilationUnit.script.name.contains( | 475 if (library.entryCompilationUnit.script.name.contains( |
| 476 'dart/tests/compiler/dart2js_native') | 476 'dart/tests/compiler/dart2js_native') |
| 477 || libraryName == 'dart:async' | 477 || libraryName == 'dart:async' |
| 478 || libraryName == 'dart:html' | 478 || libraryName == 'dart:html' |
| 479 || libraryName == 'dart:html_common' | 479 || libraryName == 'dart:html_common' |
| 480 || libraryName == 'dart:indexed_db' | 480 || libraryName == 'dart:indexed_db' |
| 481 || libraryName == 'dart:svg' | 481 || libraryName == 'dart:svg' |
| 482 || libraryName == 'dart:web_audio') { | 482 || libraryName == 'dart:web_audio' |
| 483 || libraryName == 'dart:web_sql') { |
| 483 library.canUseNative = true; | 484 library.canUseNative = true; |
| 484 } | 485 } |
| 485 } | 486 } |
| 486 | 487 |
| 487 /** | 488 /** |
| 488 * A summary of the behavior of a native element. | 489 * A summary of the behavior of a native element. |
| 489 * | 490 * |
| 490 * Native code can return values of one type and cause native subtypes of | 491 * Native code can return values of one type and cause native subtypes of |
| 491 * another type to be instantiated. By default, we compute both from the | 492 * another type to be instantiated. By default, we compute both from the |
| 492 * declared type. | 493 * declared type. |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 } else { | 895 } else { |
| 895 if (parameters.parameterCount != 0) { | 896 if (parameters.parameterCount != 0) { |
| 896 compiler.cancel( | 897 compiler.cancel( |
| 897 'native "..." syntax is restricted to functions with zero parameters', | 898 'native "..." syntax is restricted to functions with zero parameters', |
| 898 node: nativeBody); | 899 node: nativeBody); |
| 899 } | 900 } |
| 900 LiteralString jsCode = nativeBody.asLiteralString(); | 901 LiteralString jsCode = nativeBody.asLiteralString(); |
| 901 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 902 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
| 902 } | 903 } |
| 903 } | 904 } |
| OLD | NEW |