Skip to content

Commit 5c854f7

Browse files
committed
Bump Luau to 0.699
1 parent c4f8694 commit 5c854f7

31 files changed

+307
-368
lines changed

luau/Ast/include/Luau/Parser.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ class Parser
136136
const TempVector<AstAttr*>& attributes,
137137
const AstArray<AstExpr*>& args
138138
);
139-
std::optional<AstAttr::Type> validateAttribute_DEPRECATED(const char* attributeName, const TempVector<AstAttr*>& attributes);
140139

141140
// attribute ::= '@' NAME
142141
void parseAttribute(TempVector<AstAttr*>& attribute);

luau/Ast/src/Ast.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include "Luau/Common.h"
55
#include "Luau/StringUtils.h"
66

7-
LUAU_FASTFLAG(LuauParametrizedAttributeSyntax)
8-
97
namespace Luau
108
{
119

@@ -22,20 +20,7 @@ static AstAttr* findAttributeInArray(const AstArray<AstAttr*> attributes, AstAtt
2220

2321
static bool hasAttributeInArray(const AstArray<AstAttr*> attributes, AstAttr::Type attributeType)
2422
{
25-
if (FFlag::LuauParametrizedAttributeSyntax)
26-
{
27-
return findAttributeInArray(attributes, attributeType) != nullptr;
28-
}
29-
else
30-
{
31-
for (const auto attribute : attributes)
32-
{
33-
if (attribute->type == attributeType)
34-
return true;
35-
}
36-
37-
return false;
38-
}
23+
return findAttributeInArray(attributes, attributeType) != nullptr;
3924
}
4025

4126
static void visitTypeList(AstVisitor* visitor, const AstTypeList& list)

luau/Ast/src/Lexer.cpp

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
#include <limits.h>
1010

11-
LUAU_FASTFLAG(LuauParametrizedAttributeSyntax)
12-
1311
namespace Luau
1412
{
1513

@@ -991,36 +989,28 @@ Lexeme Lexer::readNext()
991989
}
992990
case '@':
993991
{
994-
if (FFlag::LuauParametrizedAttributeSyntax)
992+
if (peekch(1) == '[')
995993
{
996-
if (peekch(1) == '[')
997-
{
998-
consume();
999-
consume();
994+
consume();
995+
consume();
996+
997+
return Lexeme(Location(start, 2), Lexeme::AttributeOpen);
998+
}
999+
else
1000+
{
1001+
// consume @ first
1002+
consume();
10001003

1001-
return Lexeme(Location(start, 2), Lexeme::AttributeOpen);
1004+
if (isAlpha(peekch()) || peekch() == '_')
1005+
{
1006+
std::pair<AstName, Lexeme::Type> attribute = readName();
1007+
return Lexeme(Location(start, position()), Lexeme::Attribute, attribute.first.value);
10021008
}
10031009
else
10041010
{
1005-
// consume @ first
1006-
consume();
1007-
1008-
if (isAlpha(peekch()) || peekch() == '_')
1009-
{
1010-
std::pair<AstName, Lexeme::Type> attribute = readName();
1011-
return Lexeme(Location(start, position()), Lexeme::Attribute, attribute.first.value);
1012-
}
1013-
else
1014-
{
1015-
return Lexeme(Location(start, position()), Lexeme::Attribute, "");
1016-
}
1011+
return Lexeme(Location(start, position()), Lexeme::Attribute, "");
10171012
}
10181013
}
1019-
else
1020-
{
1021-
std::pair<AstName, Lexeme::Type> attribute = readName();
1022-
return Lexeme(Location(start, position()), Lexeme::Attribute, attribute.first.value);
1023-
}
10241014
}
10251015
default:
10261016
if (isDigit(peekch()))

luau/Ast/src/Parser.cpp

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ LUAU_FASTINTVARIABLE(LuauParseErrorLimit, 100)
1919
// See docs/SyntaxChanges.md for an explanation.
2020
LUAU_FASTFLAGVARIABLE(LuauSolverV2)
2121
LUAU_DYNAMIC_FASTFLAGVARIABLE(DebugLuauReportReturnTypeVariadicWithTypeSuffix, false)
22-
LUAU_FASTFLAGVARIABLE(LuauParametrizedAttributeSyntax)
2322
LUAU_FASTFLAGVARIABLE(DebugLuauStringSingletonBasedOnQuotes)
2423
LUAU_FASTFLAGVARIABLE(LuauAutocompleteAttributes)
2524

@@ -868,60 +867,10 @@ std::optional<AstAttr::Type> Parser::validateAttribute(
868867
return type;
869868
}
870869

871-
std::optional<AstAttr::Type> Parser::validateAttribute_DEPRECATED(const char* attributeName, const TempVector<AstAttr*>& attributes)
872-
{
873-
// check if the attribute name is valid
874-
std::optional<AstAttr::Type> type;
875-
876-
for (int i = 0; kAttributeEntries_DEPRECATED[i].name; ++i)
877-
{
878-
if (strcmp(attributeName, kAttributeEntries_DEPRECATED[i].name) == 0)
879-
{
880-
type = kAttributeEntries_DEPRECATED[i].type;
881-
break;
882-
}
883-
}
884-
885-
if (!type)
886-
{
887-
if (strlen(attributeName) == 1)
888-
report(lexer.current().location, "Attribute name is missing");
889-
else
890-
report(lexer.current().location, "Invalid attribute '%s'", attributeName);
891-
}
892-
else
893-
{
894-
// check that attribute is not duplicated
895-
for (const AstAttr* attr : attributes)
896-
{
897-
if (attr->type == *type)
898-
report(lexer.current().location, "Cannot duplicate attribute '%s'", attributeName);
899-
}
900-
}
901-
902-
return type;
903-
}
904-
905870
// attribute ::= '@' NAME
906871
void Parser::parseAttribute(TempVector<AstAttr*>& attributes)
907872
{
908873
AstArray<AstExpr*> empty;
909-
if (!FFlag::LuauParametrizedAttributeSyntax)
910-
{
911-
LUAU_ASSERT(lexer.current().type == Lexeme::Type::Attribute);
912-
913-
Location loc = lexer.current().location;
914-
915-
const char* name = lexer.current().name;
916-
std::optional<AstAttr::Type> type = validateAttribute_DEPRECATED(name, attributes);
917-
918-
nextLexeme();
919-
920-
if (type)
921-
attributes.push_back(allocator.alloc<AstAttr>(loc, *type, empty));
922-
923-
return;
924-
}
925874

926875
LUAU_ASSERT(lexer.current().type == Lexeme::Type::Attribute || lexer.current().type == Lexeme::Type::AttributeOpen);
927876

@@ -1034,7 +983,7 @@ AstArray<AstAttr*> Parser::parseAttributes()
1034983

1035984
TempVector<AstAttr*> attributes(scratchAttr);
1036985

1037-
while (lexer.current().type == Lexeme::Attribute || (FFlag::LuauParametrizedAttributeSyntax && lexer.current().type == Lexeme::AttributeOpen))
986+
while (lexer.current().type == Lexeme::Attribute || lexer.current().type == Lexeme::AttributeOpen)
1038987
parseAttribute(attributes);
1039988

1040989
return copy(attributes);
@@ -1442,8 +1391,7 @@ AstStat* Parser::parseDeclaration(const Location& start, const AstArray<AstAttr*
14421391
{
14431392
AstArray<AstAttr*> attributes{nullptr, 0};
14441393

1445-
if (lexer.current().type == Lexeme::Attribute ||
1446-
(FFlag::LuauParametrizedAttributeSyntax && lexer.current().type == Lexeme::AttributeOpen))
1394+
if (lexer.current().type == Lexeme::Attribute || lexer.current().type == Lexeme::AttributeOpen)
14471395
{
14481396
attributes = Parser::parseAttributes();
14491397

@@ -2566,7 +2514,7 @@ AstTypeOrPack Parser::parseSimpleType(bool allowPack, bool inDeclarationContext)
25662514

25672515
AstArray<AstAttr*> attributes{nullptr, 0};
25682516

2569-
if (lexer.current().type == Lexeme::Attribute || (FFlag::LuauParametrizedAttributeSyntax && lexer.current().type == Lexeme::AttributeOpen))
2517+
if (lexer.current().type == Lexeme::Attribute || lexer.current().type == Lexeme::AttributeOpen)
25702518
{
25712519
if (!inDeclarationContext)
25722520
{
@@ -3213,7 +3161,7 @@ AstExpr* Parser::parseSimpleExpr()
32133161

32143162
AstArray<AstAttr*> attributes{nullptr, 0};
32153163

3216-
if (lexer.current().type == Lexeme::Attribute || (FFlag::LuauParametrizedAttributeSyntax && lexer.current().type == Lexeme::AttributeOpen))
3164+
if (lexer.current().type == Lexeme::Attribute || lexer.current().type == Lexeme::AttributeOpen)
32173165
{
32183166
attributes = parseAttributes();
32193167

luau/CodeGen/include/Luau/IrVisitUseDef.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include "Luau/Common.h"
55
#include "Luau/IrData.h"
66

7-
LUAU_FASTFLAG(LuauCodegenDirectCompare2)
8-
97
namespace Luau
108
{
119
namespace CodeGen
@@ -40,16 +38,14 @@ static void visitVmRegDefsUses(T& visitor, IrFunction& function, const IrInst& i
4038
visitor.use(inst.b);
4139
break;
4240
case IrCmd::CMP_TAG:
43-
if (FFlag::LuauCodegenDirectCompare2)
44-
visitor.maybeUse(inst.a);
41+
visitor.maybeUse(inst.a);
4542
break;
4643
case IrCmd::JUMP_IF_TRUTHY:
4744
case IrCmd::JUMP_IF_FALSY:
4845
visitor.use(inst.a);
4946
break;
5047
case IrCmd::JUMP_EQ_TAG:
51-
if (FFlag::LuauCodegenDirectCompare2)
52-
visitor.maybeUse(inst.a);
48+
visitor.maybeUse(inst.a);
5349
break;
5450
// A <- B, C
5551
case IrCmd::DO_ARITH:

luau/CodeGen/src/CodeGenContext.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
LUAU_FASTINTVARIABLE(LuauCodeGenBlockSize, 4 * 1024 * 1024)
1717
LUAU_FASTINTVARIABLE(LuauCodeGenMaxTotalSize, 256 * 1024 * 1024)
18-
LUAU_DYNAMIC_FASTFLAGVARIABLE(LuauCodeGenDisableWithNoReentry, false)
1918

2019
namespace Luau
2120
{
@@ -377,11 +376,8 @@ static int onEnter(lua_State* L, Proto* proto)
377376

378377
static int onEnterDisabled(lua_State* L, Proto* proto)
379378
{
380-
if (DFFlag::LuauCodeGenDisableWithNoReentry)
381-
{
382-
// If the function wasn't entered natively, it cannot be resumed natively later
383-
L->ci->flags &= ~LUA_CALLINFO_NATIVE;
384-
}
379+
// If the function wasn't entered natively, it cannot be resumed natively later
380+
L->ci->flags &= ~LUA_CALLINFO_NATIVE;
385381

386382
return 1;
387383
}

luau/CodeGen/src/IrBuilder.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
#include <string.h>
1414

15-
LUAU_FASTFLAGVARIABLE(LuauCodegenDirectCompare2)
16-
1715
namespace Luau
1816
{
1917
namespace CodeGen
@@ -381,7 +379,7 @@ void IrBuilder::translateInst(LuauOpcode op, const Instruction* pc, int i)
381379
translateInstJumpX(*this, pc, i);
382380
break;
383381
case LOP_JUMPXEQKNIL:
384-
if (FFlag::LuauCodegenDirectCompare2 && isDirectCompare(function.proto, pc, i))
382+
if (isDirectCompare(function.proto, pc, i))
385383
{
386384
translateInstJumpxEqNilShortcut(*this, pc, i);
387385

@@ -394,7 +392,7 @@ void IrBuilder::translateInst(LuauOpcode op, const Instruction* pc, int i)
394392
translateInstJumpxEqNil(*this, pc, i);
395393
break;
396394
case LOP_JUMPXEQKB:
397-
if (FFlag::LuauCodegenDirectCompare2 && isDirectCompare(function.proto, pc, i))
395+
if (isDirectCompare(function.proto, pc, i))
398396
{
399397
translateInstJumpxEqBShortcut(*this, pc, i);
400398

@@ -407,7 +405,7 @@ void IrBuilder::translateInst(LuauOpcode op, const Instruction* pc, int i)
407405
translateInstJumpxEqB(*this, pc, i);
408406
break;
409407
case LOP_JUMPXEQKN:
410-
if (FFlag::LuauCodegenDirectCompare2 && isDirectCompare(function.proto, pc, i))
408+
if (isDirectCompare(function.proto, pc, i))
411409
{
412410
translateInstJumpxEqNShortcut(*this, pc, i);
413411

@@ -420,7 +418,7 @@ void IrBuilder::translateInst(LuauOpcode op, const Instruction* pc, int i)
420418
translateInstJumpxEqN(*this, pc, i);
421419
break;
422420
case LOP_JUMPXEQKS:
423-
if (FFlag::LuauCodegenDirectCompare2 && isDirectCompare(function.proto, pc, i))
421+
if (isDirectCompare(function.proto, pc, i))
424422
{
425423
translateInstJumpxEqSShortcut(*this, pc, i);
426424

0 commit comments

Comments
 (0)