From 28d1cd83ea074224171929053a272b07fbda89d9 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 11 Aug 2009 17:12:42 -0500 Subject: [PATCH] backout bad fix --- ipc/ipdl/ipdl/cxx/ast.py | 2 -- ipc/ipdl/ipdl/lower.py | 11 +++-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ipc/ipdl/ipdl/cxx/ast.py b/ipc/ipdl/ipdl/cxx/ast.py index 690e867ec5f8..608c69e1ddca 100644 --- a/ipc/ipdl/ipdl/cxx/ast.py +++ b/ipc/ipdl/ipdl/cxx/ast.py @@ -477,13 +477,11 @@ class StmtSwitch(Block): def __init__(self, expr): Block.__init__(self) self.expr = expr - self.nr_cases = 0 def addcase(self, case, block): '''NOTE: |case| is not checked for uniqueness''' self.addstmt(case) self.addstmt(block) - self.nr_cases += 1 class StmtExpr(Node): def __init__(self, expr): diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index 877fda9653c4..85eac8dacd48 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -719,10 +719,7 @@ class GenerateProtocolActorHeader(Visitor): if dispatches: addDispatcher(asynchandler, 'OnMessageReceived', [ cxx.ExprVar('msg') ]) - # bug 509581: don't generate the switch stmt if there is only the - # default case; MSVC doesn't like that - if self.asyncswitch.nr_cases > 1: - asynchandler.addstmt(self.asyncswitch) + asynchandler.addstmt(self.asyncswitch) cls.addstmt(asynchandler) cls.addstmt(cxx.Whitespace.NL) @@ -730,8 +727,7 @@ class GenerateProtocolActorHeader(Visitor): if dispatches: addDispatcher(synchandler, 'OnMessageReceived', [ cxx.ExprVar('msg'), cxx.ExprVar('reply') ]) - if self.syncswitch.nr_cases > 1: - synchandler.addstmt(self.syncswitch) + synchandler.addstmt(self.syncswitch) cls.addstmt(synchandler) cls.addstmt(cxx.Whitespace.NL) @@ -739,8 +735,7 @@ class GenerateProtocolActorHeader(Visitor): if dispatches: addDispatcher(rpchandler, 'OnCallReceived', [ cxx.ExprVar('msg'), cxx.ExprVar('reply') ]) - if self.rpcswitch.nr_cases > 1: - rpchandler.addstmt(self.rpcswitch) + rpchandler.addstmt(self.rpcswitch) cls.addstmt(rpchandler) cls.addstmt(cxx.Whitespace.NL)