mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Fix constant folding
This commit is contained in:
parent
da716a6a76
commit
b40b10826c
2 changed files with 6 additions and 4 deletions
|
@ -353,6 +353,8 @@ struct ConstantVisitor : AstVisitor
|
||||||
{
|
{
|
||||||
// INTERP CODE REVIEW: This can theoretically fold something like `debug mode: {DEBUG_MODE}` where DEBUG_MODE is true.
|
// INTERP CODE REVIEW: This can theoretically fold something like `debug mode: {DEBUG_MODE}` where DEBUG_MODE is true.
|
||||||
// Is this necessary or just something we can do later?
|
// Is this necessary or just something we can do later?
|
||||||
|
for (AstExpr* expression : interpString->expressions)
|
||||||
|
analyze(expression);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,10 +21,10 @@ assertEq(`true = {true}`, "true = true")
|
||||||
-- -- INTERP TODO: Syntax error
|
-- -- INTERP TODO: Syntax error
|
||||||
-- -- assert(string.find(`{{ "nested braces!" }}`, "table"))
|
-- -- assert(string.find(`{{ "nested braces!" }}`, "table"))
|
||||||
|
|
||||||
-- local name = "Luau"
|
local name = "Luau"
|
||||||
-- assertEq(`Welcome to {
|
assertEq(`Welcome to {
|
||||||
-- name
|
name
|
||||||
-- }!`, "Welcome to Luau!")
|
}!`, "Welcome to Luau!")
|
||||||
|
|
||||||
local nameNotConstantEvaluated = (function() return "Luau" end)()
|
local nameNotConstantEvaluated = (function() return "Luau" end)()
|
||||||
assertEq(`Welcome to {nameNotConstantEvaluated}!`, "Welcome to Luau!")
|
assertEq(`Welcome to {nameNotConstantEvaluated}!`, "Welcome to Luau!")
|
||||||
|
|
Loading…
Add table
Reference in a new issue