@@ -2066,6 +2066,9 @@ def visit_Call(self, node):
20662066
20672067
20682068 name = self .visit (node .func )
2069+ if name in typedpython .GO_SPECIAL_CALLS :
2070+ name = typedpython .GO_SPECIAL_CALLS [ name ]
2071+ return '%s( %s )' % (name , self .visit (node .args [0 ]))
20692072
20702073 if self ._with_rpc :
20712074 if not self ._with_rpc_name :
@@ -2514,7 +2517,7 @@ def visit_Call(self, node):
25142517
25152518 elif hasattr (node ,'constant' ) or name in self ._builtin_functions :
25162519 if args and kwargs :
2517- return '%s([%s], {%s})' % (args , kwargs )
2520+ return '%s([%s], {%s})' % (name , args , kwargs )
25182521 elif args :
25192522 return '%s([%s], __NULL_OBJECT__)' % (name ,args )
25202523 elif kwargs :
@@ -2998,19 +3001,19 @@ def visit_FunctionDef(self, node):
29983001 # First check the arguments are well formed
29993002 # ie. that this function is not a callback of javascript code
30003003
3004+ if not self ._with_go :
3005+ writer .write ("""if instanceof(args,Array) and Object.prototype.toString.call(kwargs) == '[object Object]' and arguments.length==2:""" )
3006+ writer .push ()
3007+ writer .write ('pass' ) # do nothing if it's not called from javascript
3008+ writer .pull ()
30013009
3002- writer .write ("""if instanceof(args,Array) and Object.prototype.toString.call(kwargs) == '[object Object]' and arguments.length==2:""" )
3003- writer .push ()
3004- writer .write ('pass' ) # do nothing if it's not called from javascript
3005- writer .pull ()
3006-
3007- writer .write ('else:' )
3008- writer .push ()
3009- # If it's the case, move use ``arguments`` to ``args``
3010- writer .write ('args = Array.prototype.slice.call(arguments, 0, __sig__.args.length)' )
3011- # This means you can't pass keyword argument from javascript but we already knew that
3012- writer .write ('kwargs = JSObject()' )
3013- writer .pull ()
3010+ writer .write ('else:' )
3011+ writer .push ()
3012+ # If it's the case, move use ``arguments`` to ``args``
3013+ writer .write ('args = Array.prototype.slice.call(arguments, 0, __sig__.args.length)' )
3014+ # This means you can't pass keyword argument from javascript but we already knew that
3015+ writer .write ('kwargs = JSObject()' )
3016+ writer .pull ()
30143017
30153018
30163019
@@ -3665,7 +3668,7 @@ def visit_With(self, node):
36653668 self ._with_js = True
36663669 writer .write ('with %s:' % self .visit (node .context_expr ))
36673670 self ._with_js = restore
3668-
3671+
36693672 writer .push ()
36703673 for b in node .body :
36713674 a = self .visit (b )
0 commit comments