Mercurial Hosting > luan
comparison src/luan/impl/Block.java @ 166:4eaee12f6c65
move luan/interp to impl
git-svn-id: https://luan-java.googlecode.com/svn/trunk@167 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Sun, 22 Jun 2014 04:17:38 +0000 |
parents | src/luan/interp/Block.java@8ede219cd111 |
children |
comparison
equal
deleted
inserted
replaced
165:94bbc4cbc106 | 166:4eaee12f6c65 |
---|---|
1 package luan.impl; | |
2 | |
3 import luan.LuanException; | |
4 | |
5 | |
6 final class Block implements Stmt { | |
7 final Stmt[] stmts; | |
8 private final int stackStart; | |
9 private final int stackEnd; | |
10 | |
11 Block(Stmt[] stmts,int stackStart,int stackEnd) { | |
12 if( stmts.length==0 ) | |
13 throw new RuntimeException("empty block"); | |
14 this.stmts = stmts; | |
15 this.stackStart = stackStart; | |
16 this.stackEnd = stackEnd; | |
17 } | |
18 | |
19 @Override public void eval(LuanStateImpl luan) throws LuanException { | |
20 try { | |
21 for( Stmt stmt : stmts ) { | |
22 stmt.eval(luan); | |
23 } | |
24 } finally { | |
25 luan.stackClear(stackStart,stackEnd); | |
26 } | |
27 } | |
28 | |
29 } |