Mercurial Hosting > luan
comparison src/luan/interp/Chunk.java @ 32:c3eab5a3ce3c
implement closures
git-svn-id: https://luan-java.googlecode.com/svn/trunk@33 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 14 Dec 2012 05:40:35 +0000 |
parents | 5cf15507d77e |
children | e3624b7cd603 |
comparison
equal
deleted
inserted
replaced
31:5cf15507d77e | 32:c3eab5a3ce3c |
---|---|
2 | 2 |
3 import luan.LuaException; | 3 import luan.LuaException; |
4 | 4 |
5 | 5 |
6 final class Chunk implements Expr { | 6 final class Chunk implements Expr { |
7 public final Stmt block; | 7 final Stmt block; |
8 public final int stackSize; | 8 final int stackSize; |
9 public final int numArgs; | 9 final int numArgs; |
10 public final boolean isVarArg; | 10 final boolean isVarArg; |
11 final UpValue.Getter[] upValueGetters; | |
11 | 12 |
12 Chunk(Stmt block,int stackSize,int numArgs,boolean isVarArg) { | 13 Chunk(Stmt block,int stackSize,int numArgs,boolean isVarArg,UpValue.Getter[] upValueGetters) { |
13 this.block = block; | 14 this.block = block; |
14 this.stackSize = stackSize; | 15 this.stackSize = stackSize; |
15 this.numArgs = numArgs; | 16 this.numArgs = numArgs; |
16 this.isVarArg = isVarArg; | 17 this.isVarArg = isVarArg; |
18 this.upValueGetters = upValueGetters; | |
17 fixReturns(block); | 19 fixReturns(block); |
18 } | 20 } |
19 | 21 |
20 private static void fixReturns(Stmt stmt) { | 22 private static void fixReturns(Stmt stmt) { |
21 if( stmt instanceof ReturnStmt ) { | 23 if( stmt instanceof ReturnStmt ) { |