OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 } | 850 } |
851 | 851 |
852 /** | 852 /** |
853 * Return the static element associated with the given expression whose type c
an be promoted, or | 853 * Return the static element associated with the given expression whose type c
an be promoted, or |
854 * {@code null} if there is no element whose type can be promoted. | 854 * {@code null} if there is no element whose type can be promoted. |
855 * | 855 * |
856 * @param expression the expression with which the element is associated | 856 * @param expression the expression with which the element is associated |
857 * @return the element associated with the given expression | 857 * @return the element associated with the given expression |
858 */ | 858 */ |
859 protected VariableElement getPromotionStaticElement(Expression expression) { | 859 protected VariableElement getPromotionStaticElement(Expression expression) { |
| 860 while (expression instanceof ParenthesizedExpression) { |
| 861 expression = ((ParenthesizedExpression) expression).getExpression(); |
| 862 } |
860 if (!(expression instanceof SimpleIdentifier)) { | 863 if (!(expression instanceof SimpleIdentifier)) { |
861 return null; | 864 return null; |
862 } | 865 } |
863 SimpleIdentifier identifier = (SimpleIdentifier) expression; | 866 SimpleIdentifier identifier = (SimpleIdentifier) expression; |
864 Element element = identifier.getStaticElement(); | 867 Element element = identifier.getStaticElement(); |
865 if (!(element instanceof VariableElement)) { | 868 if (!(element instanceof VariableElement)) { |
866 return null; | 869 return null; |
867 } | 870 } |
868 ElementKind kind = element.getKind(); | 871 ElementKind kind = element.getKind(); |
869 if (kind == ElementKind.LOCAL_VARIABLE) { | 872 if (kind == ElementKind.LOCAL_VARIABLE) { |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 * | 1395 * |
1393 * @param expression the node whose type is to be recorded | 1396 * @param expression the node whose type is to be recorded |
1394 * @param type the propagated type of the node | 1397 * @param type the propagated type of the node |
1395 */ | 1398 */ |
1396 private void recordPropagatedType(Expression expression, Type type) { | 1399 private void recordPropagatedType(Expression expression, Type type) { |
1397 if (type != null && !type.isDynamic()) { | 1400 if (type != null && !type.isDynamic()) { |
1398 expression.setPropagatedType(type); | 1401 expression.setPropagatedType(type); |
1399 } | 1402 } |
1400 } | 1403 } |
1401 } | 1404 } |
OLD | NEW |