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

Side by Side Diff: pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart

Issue 2684783003: Refactor ConstantSystem (Closed)
Patch Set: Updated cf. comments. Created 3 years, 10 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) 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 import '../compiler.dart' show Compiler; 5 import '../compiler.dart' show Compiler;
6 import '../constants/values.dart'; 6 import '../constants/values.dart';
7 import '../elements/resolution_types.dart'; 7 import '../elements/resolution_types.dart';
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../universe/use.dart' show StaticUse; 9 import '../universe/use.dart' show StaticUse;
10 import '../universe/world_impact.dart' 10 import '../universe/world_impact.dart'
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 backend.addCompileTimeConstantForEmission(constant); 182 backend.addCompileTimeConstantForEmission(constant);
183 } 183 }
184 } 184 }
185 activeClasses.addAll(newActiveClasses); 185 activeClasses.addAll(newActiveClasses);
186 instantiatedClasses.removeAll(newActiveClasses); 186 instantiatedClasses.removeAll(newActiveClasses);
187 return impactBuilder.flush(); 187 return impactBuilder.flush();
188 } 188 }
189 189
190 TypeConstantValue makeTypeConstant(ClassElement element) { 190 TypeConstantValue makeTypeConstant(ClassElement element) {
191 ResolutionDartType elementType = element.rawType; 191 ResolutionDartType elementType = element.rawType;
192 return backend.constantSystem.createType(compiler, elementType); 192 return backend.constantSystem.createType(
193 compiler.commonElements, compiler.backend.backendClasses, elementType);
193 } 194 }
194 195
195 List<ConstructorElement> computeEscapingConstructors( 196 List<ConstructorElement> computeEscapingConstructors(
196 ClassElement classElement) { 197 ClassElement classElement) {
197 List<ConstructorElement> result = <ConstructorElement>[]; 198 List<ConstructorElement> result = <ConstructorElement>[];
198 // Only classes that extend native classes have constructors in the table. 199 // Only classes that extend native classes have constructors in the table.
199 // We could refine this to classes that extend Element, but that would break 200 // We could refine this to classes that extend Element, but that would break
200 // the tests and there is no sane reason to subclass other native classes. 201 // the tests and there is no sane reason to subclass other native classes.
201 if (backend.isNative(classElement)) return result; 202 if (backend.isNative(classElement)) return result;
202 203
203 void selectGenerativeConstructors(ClassElement enclosing, Element member) { 204 void selectGenerativeConstructors(ClassElement enclosing, Element member) {
204 if (member.isGenerativeConstructor) { 205 if (member.isGenerativeConstructor) {
205 // Ignore constructors that cannot be called with zero arguments. 206 // Ignore constructors that cannot be called with zero arguments.
206 ConstructorElement constructor = member; 207 ConstructorElement constructor = member;
207 constructor.computeType(compiler.resolution); 208 constructor.computeType(compiler.resolution);
208 FunctionSignature parameters = constructor.functionSignature; 209 FunctionSignature parameters = constructor.functionSignature;
209 if (parameters.requiredParameterCount == 0) { 210 if (parameters.requiredParameterCount == 0) {
210 result.add(member); 211 result.add(member);
211 } 212 }
212 } 213 }
213 } 214 }
214 215
215 classElement.forEachMember(selectGenerativeConstructors, 216 classElement.forEachMember(selectGenerativeConstructors,
216 includeBackendMembers: false, includeSuperAndInjectedMembers: false); 217 includeBackendMembers: false, includeSuperAndInjectedMembers: false);
217 return result; 218 return result;
218 } 219 }
219 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698