Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv8432/src/bossa/syntax
Modified Files:
analyse.nice
Log Message:
Do not make arguments of known pure higher-order functions capture variables,
since they do not escape the call.
Index: analyse.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v
retrieving revision 1.89
retrieving revision 1.90
diff -C2 -d -r1.89 -r1.90
*** analyse.nice 25 Nov 2003 10:02:31 -0000 1.89
--- analyse.nice 25 Nov 2003 10:31:01 -0000 1.90
***************
*** 278,286 ****
}
! void analyse(Arguments, Info);
! analyse(args@Arguments, info)
{
for (int i = 0; i < args.size(); i++)
! args.setExp(i, analyse(args.getExp(i), info));
}
--- 278,285 ----
}
! void analyse(Arguments args, Info info, boolean noEscape)
{
for (int i = 0; i < args.size(); i++)
! args.setExp(i, analyse(args.getExp(i), info, noEscape: noEscape));
}
***************
*** 307,311 ****
markAsCallFirstArg(notNull(args.getExp(0)));
! args.analyse(info);
if (e.infix)
--- 306,313 ----
markAsCallFirstArg(notNull(args.getExp(0)));
! boolean noEscape = args.size() == 2 &&
! (e.isCallTo("foreach") || e.isCallTo("forbreak") || e.isCallTo("map") ||
! e.isCallTo("filter"));
! args.analyse(info, noEscape);
if (e.infix)
***************
*** 393,397 ****
}
! analyse(e@FunExp, info)
{
let savedDepth = info.anonFunDepth;
--- 395,404 ----
}
! ?Expression analyse(Expression e, Info info, boolean noEscape) =
! analyse(e, info);
!
! analyse(e@FunExp, info) = analyse(e, info, false);
!
! analyse(e@FunExp, info@Info, noEscape)
{
let savedDepth = info.anonFunDepth;
***************
*** 400,404 ****
info.beginInner();
info.begin();
! info.anonFunDepth = info.depth;
if (e.constraint != Constraint.True && e.constraint != null)
--- 407,412 ----
info.beginInner();
info.begin();
! if (! noEscape)
! info.anonFunDepth = info.depth;
if (e.constraint != Constraint.True && e.constraint != null)
***************
*** 554,558 ****
analyse(e@NewExp, info)
{
! e.arguments.analyse(info);
e.resolve(info.typeMap);
return e;
--- 562,566 ----
analyse(e@NewExp, info)
{
! e.arguments.analyse(info, noEscape: false);
e.resolve(info.typeMap);
return e;
|