-
Bug
-
Resolution: Fixed
-
P4
-
9
-
b20
-
generic
-
generic
FULL PRODUCT VERSION :
java version "9"
Java(TM) SE Runtime Environment (build 9+178)
Java HotSpot(TM) 64-Bit Server VM (build 9+178, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
When a unary minus or plus is parsed, the Kind of the node is set to MINUS / PLUS (i.e. the BinaryTree constants) instead of UNARY_MINUS / UNARY_PLUS for UnaryTrees.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Inspect an expression like "-x" or "+1".
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
UNARY_MINUS
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String[] args) {
String script = "var a = -x;";
DiagnosticListener listener = (Diagnostic diag) -> { System.err.println(diag.toString()); };
Parser parser = Parser.create("--language=es6", "--empty-statements");
Tree astRoot = parser.parse("unknown", script, listener);
astRoot.accept(new SimpleTreeVisitorES6<Boolean, Void>() {
@Override
public Boolean visitUnary(UnaryTree stmt, Void none) {
System.out.println(stmt.getKind());
return super.visitUnary(stmt, none);
}
}, null);
}
---------- END SOURCE ----------
java version "9"
Java(TM) SE Runtime Environment (build 9+178)
Java HotSpot(TM) 64-Bit Server VM (build 9+178, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
When a unary minus or plus is parsed, the Kind of the node is set to MINUS / PLUS (i.e. the BinaryTree constants) instead of UNARY_MINUS / UNARY_PLUS for UnaryTrees.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Inspect an expression like "-x" or "+1".
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
UNARY_MINUS
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String[] args) {
String script = "var a = -x;";
DiagnosticListener listener = (Diagnostic diag) -> { System.err.println(diag.toString()); };
Parser parser = Parser.create("--language=es6", "--empty-statements");
Tree astRoot = parser.parse("unknown", script, listener);
astRoot.accept(new SimpleTreeVisitorES6<Boolean, Void>() {
@Override
public Boolean visitUnary(UnaryTree stmt, Void none) {
System.out.println(stmt.getKind());
return super.visitUnary(stmt, none);
}
}, null);
}
---------- END SOURCE ----------