diff --git a/src/script_opt/ZAM/Compile.h b/src/script_opt/ZAM/Compile.h index e6bce25b9e..edfeff65bf 100644 --- a/src/script_opt/ZAM/Compile.h +++ b/src/script_opt/ZAM/Compile.h @@ -220,10 +220,15 @@ private: const ZAMStmt CompileInExpr(const NameExpr* n1, const ListExpr* l, const NameExpr* n2, const ConstExpr* c); - const ZAMStmt CompileIndex(const NameExpr* n1, const NameExpr* n2, const ListExpr* l); - const ZAMStmt CompileIndex(const NameExpr* n1, const ConstExpr* c, const ListExpr* l); + const ZAMStmt CompileIndex(const NameExpr* n1, const NameExpr* n2, const ListExpr* l, + bool in_when); + const ZAMStmt CompileIndex(const NameExpr* n1, const ConstExpr* c, const ListExpr* l, + bool in_when); const ZAMStmt CompileIndex(const NameExpr* n1, int n2_slot, const TypePtr& n2_type, - const ListExpr* l); + const ListExpr* l, bool in_when); + + const ZAMStmt BuildLambda(const NameExpr* n, LambdaExpr* le); + const ZAMStmt BuildLambda(int n_slot, LambdaExpr* le); // Second argument is which instruction slot holds the branch target. const ZAMStmt GenCond(const Expr* e, int& branch_v); diff --git a/src/script_opt/ZAM/Expr.cc b/src/script_opt/ZAM/Expr.cc index ebcd3bda6b..6982292755 100644 --- a/src/script_opt/ZAM/Expr.cc +++ b/src/script_opt/ZAM/Expr.cc @@ -1053,10 +1053,13 @@ const ZAMStmt ZAMCompiler::DoCall(const CallExpr* c, const NameExpr* n) if ( ! z.aux ) z.aux = new ZInstAux(0); - z.aux->can_change_globals = true; + z.aux->can_change_non_locals = true; z.call_expr = c; + if ( in_when ) + z.SetType(n->GetType()); + if ( ! indirect || func_id->IsGlobal() ) { z.aux->id_val = func_id;