v0.5.6+luau573
This commit is contained in:
parent
95cfe305ce
commit
a4d6b59251
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "luau0-src"
|
||||
version = "0.5.5+luau571"
|
||||
version = "0.5.6+luau573"
|
||||
authors = ["Aleksandr Orlenko <zxteam@protonmail.com>"]
|
||||
edition = "2021"
|
||||
repository = "https://github.com/khvzak/luau-src-rs"
|
||||
|
|
|
@ -841,14 +841,16 @@ class AstTypeReference : public AstType
|
|||
public:
|
||||
LUAU_RTTI(AstTypeReference)
|
||||
|
||||
AstTypeReference(const Location& location, std::optional<AstName> prefix, AstName name, bool hasParameterList = false,
|
||||
const AstArray<AstTypeOrPack>& parameters = {});
|
||||
AstTypeReference(const Location& location, std::optional<AstName> prefix, AstName name, std::optional<Location> prefixLocation,
|
||||
const Location& nameLocation, bool hasParameterList = false, const AstArray<AstTypeOrPack>& parameters = {});
|
||||
|
||||
void visit(AstVisitor* visitor) override;
|
||||
|
||||
bool hasParameterList;
|
||||
std::optional<AstName> prefix;
|
||||
std::optional<Location> prefixLocation;
|
||||
AstName name;
|
||||
Location nameLocation;
|
||||
AstArray<AstTypeOrPack> parameters;
|
||||
};
|
||||
|
||||
|
|
|
@ -753,12 +753,14 @@ void AstStatError::visit(AstVisitor* visitor)
|
|||
}
|
||||
}
|
||||
|
||||
AstTypeReference::AstTypeReference(
|
||||
const Location& location, std::optional<AstName> prefix, AstName name, bool hasParameterList, const AstArray<AstTypeOrPack>& parameters)
|
||||
AstTypeReference::AstTypeReference(const Location& location, std::optional<AstName> prefix, AstName name, std::optional<Location> prefixLocation,
|
||||
const Location& nameLocation, bool hasParameterList, const AstArray<AstTypeOrPack>& parameters)
|
||||
: AstType(ClassIndex(), location)
|
||||
, hasParameterList(hasParameterList)
|
||||
, prefix(prefix)
|
||||
, prefixLocation(prefixLocation)
|
||||
, name(name)
|
||||
, nameLocation(nameLocation)
|
||||
, parameters(parameters)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1343,7 +1343,7 @@ AstType* Parser::parseTableType()
|
|||
AstType* type = parseType();
|
||||
|
||||
// array-like table type: {T} desugars into {[number]: T}
|
||||
AstType* index = allocator.alloc<AstTypeReference>(type->location, std::nullopt, nameNumber);
|
||||
AstType* index = allocator.alloc<AstTypeReference>(type->location, std::nullopt, nameNumber, std::nullopt, type->location);
|
||||
indexer = allocator.alloc<AstTableIndexer>(AstTableIndexer{index, type, type->location});
|
||||
|
||||
break;
|
||||
|
@ -1449,7 +1449,7 @@ AstType* Parser::parseFunctionTypeTail(const Lexeme& begin, AstArray<AstGenericT
|
|||
{
|
||||
report(Location(begin.location, lexer.previousLocation()), "Expected '->' after '()' when parsing function type; did you mean 'nil'?");
|
||||
|
||||
return allocator.alloc<AstTypeReference>(begin.location, std::nullopt, nameNil);
|
||||
return allocator.alloc<AstTypeReference>(begin.location, std::nullopt, nameNil, std::nullopt, begin.location);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1493,7 +1493,7 @@ AstType* Parser::parseTypeSuffix(AstType* type, const Location& begin)
|
|||
{
|
||||
Location loc = lexer.current().location;
|
||||
nextLexeme();
|
||||
parts.push_back(allocator.alloc<AstTypeReference>(loc, std::nullopt, nameNil));
|
||||
parts.push_back(allocator.alloc<AstTypeReference>(loc, std::nullopt, nameNil, std::nullopt, loc));
|
||||
isUnion = true;
|
||||
}
|
||||
else if (c == '&')
|
||||
|
@ -1577,7 +1577,7 @@ AstTypeOrPack Parser::parseSimpleType(bool allowPack)
|
|||
if (lexer.current().type == Lexeme::ReservedNil)
|
||||
{
|
||||
nextLexeme();
|
||||
return {allocator.alloc<AstTypeReference>(start, std::nullopt, nameNil), {}};
|
||||
return {allocator.alloc<AstTypeReference>(start, std::nullopt, nameNil, std::nullopt, start), {}};
|
||||
}
|
||||
else if (lexer.current().type == Lexeme::ReservedTrue)
|
||||
{
|
||||
|
@ -1613,6 +1613,7 @@ AstTypeOrPack Parser::parseSimpleType(bool allowPack)
|
|||
else if (lexer.current().type == Lexeme::Name)
|
||||
{
|
||||
std::optional<AstName> prefix;
|
||||
std::optional<Location> prefixLocation;
|
||||
Name name = parseName("type name");
|
||||
|
||||
if (lexer.current().type == '.')
|
||||
|
@ -1621,6 +1622,7 @@ AstTypeOrPack Parser::parseSimpleType(bool allowPack)
|
|||
nextLexeme();
|
||||
|
||||
prefix = name.name;
|
||||
prefixLocation = name.location;
|
||||
name = parseIndexName("field name", pointPosition);
|
||||
}
|
||||
else if (lexer.current().type == Lexeme::Dot3)
|
||||
|
@ -1653,7 +1655,8 @@ AstTypeOrPack Parser::parseSimpleType(bool allowPack)
|
|||
|
||||
Location end = lexer.previousLocation();
|
||||
|
||||
return {allocator.alloc<AstTypeReference>(Location(start, end), prefix, name.name, hasParameters, parameters), {}};
|
||||
return {
|
||||
allocator.alloc<AstTypeReference>(Location(start, end), prefix, name.name, prefixLocation, name.location, hasParameters, parameters), {}};
|
||||
}
|
||||
else if (lexer.current().type == '{')
|
||||
{
|
||||
|
|
|
@ -167,7 +167,9 @@ size_t editDistance(std::string_view a, std::string_view b)
|
|||
|
||||
for (size_t y = 1; y <= b.size(); ++y)
|
||||
{
|
||||
size_t x1 = seenCharToRow[b[y - 1]];
|
||||
// The value of b[N] can be negative with unicode characters
|
||||
unsigned char bSeenCharIndex = static_cast<unsigned char>(b[y - 1]);
|
||||
size_t x1 = seenCharToRow[bSeenCharIndex];
|
||||
size_t y1 = lastMatchedY;
|
||||
|
||||
size_t cost = 1;
|
||||
|
@ -187,7 +189,9 @@ size_t editDistance(std::string_view a, std::string_view b)
|
|||
distances[getPos(x + 1, y + 1)] = std::min(std::min(insertion, deletion), std::min(substitution, transposition));
|
||||
}
|
||||
|
||||
seenCharToRow[a[x - 1]] = x;
|
||||
// The value of a[N] can be negative with unicode characters
|
||||
unsigned char aSeenCharIndex = static_cast<unsigned char>(a[x - 1]);
|
||||
seenCharToRow[aSeenCharIndex] = x;
|
||||
}
|
||||
|
||||
return distances[getPos(a.size() + 1, b.size() + 1)];
|
||||
|
|
|
@ -313,7 +313,11 @@ LUA_API uintptr_t lua_encodepointer(lua_State* L, uintptr_t p);
|
|||
LUA_API double lua_clock();
|
||||
|
||||
LUA_API void lua_setuserdatatag(lua_State* L, int idx, int tag);
|
||||
LUA_API void lua_setuserdatadtor(lua_State* L, int tag, void (*dtor)(lua_State*, void*));
|
||||
|
||||
typedef void (*lua_Destructor)(lua_State* L, void* userdata);
|
||||
|
||||
LUA_API void lua_setuserdatadtor(lua_State* L, int tag, lua_Destructor dtor);
|
||||
LUA_API lua_Destructor lua_getuserdatadtor(lua_State* L, int tag);
|
||||
|
||||
LUA_API void lua_clonefunction(lua_State* L, int idx);
|
||||
|
||||
|
|
|
@ -538,6 +538,8 @@ const void* lua_topointer(lua_State* L, int idx)
|
|||
StkId o = index2addr(L, idx);
|
||||
switch (ttype(o))
|
||||
{
|
||||
case LUA_TSTRING:
|
||||
return tsvalue(o);
|
||||
case LUA_TTABLE:
|
||||
return hvalue(o);
|
||||
case LUA_TFUNCTION:
|
||||
|
@ -1378,12 +1380,18 @@ void lua_setuserdatatag(lua_State* L, int idx, int tag)
|
|||
uvalue(o)->tag = uint8_t(tag);
|
||||
}
|
||||
|
||||
void lua_setuserdatadtor(lua_State* L, int tag, void (*dtor)(lua_State*, void*))
|
||||
void lua_setuserdatadtor(lua_State* L, int tag, lua_Destructor dtor)
|
||||
{
|
||||
api_check(L, unsigned(tag) < LUA_UTAG_LIMIT);
|
||||
L->global->udatagc[tag] = dtor;
|
||||
}
|
||||
|
||||
lua_Destructor lua_getuserdatadtor(lua_State* L, int tag)
|
||||
{
|
||||
api_check(L, unsigned(tag) < LUA_UTAG_LIMIT);
|
||||
return L->global->udatagc[tag];
|
||||
}
|
||||
|
||||
void lua_clonefunction(lua_State* L, int idx)
|
||||
{
|
||||
luaC_checkGC(L);
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
LUAU_FASTFLAGVARIABLE(LuauArrBoundResizeFix, false)
|
||||
|
||||
// max size of both array and hash part is 2^MAXBITS
|
||||
#define MAXBITS 26
|
||||
#define MAXSIZE (1 << MAXBITS)
|
||||
|
@ -466,8 +464,6 @@ static void rehash(lua_State* L, Table* t, const TValue* ek)
|
|||
int na = computesizes(nums, &nasize);
|
||||
int nh = totaluse - na;
|
||||
|
||||
if (FFlag::LuauArrBoundResizeFix)
|
||||
{
|
||||
// enforce the boundary invariant; for performance, only do hash lookups if we must
|
||||
int nadjusted = adjustasize(t, nasize, ek);
|
||||
|
||||
|
@ -486,12 +482,6 @@ static void rehash(lua_State* L, Table* t, const TValue* ek)
|
|||
// since the size was changed, it's again important to enforce the boundary invariant at the new size
|
||||
nasize = adjustasize(t, nasize, ek);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// enforce the boundary invariant; for performance, only do hash lookups if we must
|
||||
nasize = adjustasize(t, nasize, ek);
|
||||
}
|
||||
|
||||
// resize the table to new computed sizes
|
||||
resize(L, t, nasize, nh);
|
||||
|
|
|
@ -24,8 +24,7 @@ void luaU_freeudata(lua_State* L, Udata* u, lua_Page* page)
|
|||
{
|
||||
if (u->tag < LUA_UTAG_LIMIT)
|
||||
{
|
||||
void (*dtor)(lua_State*, void*) = nullptr;
|
||||
dtor = L->global->udatagc[u->tag];
|
||||
lua_Destructor dtor = L->global->udatagc[u->tag];
|
||||
// TODO: access to L here is highly unsafe since this is called during internal GC traversal
|
||||
// certain operations such as lua_getthreaddata are okay, but by and large this risks crashes on improper use
|
||||
if (dtor)
|
||||
|
|
Loading…
Reference in New Issue