public void Transform() { cas = new case_node(new ident(Consts.State)); curStatList = new statement_list(); case_variant cv = new case_variant(new expression_list(new int32_const(curState)), curStatList); cas.conditions.variants.Add(cv); foreach (var st in stl.subnodes) { Process(st); } stl.subnodes = BaseChangeVisitor.SeqStatements(cas, StatListAfterCase).ToList(); //statement_list res = new statement_list(cas); res = stl; }
public override void visit(case_node _case_node) { }
public virtual void visit(case_node _case_node) { DefaultVisit(_case_node); }
public virtual void post_do_visit(case_node _case_node) { }
public override void visit(case_node _case_node) { DefaultVisit(_case_node); pre_do_visit(_case_node); visit(case_node.param); visit(case_node.conditions); visit(case_node.else_statement); post_do_visit(_case_node); }
public virtual void visit(case_node _case_node) { }
public override void visit(case_node _case_node) { AddPossibleComments(_case_node, true, false); _case_node.param.visit(this); }
// frninja 30/05/16 public override void visit(case_node csn) { var b = HasStatementVisitor <yield_node> .Has(csn); if (!b) { return; } /* * * case i of * cv1: bla1; * cv2: bla2; * .. * cvN: blaN; * else: bla_else; * * ---> * * if i satisfy cv1 * then bla1 * else if i satisfy cv2 * then bla2 * .. * else if i satisfy cvN * then blaN * else bla_else * */ if_node currentIfNode = null; statement currentIfElseClause = (csn.else_statement != null) ? csn.else_statement :new statement_list(new empty_statement());; for (int i = csn.conditions.variants.Count - 1; i >= 0; --i) { case_variant cv = csn.conditions.variants[i]; ProcessNode(cv.exec_if_true); var ifCondition = this.CreateConditionFromCaseVariant(csn.param, cv.conditions); currentIfNode = new if_node(ifCondition, new statement_list(cv.exec_if_true), new statement_list(currentIfElseClause)); currentIfElseClause = currentIfNode; } if_node finalIfNode = currentIfNode; if (finalIfNode == null) // SSM - значит, в цикл мы не заходили и у case отсутствуют все ветви кроме else - поскольку yieldы в case есть { ReplaceStatement(csn, csn.else_statement); } else { ReplaceStatement(csn, finalIfNode); } if (finalIfNode != null) { visit(finalIfNode); } }
public override void visit(case_node _case_node) { prepare_node(_case_node.param, "param"); prepare_node(_case_node.conditions, "conditions"); prepare_node(_case_node.else_statement, "else statement"); }
public override void visit(case_node _case_node) { executer.visit(_case_node); if (_case_node.param != null) this.visit((dynamic)_case_node.param); if (_case_node.conditions != null) this.visit((dynamic)_case_node.conditions); if (_case_node.else_statement != null) this.visit((dynamic)_case_node.else_statement); if (_case_node.attributes != null) this.visit((dynamic)_case_node.attributes); }