Skip to content

Commit 50d5d71

Browse files
committed
v0.17.1+luau702
1 parent da0c805 commit 50d5d71

27 files changed

Lines changed: 1257 additions & 233 deletions

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "luau0-src"
3-
version = "0.17.0+luau701"
3+
version = "0.17.1+luau702"
44
authors = ["Aleksandr Orlenko <zxteam@protonmail.com>"]
55
edition = "2021"
66
repository = "https://github.com/mlua-rs/luau-src-rs"

luau/Ast/include/Luau/Cst.h

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

7-
#include <string>
8-
97
namespace Luau
108
{
119

@@ -86,13 +84,13 @@ class CstExprConstantString : public CstNode
8684
// Shared between the expression and call nodes
8785
struct CstTypeInstantiation
8886
{
89-
Position leftArrow1Position = {0,0};
90-
Position leftArrow2Position = {0,0};
87+
Position leftArrow1Position = {0, 0};
88+
Position leftArrow2Position = {0, 0};
9189

9290
AstArray<Position> commaPositions = {};
9391

94-
Position rightArrow1Position = {0,0};
95-
Position rightArrow2Position = {0,0};
92+
Position rightArrow1Position = {0, 0};
93+
Position rightArrow2Position = {0, 0};
9694
};
9795

9896
class CstExprCall : public CstNode
@@ -220,7 +218,19 @@ class CstStatDo : public CstNode
220218
public:
221219
LUAU_CST_RTTI(CstStatDo)
222220

223-
explicit CstStatDo(Position endPosition);
221+
explicit CstStatDo(Position statsStartPosition, Position endPosition);
222+
223+
Position statsStartPosition;
224+
Position endPosition;
225+
};
226+
227+
// Clip with FFlag::LuauCstStatBlock
228+
class CstStatDo_DEPRECATED : public CstNode
229+
{
230+
public:
231+
LUAU_CST_RTTI(CstStatDo_DEPRECATED)
232+
233+
explicit CstStatDo_DEPRECATED(Position endPosition);
224234

225235
Position endPosition;
226236
};
@@ -521,4 +531,4 @@ class CstTypePackGeneric : public CstNode
521531
Position ellipsisPosition;
522532
};
523533

524-
} // namespace Luau
534+
} // namespace Luau

luau/Ast/include/Luau/ParseResult.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ struct ParseResult
7171
CstNodeMap cstNodeMap{nullptr};
7272
};
7373

74-
struct ParseExprResult
74+
template<typename Node>
75+
struct ParseNodeResult
7576
{
76-
AstExpr* expr;
77+
Node* root;
7778
size_t lines = 0;
7879

7980
std::vector<HotComment> hotcomments;

luau/Ast/include/Luau/Parser.h

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ class TempVector
5454

5555
class Parser
5656
{
57+
template<typename Node, typename F>
58+
static ParseNodeResult<Node> runParse(
59+
const char* buffer,
60+
size_t bufferSize,
61+
AstNameTable& names,
62+
Allocator& allocator,
63+
ParseOptions options,
64+
F f
65+
);
66+
5767
public:
5868
static ParseResult parse(
5969
const char* buffer,
@@ -63,14 +73,22 @@ class Parser
6373
ParseOptions options = ParseOptions()
6474
);
6575

66-
static ParseExprResult parseExpr(
76+
static ParseNodeResult<AstExpr> parseExpr(
6777
const char* buffer,
6878
std::size_t bufferSize,
6979
AstNameTable& names,
7080
Allocator& allocator,
7181
ParseOptions options = ParseOptions()
7282
);
7383

84+
static ParseNodeResult<AstType> parseType(
85+
const char* buffer,
86+
std::size_t bufferSize,
87+
AstNameTable& names,
88+
Allocator& allocator,
89+
ParseOptions options = {}
90+
);
91+
7492
private:
7593
struct Name;
7694
struct Binding;
@@ -285,6 +303,7 @@ class Parser
285303

286304
// primaryexp -> prefixexp { `.' NAME | `[' exp `]' | TypeInstantiation | `:' NAME [TypeInstantiation] funcargs | funcargs }
287305
AstExpr* parsePrimaryExpr(bool asStatement);
306+
AstExpr* parseMethodCall(Position start, AstExpr* expr);
288307

289308
// asexp -> simpleexp [`::' Type]
290309
AstExpr* parseAssertionExpr();
@@ -311,10 +330,7 @@ class Parser
311330
AstExpr* parseInterpString();
312331

313332
// TypeInstantiation ::= `<' `<' [TypeList] `>' `>'
314-
AstArray<AstTypeOrPack> parseTypeInstantiationExpr(
315-
CstTypeInstantiation* cstNodeOut = nullptr,
316-
Location* endLocationOut = nullptr
317-
);
333+
AstArray<AstTypeOrPack> parseTypeInstantiationExpr(CstTypeInstantiation* cstNodeOut = nullptr, Location* endLocationOut = nullptr);
318334

319335
AstExpr* parseExplicitTypeInstantiationExpr(Position start, AstExpr& basedOnExpr);
320336

luau/Ast/src/Ast.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#include "Luau/Ast.h"
33

44
#include "Luau/Common.h"
5-
#include "Luau/StringUtils.h"
5+
6+
LUAU_FASTFLAGVARIABLE(LuauStandaloneParseType)
67

78
LUAU_FASTFLAG(LuauExplicitTypeExpressionInstantiation)
89

luau/Ast/src/Cst.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "Luau/Cst.h"
44
#include "Luau/Common.h"
55

6+
LUAU_FASTFLAG(LuauCstStatDoWithStatsStart)
7+
68
namespace Luau
79
{
810

@@ -82,10 +84,19 @@ CstExprExplicitTypeInstantiation::CstExprExplicitTypeInstantiation(CstTypeInstan
8284
{
8385
}
8486

85-
CstStatDo::CstStatDo(Position endPosition)
87+
CstStatDo::CstStatDo(Position statsStartPosition, Position endPosition)
88+
: CstNode(CstClassIndex())
89+
, statsStartPosition(statsStartPosition)
90+
, endPosition(endPosition)
91+
{
92+
LUAU_ASSERT(FFlag::LuauCstStatDoWithStatsStart);
93+
}
94+
95+
CstStatDo_DEPRECATED::CstStatDo_DEPRECATED(Position endPosition)
8696
: CstNode(CstClassIndex())
8797
, endPosition(endPosition)
8898
{
99+
LUAU_ASSERT(!FFlag::LuauCstStatDoWithStatsStart);
89100
}
90101

91102
CstStatRepeat::CstStatRepeat(Position untilPosition)

0 commit comments

Comments
 (0)