Skip to content

Commit

Permalink
Backed out changeset 985505cc1347 (bug 1512673) for build bustage. CL…
Browse files Browse the repository at this point in the history
…OSED TREE
  • Loading branch information
dgluca committed Dec 11, 2018
1 parent 0b51f27 commit 7da0c3b
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 103 deletions.
34 changes: 12 additions & 22 deletions ipc/ipdl/ipdl/cxx/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ def __init__(self, name):


class Type(Node):
def __init__(self, name, const=False,
ptr=False, ptrconst=False, ptrptr=False, ptrconstptr=False,
def __init__(self, name, const=0,
ptr=0, ptrconst=0, ptrptr=0, ptrconstptr=0,
ref=0,
hasimplicitcopyctor=True,
T=None,
Expand All @@ -329,16 +329,9 @@ def __init__(self, name, const=False,
ptrconstptr => T* const*
Any type, naked or pointer, can be const (const T) or ref (T&).
ref is an integer, indicating how many "levels" of references exist. So ref=2
indicates T&&.
"""
assert isinstance(name, str)
assert isinstance(const, bool)
assert isinstance(ptr, bool)
assert isinstance(ptrconst, bool)
assert isinstance(ptrptr, bool)
assert isinstance(ptrconstptr, bool)
assert not isinstance(const, str)
assert not isinstance(T, str)

Node.__init__(self)
Expand Down Expand Up @@ -371,10 +364,10 @@ def __deepcopy__(self, memo):
Type.INTPTR = Type('intptr_t')
Type.NSRESULT = Type('nsresult')
Type.UINT32 = Type('uint32_t')
Type.UINT32PTR = Type('uint32_t', ptr=True)
Type.UINT32PTR = Type('uint32_t', ptr=1)
Type.SIZE = Type('size_t')
Type.VOID = Type('void')
Type.VOIDPTR = Type('void', ptr=True)
Type.VOIDPTR = Type('void', ptr=1)
Type.AUTO = Type('auto')


Expand Down Expand Up @@ -527,16 +520,14 @@ def make_enum(name, members_str):

class MethodDecl(Node):
def __init__(self, name, params=[], ret=Type('void'),
methodspec=MethodSpec.NONE, const=False, warn_unused=0,
force_inline=False, typeop=None, T=None, cls=None):
methodspec=MethodSpec.NONE, const=0, warn_unused=0,
force_inline=0, typeop=None, T=None, cls=None):
assert not (name and typeop)
assert name is None or isinstance(name, str)
assert not isinstance(ret, list)
for decl in params:
assert not isinstance(decl, str)
assert not isinstance(T, int)
assert isinstance(const, bool)
assert isinstance(force_inline, bool)

if typeop is not None:
assert methodspec == MethodSpec.NONE
Expand Down Expand Up @@ -577,7 +568,7 @@ def __init__(self, decl):
class FunctionDecl(MethodDecl):
def __init__(self, name, params=[], ret=Type('void'),
methodspec=MethodSpec.NONE, warn_unused=0,
force_inline=False, T=None):
force_inline=0, T=None):
assert methodspec == MethodSpec.NONE or methodspec == MethodSpec.STATIC
MethodDecl.__init__(self, name, params=params, ret=ret,
methodspec=methodspec, warn_unused=warn_unused,
Expand All @@ -590,7 +581,7 @@ def __init__(self, decl):


class ConstructorDecl(MethodDecl):
def __init__(self, name, params=[], explicit=0, force_inline=False):
def __init__(self, name, params=[], explicit=0, force_inline=0):
MethodDecl.__init__(self, name, params=params, ret=None,
force_inline=force_inline)
self.explicit = explicit
Expand All @@ -608,7 +599,7 @@ def __init__(self, decl, memberinits=[]):


class DestructorDecl(MethodDecl):
def __init__(self, name, methodspec=MethodSpec.NONE, force_inline=False):
def __init__(self, name, methodspec=MethodSpec.NONE, force_inline=0):
# C++ allows pure or override destructors, but ipdl cgen does not.
assert methodspec == MethodSpec.NONE or methodspec == MethodSpec.VIRTUAL
MethodDecl.__init__(self, name, params=[], ret=None,
Expand Down Expand Up @@ -689,9 +680,8 @@ def __init__(self, expr):

class ExprCast(Node):
def __init__(self, expr, type,
dynamic=0, static=0, reinterpret=0, const=False, C=0):
assert 1 == sum([dynamic, static, reinterpret, const, C])
assert isinstance(const, bool)
dynamic=0, static=0, reinterpret=0, const=0, C=0):
assert 1 == reduce(lambda a, x: a+x, [dynamic, static, reinterpret, const, C])

Node.__init__(self)
self.expr = expr
Expand Down
Loading

0 comments on commit 7da0c3b

Please sign in to comment.