[Nice-commit] Nice/stdlib/nice/lang/inline Instanceof.java,1.3,1.4
Brought to you by:
bonniot
From: <bo...@us...> - 2003-12-19 02:12:37
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv3930/stdlib/nice/lang/inline Modified Files: Instanceof.java Log Message: Fixed 'instanceof Array' tests for values that are statically known to be arrays (they could still be null). Index: Instanceof.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/Instanceof.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Instanceof.java 1 Apr 2003 20:25:09 -0000 1.3 --- Instanceof.java 19 Dec 2003 02:12:34 -0000 1.4 *************** *** 52,56 **** value.compile(comp, Target.pushObject); ! code.emitInstanceof(type); target.compileFromStack(comp, Type.boolean_type); } --- 52,71 ---- value.compile(comp, Target.pushObject); ! ! if (type == nice.tools.code.SpecialArray.wrappedType() && ! code.topType().isArray()) ! { ! /* If we want to test if the value is 'instanceof Array', and ! we know statically that it is an array, we just need to make ! sure it is not null. ! */ ! code.emitIfNull(); ! code.emitPushBoolean(false); ! code.emitElse(); ! code.emitPushBoolean(true); ! code.emitFi(); ! } ! else ! code.emitInstanceof(type); target.compileFromStack(comp, Type.boolean_type); } |