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

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

Issue 2132383002: Renamed isParameter to isRegularParameter. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Review response 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | no next file » | 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return thisType; 676 return thisType;
677 } else if (node.isSuper()) { 677 } else if (node.isSuper()) {
678 return superType; 678 return superType;
679 } else { 679 } else {
680 TypedElement element = elements[node]; 680 TypedElement element = elements[node];
681 assert(invariant(node, element != null, 681 assert(invariant(node, element != null,
682 message: 'Missing element for identifier')); 682 message: 'Missing element for identifier'));
683 assert(invariant( 683 assert(invariant(
684 node, 684 node,
685 element.isVariable || 685 element.isVariable ||
686 element.isParameter || 686 element.isRegularParameter ||
687 element.isField || 687 element.isField ||
688 (element.isInitializingFormal && 688 (element.isInitializingFormal &&
689 compiler.options.enableInitializingFormalAccess), 689 compiler.options.enableInitializingFormalAccess),
690 message: 'Unexpected context element ${element}')); 690 message: 'Unexpected context element ${element}'));
691 return element.computeType(resolution); 691 return element.computeType(resolution);
692 } 692 }
693 } 693 }
694 694
695 DartType visitIf(If node) { 695 DartType visitIf(If node) {
696 Expression condition = node.condition.expression; 696 Expression condition = node.condition.expression;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 return new DynamicAccess(); 765 return new DynamicAccess();
766 } 766 }
767 InterfaceType interface = 767 InterfaceType interface =
768 Types.computeInterfaceType(resolution, unaliasedBound); 768 Types.computeInterfaceType(resolution, unaliasedBound);
769 ElementAccess access = getAccess(memberName, unaliasedBound, interface); 769 ElementAccess access = getAccess(memberName, unaliasedBound, interface);
770 if (access != null) { 770 if (access != null) {
771 return access; 771 return access;
772 } 772 }
773 if (receiverElement != null && 773 if (receiverElement != null &&
774 (receiverElement.isVariable || 774 (receiverElement.isVariable ||
775 receiverElement.isParameter || 775 receiverElement.isRegularParameter ||
776 (receiverElement.isInitializingFormal && 776 (receiverElement.isInitializingFormal &&
777 compiler.options.enableInitializingFormalAccess))) { 777 compiler.options.enableInitializingFormalAccess))) {
778 Link<TypePromotion> typePromotions = typePromotionsMap[receiverElement]; 778 Link<TypePromotion> typePromotions = typePromotionsMap[receiverElement];
779 if (typePromotions != null) { 779 if (typePromotions != null) {
780 while (!typePromotions.isEmpty) { 780 while (!typePromotions.isEmpty) {
781 TypePromotion typePromotion = typePromotions.head; 781 TypePromotion typePromotion = typePromotions.head;
782 if (!typePromotion.isValid) { 782 if (!typePromotion.isValid) {
783 DartType unaliasedBound = 783 DartType unaliasedBound =
784 Types.computeUnaliasedBound(resolution, typePromotion.type); 784 Types.computeUnaliasedBound(resolution, typePromotion.type);
785 if (!unaliasedBound.treatAsDynamic) { 785 if (!unaliasedBound.treatAsDynamic) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 } 1063 }
1064 return createResolvedAccess(node, name, element); 1064 return createResolvedAccess(node, name, element);
1065 } else if (element.isClassMember) { 1065 } else if (element.isClassMember) {
1066 // foo() where foo is a member. 1066 // foo() where foo is a member.
1067 return lookupMember(node, thisType, name, memberKind, null, 1067 return lookupMember(node, thisType, name, memberKind, null,
1068 lookupClassMember: element.isStatic); 1068 lookupClassMember: element.isStatic);
1069 } else if (element.isFunction) { 1069 } else if (element.isFunction) {
1070 // foo() where foo is a method in the same class. 1070 // foo() where foo is a method in the same class.
1071 return createResolvedAccess(node, name, element); 1071 return createResolvedAccess(node, name, element);
1072 } else if (element.isVariable || 1072 } else if (element.isVariable ||
1073 element.isParameter || 1073 element.isRegularParameter ||
1074 element.isField || 1074 element.isField ||
1075 element.isInitializingFormal) { 1075 element.isInitializingFormal) {
1076 // foo() where foo is a field in the same class. 1076 // foo() where foo is a field in the same class.
1077 return createResolvedAccess(node, name, element); 1077 return createResolvedAccess(node, name, element);
1078 } else if (element.isGetter || element.isSetter) { 1078 } else if (element.isGetter || element.isSetter) {
1079 return createResolvedAccess(node, name, element); 1079 return createResolvedAccess(node, name, element);
1080 } else { 1080 } else {
1081 reporter.internalError( 1081 reporter.internalError(
1082 element, 'Unexpected element kind ${element.kind}.'); 1082 element, 'Unexpected element kind ${element.kind}.');
1083 return null; 1083 return null;
1084 } 1084 }
1085 } 1085 }
1086 1086
1087 ElementAccess createResolvedAccess(Send node, String name, Element element) { 1087 ElementAccess createResolvedAccess(Send node, String name, Element element) {
1088 checkPrivateAccess(node, element, name); 1088 checkPrivateAccess(node, element, name);
1089 return createPromotedAccess(element); 1089 return createPromotedAccess(element);
1090 } 1090 }
1091 1091
1092 ElementAccess createPromotedAccess(Element element) { 1092 ElementAccess createPromotedAccess(Element element) {
1093 if (element.isVariable || 1093 if (element.isVariable ||
1094 element.isParameter || 1094 element.isRegularParameter ||
1095 (element.isInitializingFormal && 1095 (element.isInitializingFormal &&
1096 compiler.options.enableInitializingFormalAccess)) { 1096 compiler.options.enableInitializingFormalAccess)) {
1097 TypePromotion typePromotion = getKnownTypePromotion(element); 1097 TypePromotion typePromotion = getKnownTypePromotion(element);
1098 if (typePromotion != null) { 1098 if (typePromotion != null) {
1099 return new PromotedAccess(element, typePromotion.type); 1099 return new PromotedAccess(element, typePromotion.type);
1100 } 1100 }
1101 } 1101 }
1102 return new ResolvedAccess(element); 1102 return new ResolvedAccess(element);
1103 } 1103 }
1104 1104
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 node.receiver.asParenthesizedExpression(); 1223 node.receiver.asParenthesizedExpression();
1224 while (parentheses != null) { 1224 while (parentheses != null) {
1225 variable = elements[parentheses.expression]; 1225 variable = elements[parentheses.expression];
1226 if (variable != null) break; 1226 if (variable != null) break;
1227 parentheses = parentheses.expression.asParenthesizedExpression(); 1227 parentheses = parentheses.expression.asParenthesizedExpression();
1228 } 1228 }
1229 } 1229 }
1230 1230
1231 if (variable != null && 1231 if (variable != null &&
1232 (variable.isVariable || 1232 (variable.isVariable ||
1233 variable.isParameter || 1233 variable.isRegularParameter ||
1234 (variable.isInitializingFormal && 1234 (variable.isInitializingFormal &&
1235 compiler.options.enableInitializingFormalAccess))) { 1235 compiler.options.enableInitializingFormalAccess))) {
1236 DartType knownType = getKnownType(variable); 1236 DartType knownType = getKnownType(variable);
1237 if (!knownType.isDynamic) { 1237 if (!knownType.isDynamic) {
1238 DartType shownType = elements.getType(node.arguments.head); 1238 DartType shownType = elements.getType(node.arguments.head);
1239 TypePromotion typePromotion = 1239 TypePromotion typePromotion =
1240 new TypePromotion(node, variable, shownType); 1240 new TypePromotion(node, variable, shownType);
1241 if (!types.isMoreSpecific(shownType, knownType)) { 1241 if (!types.isMoreSpecific(shownType, knownType)) {
1242 String variableName = variable.name; 1242 String variableName = variable.name;
1243 if (!types.isSubtype(shownType, knownType)) { 1243 if (!types.isSubtype(shownType, knownType)) {
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 2045
2046 visitTypedef(Typedef node) { 2046 visitTypedef(Typedef node) {
2047 // Do not typecheck [Typedef] nodes. 2047 // Do not typecheck [Typedef] nodes.
2048 } 2048 }
2049 2049
2050 visitNode(Node node) { 2050 visitNode(Node node) {
2051 reporter.internalError(node, 2051 reporter.internalError(node,
2052 'Unexpected node ${node.getObjectDescription()} in the type checker.'); 2052 'Unexpected node ${node.getObjectDescription()} in the type checker.');
2053 } 2053 }
2054 } 2054 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698