Mercurial Hosting > luan
comparison core/src/luan/impl/LuanParser.java @ 688:f99f51bc5bea
fix up-values
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 18 Apr 2016 15:46:05 -0600 |
parents | fc08c3b42010 |
children | ca169567ce07 |
comparison
equal
deleted
inserted
replaced
687:fc08c3b42010 | 688:f99f51bc5bea |
---|---|
146 UpSym getUpSym(String name) { | 146 UpSym getUpSym(String name) { |
147 for( UpSym upSym : upValueSymbols ) { | 147 for( UpSym upSym : upValueSymbols ) { |
148 if( upSym.name.equals(name) ) | 148 if( upSym.name.equals(name) ) |
149 return upSym; | 149 return upSym; |
150 } | 150 } |
151 for( Frame f=parent; f!=null; f=f.parent ) { | 151 if( parent != null ) { |
152 LocalSym sym = f.getLocalSym(name); | 152 LocalSym sym = parent.getLocalSym(name); |
153 if( sym != null ) { | 153 if( sym != null ) { |
154 sym.isPointer = true; | 154 sym.isPointer = true; |
155 return addUpSym(name,sym.javaName); | 155 return addUpSym(name,sym.javaName); |
156 } | |
157 UpSym upSym = parent.getUpSym(name); | |
158 if( upSym != null ) { | |
159 return addUpSym(name,"parentUpValues["+upSym.i+"]"); | |
156 } | 160 } |
157 } | 161 } |
158 return null; | 162 return null; |
159 } | 163 } |
160 | 164 |
1931 +"super("+upValueSymbols.size()+",java); " | 1935 +"super("+upValueSymbols.size()+",java); " |
1932 + init(upValueSymbols) | 1936 + init(upValueSymbols) |
1933 +"} " | 1937 +"} " |
1934 | 1938 |
1935 +"@Override public Object doCall(LuanState luan,Object[] args) throws LuanException { " | 1939 +"@Override public Object doCall(LuanState luan,Object[] args) throws LuanException { " |
1940 +"final Pointer[] parentUpValues = upValues; " | |
1936 +"Object t; " | 1941 +"Object t; " |
1937 +"Object[] a; " | 1942 +"Object[] a; " |
1938 + stmts | 1943 + stmts |
1939 +"\n} " | 1944 +"\n} " |
1940 +"}\n" | 1945 +"}\n" |
1959 +"} " | 1964 +"} " |
1960 +"private Object _" + name + "(LuanState luan,Object[] args) throws LuanException { " | 1965 +"private Object _" + name + "(LuanState luan,Object[] args) throws LuanException { " |
1961 ); | 1966 ); |
1962 } | 1967 } |
1963 exp.add( "" | 1968 exp.add( "" |
1969 +"final Pointer[] parentUpValues = upValues; " | |
1964 +"Object t; " | 1970 +"Object t; " |
1965 +"Object[] a; " | 1971 +"Object[] a; " |
1966 ); | 1972 ); |
1967 exp.addAll( stmt ); | 1973 exp.addAll( stmt ); |
1968 exp.add( "" | 1974 exp.add( "" |