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 } | 449 } |
450 | 450 |
451 void maybeEnableNative(Compiler compiler, | 451 void maybeEnableNative(Compiler compiler, |
452 LibraryElement library, | 452 LibraryElement library, |
453 Uri uri) { | 453 Uri uri) { |
454 String libraryName = uri.toString(); | 454 String libraryName = uri.toString(); |
455 if (library.entryCompilationUnit.script.name.contains( | 455 if (library.entryCompilationUnit.script.name.contains( |
456 'dart/tests/compiler/dart2js_native') | 456 'dart/tests/compiler/dart2js_native') |
457 || libraryName == 'dart:async' | 457 || libraryName == 'dart:async' |
458 || libraryName == 'dart:chrome' | |
ahe
2013/01/17 18:41:27
Why do you need this?
blois
2013/01/17 21:03:30
I was under the impression that this is required f
ahe
2013/01/17 22:06:55
I think this is different from dart:html, etc.
As
| |
458 || libraryName == 'dart:html' | 459 || libraryName == 'dart:html' |
459 || libraryName == 'dart:html_common' | 460 || libraryName == 'dart:html_common' |
460 || libraryName == 'dart:indexed_db' | 461 || libraryName == 'dart:indexed_db' |
461 || libraryName == 'dart:svg' | 462 || libraryName == 'dart:svg' |
462 || libraryName == 'dart:web_audio') { | 463 || libraryName == 'dart:web_audio') { |
463 library.canUseNative = true; | 464 library.canUseNative = true; |
464 } | 465 } |
465 } | 466 } |
466 | 467 |
467 /** | 468 /** |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
875 } else { | 876 } else { |
876 if (parameters.parameterCount != 0) { | 877 if (parameters.parameterCount != 0) { |
877 compiler.cancel( | 878 compiler.cancel( |
878 'native "..." syntax is restricted to functions with zero parameters', | 879 'native "..." syntax is restricted to functions with zero parameters', |
879 node: nativeBody); | 880 node: nativeBody); |
880 } | 881 } |
881 LiteralString jsCode = nativeBody.asLiteralString(); | 882 LiteralString jsCode = nativeBody.asLiteralString(); |
882 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 883 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
883 } | 884 } |
884 } | 885 } |
OLD | NEW |