From: Stefan Behnel Date: Sat, 7 Jun 2008 07:44:25 +0000 (+0200) Subject: last merge broke the compiler, here are some initial fixes X-Git-Tag: 0.9.8rc1~11^2~10^2~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2bfc211bc86ff5681604e2149a6a1882f3c2cbc0;p=cython.git last merge broke the compiler, here are some initial fixes --- diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py index 1a608049..8abeccfa 100644 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@ -108,7 +108,7 @@ class Context: if debug_find_module: print("Context.find_module: Parsing %s" % pxd_pathname) source_desc = FileSourceDescriptor(pxd_pathname) - pxd_tree = self.parse(source_desc, scope.type_names, pxd = 1, + pxd_tree = self.parse(source_desc, scope, pxd = 1, full_module_name = module_name) pxd_tree.analyse_declarations(scope) except CompileError: @@ -242,7 +242,7 @@ class Context: self.modules[name] = scope return scope - def parse(self, source_desc, type_names, pxd, full_module_name): + def parse(self, source_desc, scope, pxd, full_module_name): if not isinstance(source_desc, FileSourceDescriptor): raise RuntimeError("Only file sources for code supported") source_filename = Utils.encode_filename(source_desc.filename) @@ -251,7 +251,7 @@ class Context: f = Utils.open_source_file(source_filename, "rU") try: s = PyrexScanner(f, source_desc, source_encoding = f.encoding, - type_names = type_names, context = self) + scope = scope, context = self) tree = Parsing.p_module(s, pxd, full_module_name) finally: f.close() @@ -304,7 +304,7 @@ class Context: c_suffix = ".cpp" else: c_suffix = ".c" - result.c_file = Utils .replace_suffix(source, c_suffix) + result.c_file = Utils.replace_suffix(source, c_suffix) c_stat = None if result.c_file: try: @@ -317,7 +317,7 @@ class Context: scope = self.find_module(module_name, pos = initial_pos, need_pxd = 0) errors_occurred = False try: - tree = self.parse(source, scope.type_names, pxd = 0, + tree = self.parse(source, scope, pxd = 0, full_module_name = full_module_name) tree.process_implementation(scope, options, result) except CompileError: diff --git a/Cython/Compiler/Scanning.py b/Cython/Compiler/Scanning.py index 2e20d18a..ab61bded 100644 --- a/Cython/Compiler/Scanning.py +++ b/Cython/Compiler/Scanning.py @@ -281,23 +281,26 @@ class StringSourceDescriptor(SourceDescriptor): class PyrexScanner(Scanner): # context Context Compilation context # type_names set Identifiers to be treated as type names + # included_files [string] Files included with 'include' statement # compile_time_env dict Environment for conditional compilation # compile_time_eval boolean In a true conditional compilation context # compile_time_expr boolean In a compile-time expression context resword_dict = build_resword_dict() def __init__(self, file, filename, parent_scanner = None, - type_names = None, context = None, source_encoding=None): + scope = None, context = None, source_encoding=None): Scanner.__init__(self, get_lexicon(), file, filename) if parent_scanner: self.context = parent_scanner.context self.type_names = parent_scanner.type_names + self.included_files = parent_scanner.included_files self.compile_time_env = parent_scanner.compile_time_env self.compile_time_eval = parent_scanner.compile_time_eval self.compile_time_expr = parent_scanner.compile_time_expr else: self.context = context - self.type_names = type_names + self.type_names = scope.type_names + self.included_files = scope.included_files self.compile_time_env = initial_compile_time_env() self.compile_time_eval = 1 self.compile_time_expr = 0