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 | 8 |
9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
10 import '../dart2jslib.dart'; | 10 import '../dart2jslib.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 part 'behavior.dart'; | 25 part 'behavior.dart'; |
26 part 'enqueue.dart'; | 26 part 'enqueue.dart'; |
27 part 'js.dart'; | 27 part 'js.dart'; |
28 part 'scanner.dart'; | 28 part 'scanner.dart'; |
29 part 'ssa.dart'; | 29 part 'ssa.dart'; |
30 | 30 |
31 void maybeEnableNative(Compiler compiler, | 31 void maybeEnableNative(Compiler compiler, |
32 LibraryElementX library) { | 32 LibraryElementX library) { |
33 String libraryName = library.canonicalUri.toString(); | 33 String libraryName = library.canonicalUri.toString(); |
34 if (library.entryCompilationUnit.script.name.contains( | 34 if (library.entryCompilationUnit.script.name.contains( |
35 'dart/tests/compiler/dart2js_native') | 35 'sdk/tests/compiler/dart2js_native') |
36 || libraryName == 'dart:async' | 36 || libraryName == 'dart:async' |
37 || libraryName == 'dart:html' | 37 || libraryName == 'dart:html' |
38 || libraryName == 'dart:html_common' | 38 || libraryName == 'dart:html_common' |
39 || libraryName == 'dart:indexed_db' | 39 || libraryName == 'dart:indexed_db' |
40 || libraryName == 'dart:js' | 40 || libraryName == 'dart:js' |
41 || libraryName == 'dart:svg' | 41 || libraryName == 'dart:svg' |
42 || libraryName == 'dart:_native_typed_data' | 42 || libraryName == 'dart:_native_typed_data' |
43 || libraryName == 'dart:web_audio' | 43 || libraryName == 'dart:web_audio' |
44 || libraryName == 'dart:web_gl' | 44 || libraryName == 'dart:web_gl' |
45 || libraryName == 'dart:web_sql' | 45 || libraryName == 'dart:web_sql' |
46 || compiler.allowNativeExtensions) { | 46 || compiler.allowNativeExtensions) { |
47 library.canUseNative = true; | 47 library.canUseNative = true; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 // The tags string contains comma-separated 'words' which are either dispatch | 51 // The tags string contains comma-separated 'words' which are either dispatch |
52 // tags (having JavaScript identifier syntax) and directives that begin with | 52 // tags (having JavaScript identifier syntax) and directives that begin with |
53 // `!`. | 53 // `!`. |
54 List<String> nativeTagsOfClassRaw(ClassElement cls) { | 54 List<String> nativeTagsOfClassRaw(ClassElement cls) { |
55 String quotedName = cls.nativeTagInfo; | 55 String quotedName = cls.nativeTagInfo; |
56 return quotedName.substring(1, quotedName.length - 1).split(','); | 56 return quotedName.substring(1, quotedName.length - 1).split(','); |
57 } | 57 } |
58 | 58 |
59 List<String> nativeTagsOfClass(ClassElement cls) { | 59 List<String> nativeTagsOfClass(ClassElement cls) { |
60 return nativeTagsOfClassRaw(cls).where((s) => !s.startsWith('!')).toList(); | 60 return nativeTagsOfClassRaw(cls).where((s) => !s.startsWith('!')).toList(); |
61 } | 61 } |
62 | 62 |
63 bool nativeTagsForcedNonLeaf(ClassElement cls) => | 63 bool nativeTagsForcedNonLeaf(ClassElement cls) => |
64 nativeTagsOfClassRaw(cls).contains('!nonleaf'); | 64 nativeTagsOfClassRaw(cls).contains('!nonleaf'); |
OLD | NEW |