type cleanup
authorRobert Bradshaw <robertwb@math.washington.edu>
Tue, 30 Sep 2008 07:26:31 +0000 (00:26 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Tue, 30 Sep 2008 07:26:31 +0000 (00:26 -0700)
Cython/Compiler/Parsing.py
Cython/Compiler/Scanning.py

index 70f719be711dc3186a1be99cab38023347af5e16..b96eb64fda1dd9f130f2d3c1e8492e19c66a2dd8 100644 (file)
@@ -1031,14 +1031,6 @@ def p_from_import_statement(s, first_statement = 0):
                 s.context.future_directives.add(directive)
         return Nodes.PassStatNode(pos)
     elif kind == 'cimport':
-        for (name_pos, name, as_name, kind) in imported_names:
-            local_name = as_name or name
-            if local_name == "*" and False:
-                module = s.context.find_module(dotted_name)
-                for type in module.type_entries:
-                    s.add_type_name(type.name)
-            else:
-                s.add_type_name(local_name)
         return Nodes.FromCImportStatNode(pos,
             module_name = dotted_name,
             imported_names = imported_names)
@@ -1856,8 +1848,6 @@ def p_c_simple_declarator(s, ctx, empty, is_type, cmethod_flag,
         rhs = None
         if s.sy == 'IDENT':
             name = EncodedString(s.systring)
-            if is_type:
-                s.add_type_name(name)
             if empty:
                 error(s.position(), "Declarator should be empty")
             s.next()
@@ -2042,7 +2032,6 @@ def p_c_enum_definition(s, pos, ctx):
     if s.sy == 'IDENT':
         name = s.systring
         s.next()
-        s.add_type_name(name)
         cname = p_opt_cname(s)
     else:
         name = None
@@ -2092,7 +2081,6 @@ def p_c_struct_or_union_definition(s, pos, ctx):
     s.next()
     name = p_ident(s)
     cname = p_opt_cname(s)
-    s.add_type_name(name)
     attributes = None
     if s.sy == ':':
         s.next()
@@ -2286,7 +2274,6 @@ def p_c_class_definition(s, pos,  ctx):
         as_name = p_ident(s)
     else:
         as_name = class_name
-    s.add_type_name(as_name)
     objstruct_name = None
     typeobj_name = None
     base_class_module = None
@@ -2387,8 +2374,6 @@ def p_doc_string(s):
         return None
         
 def p_code(s, level=None):
-    s.add_type_name("object")
-    s.add_type_name("Py_buffer")
     body = p_statement_list(s, Ctx(level = level), first_statement = 1)
     if s.sy != 'EOF':
         s.error("Syntax error in statement [%s,%s]" % (
@@ -2413,8 +2398,6 @@ def p_compiler_directive_comments(s):
     return result
 
 def p_module(s, pxd, full_module_name):
-    s.add_type_name("object")
-    s.add_type_name("Py_buffer")
     pos = s.position()
     doc = p_doc_string(s)
     if pxd:
index 18147457e8fd3ac027990875569032874ae2a6b0..810ba07e04b8ea6057e6bf1f022cb8c125f42e98 100644 (file)
@@ -282,7 +282,6 @@ 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
@@ -294,14 +293,12 @@ class PyrexScanner(Scanner):
         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 = scope.type_names
             self.included_files = scope.included_files
             self.compile_time_env = initial_compile_time_env()
             self.compile_time_eval = 1
@@ -431,12 +428,6 @@ class PyrexScanner(Scanner):
         # This method should be added to Plex
         self.queue.insert(0, (token, value))
     
-    def add_type_name(self, name):
-        self.type_names[name] = 1
-    
-    def looking_at_type_name(self):
-        return self.sy == 'IDENT' and self.systring in self.type_names
-    
     def error(self, message, pos = None, fatal = True):
         if pos is None:
             pos = self.position()