Пример #1
0
 def visit_FunctionDef(self, node):
   scope = self.scopeStack.peek()
   decorators = node.decorator_list and sage.buildExprListExp(map(self.visit, node.decorator_list))
   stararg_id = node.args.vararg and sage.buildInitializedName(node.args.vararg, starred=True)
   dstararg_id = node.args.kwarg  and sage.buildInitializedName(node.args.kwarg, dstarred=True)
   params = self.visit(node.args)
   (capsule, scope) = \
       sage.buildFunctionDef(node.name, params, decorators, stararg_id, dstararg_id, scope)
   self.scopeStack.push(scope)
   body_forest = map(self.visit, node.body)
   sage.appendStatements(capsule, body_forest)
   self.scopeStack.pop(scope)
   return capsule
Пример #2
0
 def visit_FunctionDef(self, node):
     scope = self.scopeStack.peek()
     decorators = node.decorator_list and sage.buildExprListExp(
         map(self.visit, node.decorator_list))
     stararg_id = node.args.vararg and sage.buildInitializedName(
         node.args.vararg, starred=True)
     dstararg_id = node.args.kwarg and sage.buildInitializedName(
         node.args.kwarg, dstarred=True)
     params = self.visit(node.args)
     (capsule, scope) = \
         sage.buildFunctionDef(node.name, params, decorators, stararg_id, dstararg_id, scope)
     self.scopeStack.push(scope)
     body_forest = map(self.visit, node.body)
     sage.appendStatements(capsule, body_forest)
     self.scopeStack.pop(scope)
     return capsule
Пример #3
0
 def visit_arguments(self, node):
     args = map(lambda arg: sage.buildInitializedName(arg.id), node.args)
     kwargs = map(self.visit, node.defaults)
     return sage.buildFunctionParameterList(args, kwargs)
Пример #4
0
 def visit_arguments(self, node):
   args = map(lambda arg: sage.buildInitializedName(arg.id), node.args)
   kwargs = map(self.visit, node.defaults)
   return sage.buildFunctionParameterList(args, kwargs)