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


Python syntax_visitor.SyntaxVisitor类代码示例

本文整理汇总了Python中syntax_visitor.SyntaxVisitor的典型用法代码示例。如果您正苦于以下问题:Python SyntaxVisitor类的具体用法?Python SyntaxVisitor怎么用?Python SyntaxVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: visit_While

 def visit_While(self, stmt):
   self.volatile_vars.push(stmt.merge.keys())
   SyntaxVisitor.visit_While(self, stmt)
   if self.does_block_return(stmt.body):
     self.block_contains_return()
   volatile_in_scope = self.volatile_vars.pop()
   self.mark_safe_assignments(stmt.body, volatile_in_scope)
开发者ID:lucciano,项目名称:parakeet,代码行数:7,代码来源:licm.py

示例2: __init__

 def __init__(self, fn):
   SyntaxVisitor.__init__(self)
   
   self.fn = fn
   self.call_stack.append(fn)
   self.bound = set(fn.arg_names)
   self.seen_return = False 
开发者ID:Abramovuch,项目名称:parakeet,代码行数:7,代码来源:verify.py

示例3: visit_block

 def visit_block(self, stmts, branch_label = None):
   self.push_scope()
   if branch_label is not None:
     self.push_scope(branch_label)
   SyntaxVisitor.visit_block(self, stmts)
   if branch_label is not None:
     self.pop_scope()
   self.pop_scope()
开发者ID:Tillsten,项目名称:parakeet,代码行数:8,代码来源:usedef.py

示例4: visit_If

 def visit_If(self, stmt):
   self.volatile_vars.push(stmt.merge.keys())
   self.visit_expr(stmt.cond)
   SyntaxVisitor.visit_If(self, stmt)
   if self.does_block_return(stmt.true) or self.does_block_return(stmt.false):
     self.mark_curr_block_returns()
   volatile_in_scope = self.volatile_vars.pop()
   self.mark_safe_assignments(stmt.true, volatile_in_scope)
   self.mark_safe_assignments(stmt.false, volatile_in_scope)
开发者ID:lucciano,项目名称:parakeet,代码行数:9,代码来源:licm.py

示例5: __init__

 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.mutable_types = None
   self.volatile_vars = ScopedSet()
   self.depends_on = {}
   self.safe_to_move = set([])
   self.curr_block_id = None
   self.block_contains_return = set([])
   self.may_alias = None
开发者ID:lucciano,项目名称:parakeet,代码行数:9,代码来源:licm.py

示例6: visit_expr

 def visit_expr(self, expr):
   if isinstance(expr, (UntypedFn, TypedFn, Closure)) or isinstance(expr.type, (FnT, ClosureT)):
     raise Yes()
   SyntaxVisitor.visit_expr(expr)
开发者ID:waytai,项目名称:parakeet,代码行数:4,代码来源:contains.py

示例7: __init__

 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.ranges = {} 
   self.old_values = ScopedDict()
   self.old_values.push()
开发者ID:Abramovuch,项目名称:parakeet,代码行数:5,代码来源:value_range_analysis.py

示例8: visit_stmt

 def visit_stmt(self, stmt):
   self.inc_counter()
   self.stmt_paths[id(stmt)] = self.curr_path()
   SyntaxVisitor.visit_stmt(self, stmt)
开发者ID:Tillsten,项目名称:parakeet,代码行数:4,代码来源:usedef.py

示例9: __init__

 def __init__(self):
   SyntaxVisitor.__init__(self)
   self.bindings = {}
开发者ID:Abramovuch,项目名称:parakeet,代码行数:3,代码来源:collect_vars.py

示例10: visit_expr

 def visit_expr(self, expr):
   abstract_shape = SyntaxVisitor.visit_expr(self, expr)
   assert abstract_shape is not None, \
       "Unsupported expression in shape inference: %s" % expr.node_type()
   return abstract_shape
开发者ID:cournape,项目名称:parakeet,代码行数:5,代码来源:shape_inference.py

示例11: visit_expr

 def visit_expr(self, expr):
   assert expr is not None
   assert expr.type is not None, \
     "Missing type annotation on %s" % expr 
   SyntaxVisitor.visit_expr(self, expr)
开发者ID:Tillsten,项目名称:parakeet,代码行数:5,代码来源:verify.py

示例12: visit_expr

 def visit_expr(self, expr):
   if isinstance(expr, Adverb):
     raise self.Yes()
   SyntaxVisitor.visit_expr(self, expr)
开发者ID:Tillsten,项目名称:parakeet,代码行数:4,代码来源:contains_adverbs.py

示例13: visit_fn

 def visit_fn(self, fn):
   self.volatile_vars.push(fn.arg_names)
   self.may_alias = may_alias(fn)
   SyntaxVisitor.visit_fn(self, fn)
   return self.safe_to_move
开发者ID:lucciano,项目名称:parakeet,代码行数:5,代码来源:licm.py

示例14: __init__

 def __init__(self, fn):
   SyntaxVisitor.__init__(self)
   self.fn = fn
   self.bound = set(fn.arg_names)
开发者ID:lucciano,项目名称:parakeet,代码行数:4,代码来源:verify.py

示例15: visit_expr

 def visit_expr(self, expr):
   assert expr is not None
   SyntaxVisitor.visit_expr(self, expr)
开发者ID:lucciano,项目名称:parakeet,代码行数:3,代码来源:verify.py


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