| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 part of dart2js.semantics_visitor; | 5 part of dart2js.semantics_visitor; |
| 6 | 6 |
| 7 enum SendStructureKind { | 7 enum SendStructureKind { |
| 8 GET, | 8 GET, |
| 9 SET, | 9 SET, |
| 10 INVOKE, | 10 INVOKE, |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 302 } |
| 303 | 303 |
| 304 AccessSemantics computeAccessSemantics(Send node, | 304 AccessSemantics computeAccessSemantics(Send node, |
| 305 {bool isGetOrSet: false, | 305 {bool isGetOrSet: false, |
| 306 bool isInvoke: false, | 306 bool isInvoke: false, |
| 307 bool isCompound: false}) { | 307 bool isCompound: false}) { |
| 308 Element element = elements[node]; | 308 Element element = elements[node]; |
| 309 Element getter = isCompound ? elements[node.selector] : null; | 309 Element getter = isCompound ? elements[node.selector] : null; |
| 310 if (elements.isTypeLiteral(node)) { | 310 if (elements.isTypeLiteral(node)) { |
| 311 DartType dartType = elements.getTypeLiteralType(node); | 311 DartType dartType = elements.getTypeLiteralType(node); |
| 312 TypeConstantExpression constant = elements.getConstant( | 312 // TODO(johnniwinther): Handle deferred constants. There are runtime |
| 313 // but not compile-time constants and should have their own |
| 314 // [DeferredConstantExpression] class. |
| 315 ConstantExpression constant = elements.getConstant( |
| 313 isInvoke ? node.selector : node); | 316 isInvoke ? node.selector : node); |
| 314 switch (dartType.kind) { | 317 switch (dartType.kind) { |
| 315 case TypeKind.INTERFACE: | 318 case TypeKind.INTERFACE: |
| 316 return new ConstantAccess.classTypeLiteral(constant); | 319 return new ConstantAccess.classTypeLiteral(constant); |
| 317 case TypeKind.TYPEDEF: | 320 case TypeKind.TYPEDEF: |
| 318 return new ConstantAccess.typedefTypeLiteral(constant); | 321 return new ConstantAccess.typedefTypeLiteral(constant); |
| 319 case TypeKind.TYPE_VARIABLE: | 322 case TypeKind.TYPE_VARIABLE: |
| 320 return new StaticAccess.typeParameterTypeLiteral(dartType.element); | 323 return new StaticAccess.typeParameterTypeLiteral(dartType.element); |
| 321 case TypeKind.DYNAMIC: | 324 case TypeKind.DYNAMIC: |
| 322 return new ConstantAccess.dynamicTypeLiteral(constant); | 325 return new ConstantAccess.dynamicTypeLiteral(constant); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // TODO(johnniwinther): Provide an [ErroneousElement]. | 395 // TODO(johnniwinther): Provide an [ErroneousElement]. |
| 393 // This happens for code like `C.this`. | 396 // This happens for code like `C.this`. |
| 394 return new StaticAccess.unresolved(null); | 397 return new StaticAccess.unresolved(null); |
| 395 } else { | 398 } else { |
| 396 return handleStaticallyResolvedAccess(node, element, getter); | 399 return handleStaticallyResolvedAccess(node, element, getter); |
| 397 } | 400 } |
| 398 } | 401 } |
| 399 } | 402 } |
| 400 } | 403 } |
| 401 | 404 |
| OLD | NEW |