Mercurial Hosting > luan
diff core/src/luan/impl/LuanParser.java @ 186:cf939124461a
don't import modules by default
git-svn-id: https://luan-java.googlecode.com/svn/trunk@187 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 26 Jun 2014 00:36:50 +0000 |
parents | 5d2cb8c1f844 |
children | 04b86428dc50 |
line wrap: on
line diff
--- a/core/src/luan/impl/LuanParser.java Wed Jun 25 07:06:16 2014 +0000 +++ b/core/src/luan/impl/LuanParser.java Thu Jun 26 00:36:50 2014 +0000 @@ -9,6 +9,7 @@ import luan.Luan; import luan.LuanState; import luan.LuanSource; +import luan.modules.PackageLuan; final class LuanParser { @@ -345,21 +346,6 @@ int start = parser.begin(); if( !Keyword("import",In.NOTHING) ) return parser.failure(null); - Expr importExpr; - { - LuanSource.Element se = se(start); - int index = stackIndex("require"); - if( index != -1 ) { - importExpr = new GetLocalVar(se,index); - } else { - index = upValueIndex("require"); - if( index != -1 ) { - importExpr = new GetUpVar(se,index); - } else { - throw parser.exception("no local 'require' function, needed for import"); - } - } - } String modName = StringLiteral(In.NOTHING); if( modName==null ) return parser.failure(null); @@ -370,7 +356,7 @@ if( !isValidName(varName) ) throw parser.exception("invalid variable name '"+varName+"' in import"); LuanSource.Element se = se(start); - FnCall require = new FnCall( se, importExpr, new ConstExpr(modName) ); + FnCall require = new FnCall( se, new ConstExpr(se,PackageLuan.requireFn), new ConstExpr(modName) ); Settable settable; if( interactive ) { settable = nameVar(se,varName).settable();