| 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 package com.google.dart.compiler.resolver; | 5 package com.google.dart.compiler.resolver; |
| 6 | 6 |
| 7 import com.google.common.annotations.VisibleForTesting; | 7 import com.google.common.annotations.VisibleForTesting; |
| 8 import com.google.common.collect.Lists; | 8 import com.google.common.collect.Lists; |
| 9 import com.google.common.collect.Sets; | 9 import com.google.common.collect.Sets; |
| 10 import com.google.dart.compiler.DartCompilationPhase; | 10 import com.google.dart.compiler.DartCompilationPhase; |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 @Override | 1490 @Override |
| 1491 public Element visitFunctionObjectInvocation(DartFunctionObjectInvocation x)
{ | 1491 public Element visitFunctionObjectInvocation(DartFunctionObjectInvocation x)
{ |
| 1492 x.getTarget().accept(this); | 1492 x.getTarget().accept(this); |
| 1493 visit(x.getArguments()); | 1493 visit(x.getArguments()); |
| 1494 return null; | 1494 return null; |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 @Override | 1497 @Override |
| 1498 public Element visitNewExpression(DartNewExpression x) { | 1498 public Element visitNewExpression(final DartNewExpression x) { |
| 1499 this.visit(x.getArguments()); | 1499 this.visit(x.getArguments()); |
| 1500 | 1500 |
| 1501 Element element = x.getConstructor().accept(getContext().new Selector() { | 1501 Element element = x.getConstructor().accept(getContext().new Selector() { |
| 1502 // Only 'new' expressions can have a type in a property access. | 1502 // Only 'new' expressions can have a type in a property access. |
| 1503 @Override | 1503 @Override |
| 1504 public Element visitTypeNode(DartTypeNode type) { | 1504 public Element visitTypeNode(DartTypeNode type) { |
| 1505 TypeErrorCode errorCode = x.isConst() ? TypeErrorCode.NO_SUCH_TYPE_CON
ST : TypeErrorCode.NO_SUCH_TYPE; |
| 1505 return recordType(type, resolveType(type, inStaticContext(currentMetho
d), | 1506 return recordType(type, resolveType(type, inStaticContext(currentMetho
d), |
| 1506 inFactoryContext(currentMethod), | 1507 inFactoryContext(currentMethod), |
| 1507 TypeErrorCode.NO_SUCH_TYPE, | 1508 errorCode, |
| 1508 ResolverErrorCode.WRONG_NUMBER_OF_
TYPE_ARGUMENTS)); | 1509 ResolverErrorCode.WRONG_NUMBER_OF_
TYPE_ARGUMENTS)); |
| 1509 } | 1510 } |
| 1510 | 1511 |
| 1511 @Override public Element visitPropertyAccess(DartPropertyAccess node) { | 1512 @Override public Element visitPropertyAccess(DartPropertyAccess node) { |
| 1512 Element element = node.getQualifier().accept(this); | 1513 Element element = node.getQualifier().accept(this); |
| 1513 if (ElementKind.of(element).equals(ElementKind.CLASS)) { | 1514 if (ElementKind.of(element).equals(ElementKind.CLASS)) { |
| 1514 assert node.getQualifier() instanceof DartTypeNode; | 1515 assert node.getQualifier() instanceof DartTypeNode; |
| 1515 recordType(node, node.getQualifier().getType()); | 1516 recordType(node, node.getQualifier().getType()); |
| 1516 return Elements.lookupConstructor(((ClassElement) element), node.get
PropertyName()); | 1517 return Elements.lookupConstructor(((ClassElement) element), node.get
PropertyName()); |
| 1517 } else { | 1518 } else { |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle
ment(); | 2300 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle
ment(); |
| 2300 if (nextClass == currentClass) { | 2301 if (nextClass == currentClass) { |
| 2301 return (ConstructorNodeElement) nextConstructorElement; | 2302 return (ConstructorNodeElement) nextConstructorElement; |
| 2302 } | 2303 } |
| 2303 } | 2304 } |
| 2304 } | 2305 } |
| 2305 } | 2306 } |
| 2306 return null; | 2307 return null; |
| 2307 } | 2308 } |
| 2308 } | 2309 } |
| OLD | NEW |