NormalizeTree(self),
PostParse(self),
_specific_post_parse,
- InterpretCompilerDirectives(self, self.pragma_overrides),
+ InterpretCompilerDirectives(self, self.compiler_directives),
_align_function_definitions,
+ MarkClosureVisitor(self),
ConstantFolding(),
FlattenInListTransform(),
WithTransform(self),
DecoratorTransform(self),
AnalyseDeclarationsTransform(self),
+ CreateClosureClasses(self),
+ AutoTestDictTransform(self),
EmbedSignature(self),
TransformBuiltinMethods(self),
IntroduceBufferAuxiliaryVars(self),
code.putln("")
code.putln("/* Implementation of %s */" % env.qualified_name)
- code.globalstate.insert_global_var_declarations_into(code)
+ code = globalstate['all_the_rest']
self.generate_cached_builtins_decls(env, code)
+ # generate lambda function definitions
+ for node in env.lambda_defs:
+ node.generate_function_definitions(env, code)
+ # generate normal function definitions
self.body.generate_function_definitions(env, code)
code.mark_pos(None)
self.generate_typeobj_definitions(env, code)
vtabstruct_prefix = pyrex_prefix + "vtabstruct_"
opt_arg_prefix = pyrex_prefix + "opt_args_"
convert_func_prefix = pyrex_prefix + "convert_"
+closure_scope_prefix = pyrex_prefix + "scope_"
+closure_class_prefix = pyrex_prefix + "scope_struct_"
+lambda_func_prefix = pyrex_prefix + "lambda_"
+ module_is_main = pyrex_prefix + "module_is_main_"
args_cname = pyrex_prefix + "args"
pykwdlist_cname = pyrex_prefix + "pyargnames"
optional_args_cname = pyrex_prefix + "optional_args"
import_star = pyrex_prefix + "import_star"
import_star_set = pyrex_prefix + "import_star_set"
- cur_scope_cname = pyrex_prefix + "scope"
+outer_scope_cname= pyrex_prefix + "outer_scope"
+ cur_scope_cname = pyrex_prefix + "cur_scope"
+ enc_scope_cname = pyrex_prefix + "enc_scope"
+ frame_cname = pyrex_prefix + "frame"
+ frame_code_cname = pyrex_prefix + "frame_code"
line_c_macro = "__LINE__"
import PyrexTypes
import TypeSlots
from PyrexTypes import py_object_type, error_type, CTypedefType, CFuncType
-from Symtab import ModuleScope, LocalScope, GeneratorLocalScope, \
+from Symtab import ModuleScope, LocalScope, ClosureScope, \
StructOrUnionScope, PyClassScope, CClassScope
- from Cython.Utils import open_new_file, replace_suffix, UtilityCode
+ from Cython.Utils import open_new_file, replace_suffix
+ from Code import UtilityCode
from StringEncoding import EncodedString, escape_byte_string, split_docstring
import Options
import ControlFlow
cpdef p_c_func_or_var_declaration(PyrexScanner s, pos, ctx)
cpdef p_ctypedef_statement(PyrexScanner s, ctx)
cpdef p_decorators(PyrexScanner s)
-cpdef p_def_statement(PyrexScanner s, decorators = *)
+cpdef p_def_statement(PyrexScanner s, list decorators = *)
+cpdef p_varargslist(PyrexScanner s, terminator=*)
cpdef p_py_arg_decl(PyrexScanner s)
- cpdef p_class_statement(PyrexScanner s)
+ cpdef p_class_statement(PyrexScanner s, decorators)
cpdef p_c_class_definition(PyrexScanner s, pos, ctx)
cpdef p_c_class_options(PyrexScanner s)
cpdef p_property_decl(PyrexScanner s)
self.obj_to_entry = {}
self.pystring_entries = []
self.buffer_entries = []
+ self.lambda_defs = []
self.control_flow = ControlFlow.LinearControlFlow()
+ self.return_type = None
def start_branching(self, pos):
self.control_flow = self.control_flow.start_branch(pos)