Skip to content

Commit

Permalink
Fix for issue #344: instanceof ternary expression flow typing
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Oct 2, 2017
1 parent 8e82239 commit 7c83c58
Show file tree
Hide file tree
Showing 6 changed files with 4,083 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2193,6 +2193,9 @@ public void visitTernaryExpression(final TernaryExpression expression) {
Expression trueExpression = expression.getTrueExpression();
Expression falseExpression = expression.getFalseExpression();
trueExpression.visit(this);
// GRECLIPSE add
final ClassNode typeOfTrue = findCurrentInstanceOfClass(trueExpression, getType(trueExpression));
// GRECLIPSE end
// pop if-then-else temporary type info
temporaryIfBranchTypeInformation.pop();
falseExpression.visit(this);
Expand All @@ -2209,7 +2212,9 @@ public void visitTernaryExpression(final TernaryExpression expression) {
}
} else {
// store type information
final ClassNode typeOfTrue = getType(trueExpression);
// GRECLIPSE edit
//final ClassNode typeOfTrue = getType(trueExpression);
// GRECLIPSE end
final ClassNode typeOfFalse = getType(falseExpression);
resultType = lowestUpperBound(typeOfTrue, typeOfFalse);
}
Expand Down
Loading

0 comments on commit 7c83c58

Please sign in to comment.