Chromium Code Reviews| 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 '../compiler.dart' show Compiler; | |
| 8 import '../elements/entities.dart'; | 7 import '../elements/entities.dart'; |
| 9 | 8 |
| 10 export 'behavior.dart'; | 9 export 'behavior.dart'; |
| 11 export 'enqueue.dart'; | 10 export 'enqueue.dart'; |
| 12 export 'js.dart'; | 11 export 'js.dart'; |
| 13 export 'scanner.dart'; | 12 export 'scanner.dart'; |
| 14 export 'ssa.dart'; | 13 export 'ssa.dart'; |
| 15 | 14 |
| 16 const Iterable<String> _allowedDartSchemePaths = const <String>[ | 15 const Iterable<String> _allowedDartSchemePaths = const <String>[ |
| 17 'async', | 16 'async', |
| 18 'html', | 17 'html', |
| 19 'html_common', | 18 'html_common', |
| 20 'indexed_db', | 19 'indexed_db', |
| 21 'js', | 20 'js', |
| 22 'js_util', | 21 'js_util', |
| 23 'svg', | 22 'svg', |
| 24 '_native_typed_data', | 23 '_native_typed_data', |
| 25 'web_audio', | 24 'web_audio', |
| 26 'web_gl', | 25 'web_gl', |
| 27 'web_sql' | 26 'web_sql' |
| 28 ]; | 27 ]; |
| 29 | 28 |
| 30 bool maybeEnableNative(Compiler compiler, LibraryEntity library) { | 29 bool maybeEnableNative(LibraryEntity library, |
|
Siggi Cherem (dart-lang)
2017/05/30 22:17:56
Could we change this to just take the Uri instead?
Johnni Winther
2017/05/31 08:40:01
Done.
| |
| 30 {bool allowNativeExtensions: false}) { | |
| 31 bool allowedTestLibrary() { | 31 bool allowedTestLibrary() { |
| 32 Uri uri = library.canonicalUri; | 32 Uri uri = library.canonicalUri; |
| 33 String scriptName = uri.path; | 33 String scriptName = uri.path; |
| 34 return scriptName.contains('sdk/tests/compiler/dart2js_native') || | 34 return scriptName.contains('sdk/tests/compiler/dart2js_native') || |
| 35 scriptName.contains('sdk/tests/compiler/dart2js_extra'); | 35 scriptName.contains('sdk/tests/compiler/dart2js_extra'); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool allowedDartLibary() { | 38 bool allowedDartLibary() { |
| 39 Uri uri = library.canonicalUri; | 39 Uri uri = library.canonicalUri; |
| 40 if (uri.scheme != 'dart') return false; | 40 if (uri.scheme != 'dart') return false; |
| 41 return _allowedDartSchemePaths.contains(uri.path); | 41 return _allowedDartSchemePaths.contains(uri.path); |
| 42 } | 42 } |
| 43 | 43 |
| 44 return allowedTestLibrary() || | 44 return allowedTestLibrary() || allowedDartLibary() || allowNativeExtensions; |
| 45 allowedDartLibary() || | |
| 46 compiler.options.allowNativeExtensions; | |
| 47 } | 45 } |
| OLD | NEW |