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

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

Issue 2735763002: Create ResolutionEnqueuer after library loading. (Closed)
Patch Set: Updated cf. comments. Created 3 years, 9 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) 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 22 matching lines...) Expand all
33 MemberSignature, 33 MemberSignature,
34 Name, 34 Name,
35 ParameterElement, 35 ParameterElement,
36 PrivateName, 36 PrivateName,
37 PublicName, 37 PublicName,
38 ResolvedAst, 38 ResolvedAst,
39 SetterElement, 39 SetterElement,
40 TypeDeclarationElement, 40 TypeDeclarationElement,
41 TypedElement, 41 TypedElement,
42 VariableElement; 42 VariableElement;
43 import 'enqueue.dart' show DeferredAction;
43 import 'resolution/class_members.dart' show MembersCreator, ErroneousMember; 44 import 'resolution/class_members.dart' show MembersCreator, ErroneousMember;
44 import 'resolution/tree_elements.dart' show TreeElements; 45 import 'resolution/tree_elements.dart' show TreeElements;
45 import 'tree/tree.dart'; 46 import 'tree/tree.dart';
46 import 'util/util.dart' show Link, LinkBuilder; 47 import 'util/util.dart' show Link, LinkBuilder;
47 48
48 class TypeCheckerTask extends CompilerTask { 49 class TypeCheckerTask extends CompilerTask {
49 final Compiler compiler; 50 final Compiler compiler;
50 TypeCheckerTask(Compiler compiler) 51 TypeCheckerTask(Compiler compiler)
51 : compiler = compiler, 52 : compiler = compiler,
52 super(compiler.measurer); 53 super(compiler.measurer);
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 if (caseMatch == null) continue; 1986 if (caseMatch == null) continue;
1986 1987
1987 ResolutionDartType caseType = analyze(caseMatch.expression); 1988 ResolutionDartType caseType = analyze(caseMatch.expression);
1988 checkAssignable(caseMatch, expressionType, caseType); 1989 checkAssignable(caseMatch, expressionType, caseType);
1989 } 1990 }
1990 1991
1991 analyzeUntyped(switchCase); 1992 analyzeUntyped(switchCase);
1992 } 1993 }
1993 1994
1994 if (!hasDefaultCase && expressionType.isEnumType) { 1995 if (!hasDefaultCase && expressionType.isEnumType) {
1995 compiler.enqueuer.resolution.addDeferredAction(executableContext, () { 1996 compiler.enqueuer.resolution
1997 .addDeferredAction(new DeferredAction(executableContext, () {
1996 Map<ConstantValue, FieldElement> enumValues = 1998 Map<ConstantValue, FieldElement> enumValues =
1997 <ConstantValue, FieldElement>{}; 1999 <ConstantValue, FieldElement>{};
1998 List<FieldElement> unreferencedFields = <FieldElement>[]; 2000 List<FieldElement> unreferencedFields = <FieldElement>[];
1999 EnumClassElement enumClass = expressionType.element; 2001 EnumClassElement enumClass = expressionType.element;
2000 enumClass.enumValues.forEach((EnumConstantElement field) { 2002 enumClass.enumValues.forEach((EnumConstantElement field) {
2001 // TODO(johnniwinther): Ensure that the enum constant is computed at 2003 // TODO(johnniwinther): Ensure that the enum constant is computed at
2002 // this point. 2004 // this point.
2003 ConstantValue constantValue = compiler.resolver.constantCompiler 2005 ConstantValue constantValue = compiler.resolver.constantCompiler
2004 .getConstantValueForVariable(field); 2006 .getConstantValueForVariable(field);
2005 if (constantValue == null) { 2007 if (constantValue == null) {
(...skipping 16 matching lines...) Expand all
2022 } 2024 }
2023 } 2025 }
2024 } 2026 }
2025 unreferencedFields.addAll(enumValues.values); 2027 unreferencedFields.addAll(enumValues.values);
2026 if (!unreferencedFields.isEmpty) { 2028 if (!unreferencedFields.isEmpty) {
2027 reporter.reportWarningMessage(node, MessageKind.MISSING_ENUM_CASES, { 2029 reporter.reportWarningMessage(node, MessageKind.MISSING_ENUM_CASES, {
2028 'enumType': expressionType, 2030 'enumType': expressionType,
2029 'enumValues': unreferencedFields.map((e) => e.name).join(', ') 2031 'enumValues': unreferencedFields.map((e) => e.name).join(', ')
2030 }); 2032 });
2031 } 2033 }
2032 }); 2034 }));
2033 } 2035 }
2034 } 2036 }
2035 2037
2036 visitSwitchCase(SwitchCase node) { 2038 visitSwitchCase(SwitchCase node) {
2037 analyzeUntyped(node.statements); 2039 analyzeUntyped(node.statements);
2038 } 2040 }
2039 2041
2040 visitTryStatement(TryStatement node) { 2042 visitTryStatement(TryStatement node) {
2041 // TODO(johnniwinther): Use reachability information of try-block, 2043 // TODO(johnniwinther): Use reachability information of try-block,
2042 // catch-blocks and finally-block to compute the whether the try statement 2044 // catch-blocks and finally-block to compute the whether the try statement
(...skipping 11 matching lines...) Expand all
2054 2056
2055 visitTypedef(Typedef node) { 2057 visitTypedef(Typedef node) {
2056 // Do not typecheck [Typedef] nodes. 2058 // Do not typecheck [Typedef] nodes.
2057 } 2059 }
2058 2060
2059 visitNode(Node node) { 2061 visitNode(Node node) {
2060 reporter.internalError(node, 2062 reporter.internalError(node,
2061 'Unexpected node ${node.getObjectDescription()} in the type checker.'); 2063 'Unexpected node ${node.getObjectDescription()} in the type checker.');
2062 } 2064 }
2063 } 2065 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution_common.dart ('k') | pkg/compiler/lib/src/universe/resolution_world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698