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

Side by Side Diff: pkg/compiler/lib/src/typechecker.dart

Issue 1919143002: Store constant variable initializers in elements. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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/ssa/builder.dart ('k') | tests/compiler/dart2js/serialization_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.typechecker; 5 library dart2js.typechecker;
6 6
7 import 'common/names.dart' show Identifiers; 7 import 'common/names.dart' show Identifiers;
8 import 'common/resolution.dart' show Resolution; 8 import 'common/resolution.dart' show Resolution;
9 import 'common/tasks.dart' show CompilerTask; 9 import 'common/tasks.dart' show CompilerTask;
10 import 'common.dart'; 10 import 'common.dart';
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 analyze(switchCase); 1946 analyze(switchCase);
1947 } 1947 }
1948 1948
1949 if (!hasDefaultCase && expressionType.isEnumType) { 1949 if (!hasDefaultCase && expressionType.isEnumType) {
1950 compiler.enqueuer.resolution.addDeferredAction(executableContext, () { 1950 compiler.enqueuer.resolution.addDeferredAction(executableContext, () {
1951 Map<ConstantValue, FieldElement> enumValues = 1951 Map<ConstantValue, FieldElement> enumValues =
1952 <ConstantValue, FieldElement>{}; 1952 <ConstantValue, FieldElement>{};
1953 List<FieldElement> unreferencedFields = <FieldElement>[]; 1953 List<FieldElement> unreferencedFields = <FieldElement>[];
1954 EnumClassElement enumClass = expressionType.element; 1954 EnumClassElement enumClass = expressionType.element;
1955 enumClass.enumValues.forEach((EnumConstantElement field) { 1955 enumClass.enumValues.forEach((EnumConstantElement field) {
1956 ConstantValue constantValue = 1956 // TODO(johnniwinther): Ensure that the enum constant is computed at
1957 compiler.constants.getConstantValueForVariable(field); 1957 // this point.
1958 ConstantValue constantValue = compiler.resolver.constantCompiler
1959 .getConstantValueForVariable(field);
1958 if (constantValue == null) { 1960 if (constantValue == null) {
1959 // The field might not have been resolved. 1961 // The field might not have been resolved.
1960 unreferencedFields.add(field); 1962 unreferencedFields.add(field);
1961 } else { 1963 } else {
1962 enumValues[constantValue] = field; 1964 enumValues[constantValue] = field;
1963 } 1965 }
1964 }); 1966 });
1965 1967
1966 for (SwitchCase switchCase in node.cases) { 1968 for (SwitchCase switchCase in node.cases) {
1967 for (Node labelOrCase in switchCase.labelsAndCases) { 1969 for (Node labelOrCase in switchCase.labelsAndCases) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 2012
2011 visitTypedef(Typedef node) { 2013 visitTypedef(Typedef node) {
2012 // Do not typecheck [Typedef] nodes. 2014 // Do not typecheck [Typedef] nodes.
2013 } 2015 }
2014 2016
2015 visitNode(Node node) { 2017 visitNode(Node node) {
2016 reporter.internalError(node, 2018 reporter.internalError(node,
2017 'Unexpected node ${node.getObjectDescription()} in the type checker.'); 2019 'Unexpected node ${node.getObjectDescription()} in the type checker.');
2018 } 2020 }
2019 } 2021 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/compiler/dart2js/serialization_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698