01: package net.sf.saxon.query;
02:
03: import net.sf.saxon.expr.BindingReference;
04: import net.sf.saxon.expr.VariableDeclaration;
05: import net.sf.saxon.instruct.GlobalVariable;
06: import net.sf.saxon.trans.XPathException;
07:
08: import java.util.Collections;
09: import java.util.Iterator;
10:
11: /**
12: * An UndeclaredVariable object is created when a reference is encountered to a variable
13: * that has not yet been declared. This can happen as a result of recursive module imports.
14: * These references are resolved at the end of query parsing.
15: */
16:
17: public class UndeclaredVariable extends GlobalVariableDefinition {
18:
19: public UndeclaredVariable() {
20: }
21:
22: public void transferReferences(VariableDeclaration var) {
23: Iterator iter = references.iterator();
24: while (iter.hasNext()) {
25: BindingReference ref = (BindingReference) iter.next();
26: var.registerReference(ref);
27: }
28: references = Collections.EMPTY_LIST;
29: }
30:
31: public GlobalVariable compile(StaticQueryContext env, int slot)
32: throws XPathException {
33: throw new UnsupportedOperationException(
34: "Attempt to compile a place-holder for an undeclared variable");
35: }
36: }
37:
38: //
39: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
40: // you may not use this file except in compliance with the License. You may obtain a copy of the
41: // License at http://www.mozilla.org/MPL/
42: //
43: // Software distributed under the License is distributed on an "AS IS" basis,
44: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
45: // See the License for the specific language governing rights and limitations under the License.
46: //
47: // The Original Code is: all this file.
48: //
49: // The Initial Developer of the Original Code is Michael H. Kay
50: //
51: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
52: //
53: // Contributor(s): none
54: //
|