def p_statement_global(p): 'statement : GLOBAL global_var_list SEMI' p[0] = ast.Global(p[2], lineno=p.lineno(1))
if not body: body = [py.Pass(**pos(node))] rv = py.FunctionDef(node.name, py.arguments(args, '_varargs', None, defaults), body, decorator_list, **pos(node)) self.scope_stack.pop(-1) return rv if isinstance(node, php.Static): assert len(node.nodes) == 1, "can't handle more than 1 static" node = node.nodes[0] self.add_static(node.name[1:]) name = node.name initial = node.initial lineno = node.lineno node = php.Block([ php.Global([php.Variable(name, lineno=lineno)], lineno = lineno), php.If( php.UnaryOp("!", php.IsSet([php.Variable(name, lineno=lineno)], lineno=lineno), lineno=lineno), php.Assignment( php.Variable(name, lineno=lineno), initial, False, lineno=lineno), [], None, lineno=node.lineno) ],lineno = lineno) return self.from_phpast(node)