fix 2 special cases of method invocation

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-11-28 00:20:52 -08:00
parent cacc8899a9
commit 2da2969a36
2 changed files with 32 additions and 3 deletions

View File

@@ -129,10 +129,18 @@ namespace Orchard.Widgets.SimpleScripting.Compiler {
var target = _lexer.Token();
_lexer.NextToken();
bool hasParenthesis = (IsMatch(TokenKind.OpenParen) != null);
bool isParenthesizedCall = (IsMatch(TokenKind.OpenParen) != null);
var arguments = new List<AstNode>();
while (true) {
// Special case: we might reach the end of the token stream
if (_lexer.Token().Kind == TokenKind.Eof)
break;
// Special case: we must support "foo()"
if (isParenthesizedCall && _lexer.Token().Kind == TokenKind.CloseParen)
break;
var argument = ParseExpression();
arguments.Add(argument);
@@ -140,7 +148,7 @@ namespace Orchard.Widgets.SimpleScripting.Compiler {
break;
}
if (hasParenthesis)
if (isParenthesizedCall)
Match(TokenKind.CloseParen);
return new MethodCallAstNode(target, arguments);