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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.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
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/enqueue.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library elements.modelx; 5 library elements.modelx;
6 6
7 import 'common.dart'; 7 import 'common.dart';
8 import 'elements.dart'; 8 import 'elements.dart';
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/constructors.dart'; 10 import '../constants/constructors.dart';
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 enclosing) ; 2135 enclosing) ;
2136 2136
2137 SynthesizedConstructorElementX.forDefault(this.definingConstructor, 2137 SynthesizedConstructorElementX.forDefault(this.definingConstructor,
2138 Element enclosing) 2138 Element enclosing)
2139 : isDefaultConstructor = true, 2139 : isDefaultConstructor = true,
2140 super('', 2140 super('',
2141 ElementKind.GENERATIVE_CONSTRUCTOR, 2141 ElementKind.GENERATIVE_CONSTRUCTOR,
2142 Modifiers.EMPTY, 2142 Modifiers.EMPTY,
2143 enclosing) { 2143 enclosing) {
2144 typeCache = new FunctionType.synthesized(enclosingClass.thisType); 2144 typeCache = new FunctionType.synthesized(enclosingClass.thisType);
2145 functionSignatureCache = new FunctionSignatureX(type: type);
2145 } 2146 }
2146 2147
2147 FunctionExpression parseNode(DiagnosticListener listener) => null; 2148 FunctionExpression parseNode(DiagnosticListener listener) => null;
2148 2149
2149 bool get hasNode => false; 2150 bool get hasNode => false;
2150 2151
2151 FunctionExpression get node => null; 2152 FunctionExpression get node => null;
2152 2153
2153 Token get position => enclosingElement.position; 2154 Token get position => enclosingElement.position;
2154 2155
2155 bool get isSynthesized => true; 2156 bool get isSynthesized => true;
2156 2157
2157 DartType get type { 2158 DartType get type {
2158 if (isDefaultConstructor) { 2159 if (isDefaultConstructor) {
2159 return super.type; 2160 return super.type;
2160 } else { 2161 } else {
2161 // TODO(johnniwinther): Ensure that the function type substitutes type 2162 // TODO(johnniwinther): Ensure that the function type substitutes type
2162 // variables correctly. 2163 // variables correctly.
2163 return definingConstructor.type; 2164 return definingConstructor.type;
2164 } 2165 }
2165 } 2166 }
2166 2167
2167 FunctionSignature computeSignature(compiler) { 2168 FunctionSignature computeSignature(compiler) {
2168 if (functionSignatureCache != null) return functionSignatureCache; 2169 if (functionSignatureCache != null) return functionSignatureCache;
2169 if (isDefaultConstructor) {
2170 return functionSignatureCache = new FunctionSignatureX(
2171 type: type);
2172 }
2173 if (definingConstructor.isErroneous) { 2170 if (definingConstructor.isErroneous) {
2174 return functionSignatureCache = 2171 return functionSignatureCache =
2175 compiler.objectClass.localLookup('').computeSignature(compiler); 2172 compiler.objectClass.localLookup('').computeSignature(compiler);
2176 } 2173 }
2177 // TODO(johnniwinther): Ensure that the function signature (and with it the 2174 // TODO(johnniwinther): Ensure that the function signature (and with it the
2178 // function type) substitutes type variables correctly. 2175 // function type) substitutes type variables correctly.
2179 return functionSignatureCache = 2176 definingConstructor.computeType(compiler);
2180 definingConstructor.computeSignature(compiler); 2177 functionSignatureCache = definingConstructor.functionSignature;
2178 typeCache = definingConstructor.type;
2179 return functionSignatureCache;
2181 } 2180 }
2182 2181
2183 accept(ElementVisitor visitor, arg) { 2182 accept(ElementVisitor visitor, arg) {
2184 return visitor.visitFunctionElement(this, arg); 2183 return visitor.visitFunctionElement(this, arg);
2185 } 2184 }
2186 } 2185 }
2187 2186
2188 abstract class TypeDeclarationElementX<T extends GenericType> 2187 abstract class TypeDeclarationElementX<T extends GenericType>
2189 implements TypeDeclarationElement { 2188 implements TypeDeclarationElement {
2190 /** 2189 /**
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2902 AstElement get definingElement; 2901 AstElement get definingElement;
2903 2902
2904 bool get hasResolvedAst => definingElement.hasTreeElements; 2903 bool get hasResolvedAst => definingElement.hasTreeElements;
2905 2904
2906 ResolvedAst get resolvedAst { 2905 ResolvedAst get resolvedAst {
2907 return new ResolvedAst(declaration, 2906 return new ResolvedAst(declaration,
2908 definingElement.node, definingElement.treeElements); 2907 definingElement.node, definingElement.treeElements);
2909 } 2908 }
2910 2909
2911 } 2910 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698