Mercurial Hosting > luan
comparison src/luan/interp/Block.java @ 17:09d41f7490a8
add local variables
git-svn-id: https://luan-java.googlecode.com/svn/trunk@18 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 30 Nov 2012 11:46:34 +0000 |
parents | b7d7069fee58 |
children | c93d8c781853 |
comparison
equal
deleted
inserted
replaced
16:2a30281ef47c | 17:09d41f7490a8 |
---|---|
4 import luan.LuaException; | 4 import luan.LuaException; |
5 | 5 |
6 | 6 |
7 final class Block implements Stmt { | 7 final class Block implements Stmt { |
8 private final Stmt[] stmts; | 8 private final Stmt[] stmts; |
9 private final int stackStart; | |
10 private final int stackEnd; | |
9 | 11 |
10 Block(Stmt[] stmts) { | 12 Block(Stmt[] stmts,int stackStart,int stackEnd) { |
11 this.stmts = stmts; | 13 this.stmts = stmts; |
14 this.stackStart = stackStart; | |
15 this.stackEnd = stackEnd; | |
12 } | 16 } |
13 | 17 |
14 @Override public void eval(LuaState lua) throws LuaException { | 18 @Override public void eval(LuaState lua) throws LuaException { |
15 for( Stmt stmt : stmts ) { | 19 try { |
16 stmt.eval(lua); | 20 for( Stmt stmt : stmts ) { |
21 stmt.eval(lua); | |
22 } | |
23 } finally { | |
24 Object[] stack = lua.stack(); | |
25 for( int i=stackStart; i<stackEnd; i++ ) { | |
26 stack[i] = null; | |
27 } | |
17 } | 28 } |
18 } | 29 } |
19 | 30 |
20 } | 31 } |