Chromium Code Reviews| 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 4784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4795 // which is symbolized for native classes. | 4795 // which is symbolized for native classes. |
| 4796 var safeName = _emitMemberName(memberName, | 4796 var safeName = _emitMemberName(memberName, |
| 4797 type: getStaticType(target), | 4797 type: getStaticType(target), |
| 4798 isStatic: isStatic, | 4798 isStatic: isStatic, |
| 4799 element: accessor, | 4799 element: accessor, |
| 4800 alwaysSymbolizeNative: true); | 4800 alwaysSymbolizeNative: true); |
| 4801 if (isSuper) { | 4801 if (isSuper) { |
| 4802 result = _callHelper('bind(this, #, #)', | 4802 result = _callHelper('bind(this, #, #)', |
| 4803 [safeName, _emitTargetAccess(jsTarget, name, accessor)]); | 4803 [safeName, _emitTargetAccess(jsTarget, name, accessor)]); |
| 4804 } else if (_isObjectMemberCall(target, memberName)) { | 4804 } else if (_isObjectMemberCall(target, memberName)) { |
| 4805 result = _callHelper('bind(#, #, #.#)', | 4805 result = _callHelper( |
|
Jennifer Messerly
2017/06/22 22:13:03
since we have just 4 of these (see `isObjectMember
vsm
2017/06/22 23:01:01
I don't think tearing these off is that common. W
| |
| 4806 'bind(#, #, function (...args) { return #.#.apply(null, [this].conca t(args)); })', | |
| 4806 [jsTarget, _propertyName(memberName), _runtimeModule, memberName]); | 4807 [jsTarget, _propertyName(memberName), _runtimeModule, memberName]); |
| 4807 } else { | 4808 } else { |
| 4808 result = _callHelper('bind(#, #)', [jsTarget, safeName]); | 4809 result = _callHelper('bind(#, #)', [jsTarget, safeName]); |
| 4809 } | 4810 } |
| 4810 } else if (_isObjectMemberCall(target, memberName)) { | 4811 } else if (_isObjectMemberCall(target, memberName)) { |
| 4811 result = _callHelper('#(#)', [memberName, jsTarget]); | 4812 result = _callHelper('#(#)', [memberName, jsTarget]); |
| 4812 } else { | 4813 } else { |
| 4813 result = _emitTargetAccess(jsTarget, name, accessor); | 4814 result = _emitTargetAccess(jsTarget, name, accessor); |
| 4814 } | 4815 } |
| 4815 if (typeArgs == null) { | 4816 if (typeArgs == null) { |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5836 if (targetIdentifier.staticElement is! PrefixElement) return false; | 5837 if (targetIdentifier.staticElement is! PrefixElement) return false; |
| 5837 var prefix = targetIdentifier.staticElement as PrefixElement; | 5838 var prefix = targetIdentifier.staticElement as PrefixElement; |
| 5838 | 5839 |
| 5839 // The library the prefix is referring to must come from a deferred import. | 5840 // The library the prefix is referring to must come from a deferred import. |
| 5840 var containingLibrary = resolutionMap | 5841 var containingLibrary = resolutionMap |
| 5841 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 5842 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
| 5842 .library; | 5843 .library; |
| 5843 var imports = containingLibrary.getImportsWithPrefix(prefix); | 5844 var imports = containingLibrary.getImportsWithPrefix(prefix); |
| 5844 return imports.length == 1 && imports[0].isDeferred; | 5845 return imports.length == 1 && imports[0].isDeferred; |
| 5845 } | 5846 } |
| OLD | NEW |