merge
authorRobert Bradshaw <robertwb@math.washington.edu>
Tue, 15 Dec 2009 11:07:58 +0000 (03:07 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Tue, 15 Dec 2009 11:07:58 +0000 (03:07 -0800)
1  2 
Cython/Compiler/Nodes.py
Cython/Compiler/Parsing.py
Cython/Compiler/PyrexTypes.py
Cython/Compiler/Symtab.py

Simple merge
index 495abe238beca3f717e85d42c1574f64b62ac11e,789429b7017f25051c8c775a3a39ad89d1e6bb84..816429457e578a940e757712c6431d3314bc4d39
@@@ -1990,6 -1988,12 +1988,12 @@@ def p_c_simple_declarator(s, ctx, empty
          result = Nodes.CPtrDeclaratorNode(pos,
              base = Nodes.CPtrDeclaratorNode(pos,
                  base = base))
 -    elif s.sy == '&' and Options.cplus:
++    elif s.sy == '&':
+         s.next()
+         base = p_c_declarator(s, ctx, empty = empty, is_type = is_type,
+                               cmethod_flag = cmethod_flag,
+                               assignable = assignable, nonempty = nonempty)
+         result = Nodes.CReferenceDeclaratorNode(pos, base = base)
      else:
          rhs = None
          if s.sy == 'IDENT':
index f536ffb5df0fdbf429e09c3cc17a80d6a951fc33,514805fed65faf6f410ed35b0ef5582c034f00d5..26e4fb09b5ce6629a56291f8ce7c4aa176d2fa38
@@@ -1041,8 -1042,19 +1042,19 @@@ class CReferenceType(CType)
              for_display, dll_linkage, pyrex)
      
      def assignable_from_resolved_type(self, other_type):
-         return 0 #TODO (Danilo) implement this
-     
+         if other_type is error_type:
+             return 1
+         if other_type.is_ptr:
+             if other_type.base_type == self.base_type:
+                 return 1
+             else:
+                 pass
 -                #should send a warning message: initialization from incompatible pointer type (in C/C++)
++                #TODO: should send a warning message: initialization from incompatible pointer type (in C/C++)
+         if other_type == self.base_type:
+             return 1
+         else: #for now
+             return 0
+         
      def specialize(self, values):
          base_type = self.base_type.specialize(values)
          if base_type == self.base_type:
@@@ -1797,6 -1809,9 +1809,10 @@@ def is_promotion(type, other_type)
          return False
  
  def best_match(args, functions, pos):
 -    '''Finds the best function to be called
 -       Error if no function fits the call or an ambiguity is find (two or more possible functions)'''
 -    #print functions
++    """
++    Finds the best function to be called
++    Error if no function fits the call or an ambiguity is find (two or more possible functions)
++    """
      actual_nargs = len(args)
      possibilities = []
      bad_types = 0
index 0be550e879a87b6735fc3e3d23a8491a8e008a73,bc014479f1b74121da2743fea7509e6c99ca839b..aa9c51d3f1d1c80fffc93e87270ef86281a15f66
@@@ -316,7 -319,10 +316,10 @@@ class Scope(object)
          entry.in_cinclude = self.in_cinclude
          if name:
              entry.qualified_name = self.qualify_name(name)
-             entries[name] = entry
 -            if name not in entries:
 -                entries[name] = entry
 -            else:
++            if name in entries and self.is_cpp():
+                 entries[name].overloaded_alternatives.append(entry)
++            else:
++                entries[name] = entry
          entry.scope = self
          entry.visibility = visibility
          return entry
              if name in self.entries:    
                  return 1
          return 0
-         return self.outer_scope.is_cpp()
 +    
 +    def is_cpp(self):
++        outer = self.outer_scope
++        if outer is None:
++            return False
++        else:
++            return outer.is_cpp()
  
  class PreImportScope(Scope):