當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。