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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 /// Returns [: true :] if the element can be access as an invocation. | 104 /// Returns [: true :] if the element can be access as an invocation. |
105 bool isCallable(Compiler compiler) { | 105 bool isCallable(Compiler compiler) { |
106 if (element != null && element.isAbstractField) { | 106 if (element != null && element.isAbstractField) { |
107 AbstractFieldElement abstractFieldElement = element; | 107 AbstractFieldElement abstractFieldElement = element; |
108 if (abstractFieldElement.getter == null) { | 108 if (abstractFieldElement.getter == null) { |
109 // Setters cannot be invoked as function invocations. | 109 // Setters cannot be invoked as function invocations. |
110 return false; | 110 return false; |
111 } | 111 } |
112 } | 112 } |
113 ResolutionInterfaceType functionType = compiler.commonElements.functionType; | 113 ResolutionInterfaceType functionType = |
| 114 compiler.resolution.commonElements.functionType; |
114 return compiler.types | 115 return compiler.types |
115 .isAssignable(computeType(compiler.resolution), functionType); | 116 .isAssignable(computeType(compiler.resolution), functionType); |
116 } | 117 } |
117 } | 118 } |
118 | 119 |
119 /// An access of a instance member. | 120 /// An access of a instance member. |
120 class MemberAccess extends ElementAccess { | 121 class MemberAccess extends ElementAccess { |
121 final MemberSignature member; | 122 final MemberSignature member; |
122 | 123 |
123 MemberAccess(MemberSignature this.member); | 124 MemberAccess(MemberSignature this.member); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 293 |
293 Node lastSeenNode; | 294 Node lastSeenNode; |
294 ResolutionDartType expectedReturnType; | 295 ResolutionDartType expectedReturnType; |
295 AsyncMarker currentAsyncMarker = AsyncMarker.SYNC; | 296 AsyncMarker currentAsyncMarker = AsyncMarker.SYNC; |
296 | 297 |
297 final ClassElement currentClass; | 298 final ClassElement currentClass; |
298 | 299 |
299 /// The immediately enclosing field, method or constructor being analyzed. | 300 /// The immediately enclosing field, method or constructor being analyzed. |
300 ExecutableElement executableContext; | 301 ExecutableElement executableContext; |
301 | 302 |
302 CommonElements get commonElements => compiler.commonElements; | 303 CommonElements get commonElements => resolution.commonElements; |
303 | 304 |
304 DiagnosticReporter get reporter => compiler.reporter; | 305 DiagnosticReporter get reporter => compiler.reporter; |
305 | 306 |
306 Resolution get resolution => compiler.resolution; | 307 Resolution get resolution => compiler.resolution; |
307 | 308 |
308 ResolutionInterfaceType get intType => commonElements.intType; | 309 ResolutionInterfaceType get intType => commonElements.intType; |
309 ResolutionInterfaceType get doubleType => commonElements.doubleType; | 310 ResolutionInterfaceType get doubleType => commonElements.doubleType; |
310 ResolutionInterfaceType get boolType => commonElements.boolType; | 311 ResolutionInterfaceType get boolType => commonElements.boolType; |
311 ResolutionInterfaceType get stringType => commonElements.stringType; | 312 ResolutionInterfaceType get stringType => commonElements.stringType; |
312 | 313 |
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 | 2055 |
2055 visitTypedef(Typedef node) { | 2056 visitTypedef(Typedef node) { |
2056 // Do not typecheck [Typedef] nodes. | 2057 // Do not typecheck [Typedef] nodes. |
2057 } | 2058 } |
2058 | 2059 |
2059 visitNode(Node node) { | 2060 visitNode(Node node) { |
2060 reporter.internalError(node, | 2061 reporter.internalError(node, |
2061 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2062 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
2062 } | 2063 } |
2063 } | 2064 } |
OLD | NEW |