Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2953933002: Fix Object method tearoffs (Closed)
Patch Set: Address comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/dev_compiler/test/browser/language_tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 var fn = js.call(
4806 [jsTarget, _propertyName(memberName), _runtimeModule, memberName]); 4806 memberName == 'noSuchMethod'
4807 ? 'function(i) { return #.#(this, i); }'
4808 : 'function() { return #.#(this); }',
4809 [_runtimeModule, memberName]);
4810 result = _callHelper(
4811 'bind(#, #, #)', [jsTarget, _propertyName(memberName), fn]);
4807 } else { 4812 } else {
4808 result = _callHelper('bind(#, #)', [jsTarget, safeName]); 4813 result = _callHelper('bind(#, #)', [jsTarget, safeName]);
4809 } 4814 }
4810 } else if (_isObjectMemberCall(target, memberName)) { 4815 } else if (_isObjectMemberCall(target, memberName)) {
4811 result = _callHelper('#(#)', [memberName, jsTarget]); 4816 result = _callHelper('#(#)', [memberName, jsTarget]);
4812 } else { 4817 } else {
4813 result = _emitTargetAccess(jsTarget, name, accessor); 4818 result = _emitTargetAccess(jsTarget, name, accessor);
4814 } 4819 }
4815 if (typeArgs == null) { 4820 if (typeArgs == null) {
4816 return result; 4821 return result;
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
5831 if (targetIdentifier.staticElement is! PrefixElement) return false; 5836 if (targetIdentifier.staticElement is! PrefixElement) return false;
5832 var prefix = targetIdentifier.staticElement as PrefixElement; 5837 var prefix = targetIdentifier.staticElement as PrefixElement;
5833 5838
5834 // The library the prefix is referring to must come from a deferred import. 5839 // The library the prefix is referring to must come from a deferred import.
5835 var containingLibrary = resolutionMap 5840 var containingLibrary = resolutionMap
5836 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) 5841 .elementDeclaredByCompilationUnit(target.root as CompilationUnit)
5837 .library; 5842 .library;
5838 var imports = containingLibrary.getImportsWithPrefix(prefix); 5843 var imports = containingLibrary.getImportsWithPrefix(prefix);
5839 return imports.length == 1 && imports[0].isDeferred; 5844 return imports.length == 1 && imports[0].isDeferred;
5840 } 5845 }
OLDNEW
« no previous file with comments | « no previous file | pkg/dev_compiler/test/browser/language_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698