Merge remote-tracking branch 'origin/topic/vern/script-xform'

* origin/topic/vern/script-xform: (30 commits)
  Adjust some Reducer ref-counting and IntrusivePtr usage
  Fix reference counting in ListExpr inline/reduce methods
  Simplify WhileStmt::CondPredStmt()
  Use std::move() in Case::UpdateBody()
  Switch some Stmt transform/reduce logic to use IntrusivePtr
  Switch some Expr transform/reduce logic to use IntrusivePtr
  Adjust how some Expr::SetOpX() calls use std::move()
  Add missing header-includes to Reduce.h
  Add std::move() for args to an assign_to_index call
  Adjust memory management for &default argument expression type-check
  Use string for TempVar::name
  Switch AnalyOpt::only_func to optional<string>
  Fix a signed/unsigned comparison warning
  simplified some vestigial complexity I noticed when flipping through diffs
  canonicalization for an error message in one of the alternative test baselines
  baseline differences for "xform" alternative: changes generally reflect exposure of transformed code, or error propagation stopping earlier due to error now occurring in an assignment (to a temporary)
  new testing alternative for script transformation (= xform)
  bug in correctly inspecting test output file
  split bifs.string_utils into a non-error test and an only-errors test, to help control for differing error propagation
  logic for driving the script optimization process
  ...
This commit is contained in:
Jon Siwek 2021-01-14 15:00:48 -08:00
commit 16942f3859
61 changed files with 19865 additions and 328 deletions

View file

@ -556,6 +556,21 @@ void ScriptFunc::AddBody(StmtPtr new_body,
sort(bodies.begin(), bodies.end());
}
void ScriptFunc::ReplaceBody(const StmtPtr& old_body, StmtPtr new_body)
{
bool found_it = false;
for ( auto& body : bodies )
if ( body.stmts.get() == old_body.get() )
{
body.stmts = new_body;
found_it = true;
}
ASSERT(found_it);
current_body = new_body;
}
void ScriptFunc::AddClosure(IDPList ids, Frame* f)
{
if ( ! f )