mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
BytecodeBuilder::dumpConstant
import indexes containing whitespace are now bracket wrapped
This commit is contained in:
parent
401f99e121
commit
0f0c1ab891
1 changed files with 20 additions and 2 deletions
|
@ -1735,7 +1735,16 @@ void BytecodeBuilder::dumpConstant(std::string& result, int k) const
|
|||
LUAU_ASSERT(id.type == Constant::Type_String && id.valueString <= debugStrings.size());
|
||||
|
||||
const StringRef& str = debugStrings[id.valueString - 1];
|
||||
formatAppend(result, ".%.*s", int(str.length), str.data);
|
||||
|
||||
/* check if index contains whitespace */
|
||||
if (strchr(str.data, ' '))
|
||||
{
|
||||
formatAppend(result, "[\"%.*s\"]", int(str.length), str.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
formatAppend(result, ".%.*s", int(str.length), str.data);
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 2)
|
||||
|
@ -1744,7 +1753,16 @@ void BytecodeBuilder::dumpConstant(std::string& result, int k) const
|
|||
LUAU_ASSERT(id.type == Constant::Type_String && id.valueString <= debugStrings.size());
|
||||
|
||||
const StringRef& str = debugStrings[id.valueString - 1];
|
||||
formatAppend(result, ".%.*s", int(str.length), str.data);
|
||||
|
||||
/* check if index contains whitespace */
|
||||
if (strchr(str.data, ' '))
|
||||
{
|
||||
formatAppend(result, "[\".%.*s\"]", int(str.length), str.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
formatAppend(result, ".%.*s", int(str.length), str.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue