[Nice-commit] Nice/stdlib/nice/lang/inline ReferenceOp.java,1.2,1.3
Brought to you by:
bonniot
From: <ar...@us...> - 2003-07-22 12:09:08
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv7572/F:/nice/stdlib/nice/lang/inline Modified Files: ReferenceOp.java Log Message: Give a warning when comparing something of a non-null type with null. Index: ReferenceOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/ReferenceOp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReferenceOp.java 24 Mar 2003 23:40:09 -0000 1.2 --- ReferenceOp.java 22 Jul 2003 12:09:05 -0000 1.3 *************** *** 20,24 **** Inlining of native reference operators. */ ! public class ReferenceOp extends Procedure2 implements Inlineable, Branchable { private final static int --- 20,24 ---- Inlining of native reference operators. */ ! public class ReferenceOp extends Procedure2 implements Branchable, bossa.syntax.Macro { private final static int *************** *** 172,175 **** --- 172,188 ---- { return retType; + } + + public void checkSpecialRequirements(bossa.syntax.Expression[] arguments) + { + bossa.syntax.Expression exp = null; + if (arguments[0] instanceof bossa.syntax.NullExp) + exp = arguments[1]; + else if (arguments[1] instanceof bossa.syntax.NullExp) + exp = arguments[0]; + + + if (exp != null && nice.tools.code.Types.isSure(exp.getType().getMonotype())) + bossa.util.User.warning(exp, "Warning: comparing a non-null value with null"); } |