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

Unified Diff: lib/analyzer/ast_from_analyzer.dart

Issue 2465263002: Always store the type of a conditional expression on the node. (Closed)
Patch Set: Update test expectation Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/ast.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/analyzer/ast_from_analyzer.dart
diff --git a/lib/analyzer/ast_from_analyzer.dart b/lib/analyzer/ast_from_analyzer.dart
index 0ff713a456583ad7ae23ea8a0be4a72719143a9e..18c28c6447b13434351cd66a24a1d4579326e3ce 100644
--- a/lib/analyzer/ast_from_analyzer.dart
+++ b/lib/analyzer/ast_from_analyzer.dart
@@ -330,7 +330,7 @@ class TypeScope extends ReferenceScope {
return classNode.asRawSupertype;
} else {
return new ast.Supertype(classNode,
- type.typeArguments.map(buildType).toList(growable: false));
+ type.typeArguments.map(buildType).toList(growable: false));
}
}
return getRootClassReference().asRawSupertype;
@@ -403,8 +403,7 @@ class TypeScope extends ReferenceScope {
ast.TypeParameter buildTypeParameter(TypeParameter node) {
return makeTypeParameter(node.element,
- bound:
- buildOptionalTypeAnnotation(node.bound) ??
+ bound: buildOptionalTypeAnnotation(node.bound) ??
defaultTypeParameterBound);
}
@@ -682,7 +681,8 @@ class ExpressionScope extends TypeScope {
parameters[firstNamedParameter].parameterKind != ParameterKind.NAMED) {
++firstNamedParameter;
}
- namedLoop: for (int i = 0; i < arguments.named.length; ++i) {
+ namedLoop:
+ for (int i = 0; i < arguments.named.length; ++i) {
String name = arguments.named[i].name;
for (int j = firstNamedParameter; j < parameters.length; ++j) {
if (parameters[j].parameterKind == ParameterKind.NAMED &&
@@ -1324,7 +1324,8 @@ class ExpressionBuilder
if (operator == '=') {
return leftHand.buildAssignment(rightHand, voidContext: voidContext);
} else if (operator == '??=') {
- return leftHand.buildNullAwareAssignment(rightHand,
+ return leftHand.buildNullAwareAssignment(
+ rightHand, scope.buildType(node.staticType),
voidContext: voidContext);
} else {
// Cut off the trailing '='.
@@ -1690,6 +1691,7 @@ class ExpressionBuilder
numberOfTypeArguments, const ast.DynamicType(),
growable: true);
}
+
var arguments = buildArguments(node.argumentList,
explicitTypeArguments: node.constructorName.type.typeArguments,
inferTypeArguments: inferTypeArguments);
@@ -1700,6 +1702,7 @@ class ExpressionBuilder
new ast.NullLiteral(), '${node.constructorName}', arguments,
candidateTarget: element);
}
+
if (element == null) {
return noSuchMethodError();
}
@@ -1851,7 +1854,8 @@ class ExpressionBuilder
new ast.VariableGet(receiver),
scope.buildName(node.methodName),
buildArgumentsForInvocation(node),
- element)));
+ element),
+ scope.buildType(node.staticType)));
} else {
return buildDecomposableMethodInvocation(
build(node.target),
@@ -1946,7 +1950,8 @@ class ExpressionBuilder
return scope.staticAccess(node.propertyName.name, element, auxiliary);
} else if (node.operator.value() == '?.') {
return new NullAwarePropertyAccessor(
- build(target), scope.buildName(node.propertyName), getter, setter);
+ build(target), scope.buildName(node.propertyName), getter, setter,
+ scope.buildType(node.staticType));
} else {
return PropertyAccessor.make(
build(target), scope.buildName(node.propertyName), getter, setter);
@@ -2631,9 +2636,8 @@ class MemberBodyBuilder extends GeneralizingAstVisitor<Null> {
// TODO(asgerf): Sometimes a TypeError should be thrown.
function.body = new ast.ExpressionStatement(
scope.buildThrowNoSuchMethodError(
- new ast.NullLiteral(),
- name,
- new ast.Arguments.empty()))..parent = function;
+ new ast.NullLiteral(), name, new ast.Arguments.empty()))
+ ..parent = function;
}
}
« no previous file with comments | « no previous file | lib/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698