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

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

Issue 2942763002: Late night strong mode cleaning. (Closed)
Patch Set: Created 3 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/platform_configuration.dart ('k') | pkg/compiler/testing_strong.json » ('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';
11 import 'compiler.dart' show Compiler; 11 import 'compiler.dart' show Compiler;
12 import 'constants/expressions.dart'; 12 import 'constants/expressions.dart';
13 import 'constants/values.dart'; 13 import 'constants/values.dart';
14 import 'common_elements.dart'; 14 import 'common_elements.dart';
15 import 'elements/resolution_types.dart'; 15 import 'elements/resolution_types.dart';
16 import 'elements/elements.dart' 16 import 'elements/elements.dart'
17 show 17 show
18 AbstractFieldElement, 18 AbstractFieldElement,
19 AstElement, 19 AstElement,
20 ClassElement, 20 ClassElement,
21 ConstructorElement, 21 ConstructorElement,
22 Element, 22 Element,
23 Elements, 23 Elements,
24 EnumClassElement, 24 EnumClassElement,
25 EnumConstantElement, 25 EnumConstantElement,
26 ExecutableElement, 26 ExecutableElement,
27 FieldElement, 27 FieldElement,
28 FormalElement,
28 FunctionElement, 29 FunctionElement,
29 GetterElement, 30 GetterElement,
30 InitializingFormalElement, 31 InitializingFormalElement,
31 LibraryElement, 32 LibraryElement,
32 MemberSignature, 33 MemberSignature,
33 ParameterElement,
34 ResolvedAst, 34 ResolvedAst,
35 SetterElement, 35 SetterElement,
36 TypeDeclarationElement, 36 TypeDeclarationElement,
37 TypedElement, 37 TypedElement,
38 VariableElement; 38 VariableElement;
39 import 'elements/entities.dart' show AsyncMarker; 39 import 'elements/entities.dart' show AsyncMarker;
40 import 'elements/names.dart'; 40 import 'elements/names.dart';
41 import 'enqueue.dart' show DeferredAction; 41 import 'enqueue.dart' show DeferredAction;
42 import 'resolution/class_members.dart' show MembersCreator, ErroneousMember; 42 import 'resolution/class_members.dart' show MembersCreator, ErroneousMember;
43 import 'resolution/tree_elements.dart' show TreeElements; 43 import 'resolution/tree_elements.dart' show TreeElements;
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 ResolutionDartType type; 647 ResolutionDartType type;
648 ResolutionDartType returnType; 648 ResolutionDartType returnType;
649 final FunctionElement element = elements.getFunctionDefinition(node); 649 final FunctionElement element = elements.getFunctionDefinition(node);
650 assert( 650 assert(
651 element != null, failedAt(node, 'FunctionExpression with no element')); 651 element != null, failedAt(node, 'FunctionExpression with no element'));
652 if (Elements.isUnresolved(element)) return const ResolutionDynamicType(); 652 if (Elements.isUnresolved(element)) return const ResolutionDynamicType();
653 if (element.isGenerativeConstructor) { 653 if (element.isGenerativeConstructor) {
654 type = const ResolutionDynamicType(); 654 type = const ResolutionDynamicType();
655 returnType = const ResolutionVoidType(); 655 returnType = const ResolutionVoidType();
656 656
657 element.functionSignature.forEachParameter((ParameterElement parameter) { 657 element.functionSignature.forEachParameter((FormalElement parameter) {
658 if (parameter.isInitializingFormal) { 658 if (parameter.isInitializingFormal) {
659 InitializingFormalElement fieldParameter = parameter; 659 InitializingFormalElement fieldParameter = parameter;
660 checkAssignable(parameter, parameter.type, 660 checkAssignable(parameter, parameter.type,
661 fieldParameter.fieldElement.computeType(resolution)); 661 fieldParameter.fieldElement.computeType(resolution));
662 } 662 }
663 }); 663 });
664 if (node.initializers != null) { 664 if (node.initializers != null) {
665 analyzeUntyped(node.initializers, inInitializer: true); 665 analyzeUntyped(node.initializers, inInitializer: true);
666 } 666 }
667 } else { 667 } else {
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 // of a subtype. 1678 // of a subtype.
1679 } 1679 }
1680 1680
1681 visitRethrow(Rethrow node) { 1681 visitRethrow(Rethrow node) {
1682 // Nothing to do here. 1682 // Nothing to do here.
1683 } 1683 }
1684 1684
1685 /** Dart Programming Language Specification: 11.10 Return */ 1685 /** Dart Programming Language Specification: 11.10 Return */
1686 visitReturn(Return node) { 1686 visitReturn(Return node) {
1687 if (identical(node.beginToken.stringValue, 'native')) { 1687 if (identical(node.beginToken.stringValue, 'native')) {
1688 return; 1688 return null;
1689 } 1689 }
1690 1690
1691 final Node expression = node.expression; 1691 final Node expression = node.expression;
1692 1692
1693 // Executing a return statement return e; [...] It is a static type warning 1693 // Executing a return statement return e; [...] It is a static type warning
1694 // if the type of e may not be assigned to the declared return type of the 1694 // if the type of e may not be assigned to the declared return type of the
1695 // immediately enclosing function. 1695 // immediately enclosing function.
1696 if (expression != null) { 1696 if (expression != null) {
1697 ResolutionDartType expressionType = analyze(expression); 1697 ResolutionDartType expressionType = analyze(expression);
1698 if (executableContext.isGenerativeConstructor) { 1698 if (executableContext.isGenerativeConstructor) {
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 2055
2056 visitTypedef(Typedef node) { 2056 visitTypedef(Typedef node) {
2057 // Do not typecheck [Typedef] nodes. 2057 // Do not typecheck [Typedef] nodes.
2058 } 2058 }
2059 2059
2060 visitNode(Node node) { 2060 visitNode(Node node) {
2061 reporter.internalError(node, 2061 reporter.internalError(node,
2062 'Unexpected node ${node.getObjectDescription()} in the type checker.'); 2062 'Unexpected node ${node.getObjectDescription()} in the type checker.');
2063 } 2063 }
2064 } 2064 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/platform_configuration.dart ('k') | pkg/compiler/testing_strong.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698