From: Jay Freeman (saurik) Date: Sun, 6 Dec 2015 22:27:43 +0000 (-0800) Subject: Fix support for multiple "block lambda" arguments. X-Git-Tag: v0.9.590~241 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/1abe53bff9f3ea0bebf749a4b49271c4eff7ec12 Fix support for multiple "block lambda" arguments. --- diff --git a/Parser.ypp.in b/Parser.ypp.in index 2a00d69..fe1c5f3 100644 --- a/Parser.ypp.in +++ b/Parser.ypp.in @@ -1062,7 +1062,7 @@ UnaryExpression_ ; UnaryExpression - : PostfixExpression { $$ = $1; } + : %prec "" PostfixExpression { $$ = $1; } | LexSetRegExp UnaryExpression_ { $$ = $2; } ; /* }}} */ @@ -2352,7 +2352,7 @@ PrimaryExpression ; PostfixExpression - : LeftHandSideExpression RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); } + : PostfixExpression RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); } ; /* }}} */ diff --git a/Replace.cpp b/Replace.cpp index 54e931e..2ac6942 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -738,6 +738,10 @@ CYExpression *CYRubyBlock::Replace(CYContext &context) { return call_->AddArgument(context, proc_->Replace(context)); } +CYExpression *CYRubyBlock::AddArgument(CYContext &context, CYExpression *value) { + return Replace(context)->AddArgument(context, value); +} + CYExpression *CYRubyProc::Replace(CYContext &context) { CYFunctionExpression *function($ CYFunctionExpression(NULL, parameters_, code_)); function = CYNonLocalize(context, function); diff --git a/Syntax.hpp b/Syntax.hpp index a70e4a3..82b1392 100644 --- a/Syntax.hpp +++ b/Syntax.hpp @@ -1420,6 +1420,8 @@ struct CYRubyBlock : virtual CYExpression *Replace(CYContext &context); virtual void Output(CYOutput &out, CYFlags flags) const; + + virtual CYExpression *AddArgument(CYContext &context, CYExpression *value); }; struct CYIf :