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

Side by Side Diff: pkg/compiler/lib/src/resolution/class_hierarchy.dart

Issue 1165363004: Remove computeSignature from FunctionElement. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
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 // 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 part of resolution; 5 part of resolution;
6 6
7 class TypeDefinitionVisitor extends MappingVisitor<DartType> { 7 class TypeDefinitionVisitor extends MappingVisitor<DartType> {
8 Scope scope; 8 Scope scope;
9 final TypeDeclarationElement enclosingElement; 9 final TypeDeclarationElement enclosingElement;
10 TypeDeclarationElement get element => enclosingElement; 10 TypeDeclarationElement get element => enclosingElement;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 Map arguments = {'constructorName': ''}; 158 Map arguments = {'constructorName': ''};
159 // TODO(ahe): Why is this a compile-time error? Or if it is an error, 159 // TODO(ahe): Why is this a compile-time error? Or if it is an error,
160 // why do we bother to registerThrowNoSuchMethod below? 160 // why do we bother to registerThrowNoSuchMethod below?
161 compiler.reportError(node, kind, arguments); 161 compiler.reportError(node, kind, arguments);
162 superMember = new ErroneousElementX( 162 superMember = new ErroneousElementX(
163 kind, arguments, '', element); 163 kind, arguments, '', element);
164 registry.registerThrowNoSuchMethod(); 164 registry.registerThrowNoSuchMethod();
165 } else { 165 } else {
166 ConstructorElement superConstructor = superMember; 166 ConstructorElement superConstructor = superMember;
167 Selector callToMatch = new Selector.call("", element.library, 0); 167 Selector callToMatch = new Selector.call("", element.library, 0);
168 superConstructor.computeSignature(compiler); 168 superConstructor.computeType(compiler);
169 if (!callToMatch.applies(superConstructor, compiler.world)) { 169 if (!callToMatch.applies(superConstructor, compiler.world)) {
170 MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT; 170 MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT;
171 compiler.reportError(node, kind); 171 compiler.reportError(node, kind);
172 superMember = new ErroneousElementX(kind, {}, '', element); 172 superMember = new ErroneousElementX(kind, {}, '', element);
173 } 173 }
174 } 174 }
175 FunctionElement constructor = 175 FunctionElement constructor =
176 new SynthesizedConstructorElementX.forDefault(superMember, element); 176 new SynthesizedConstructorElementX.forDefault(superMember, element);
177 if (superMember.isErroneous) { 177 if (superMember.isErroneous) {
178 compiler.elementsWithCompileTimeErrors.add(constructor); 178 compiler.elementsWithCompileTimeErrors.add(constructor);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 mixinApplication.computeThisAndRawType(compiler, typeVariables); 289 mixinApplication.computeThisAndRawType(compiler, typeVariables);
290 // Substitute in synthetic type variables in super and mixin types. 290 // Substitute in synthetic type variables in super and mixin types.
291 supertype = supertype.subst(typeVariables, element.typeVariables); 291 supertype = supertype.subst(typeVariables, element.typeVariables);
292 mixinType = mixinType.subst(typeVariables, element.typeVariables); 292 mixinType = mixinType.subst(typeVariables, element.typeVariables);
293 293
294 doApplyMixinTo(mixinApplication, supertype, mixinType); 294 doApplyMixinTo(mixinApplication, supertype, mixinType);
295 mixinApplication.resolutionState = STATE_DONE; 295 mixinApplication.resolutionState = STATE_DONE;
296 mixinApplication.supertypeLoadState = STATE_DONE; 296 mixinApplication.supertypeLoadState = STATE_DONE;
297 // Replace the synthetic type variables by the original type variables in 297 // Replace the synthetic type variables by the original type variables in
298 // the returned type (which should be the type actually extended). 298 // the returned type (which should be the type actually extended).
299 InterfaceType mixinThisType = mixinApplication.computeType(compiler); 299 InterfaceType mixinThisType = mixinApplication.thisType;
300 return mixinThisType.subst(element.typeVariables, 300 return mixinThisType.subst(element.typeVariables,
301 mixinThisType.typeArguments); 301 mixinThisType.typeArguments);
302 } 302 }
303 303
304 bool isDefaultConstructor(FunctionElement constructor) { 304 bool isDefaultConstructor(FunctionElement constructor) {
305 return constructor.name == '' && 305 if (constructor.name != '') return false;
306 constructor.computeSignature(compiler).parameterCount == 0; 306 constructor.computeType(compiler);
307 return constructor.functionSignature.parameterCount == 0;
307 } 308 }
308 309
309 FunctionElement createForwardingConstructor(ConstructorElement target, 310 FunctionElement createForwardingConstructor(ConstructorElement target,
310 ClassElement enclosing) { 311 ClassElement enclosing) {
311 return new SynthesizedConstructorElementX.notForDefault( 312 return new SynthesizedConstructorElementX.notForDefault(
312 target.name, target, enclosing); 313 target.name, target, enclosing);
313 } 314 }
314 315
315 void doApplyMixinTo(MixinApplicationElementX mixinApplication, 316 void doApplyMixinTo(MixinApplicationElementX mixinApplication,
316 DartType supertype, 317 DartType supertype,
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 Identifier selector = node.selector.asIdentifier(); 630 Identifier selector = node.selector.asIdentifier();
630 var e = prefixElement.lookupLocalMember(selector.source); 631 var e = prefixElement.lookupLocalMember(selector.source);
631 if (e == null || !e.impliesType) { 632 if (e == null || !e.impliesType) {
632 error(node.selector, MessageKind.CANNOT_RESOLVE_TYPE, 633 error(node.selector, MessageKind.CANNOT_RESOLVE_TYPE,
633 {'typeName': node.selector}); 634 {'typeName': node.selector});
634 return; 635 return;
635 } 636 }
636 loadSupertype(e, node); 637 loadSupertype(e, node);
637 } 638 }
638 } 639 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698