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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 411 |
412 void maybeEnableNative(Compiler compiler, | 412 void maybeEnableNative(Compiler compiler, |
413 LibraryElement library, | 413 LibraryElement library, |
414 Uri uri) { | 414 Uri uri) { |
415 String libraryName = uri.toString(); | 415 String libraryName = uri.toString(); |
416 if (library.entryCompilationUnit.script.name.contains( | 416 if (library.entryCompilationUnit.script.name.contains( |
417 'dart/tests/compiler/dart2js_native') | 417 'dart/tests/compiler/dart2js_native') |
418 || libraryName == 'dart:isolate' | 418 || libraryName == 'dart:isolate' |
419 || libraryName == 'dart:html' | 419 || libraryName == 'dart:html' |
420 || libraryName == 'dart:html_common' | 420 || libraryName == 'dart:html_common' |
| 421 || libraryName == 'dart:indexed_db' |
421 || libraryName == 'dart:svg' | 422 || libraryName == 'dart:svg' |
422 || libraryName == 'dart:web_audio') { | 423 || libraryName == 'dart:web_audio') { |
423 library.canUseNative = true; | 424 library.canUseNative = true; |
424 } | 425 } |
425 } | 426 } |
426 | 427 |
427 /** | 428 /** |
428 * A summary of the behavior of a native element. | 429 * A summary of the behavior of a native element. |
429 * | 430 * |
430 * Native code can return values of one type and cause native subtypes of | 431 * 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... |
863 builder.add(new HForeign( | 864 builder.add(new HForeign( |
864 new DartString.literal('${parameter.name.slowToString()} = #'), | 865 new DartString.literal('${parameter.name.slowToString()} = #'), |
865 const LiteralDartString('void'), | 866 const LiteralDartString('void'), |
866 <HInstruction>[jsClosure])); | 867 <HInstruction>[jsClosure])); |
867 } | 868 } |
868 }); | 869 }); |
869 LiteralString jsCode = nativeBody.asLiteralString(); | 870 LiteralString jsCode = nativeBody.asLiteralString(); |
870 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 871 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
871 } | 872 } |
872 } | 873 } |
OLD | NEW |