Resolve types for case expressions

This commit is contained in:
Simon Binder 2019-06-29 18:02:44 +02:00
parent 9c07eaa465
commit d9f5cf0e69
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 4 additions and 1 deletions

View File

@ -91,6 +91,8 @@ class TypeResolver {
}
} else if (expr is BetweenExpression) {
return const ResolveResult(ResolvedType.bool());
} else if (expr is CaseExpression) {
return resolveExpression(expr.whens.first.then);
} else if (expr is SubQuery) {
// todo
}
@ -247,7 +249,8 @@ class TypeResolver {
ResolveResult _argumentType(Expression parent, Expression argument) {
if (parent is IsExpression ||
parent is BinaryExpression ||
parent is BetweenExpression) {
parent is BetweenExpression ||
parent is CaseExpression) {
final relevant = parent.childNodes
.lastWhere((node) => node is Expression && node != argument);
return resolveExpression(relevant as Expression);