File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ local ASSIGNMENT_NO_WARN_LOOKUP = lookupify{
3838 AstKind .VarargExpression
3939};
4040
41+ local CALLABLE_PREFIX_EXPRESSION_LOOKUP = lookupify {
42+ AstKind .VariableExpression ,
43+ AstKind .IndexExpression ,
44+ AstKind .FunctionCallExpression ,
45+ AstKind .PassSelfFunctionCallExpression
46+ };
47+
4148local function generateError (self , message )
4249 local token ;
4350 if (self .index > self .length ) then
782789
783790function Parser :expressionFunctionCall (scope , base )
784791 base = base or self :expressionIndex (scope );
792+
793+ if (not (base and (CALLABLE_PREFIX_EXPRESSION_LOOKUP [base .kind ] or base .isParenthesizedExpression ))) then
794+ return base ;
795+ end
785796
786797 -- Normal Function Call
787798 local args = {};
@@ -887,6 +898,9 @@ function Parser:expressionLiteral(scope)
887898 if (consume (self , TokenKind .Symbol , " (" )) then
888899 local expr = self :expression (scope );
889900 expect (self , TokenKind .Symbol , " )" );
901+ if expr then
902+ expr .isParenthesizedExpression = true ;
903+ end
890904 return expr ;
891905 end
892906
Original file line number Diff line number Diff line change 1+ -- Reproduction for issue #203 where the parser misreads the following
2+ -- as arguments to the previous literal assignment.
3+ local counter = 1
4+
5+ (function ()
6+ counter = counter + 1
7+ print (" counter:" , counter )
8+ end )();
You can’t perform that action at this time.
0 commit comments