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

Side by Side Diff: pkg/compiler/lib/src/constants/constant_constructors.dart

Issue 2118763002: Revert "Handle fields with initializers in constant constructors." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 // TODO(johnniwinther): Remove this library when all constant constructors are 5 // TODO(johnniwinther): Remove this library when all constant constructors are
6 // computed during resolution. 6 // computed during resolution.
7 library dart2js.constants.constant_constructors; 7 library dart2js.constants.constant_constructors;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 ConstantConstructor visitGenerativeConstructorDeclaration( 80 ConstantConstructor visitGenerativeConstructorDeclaration(
81 FunctionExpression node, 81 FunctionExpression node,
82 ConstructorElement constructor, 82 ConstructorElement constructor,
83 NodeList parameters, 83 NodeList parameters,
84 NodeList initializers, 84 NodeList initializers,
85 Node body, 85 Node body,
86 _) { 86 _) {
87 applyParameters(parameters, _); 87 applyParameters(parameters, _);
88 ConstructedConstantExpression constructorInvocation = 88 ConstructedConstantExpression constructorInvocation =
89 applyInitializers(node, _); 89 applyInitializers(node, _);
90 constructor.enclosingClass.forEachInstanceField((_, FieldElement field) {
91 if (!fieldMap.containsKey(field)) {
92 fieldMap[field] = field.constant;
93 }
94 });
95 return new GenerativeConstantConstructor( 90 return new GenerativeConstantConstructor(
96 currentClass.thisType, defaultValues, fieldMap, constructorInvocation); 91 currentClass.thisType, defaultValues, fieldMap, constructorInvocation);
97 } 92 }
98 93
99 ConstantConstructor visitRedirectingGenerativeConstructorDeclaration( 94 ConstantConstructor visitRedirectingGenerativeConstructorDeclaration(
100 FunctionExpression node, 95 FunctionExpression node,
101 ConstructorElement constructor, 96 ConstructorElement constructor,
102 NodeList parameters, 97 NodeList parameters,
103 NodeList initializers, 98 NodeList initializers,
104 _) { 99 _) {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 ConstantExpression visitNamedArgument(NamedArgument node) { 334 ConstantExpression visitNamedArgument(NamedArgument node) {
340 return apply(node.expression); 335 return apply(node.expression);
341 } 336 }
342 337
343 @override 338 @override
344 ConstantExpression visitIfNull(Send node, Node left, Node right, _) { 339 ConstantExpression visitIfNull(Send node, Node left, Node right, _) {
345 return new BinaryConstantExpression( 340 return new BinaryConstantExpression(
346 apply(left), BinaryOperator.IF_NULL, apply(right)); 341 apply(left), BinaryOperator.IF_NULL, apply(right));
347 } 342 }
348 } 343 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698