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,8 +1735,17 @@ void BytecodeBuilder::dumpConstant(std::string& result, int k) const
|
||||||
LUAU_ASSERT(id.type == Constant::Type_String && id.valueString <= debugStrings.size());
|
LUAU_ASSERT(id.type == Constant::Type_String && id.valueString <= debugStrings.size());
|
||||||
|
|
||||||
const StringRef& str = debugStrings[id.valueString - 1];
|
const StringRef& str = debugStrings[id.valueString - 1];
|
||||||
|
|
||||||
|
/* 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);
|
formatAppend(result, ".%.*s", int(str.length), str.data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (count > 2)
|
if (count > 2)
|
||||||
{
|
{
|
||||||
|
@ -1744,9 +1753,18 @@ void BytecodeBuilder::dumpConstant(std::string& result, int k) const
|
||||||
LUAU_ASSERT(id.type == Constant::Type_String && id.valueString <= debugStrings.size());
|
LUAU_ASSERT(id.type == Constant::Type_String && id.valueString <= debugStrings.size());
|
||||||
|
|
||||||
const StringRef& str = debugStrings[id.valueString - 1];
|
const StringRef& str = debugStrings[id.valueString - 1];
|
||||||
|
|
||||||
|
/* 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);
|
formatAppend(result, ".%.*s", int(str.length), str.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Constant::Type_Table:
|
case Constant::Type_Table:
|
||||||
|
|
Loading…
Add table
Reference in a new issue