mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Merge branch 'petrih-vector-literals' of https://github.com/petrihakkinen/luau into petrih-vector-literals
This commit is contained in:
commit
50904b04e8
2 changed files with 3 additions and 3 deletions
|
@ -1131,7 +1131,7 @@ struct Compiler
|
|||
}
|
||||
|
||||
// disable fast path for vectors because supporting it would require a new opcode
|
||||
if (isConstantVector(right))
|
||||
if (operandIsConstant && isConstantVector(right))
|
||||
operandIsConstant = false;
|
||||
|
||||
uint8_t rl = compileExprAuto(left, rs);
|
||||
|
|
|
@ -4498,12 +4498,12 @@ TEST_CASE("VectorLiterals")
|
|||
{
|
||||
ScopedFastFlag sff("LuauVectorLiterals", true);
|
||||
|
||||
CHECK_EQ("\n" + compileFunction("return Vector3.new(1, 2, 3)", 0, 2, true), R"(
|
||||
CHECK_EQ("\n" + compileFunction("return Vector3.new(1, 2, 3)", 0, 2, /*enableVectors*/ true), R"(
|
||||
LOADK R0 K0 [1, 2, 3]
|
||||
RETURN R0 1
|
||||
)");
|
||||
|
||||
CHECK_EQ("\n" + compileFunction("print(Vector3.new(1, 2, 3))", 0, 2, true), R"(
|
||||
CHECK_EQ("\n" + compileFunction("print(Vector3.new(1, 2, 3))", 0, 2, /*enableVectors*/ true), R"(
|
||||
GETIMPORT R0 1 [print]
|
||||
LOADK R1 K2 [1, 2, 3]
|
||||
CALL R0 1 0
|
||||
|
|
Loading…
Add table
Reference in a new issue