Mercurial Hosting > luan
changeset 669:e320488819b6
minor fix
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 11 Apr 2016 16:00:44 -0600 |
parents | 7780cafca27f |
children | 58ebfec6178b |
files | core/src/luan/impl/LuanParser.java |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/core/src/luan/impl/LuanParser.java Mon Apr 11 14:13:52 2016 -0600 +++ b/core/src/luan/impl/LuanParser.java Mon Apr 11 16:00:44 2016 -0600 @@ -1717,7 +1717,9 @@ if( isExpr ) return this; ExpString exp = new ExpString(true,isStmt); + exp.list.add( "Luan.first(" ); exp.list.addAll( list ); + exp.list.add( ")" ); return exp; } } @@ -1757,15 +1759,19 @@ boolean hasReturn = false; } - private static Class toFnClass(StmtString stmt,int stackSize,int numArgs,boolean isVarArg,UpValue.Getter[] upValueGetters) { + private static String concat(List list) { StringBuilder sb = new StringBuilder(); - for( Object o : stmt.list ) { + for( Object o : list ) { if( o instanceof List ) throw new RuntimeException(); if( o instanceof ExpString ) throw new RuntimeException(); if( o instanceof StmtString ) throw new RuntimeException(); sb.append( o.toString() ); } - String code = sb.toString(); + return sb.toString(); + } + + private static Class toFnClass(StmtString stmt,int stackSize,int numArgs,boolean isVarArg,UpValue.Getter[] upValueGetters) { + String code = concat(stmt.list); //System.out.println("code:\n"+code); int i = LuanImpl.addObj(upValueGetters);