comparison core/src/luan/impl/LuanJavaCompiler.java @ 650:d658eab7bf4c

finish compiling operators
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 31 Mar 2016 22:43:51 -0600
parents e387e4021afe
children 067d9470184d
comparison
equal deleted inserted replaced
649:37f0cf43f191 650:d658eab7bf4c
55 byte[] byteCode = baos.toByteArray(); 55 byte[] byteCode = baos.toByteArray();
56 int max = byteCode.length-len-3; 56 int max = byteCode.length-len-3;
57 outer: 57 outer:
58 for( int i=0; true; i++ ) { 58 for( int i=0; true; i++ ) {
59 if( i > max ) 59 if( i > max )
60 throw new RuntimeException(); 60 throw new RuntimeException("len="+len);
61 if( byteCode[i]==1 && byteCode[i+1]*256 + byteCode[i+2] == len ) { 61 if( byteCode[i]==1 && (byteCode[i+1] << 8 | 0xFF & byteCode[i+2]) == len ) {
62 for( int j=i+3; j<i+3+len; j++ ) { 62 for( int j=i+3; j<i+3+len; j++ ) {
63 if( byteCode[j] != '$' ) 63 if( byteCode[j] != '$' )
64 continue outer; 64 continue outer;
65 } 65 }
66 System.arraycopy(sourceName.getBytes(),0,byteCode,i+3,len); 66 System.arraycopy(sourceName.getBytes(),0,byteCode,i+3,len);