view core/src/luan/impl/GetUpVar.java @ 638:3ab4f282f0bd 0.16

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Mar 2016 22:52:41 -0700
parents 0742ac78fa69
children 859c0dedc8b6
line wrap: on
line source

package luan.impl;

import luan.LuanElement;


final class GetUpVar extends CodeImpl implements Expr {
	private final int index;

	GetUpVar(LuanElement se,int index) {
		super(se);
		if( index < 0 )  throw new RuntimeException();
		this.index = index;
	}

	@Override public Object eval(LuanStateImpl luan) {
		return luan.closure().upValues()[index].get();
	}
}