mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
More param names
This commit is contained in:
parent
ae4632a386
commit
7bce339d4f
3 changed files with 9 additions and 9 deletions
|
@ -221,7 +221,7 @@ void registerBuiltinTypes(TypeChecker& typeChecker)
|
||||||
|
|
||||||
TypeId tableMetaMT = arena.addType(MetatableTypeVar{tabTy, genericMT});
|
TypeId tableMetaMT = arena.addType(MetatableTypeVar{tabTy, genericMT});
|
||||||
|
|
||||||
addGlobalBinding(typeChecker, "getmetatable", makeFunction(arena, std::nullopt, {genericMT}, {}, {tableMetaMT}, {genericMT}), "@luau");
|
addGlobalBinding(typeChecker, "getmetatable", makeFunction(arena, std::nullopt, {genericMT}, {}, {tableMetaMT}, {"tbl"}, {genericMT}), "@luau");
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// setmetatable<T: {}, MT>(T, MT) -> { @metatable MT, T }
|
// setmetatable<T: {}, MT>(T, MT) -> { @metatable MT, T }
|
||||||
|
|
|
@ -170,7 +170,7 @@ declare table: {
|
||||||
|
|
||||||
getn: <V>(tbl: {V}) -> number,
|
getn: <V>(tbl: {V}) -> number,
|
||||||
foreach: <K, V>(tbl: {[K]: V}, f: (key: K, value: V) -> ()) -> (),
|
foreach: <K, V>(tbl: {[K]: V}, f: (key: K, value: V) -> ()) -> (),
|
||||||
foreachi: <V>(tbl: {V}, (index: number, value: V) -> ()) -> (),
|
foreachi: <V>(tbl: {V}, f: (index: number, value: V) -> ()) -> (),
|
||||||
|
|
||||||
move: <V>(tbl: {V}, from: number, to: number, startIndex: number, newTbl: {V}?) -> {V},
|
move: <V>(tbl: {V}, from: number, to: number, startIndex: number, newTbl: {V}?) -> {V},
|
||||||
clear: <K, V>(tbl: {[K]: V}) -> (),
|
clear: <K, V>(tbl: {[K]: V}) -> (),
|
||||||
|
|
|
@ -766,14 +766,14 @@ TypeId SingletonTypes::makeStringMetatable()
|
||||||
const TypePackId stringVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{stringType}});
|
const TypePackId stringVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{stringType}});
|
||||||
const TypePackId numberVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{numberType}});
|
const TypePackId numberVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{numberType}});
|
||||||
|
|
||||||
const TypeId stringToStringType = makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {}, {stringType});
|
const TypeId stringToStringType = makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {"str"}, {stringType});
|
||||||
|
|
||||||
const TypeId replArgType = arena->addType(
|
const TypeId replArgType = arena->addType(
|
||||||
UnionTypeVar{{stringType, arena->addType(TableTypeVar({}, TableIndexer(stringType, stringType), TypeLevel{}, TableState::Generic)),
|
UnionTypeVar{{stringType, arena->addType(TableTypeVar({}, TableIndexer(stringType, stringType), TypeLevel{}, TableState::Generic)),
|
||||||
makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {}, {stringType})}});
|
makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {}, {stringType})}});
|
||||||
const TypeId gsubFunc = makeFunction(*arena, stringType, {}, {}, {stringType, replArgType, optionalNumber}, {}, {stringType, numberType});
|
const TypeId gsubFunc = makeFunction(*arena, stringType, {}, {}, {stringType, replArgType, optionalNumber}, {"pattern", "replace", "maxs"}, {stringType, numberType});
|
||||||
const TypeId gmatchFunc =
|
const TypeId gmatchFunc =
|
||||||
makeFunction(*arena, stringType, {}, {}, {stringType}, {}, {arena->addType(FunctionTypeVar{emptyPack, stringVariadicList})});
|
makeFunction(*arena, stringType, {}, {}, {stringType}, {"pattern"}, {arena->addType(FunctionTypeVar{emptyPack, stringVariadicList})});
|
||||||
attachMagicFunction(gmatchFunc, magicFunctionGmatch);
|
attachMagicFunction(gmatchFunc, magicFunctionGmatch);
|
||||||
|
|
||||||
const TypeId matchFunc = arena->addType(FunctionTypeVar{arena->addTypePack({stringType, stringType, optionalNumber}),
|
const TypeId matchFunc = arena->addType(FunctionTypeVar{arena->addTypePack({stringType, stringType, optionalNumber}),
|
||||||
|
@ -794,17 +794,17 @@ TypeId SingletonTypes::makeStringMetatable()
|
||||||
{"len", {makeFunction(*arena, stringType, {}, {}, {}, {}, {numberType})}},
|
{"len", {makeFunction(*arena, stringType, {}, {}, {}, {}, {numberType})}},
|
||||||
{"lower", {stringToStringType}},
|
{"lower", {stringToStringType}},
|
||||||
{"match", {matchFunc}},
|
{"match", {matchFunc}},
|
||||||
{"rep", {makeFunction(*arena, stringType, {}, {}, {numberType}, {}, {stringType})}},
|
{"rep", {makeFunction(*arena, stringType, {}, {}, {numberType}, {"n"}, {stringType})}},
|
||||||
{"reverse", {stringToStringType}},
|
{"reverse", {stringToStringType}},
|
||||||
{"sub", {makeFunction(*arena, stringType, {}, {}, {numberType, optionalNumber}, {}, {stringType})}},
|
{"sub", {makeFunction(*arena, stringType, {}, {}, {numberType, optionalNumber}, {"from", "to"}, {stringType})}},
|
||||||
{"upper", {stringToStringType}},
|
{"upper", {stringToStringType}},
|
||||||
{"split", {makeFunction(*arena, stringType, {}, {}, {optionalString}, {},
|
{"split", {makeFunction(*arena, stringType, {}, {}, {optionalString}, {"sep"},
|
||||||
{arena->addType(TableTypeVar{{}, TableIndexer{numberType, stringType}, TypeLevel{}, TableState::Sealed})})}},
|
{arena->addType(TableTypeVar{{}, TableIndexer{numberType, stringType}, TypeLevel{}, TableState::Sealed})})}},
|
||||||
{"pack", {arena->addType(FunctionTypeVar{
|
{"pack", {arena->addType(FunctionTypeVar{
|
||||||
arena->addTypePack(TypePack{{stringType}, anyTypePack}),
|
arena->addTypePack(TypePack{{stringType}, anyTypePack}),
|
||||||
oneStringPack,
|
oneStringPack,
|
||||||
})}},
|
})}},
|
||||||
{"packsize", {makeFunction(*arena, stringType, {}, {}, {}, {}, {numberType})}},
|
{"packsize", {makeFunction(*arena, stringType, {}, {}, {}, {"format"}, {numberType})}},
|
||||||
{"unpack", {arena->addType(FunctionTypeVar{
|
{"unpack", {arena->addType(FunctionTypeVar{
|
||||||
arena->addTypePack(TypePack{{stringType, stringType, optionalNumber}}),
|
arena->addTypePack(TypePack{{stringType, stringType, optionalNumber}}),
|
||||||
anyTypePack,
|
anyTypePack,
|
||||||
|
|
Loading…
Add table
Reference in a new issue