当前位置: 首页>>代码示例>>Python>>正文


Python Node.putIntProp方法代码示例

本文整理汇总了Python中Node.Node.putIntProp方法的典型用法代码示例。如果您正苦于以下问题:Python Node.putIntProp方法的具体用法?Python Node.putIntProp怎么用?Python Node.putIntProp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Node.Node的用法示例。


在下文中一共展示了Node.putIntProp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createCallOrNew

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import putIntProp [as 别名]
 def createCallOrNew(self, nodeType, child):
     type = Node.NON_SPECIALCALL
     if (child.getType() == Token.NAME):
         name = child.getString()
         if name == "eval":
             type = Node.SPECIALCALL_EVAL
         else:
             if name == "With":
                 type = Node.SPECIALCALL_WITH
     else:
         if (child.getType() == Token.GETPROP):
             name = child.getLastChild().getString()
             if name == "eval":
                 type = Node.SPECIALCALL_EVAL
     node = Node(nodeType, child)
     if (type != Node.NON_SPECIALCALL):
         self.setRequiresActivation()
         node.putIntProp(Node.SPECIALCALL_PROP, type)
     return node
开发者ID:Mitame,项目名称:pynoceros,代码行数:21,代码来源:IRFactory.py

示例2: createMemberRefGet

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import putIntProp [as 别名]
 def createMemberRefGet(self, target, namespace, elem, memberTypeFlags):
     nsNode = None
     if namespace is not None:
         if namespace == "*":
             nsNode = Node(Token.NULL)
         else:
             nsNode = self.createName(namespace)
     ref = None#Node()
     if target is None:
         if namespace is None:
             ref = Node(Token.REF_NAME, elem)
         else:
             ref = Node(Token.REF_NS_NAME, nsNode, elem)
     else:
         if namespace is None:
             ref = Node(Token.REF_MEMBER, target, elem)
         else:
             ref = Node(Token.REF_NS_MEMBER, target, nsNode, elem)
     if (memberTypeFlags != 0):
         ref.putIntProp(Node.MEMBER_TYPE_PROP, memberTypeFlags)
     return Node(Token.GET_REF, ref)
开发者ID:Mitame,项目名称:pynoceros,代码行数:23,代码来源:IRFactory.py

示例3: createIncDec

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import putIntProp [as 别名]
 def createIncDec(self, nodeType, post, child):
     child = self.makeReference(child)
     if child is None:
         msg = ""
         if (nodeType == Token.DEC):
             msg = "msg.bad.decr"
         else:
             msg = "msg.bad.incr"
         self.parser.reportError(msg)
         return
     childType = child.getType()
     if childType in  (Token.NAME,
                       Token.GETPROP,
                       Token.GETELEM,
                       Token.GET_REF):
         n = Node(nodeType, child)
         incrDecrMask = 0
         if (nodeType == Token.DEC):
             incrDecrMask |= Node.DECR_FLAG
         if post:
             incrDecrMask |= Node.POST_FLAG
         n.putIntProp(Node.INCRDECR_PROP, incrDecrMask)
         return n
     raise Kit.codeBug()
开发者ID:Mitame,项目名称:pynoceros,代码行数:26,代码来源:IRFactory.py

示例4: createRegExp

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import putIntProp [as 别名]
 def createRegExp(self, regexpIndex):
     n = Node(Token.REGEXP)
     n.putIntProp(Node.REGEXP_PROP, regexpIndex)
     return n
开发者ID:Mitame,项目名称:pynoceros,代码行数:6,代码来源:IRFactory.py

示例5: createTryCatchFinally

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import putIntProp [as 别名]
 def createTryCatchFinally(self, tryBlock, catchBlocks, finallyBlock, lineno):
     hasFinally = finallyBlock is not None and ( (finallyBlock.getType() != Token.BLOCK) or finallyBlock.hasChildren())
     if (tryBlock.getType() == Token.BLOCK) and not tryBlock.hasChildren() and not hasFinally:
         return tryBlock
     hasCatch = catchBlocks.hasChildren()
     if not hasFinally and not hasCatch:
         return tryBlock
     handlerBlock = Node(Token.LOCAL_BLOCK)
     pn = Jump(Token.TRY, tryBlock, lineno)
     pn.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock)
     if hasCatch:
         endCatch = Node.newTarget()
         pn.addChildToBack(self.makeJump(Token.GOTO, endCatch))
         catchTarget = Node.newTarget()
         pn.target = catchTarget
         pn.addChildToBack(catchTarget)
         catchScopeBlock = Node(Token.LOCAL_BLOCK)
         cb = catchBlocks.getFirstChild()
         hasDefault = False
         scopeIndex = 0
         while cb is not None:
             catchLineNo = cb.getLineno()
             name = cb.getFirstChild()
             cond = name.getNext()
             catchStatement = cond.getNext()
             cb.removeChild(name)
             cb.removeChild(cond)
             cb.removeChild(catchStatement)
             catchStatement.addChildToBack(Node(Token.LEAVEWITH))
             catchStatement.addChildToBack(self.makeJump(Token.GOTO, endCatch))
             condStmt = None#Node()
             if (cond.getType() == Token.EMPTY):
                 condStmt = catchStatement
                 hasDefault = True
             else:
                 condStmt = self.createIf(cond, catchStatement, None, catchLineNo)
             catchScope = Node(Token.CATCH_SCOPE, name, self.createUseLocal(handlerBlock))
             catchScope.putProp(Node.LOCAL_BLOCK_PROP, catchScopeBlock)
             catchScope.putIntProp(Node.CATCH_SCOPE_PROP, scopeIndex)
             catchScopeBlock.addChildToBack(catchScope)
             catchScopeBlock.addChildToBack(self.createWith(self.createUseLocal(catchScopeBlock), condStmt, catchLineNo))
             cb = cb.getNext()
             scopeIndex += 1
         pn.addChildToBack(catchScopeBlock)
         if not hasDefault:
             rethrow = Node(Token.RETHROW)
             rethrow.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock)
             pn.addChildToBack(rethrow)
         pn.addChildToBack(endCatch)
     if hasFinally:
         finallyTarget = Node.newTarget()
         pn.setFinally(finallyTarget)
         pn.addChildToBack(self.makeJump(Token.JSR, finallyTarget))
         finallyEnd = Node.newTarget()
         pn.addChildToBack(self.makeJump(Token.GOTO, finallyEnd))
         pn.addChildToBack(finallyTarget)
         fBlock = Node(Token.FINALLY, finallyBlock)
         fBlock.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock)
         pn.addChildToBack(fBlock)
         pn.addChildToBack(finallyEnd)
     handlerBlock.addChildToBack(pn)
     return handlerBlock
开发者ID:Mitame,项目名称:pynoceros,代码行数:64,代码来源:IRFactory.py


注:本文中的Node.Node.putIntProp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。