Changeset 771


Ignore:
Timestamp:
Dec 3, 2010, 6:11:02 AM (9 years ago)
Author:
cameron
Message:

AugAssign? removal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/pablo.py

    r770 r771  
    3737  if isinstance(fn_name, str): fn_name = ast.Name(fn_name, ast.Load())
    3838  return ast.Expr(ast.Call(fn_name, args, [], None, None))
     39
     40#
     41# Reducing AugAssign
     42#
     43class AugAssignRemoval(ast.NodeTransformer):
     44  def xfrm(self, t):
     45    return self.generic_visit(t)
     46  def visit_AugAssign(self, e):
     47    self.generic_visit(e)
     48    return ast.Assign([e.target], ast.BinOp(e.target, e.op, e.value))
    3949
    4050#
     
    341351    return self.Ccode
    342352  def visit_FunctionDef(self, fndef):
     353    AugAssignRemoval().xfrm(fndef)
    343354    Bitwise_to_SIMD().xfrm(fndef)
    344355    self.Ccode += BitBlock_header_of_fn(fndef) + " {\n"
     
    368379
    369380def block_stmts(main_fn):
     381  AugAssignRemoval().xfrm(main_fn)
    370382  Bitwise_to_SIMD().xfrm(main_fn)
    371383  CarryIntro().xfrm_fndef(main_fn)
Note: See TracChangeset for help on using the changeset viewer.