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':
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:
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
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):