Mercurial Hosting > luan
comparison src/luan/interp/GenericForStmt.java @ 111:2428ecfed375
change LuanFunction.call() from returning Object[] to returning Object, to reduce garbage collection
git-svn-id: https://luan-java.googlecode.com/svn/trunk@112 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 23 May 2014 20:40:05 +0000 |
parents | 219e05867366 |
children |
comparison
equal
deleted
inserted
replaced
110:7afa6df829f3 | 111:2428ecfed375 |
---|---|
25 LuanFunction iter = luan.bit(se).checkFunction( iterExpr.eval(luan) ); | 25 LuanFunction iter = luan.bit(se).checkFunction( iterExpr.eval(luan) ); |
26 LuanBit bit = luan.bit(iterExpr.se()); | 26 LuanBit bit = luan.bit(iterExpr.se()); |
27 String name = iterExpr.se().text(); | 27 String name = iterExpr.se().text(); |
28 try { | 28 try { |
29 while(true) { | 29 while(true) { |
30 Object[] vals = bit.call(iter,name); | 30 Object vals = bit.call(iter,name); |
31 if( vals.length==0 || vals[0]==null ) | 31 if( vals==null ) |
32 break; | 32 break; |
33 for( int i=0; i<nVars; i++ ) { | 33 if( vals instanceof Object[] ) { |
34 luan.stackSet( iVars+i, i < vals.length ? vals[i] : null ); | 34 Object[] a = (Object[])vals; |
35 if( a.length==0 ) | |
36 break; | |
37 for( int i=0; i<nVars; i++ ) { | |
38 luan.stackSet( iVars+i, i < a.length ? a[i] : null ); | |
39 } | |
40 } else { | |
41 luan.stackSet( iVars, vals ); | |
42 for( int i=1; i<nVars; i++ ) { | |
43 luan.stackSet( iVars+i, null ); | |
44 } | |
35 } | 45 } |
36 block.eval(luan); | 46 block.eval(luan); |
37 } | 47 } |
38 } catch(BreakException e) { | 48 } catch(BreakException e) { |
39 } finally { | 49 } finally { |