This should give an error message (made use of undefined node) if you haven't put a prior distribution on oldvar[1]. WinBUGS expects all nodes to have values if they are used in calculations. If you have put a prior on it, then WinBUGS should generate values from the posterior distribution of oldvar[1], and then the equals() function should operate on those generated values.
http://stackoverflow.com/questions/16597737/winbugs-equals-function-with-na