|
5 | 5 | #include "Luau/Lexer.h" |
6 | 6 | #include "Luau/ParseOptions.h" |
7 | 7 | #include "Luau/ParseResult.h" |
8 | | -#include "Luau/DenseHash.h" |
| 8 | +#include "Luau/DenseHash2.h" |
9 | 9 | #include "Luau/Common.h" |
10 | 10 | #include "Luau/Cst.h" |
11 | 11 |
|
@@ -164,7 +164,6 @@ class Parser |
164 | 164 | void parseAttrList(TempVector<AstAttr*>& attributes, TempVector<CstAttrList*>* cstAttrLists); |
165 | 165 |
|
166 | 166 | // attribute ::= '@' NAME | attrlist |
167 | | - void parseAttribute_DEPRECATED(TempVector<AstAttr*>& attribute); // TODO: Clip with LuauCstAttr |
168 | 167 | void parseAttribute(TempVector<AstAttr*>& attribute); |
169 | 168 |
|
170 | 169 | // attributes ::= {attribute} |
@@ -192,7 +191,7 @@ class Parser |
192 | 191 | // type Name `=' Type |
193 | 192 | AstStat* parseTypeAlias(const Location& start, bool exported, Position typeKeywordPosition); |
194 | 193 |
|
195 | | - AstStat* parseClassStat(const Location& start, bool exported); |
| 194 | + AstStat* parseClassStat(const Location& start, bool exported, bool open); |
196 | 195 |
|
197 | 196 | // type function Name ... end |
198 | 197 | AstStat* parseTypeFunction(const Location& start, bool exported, Position typeKeywordPosition); |
@@ -364,6 +363,8 @@ class Parser |
364 | 363 |
|
365 | 364 | AstExpr* parseExplicitTypeInstantiationExpr(Position start, AstExpr& basedOnExpr); |
366 | 365 |
|
| 366 | + AstExpr* parseClassRefExpr(); |
| 367 | + |
367 | 368 | // Name |
368 | 369 | std::optional<Name> parseNameOpt(const char* context = nullptr); |
369 | 370 | Name parseName(const char* context = nullptr); |
@@ -448,6 +449,8 @@ class Parser |
448 | 449 | ... |
449 | 450 | ) LUAU_PRINTF_ATTR(5, 6); |
450 | 451 | AstExprError* reportExprError(const Location& location, const AstArray<AstExpr*>& expressions, const char* format, ...) LUAU_PRINTF_ATTR(4, 5); |
| 452 | + AstStatClass* getMatchingClass(AstExpr* expr); |
| 453 | + bool isExprLValue(AstExpr* expr); |
451 | 454 | AstExprError* reportLValueError(AstExpr* expr); |
452 | 455 | AstTypeError* reportTypeError(const Location& location, const AstArray<AstType*>& types, const char* format, ...) LUAU_PRINTF_ATTR(4, 5); |
453 | 456 | // `parseErrorLocation` is associated with the parser error |
@@ -540,15 +543,15 @@ class Parser |
540 | 543 | std::vector<Function> functionStack; |
541 | 544 | size_t typeFunctionDepth = 0; |
542 | 545 |
|
543 | | - DenseHashMap<AstName, AstLocal*> localMap; |
| 546 | + DenseHashMap2<AstName, AstLocal*> localMap; |
544 | 547 | std::vector<AstLocal*> localStack; |
545 | | - DenseHashSet<AstName> classesWithinModule{{}}; |
| 548 | + DenseHashMap2<AstName, AstStatClass*> classesWithinModule; |
546 | 549 |
|
547 | 550 | std::vector<ParseError> parseErrors; |
548 | 551 |
|
549 | 552 | std::vector<unsigned int> matchRecoveryStopOnToken; |
550 | 553 |
|
551 | | - DenseHashMap<AstName, Location> declaredExportBindings; |
| 554 | + DenseHashMap2<AstName, Location> declaredExportBindings; |
552 | 555 | bool hasModuleReturn = false; |
553 | 556 |
|
554 | 557 | std::vector<AstAttr*> scratchAttr; |
|
0 commit comments