| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 | 2 |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import 'dart:collection' show HashMap, HashSet; | 6 import 'dart:collection' show HashMap, HashSet; |
| 7 import 'dart:math' show min, max; | 7 import 'dart:math' show min, max; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 5854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5865 | 5865 |
| 5866 JS.Statement _callHelperStatement(String code, args) { | 5866 JS.Statement _callHelperStatement(String code, args) { |
| 5867 if (args is List) { | 5867 if (args is List) { |
| 5868 args.insert(0, _runtimeModule); | 5868 args.insert(0, _runtimeModule); |
| 5869 } else { | 5869 } else { |
| 5870 args = [_runtimeModule, args]; | 5870 args = [_runtimeModule, args]; |
| 5871 } | 5871 } |
| 5872 return js.statement('#.$code', args); | 5872 return js.statement('#.$code', args); |
| 5873 } | 5873 } |
| 5874 | 5874 |
| 5875 // TODO(kevmoo): https://github.com/dart-lang/sdk/issues/27255 |
| 5876 // TODO(kevmoo): Remove once pkg/angular2 has moved to the new compiler |
| 5877 // See https://github.com/dart-lang/angular2/issues/48 |
| 5878 /// Temporary workaround *cough* total hack *cough*. |
| 5879 /// |
| 5875 /// Maps whitelisted files to a list of whitelisted methods | 5880 /// Maps whitelisted files to a list of whitelisted methods |
| 5876 /// within the file. | 5881 /// within the file. |
| 5877 /// | 5882 /// |
| 5878 /// If the value is null, the entire file is whitelisted. | 5883 /// If the value is null, the entire file is whitelisted. |
| 5879 /// | 5884 /// |
| 5880 // TODO(jmesserly): why is this here, and what can we do to remove it? | 5885 static const Map<String, List<String>> _uncheckedWhitelist = const { |
| 5881 // | 5886 'dom_renderer.dart': const ['moveNodesAfterSibling'], |
| 5882 // Hard coded lists are completely unnecessary -- if a feature is needed, | 5887 'template_ref.dart': const ['createEmbeddedView'], |
| 5883 // metadata, type system features, or command line options are the right way | 5888 'ng_class.dart': const ['_applyIterableChanges'], |
| 5884 // to express it. | 5889 'ng_for.dart': const ['_bulkRemove', '_bulkInsert'], |
| 5885 // | 5890 'view_container_ref.dart': const ['createEmbeddedView'], |
| 5886 // As it is this is completely unsound and unmaintainable. | |
| 5887 static Map<String, List<String>> _uncheckedWhitelist = { | |
| 5888 'dom_renderer.dart': ['moveNodesAfterSibling'], | |
| 5889 'template_ref.dart': ['createEmbeddedView'], | |
| 5890 'ng_class.dart': ['_applyIterableChanges'], | |
| 5891 'ng_for.dart': ['_bulkRemove', '_bulkInsert'], | |
| 5892 'view_container_ref.dart': ['createEmbeddedView'], | |
| 5893 'default_iterable_differ.dart': null, | 5891 'default_iterable_differ.dart': null, |
| 5894 }; | 5892 }; |
| 5895 | 5893 |
| 5896 static Set<String> _uncheckedWhitelistCalls = new Set() | 5894 static Set<String> _uncheckedWhitelistCalls = new Set() |
| 5897 ..add('ng_zone_impl.dart') | 5895 ..add('ng_zone_impl.dart') |
| 5898 ..add('stack_zone_specification.dart') | 5896 ..add('stack_zone_specification.dart') |
| 5899 ..add('view_manager.dart') | 5897 ..add('view_manager.dart') |
| 5900 ..add('view.dart'); | 5898 ..add('view.dart'); |
| 5901 | 5899 |
| 5902 bool _inWhitelistCode(AstNode node, {isCall: false}) { | 5900 bool _inWhitelistCode(AstNode node, {isCall: false}) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6039 if (targetIdentifier.staticElement is! PrefixElement) return false; | 6037 if (targetIdentifier.staticElement is! PrefixElement) return false; |
| 6040 var prefix = targetIdentifier.staticElement as PrefixElement; | 6038 var prefix = targetIdentifier.staticElement as PrefixElement; |
| 6041 | 6039 |
| 6042 // The library the prefix is referring to must come from a deferred import. | 6040 // The library the prefix is referring to must come from a deferred import. |
| 6043 var containingLibrary = resolutionMap | 6041 var containingLibrary = resolutionMap |
| 6044 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 6042 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
| 6045 .library; | 6043 .library; |
| 6046 var imports = containingLibrary.getImportsWithPrefix(prefix); | 6044 var imports = containingLibrary.getImportsWithPrefix(prefix); |
| 6047 return imports.length == 1 && imports[0].isDeferred; | 6045 return imports.length == 1 && imports[0].isDeferred; |
| 6048 } | 6046 } |
| OLD | NEW |