mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-15 01:13:48 +01:00
spelling: falsy
This commit is contained in:
parent
4faa342922
commit
dd4702ac09
1 changed files with 4 additions and 4 deletions
|
@ -713,7 +713,7 @@ struct Compiler
|
||||||
|
|
||||||
// compile expr to target temp register
|
// compile expr to target temp register
|
||||||
// if the expr (or not expr if onlyTruth is false) is truthful, jump via skipJump
|
// if the expr (or not expr if onlyTruth is false) is truthful, jump via skipJump
|
||||||
// if the expr (or not expr if onlyTruth is false) is falseful, fall through (target isn't guaranteed to be updated in this case)
|
// if the expr (or not expr if onlyTruth is false) is falsy, fall through (target isn't guaranteed to be updated in this case)
|
||||||
// if target is omitted, then the jump behavior is the same - skipJump or fallthrough depending on the truthfulness of the expression
|
// if target is omitted, then the jump behavior is the same - skipJump or fallthrough depending on the truthfulness of the expression
|
||||||
void compileConditionValue(AstExpr* node, const uint8_t* target, std::vector<size_t>& skipJump, bool onlyTruth)
|
void compileConditionValue(AstExpr* node, const uint8_t* target, std::vector<size_t>& skipJump, bool onlyTruth)
|
||||||
{
|
{
|
||||||
|
@ -741,7 +741,7 @@ struct Compiler
|
||||||
case AstExprBinary::And:
|
case AstExprBinary::And:
|
||||||
case AstExprBinary::Or:
|
case AstExprBinary::Or:
|
||||||
{
|
{
|
||||||
// disambiguation: there's 4 cases (we only need truthful or falseful results based on onlyTruth)
|
// disambiguation: there's 4 cases (we only need truthful or falsy results based on onlyTruth)
|
||||||
// onlyTruth = 1: a and b transforms to a ? b : dontcare
|
// onlyTruth = 1: a and b transforms to a ? b : dontcare
|
||||||
// onlyTruth = 1: a or b transforms to a ? a : a
|
// onlyTruth = 1: a or b transforms to a ? a : a
|
||||||
// onlyTruth = 0: a and b transforms to !a ? a : b
|
// onlyTruth = 0: a and b transforms to !a ? a : b
|
||||||
|
@ -785,8 +785,8 @@ struct Compiler
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
// since target is a temp register, we'll initialize it to 1, and then jump if the comparison is true
|
// since target is a temp register, we'll initialize it to 1, and then jump if the comparison is true
|
||||||
// if the comparison is false, we'll fallthrough and target will still be 1 but target has unspecified value for falseful results
|
// if the comparison is false, we'll fallthrough and target will still be 1 but target has unspecified value for falsy results
|
||||||
// when we only care about falseful values instead of truthful values, the process is the same but with flipped conditionals
|
// when we only care about falsy values instead of truthful values, the process is the same but with flipped conditionals
|
||||||
bytecode.emitABC(LOP_LOADB, *target, onlyTruth ? 1 : 0, 0);
|
bytecode.emitABC(LOP_LOADB, *target, onlyTruth ? 1 : 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue