mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add FFlag for %*
This commit is contained in:
parent
41fa546a17
commit
8ef45854f7
2 changed files with 20 additions and 1 deletions
|
@ -8,6 +8,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
LUAU_FASTFLAG(LuauInterpolatedStringBaseSupport)
|
||||||
|
LUAU_FASTFLAGVARIABLE(LuauTostringFormatSpecifier, false);
|
||||||
|
|
||||||
/* macro to `unsign' a character */
|
/* macro to `unsign' a character */
|
||||||
#define uchar(c) ((unsigned char)(c))
|
#define uchar(c) ((unsigned char)(c))
|
||||||
|
|
||||||
|
@ -1034,6 +1037,18 @@ static int str_format(lua_State* L)
|
||||||
}
|
}
|
||||||
case '*':
|
case '*':
|
||||||
{
|
{
|
||||||
|
if (!FFlag::LuauTostringFormatSpecifier)
|
||||||
|
{
|
||||||
|
if (FFlag::LuauInterpolatedStringBaseSupport)
|
||||||
|
{
|
||||||
|
luaL_error(L, "interpolated strings are enabled, but the '*' format specifier is not. this is a configuration bug.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
luaL_error(L, "invalid option '%%*' to 'format'");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (formatItemSize != 1)
|
if (formatItemSize != 1)
|
||||||
{
|
{
|
||||||
luaL_error(L, "'%%*' does not take a form");
|
luaL_error(L, "'%%*' does not take a form");
|
||||||
|
|
|
@ -291,12 +291,16 @@ TEST_CASE("Clear")
|
||||||
|
|
||||||
TEST_CASE("Strings")
|
TEST_CASE("Strings")
|
||||||
{
|
{
|
||||||
|
ScopedFastFlag sff{"LuauTostringFormatSpecifier", true};
|
||||||
|
|
||||||
runConformance("strings.lua");
|
runConformance("strings.lua");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("StringInterp")
|
TEST_CASE("StringInterp")
|
||||||
{
|
{
|
||||||
ScopedFastFlag sff{"LuauInterpolatedStringBaseSupport", true};
|
ScopedFastFlag sffInterpStrings{"LuauInterpolatedStringBaseSupport", true};
|
||||||
|
ScopedFastFlag sffTostringFormat{"LuauTostringFormatSpecifier", true};
|
||||||
|
|
||||||
runConformance("stringinterp.lua");
|
runConformance("stringinterp.lua");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue