Commit d80c2c4c authored by Mark Florisson's avatar Mark Florisson

Pass failing tests and adapt for control flow

parent b8d99c33
......@@ -1041,7 +1041,8 @@ class CVarDefNode(StatNode):
if self.directive_locals:
error(self.pos, "Decorators can only be followed by functions")
self.entry = dest_scope.declare_var(name, type, declarator.pos,
cname=cname, visibility=visibility, api=self.api, is_cdef=1)
cname=cname, visibility=visibility, in_pxd=self.in_pxd,
api=self.api, is_cdef=1)
class CStructOrUnionDefNode(StatNode):
......@@ -2208,7 +2209,15 @@ class FusedCFuncDefNode(StatListNode):
else:
if_ = 'elif'
tup = (if_, i, py_type_name, len(seen_fused_types) - 1,
# in the case of long, unicode or bytes we need to instance
# check for long_, unicode_, bytes_ (long = long is no longer
# valid code with control flow analysis)
instance_check_py_type_name = py_type_name
if py_type_name in ('long', 'unicode', 'bytes'):
instance_check_py_type_name += '_'
tup = (if_, i, instance_check_py_type_name,
len(seen_fused_types) - 1,
specialized_type.typeof_name())
body_stmts.append(
" %s isinstance(args[%d], %s): "
......@@ -2228,10 +2237,13 @@ def __pyx_fused_cpdef(signatures, args):
import sys
if sys.version_info >= (3, 0):
long = int
unicode = str
long_ = int
unicode_ = str
bytes_ = bytes
else:
bytes = str
long_ = long
unicode_ = unicode
bytes_ = str
dest_sig = [None] * len(args)
......
......@@ -160,11 +160,11 @@ cdef p_c_enum_definition(PyrexScanner s, pos, ctx)
cdef p_c_enum_line(PyrexScanner s, ctx, list items)
cdef p_c_enum_item(PyrexScanner s, ctx, list items)
cdef p_c_struct_or_union_definition(PyrexScanner s, pos, ctx)
cdef p_fused_definition(PyrexScanner s, pos, ctx)
cdef p_visibility(PyrexScanner s, prev_visibility)
cdef p_c_modifiers(PyrexScanner s)
cdef p_c_func_or_var_declaration(PyrexScanner s, pos, ctx)
cdef p_ctypedef_statement(PyrexScanner s, ctx)
cdef p_typelist(PyrexScanner s)
cdef p_decorators(PyrexScanner s)
cdef p_def_statement(PyrexScanner s, list decorators = *)
cpdef p_varargslist(PyrexScanner s, terminator=*, bint annotated = *)
......
......@@ -2650,24 +2650,6 @@ def p_c_func_or_var_declaration(s, pos, ctx):
overridable = ctx.overridable)
return result
#def p_typelist(s):
# """
# parse a list of basic c types as part of a function call, like
# cython.fused_type(int, long, double)
# """
# types = []
# pos = s.position()
#
# while s.sy == 'IDENT':
# types.append(p_c_base_type(s))
# if s.sy != ',':
# if s.sy != ')':
# s.expect(',')
# break
# s.next()
#
# return Nodes.FusedTypeNode(pos, types=types)
def p_ctypedef_statement(s, ctx):
# s.sy == 'ctypedef'
pos = s.position()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment