--- a/ipc/ipdl/ipdl/type.py
+++ b/ipc/ipdl/ipdl/type.py
@@ -418,17 +418,17 @@ class StructType(_CompoundType):
_CompoundType.__init__(self)
self.qname = qname
self.fields = fields # [ Type ]
def isStruct(self): return True
def itercomponents(self):
for f in self.fields:
yield f
-
+
def name(self): return self.qname.baseid
def fullname(self): return str(self.qname)
class UnionType(_CompoundType):
def __init__(self, qname, components):
_CompoundType.__init__(self)
self.qname = qname
self.components = components # [ Type ]
@@ -547,17 +547,17 @@ def errormsg(loc, fmt, *args):
##--------------------
class SymbolTable:
def __init__(self, errors):
self.errors = errors
self.scopes = [ { } ] # stack({})
self.globalScope = self.scopes[0]
self.currentScope = self.globalScope
-
+
def enterScope(self, node):
assert (isinstance(self.scopes[0], dict)
and self.globalScope is self.scopes[0])
assert (isinstance(self.currentScope, dict))
if not hasattr(node, 'symtab'):
node.symtab = { }
@@ -838,17 +838,17 @@ class GatherDecls(TcheckVisitor):
self.symtab.exitScope(sd)
def visitUnionDecl(self, ud):
utype = ud.decl.type
# If we've already processed this union, don't do it again.
if len(utype.components):
return
-
+
for c in ud.components:
cdecl = self.symtab.lookup(str(c))
if cdecl is None:
self.error(c.loc, "unknown component type `%s' of union `%s'",
str(c), ud.name)
continue
utype.components.append(self._canonicalType(cdecl.type, c))
@@ -925,17 +925,17 @@ class GatherDecls(TcheckVisitor):
if not (ctordecl and ctordecl.type.isCtor()):
self.error(
managed.loc,
"constructor declaration required for managed protocol `%s' (managed by protocol `%s')",
mgdname, p.name)
p.states = { }
-
+
if len(p.transitionStmts):
p.startStates = [ ts for ts in p.transitionStmts
if ts.state.start ]
if 0 == len(p.startStates):
p.startStates = [ p.transitionStmts[0] ]
# declare implicit "any", "dead", and "dying" states
self.declare(loc=State.ANY.loc,
@@ -961,30 +961,30 @@ class GatherDecls(TcheckVisitor):
self.seentriggers = set()
trans.accept(self)
if not (p.decl.type.stateless
or (p.decl.type.isToplevel()
and None is self.symtab.lookup(_DELETE_MSG))):
# add a special state |state DEAD: null goto DEAD;|
deadtrans = TransitionStmt.makeNullStmt(State.DEAD)
- p.states[State.DEAD] = deadtrans
+ p.states[State.DEAD] = deadtrans
if p.decl.type.hasReentrantDelete:
dyingtrans = TransitionStmt.makeNullStmt(State.DYING)
p.states[State.DYING] = dyingtrans
# visit the message decls once more and resolve the state names
# attached to actor params and returns
def resolvestate(loc, actortype):
assert actortype.isIPDL() and actortype.isActor()
# already resolved this guy's state
if isinstance(actortype.state, Decl):
return
-
+
if actortype.state is None:
# we thought this was a C++ type until type checking,
# when we realized it was an IPDL actor type. But
# that means that the actor wasn't specified to be in
# any particular state
actortype.state = State.ANY
statename = actortype.state.name
@@ -1177,17 +1177,17 @@ class GatherDecls(TcheckVisitor):
mname = t.msg
if t in self.seentriggers:
self.error(loc, "trigger `%s' appears multiple times", t.msg)
self.seentriggers.add(t)
mdecl = self.symtab.lookup(mname)
if mdecl is not None and mdecl.type.isIPDL() and mdecl.type.isProtocol():
mdecl = self.symtab.lookup(mname +'Constructor')
-
+
if mdecl is None:
self.error(loc, "message `%s' has not been declared", mname)
elif not mdecl.type.isMessage():
self.error(
loc,
"`%s' should have message type, but instead has type `%s'",
mname, mdecl.type.typename())
else:
@@ -1242,17 +1242,17 @@ def checkcycles(p, stack=None):
if stack is None:
stack = []
for cp in p.manages:
# special case for self-managed protocols
if cp is p:
continue
-
+
if cp in stack:
return [stack + [p, cp]]
cycles += checkcycles(cp, stack + [p])
return cycles
def formatcycles(cycles):
r = []
@@ -1323,17 +1323,17 @@ class CheckTypes(TcheckVisitor):
def visitUnionDecl(self, ud):
if not fullyDefined(ud.decl.type):
self.error(ud.decl.loc,
"union `%s' is only partially defined", ud.name)
def visitProtocol(self, p):
self.ptype = p.decl.type
-
+
# check that we require no more "power" than our manager protocols
ptype, pname = p.decl.type, p.decl.shortname
if len(p.spawnsStmts) and not ptype.isToplevel():
self.error(p.decl.loc,
"protocol `%s' is not top-level and so cannot declare |spawns|",
pname)
@@ -1449,17 +1449,17 @@ class CheckTypes(TcheckVisitor):
self.error(
loc,
"|manages| declaration in protocol `%s' does not match any |manager| declaration in protocol `%s'",
pname, mgsname)
def visitManager(self, mgr):
# FIXME/bug 541126: check that the protocol graph is acyclic
-
+
pdecl = mgr.of.decl
ptype, pname = pdecl.type, pdecl.shortname
mgrdecl = mgr.decl
mgrtype, mgrname = mgrdecl.type, mgrdecl.shortname
# we added this information; sanity check it
assert ptype.isManagedBy(mgrtype)
@@ -1518,29 +1518,29 @@ class CheckTypes(TcheckVisitor):
self.error(
loc,
"message `%s' in protocol `%s' requests compression but is not async or is special (ctor or dtor)",
mname[:-len('constructor')], pname)
if mtype.isCtor() and not ptype.isManagerOf(mtype.constructedType()):
self.error(
loc,
- "ctor for protocol `%s', which is not managed by protocol `%s'",
+ "ctor for protocol `%s', which is not managed by protocol `%s'",
mname[:-len('constructor')], pname)
def visitTransition(self, t):
_YNC = [ ASYNC, SYNC ]
loc = t.loc
impliedDirection, impliedSems = {
SEND: [ OUT, _YNC ], RECV: [ IN, _YNC ],
CALL: [ OUT, INTR ], ANSWER: [ IN, INTR ],
} [t.trigger]
-
+
if (OUT is impliedDirection and t.msg.type.isIn()
or IN is impliedDirection and t.msg.type.isOut()
or _YNC is impliedSems and t.msg.type.isInterrupt()
or INTR is impliedSems and (not t.msg.type.isInterrupt())):
mtype = t.msg.type
self.error(
loc, "%s %s message `%s' is not `%s'd",
@@ -2142,17 +2142,17 @@ direction as trigger |t|'''
return '[error]'
T1 = stateName(T1)
T2 = stateName(T2)
U1 = stateName(U1)
U2 = stateName(U2)
return T1, M1.msg.progname, U1, T2, M2.msg.progname, U2
-
+
def reportRaceError(self, loc, S, t1Seq, t2Seq):
T1, M1, U1, T2, M2, U2 = self._normalizeTransitionSequences(t1Seq, t2Seq)
self.error(
loc,
"""in protocol `%(P)s', the sequence of events
parent: +--`send %(M1)s'-->( state `%(T1)s' )--`recv %(M2)s'-->( state %(U1)s )
/