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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 void maybeEnableNative(Compiler compiler, | 482 void maybeEnableNative(Compiler compiler, |
483 LibraryElement library) { | 483 LibraryElement library) { |
484 String libraryName = library.canonicalUri.toString(); | 484 String libraryName = library.canonicalUri.toString(); |
485 if (library.entryCompilationUnit.script.name.contains( | 485 if (library.entryCompilationUnit.script.name.contains( |
486 'dart/tests/compiler/dart2js_native') | 486 'dart/tests/compiler/dart2js_native') |
487 || libraryName == 'dart:async' | 487 || libraryName == 'dart:async' |
488 || libraryName == 'dart:html' | 488 || libraryName == 'dart:html' |
489 || libraryName == 'dart:html_common' | 489 || libraryName == 'dart:html_common' |
490 || libraryName == 'dart:indexed_db' | 490 || libraryName == 'dart:indexed_db' |
491 || libraryName == 'dart:svg' | 491 || libraryName == 'dart:svg' |
492 || libraryName == 'dart:typeddata' | 492 || libraryName == 'dart:typed_data' |
493 || libraryName == 'dart:web_audio' | 493 || libraryName == 'dart:web_audio' |
494 || libraryName == 'dart:web_gl' | 494 || libraryName == 'dart:web_gl' |
495 || libraryName == 'dart:web_sql') { | 495 || libraryName == 'dart:web_sql') { |
496 library.canUseNative = true; | 496 library.canUseNative = true; |
497 } | 497 } |
498 } | 498 } |
499 | 499 |
500 /** | 500 /** |
501 * A summary of the behavior of a native element. | 501 * A summary of the behavior of a native element. |
502 * | 502 * |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 } else { | 908 } else { |
909 if (parameters.parameterCount != 0) { | 909 if (parameters.parameterCount != 0) { |
910 compiler.cancel( | 910 compiler.cancel( |
911 'native "..." syntax is restricted to functions with zero parameters', | 911 'native "..." syntax is restricted to functions with zero parameters', |
912 node: nativeBody); | 912 node: nativeBody); |
913 } | 913 } |
914 LiteralString jsCode = nativeBody.asLiteralString(); | 914 LiteralString jsCode = nativeBody.asLiteralString(); |
915 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 915 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
916 } | 916 } |
917 } | 917 } |
OLD | NEW |