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

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

Issue 2944003003: Fixes for super tearoff in constructor (Closed)
Patch Set: Format 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 | tests/language_strong/super_from_constructor_test.dart » ('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 4808 matching lines...) Expand 10 before | Expand all | Expand 10 after
4819 // Tear-off methods: explicitly bind it. 4819 // Tear-off methods: explicitly bind it.
4820 // To be safe always use the symbolized name when binding on a native 4820 // To be safe always use the symbolized name when binding on a native
4821 // class as bind assumes the name will match the name class signatures 4821 // class as bind assumes the name will match the name class signatures
4822 // which is symbolized for native classes. 4822 // which is symbolized for native classes.
4823 var safeName = _emitMemberName(memberName, 4823 var safeName = _emitMemberName(memberName,
4824 type: getStaticType(target), 4824 type: getStaticType(target),
4825 isStatic: isStatic, 4825 isStatic: isStatic,
4826 element: accessor, 4826 element: accessor,
4827 alwaysSymbolizeNative: true); 4827 alwaysSymbolizeNative: true);
4828 if (isSuper) { 4828 if (isSuper) {
4829 result = 4829 result = _callHelper('bind(this, #, #)',
4830 _callHelper('bind(this, #, #.#)', [safeName, jsTarget, safeName]); 4830 [safeName, _emitTargetAccess(jsTarget, name, accessor)]);
4831 } else if (_isObjectMemberCall(target, memberName)) { 4831 } else if (_isObjectMemberCall(target, memberName)) {
4832 result = _callHelper('bind(#, #, #.#)', 4832 result = _callHelper('bind(#, #, #.#)',
4833 [jsTarget, _propertyName(memberName), _runtimeModule, memberName]); 4833 [jsTarget, _propertyName(memberName), _runtimeModule, memberName]);
4834 } else { 4834 } else {
4835 result = _callHelper('bind(#, #)', [jsTarget, safeName]); 4835 result = _callHelper('bind(#, #)', [jsTarget, safeName]);
4836 } 4836 }
4837 } else if (_isObjectMemberCall(target, memberName)) { 4837 } else if (_isObjectMemberCall(target, memberName)) {
4838 result = _callHelper('#(#)', [memberName, jsTarget]); 4838 result = _callHelper('#(#)', [memberName, jsTarget]);
4839 } else { 4839 } else {
4840 result = _emitTargetAccess(jsTarget, name, accessor); 4840 result = _emitTargetAccess(jsTarget, name, accessor);
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
5863 if (targetIdentifier.staticElement is! PrefixElement) return false; 5863 if (targetIdentifier.staticElement is! PrefixElement) return false;
5864 var prefix = targetIdentifier.staticElement as PrefixElement; 5864 var prefix = targetIdentifier.staticElement as PrefixElement;
5865 5865
5866 // The library the prefix is referring to must come from a deferred import. 5866 // The library the prefix is referring to must come from a deferred import.
5867 var containingLibrary = resolutionMap 5867 var containingLibrary = resolutionMap
5868 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) 5868 .elementDeclaredByCompilationUnit(target.root as CompilationUnit)
5869 .library; 5869 .library;
5870 var imports = containingLibrary.getImportsWithPrefix(prefix); 5870 var imports = containingLibrary.getImportsWithPrefix(prefix);
5871 return imports.length == 1 && imports[0].isDeferred; 5871 return imports.length == 1 && imports[0].isDeferred;
5872 } 5872 }
OLDNEW
« no previous file with comments | « no previous file | tests/language_strong/super_from_constructor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698