OLD | NEW |
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 Loading... |
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 'resolution/class_members.dart' show MembersCreator; | 43 import 'resolution/class_members.dart' show MembersCreator, ErroneousMember; |
44 import 'resolution/tree_elements.dart' show TreeElements; | 44 import 'resolution/tree_elements.dart' show TreeElements; |
45 import 'tree/tree.dart'; | 45 import 'tree/tree.dart'; |
46 import 'util/util.dart' show Link, LinkBuilder; | 46 import 'util/util.dart' show Link, LinkBuilder; |
47 | 47 |
48 class TypeCheckerTask extends CompilerTask { | 48 class TypeCheckerTask extends CompilerTask { |
49 final Compiler compiler; | 49 final Compiler compiler; |
50 TypeCheckerTask(Compiler compiler) | 50 TypeCheckerTask(Compiler compiler) |
51 : compiler = compiler, | 51 : compiler = compiler, |
52 super(compiler.measurer); | 52 super(compiler.measurer); |
53 | 53 |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 ? interface.lookupClassMember(name) | 726 ? interface.lookupClassMember(name) |
727 : interface.lookupInterfaceMember(name); | 727 : interface.lookupInterfaceMember(name); |
728 } | 728 } |
729 | 729 |
730 // Compute the access of [name] on [type]. This function takes the special | 730 // Compute the access of [name] on [type]. This function takes the special |
731 // 'call' method into account. | 731 // 'call' method into account. |
732 ElementAccess getAccess( | 732 ElementAccess getAccess( |
733 Name name, DartType unaliasedBound, InterfaceType interface) { | 733 Name name, DartType unaliasedBound, InterfaceType interface) { |
734 MemberSignature member = lookupMemberSignature(memberName, interface); | 734 MemberSignature member = lookupMemberSignature(memberName, interface); |
735 if (member != null) { | 735 if (member != null) { |
736 return new MemberAccess(member); | 736 if (member is ErroneousMember) { |
| 737 return const DynamicAccess(); |
| 738 } else { |
| 739 return new MemberAccess(member); |
| 740 } |
737 } | 741 } |
738 if (name == const PublicName('call')) { | 742 if (name == const PublicName('call')) { |
739 if (unaliasedBound.isFunctionType) { | 743 if (unaliasedBound.isFunctionType) { |
740 // This is an access the implicit 'call' method of a function type. | 744 // This is an access the implicit 'call' method of a function type. |
741 return new FunctionCallAccess(receiverElement, unaliasedBound); | 745 return new FunctionCallAccess(receiverElement, unaliasedBound); |
742 } | 746 } |
743 if (types.isSubtype(interface, coreTypes.functionType)) { | 747 if (types.isSubtype(interface, coreTypes.functionType)) { |
744 // This is an access of the special 'call' method implicitly defined | 748 // This is an access of the special 'call' method implicitly defined |
745 // on 'Function'. This method can be called with any arguments, which | 749 // on 'Function'. This method can be called with any arguments, which |
746 // we ensure by giving it the type 'dynamic'. | 750 // we ensure by giving it the type 'dynamic'. |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 | 2030 |
2027 visitTypedef(Typedef node) { | 2031 visitTypedef(Typedef node) { |
2028 // Do not typecheck [Typedef] nodes. | 2032 // Do not typecheck [Typedef] nodes. |
2029 } | 2033 } |
2030 | 2034 |
2031 visitNode(Node node) { | 2035 visitNode(Node node) { |
2032 reporter.internalError(node, | 2036 reporter.internalError(node, |
2033 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2037 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
2034 } | 2038 } |
2035 } | 2039 } |
OLD | NEW |