Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java

Issue 47513022: Issue 14363. Support for type promotion when '(v) is T'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698