changeset 409:abce9b0041b0

remove LuanState.require(), eval() is good enough
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 29 Apr 2015 15:26:54 -0600
parents 1b38de2b1845
children 0d6098a29b3e
files core/src/luan/LuanState.java core/src/luan/modules/BinaryLuan.java core/src/luan/modules/StringLuan.java
diffstat 3 files changed, 2 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/LuanState.java	Wed Apr 29 13:15:17 2015 -0600
+++ b/core/src/luan/LuanState.java	Wed Apr 29 15:26:54 2015 -0600
@@ -1,19 +1,9 @@
 package luan;
 
-import java.io.InputStream;
-import java.io.PrintStream;
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Map;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import java.util.HashSet;
 import luan.impl.LuanCompiler;
 import luan.modules.BasicLuan;
-import luan.modules.PackageLuan;
-import luan.modules.JavaLuan;
-import luan.modules.StringLuan;
-import luan.modules.BinaryLuan;
 
 
 public abstract class LuanState implements DeepCloneable<LuanState> {
@@ -39,10 +29,6 @@
 		return registry;
 	}
 
-	public final Object require(String modName) throws LuanException {
-		return PackageLuan.require(this,modName);
-	}
-
 	public static LuanState newInstance() {
 		return LuanCompiler.newLuanState();
 	}
--- a/core/src/luan/modules/BinaryLuan.java	Wed Apr 29 13:15:17 2015 -0600
+++ b/core/src/luan/modules/BinaryLuan.java	Wed Apr 29 15:26:54 2015 -0600
@@ -11,7 +11,7 @@
 public final class BinaryLuan {
 
 	public static Object __index(LuanState luan,final byte[] binary,Object key) throws LuanException {
-		LuanTable mod = (LuanTable)luan.require("luan:Binary");
+		LuanTable mod = (LuanTable)PackageLuan.require(luan,"luan:Binary");
 		Object obj = mod.get(key);
 		if( obj instanceof LuanFunction ) {
 			final LuanFunction fn = (LuanFunction)obj;
--- a/core/src/luan/modules/StringLuan.java	Wed Apr 29 13:15:17 2015 -0600
+++ b/core/src/luan/modules/StringLuan.java	Wed Apr 29 15:26:54 2015 -0600
@@ -15,7 +15,7 @@
 public final class StringLuan {
 
 	public static Object __index(LuanState luan,final String s,Object key) throws LuanException {
-		LuanTable mod = (LuanTable)luan.require("luan:String");
+		LuanTable mod = (LuanTable)PackageLuan.require(luan,"luan:String");
 		Object obj = mod.get(key);
 		if( obj instanceof LuanFunction ) {
 			final LuanFunction fn = (LuanFunction)obj;