mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
BUGFIX: typeof keyword precedence was off
This commit is contained in:
@@ -140,7 +140,7 @@ static Toy_Opcode asType(Toy_Parser* parser, Toy_ASTNode** nodeHandle) {
|
||||
|
||||
static Toy_Opcode typeOf(Toy_Parser* parser, Toy_ASTNode** nodeHandle) {
|
||||
Toy_ASTNode* rhs = NULL;
|
||||
parsePrecedence(parser, &rhs, PREC_TERNARY);
|
||||
parsePrecedence(parser, &rhs, PREC_CALL);
|
||||
Toy_emitASTNodeUnary(nodeHandle, TOY_OP_TYPE_OF, rhs);
|
||||
return TOY_OP_EOF;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ import standard;
|
||||
assert max(a, b, c) == 3, "var.max() failed";
|
||||
|
||||
assert max(1, 2, 3, 4, 5, 6, 7, 8, 9, 0) == 9, "max() with many args failed";
|
||||
|
||||
assert typeof max(1, 2, 3) == int, "typeof max() == int failed";
|
||||
assert typeof max(1, 2, 3.4) == float, "typeof max() == float failed";
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +79,9 @@ import standard;
|
||||
assert min(a, b, c) == 1, "var.min() failed";
|
||||
|
||||
assert min(1, 2, 3, 4, 5, 6, 7, 8, 9, 0) == 0, "min() with many args failed";
|
||||
|
||||
assert typeof min(1, 2, 3) == int, "typeof min() == int failed";
|
||||
assert typeof min(1, 2, 3.4) == float, "typeof min() == float failed";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user