def _visit_function(self, node):
		getter = False
		setter = False
		args_typedefs = {}
		for decor in node.decorator_list:
			if isinstance(decor, ast.Name) and decor.id == 'property':
				getter = True
			elif isinstance(decor, ast.Attribute) and isinstance(decor.value, ast.Name) and decor.attr == 'setter':
				setter = True
			elif isinstance(decor, ast.Call) and isinstance(decor.func, ast.Name) and decor.func.id == '__typedef__':
				for key in decor.keywords:
					args_typedefs[ key.arg ] = key.value.id
			else:
				raise SyntaxError

		args = []  #self.visit(node.args)
		oargs = []
		offset = len(node.args.args) - len(node.args.defaults)
		varargs = False
		varargs_name = None
		for i, arg in enumerate(node.args.args):
			a = arg.id
			if a in args_typedefs:
				a = '%s %s' %(args_typedefs[a], a)
			dindex = i - offset
			if a.startswith('__variable_args__'):
				varargs_name = a.split('__')[-1]
				varargs = ['_vararg_%s'%n for n in range(16) ]
				args.append( ','.join(varargs)%'[%s]' )

			elif dindex >= 0 and node.args.defaults:
				default_value = self.visit( node.args.defaults[dindex] )
				oargs.append( '%s:%s' %(a, default_value) )
			else:
				args.append( a )

		if oargs:
			#args.append( '[%s]' % ','.join(oargs) )
			args.append( '{%s}' % ','.join(oargs) )

		buffer = self.indent()
		if hasattr(node,'_prefix'): buffer += node._prefix + ' '

		if getter:
			buffer += 'get %s {\n' % node.name
		elif setter:
			buffer += 'set %s(%s) {\n' % (node.name, ', '.join(args))
		else:
			buffer += '%s(%s) {\n' % (node.name, ', '.join(args))
		self.push()

		if varargs:
			buffer += 'var %s = new list([]);\n' %varargs_name
			for i,n in enumerate(varargs):
				buffer += 'if (%s != null) %s.append(%s);\n' %(n, varargs_name, n)

		body = list()
		for child in node.body:
			if isinstance(child, ast.Str):
				continue
			else:
				body.append( self.indent() + self.visit(child) )

		buffer += '\n'.join(body)
		self.pull()
		buffer += '\n%s}\n' %self.indent()
		return buffer
dataset/ETHPy150Open PythonJS/PythonJS/pythonjs/pythonjs_to_dart.py/DartGenerator._visit_function/swapped operands of `%`