Ticket #221: methodcall-spaces.patch
File methodcall-spaces.patch, 1.5 KB (added by hopscc, 12 years ago) |
---|
-
Source/CobraParser.cobra
2848 2848 # requires special handling - PostCallExpr 2849 2849 # this happens for something like: foo[i]('x') 2850 2850 if not PostCallExpr.isTargetAcceptable(left to !) 2851 .throwError('Unexpected call.') # example: t = x to List<of String>() 2851 msg = '' 2852 if left inherits DotExpr 2853 if left.right inherits MemberExpr # example: .somecall (arg) 2854 msg =' Method calls should not have whitespace between the methodname and the parenthesised arglist.' 2855 .throwError('Unexpected call.[msg]') # example: t = x to List<of String>() 2852 2856 token = .grab 2853 2857 exprs = .commaSepExprs('RPAREN.') 2854 2858 return .expression(precedence, PostCallExpr(token, left, exprs)) -
Tests/820-errors/100-lexing-and-parsing/320-extra-spaces-methodcall.cobra
1 class Program 2 3 def main 4 a = .someCall ("abc") and _ # .error. should not have whitespace 5 .anotherCall("def") 6 print a 7 8 def someCall(s as String) as bool 9 return true 10 11 def anotherCall(s as String) as bool 12 return true 13