// Instance Members that are only meaningful on root Template //////////////////////////////////////
- private JSScope staticJSScope = null; ///< the scope in which the static block is executed
+ private JSScope staticScope = null; ///< the scope in which the static block is executed
private JSFunction staticscript = null; ///< the script on the static node of this template, null already performed
}
/** called before this template is applied or its static object can be externally referenced */
- JSScope getStatic() throws JSExn {
- if (staticJSScope == null) staticJSScope = new JSScope(null);
- if (staticscript == null) return staticJSScope;
+ JSScope getStatic(XWT xwt) throws JSExn {
+ if (staticScope == null) staticScope = new PerInstantiationJSScope(null, xwt, null, null);
+ if (staticscript == null) return staticScope;
JSFunction temp = staticscript;
staticscript = null;
- temp.cloneWithNewParentScope(staticJSScope).call(null, null, null, null, 0);
- return staticJSScope;
+ temp.cloneWithNewParentScope(staticScope).call(null, null, null, null, 0);
+ return staticScope;
}
/** Applies the template to Box b
private void apply(Box b, XWT xwt, PerInstantiationJSScope parentPis) throws JSExn {
- getStatic();
+ getStatic(xwt);
if (id != null) parentPis.putDollar(id, b);
for(int i=0; i<preapply.size(); i++) {
t.apply(b, xwt);
}
- PerInstantiationJSScope pis = new PerInstantiationJSScope(b, xwt, parentPis, staticJSScope);
+ PerInstantiationJSScope pis = new PerInstantiationJSScope(b, xwt, parentPis, staticScope);
for (int i=0; children != null && i<children.size(); i++) {
Box kid = new Box();
((Template)children.elementAt(i)).apply(kid, xwt, pis);
public void characters(char[] ch, int start, int length) throws XML.Exn {
// invoke the no-tab crusade
for (int i=0; length >i; i++) if (ch[start+i] == '\t')
- throw new XML.Exn("tabs are not allowed in XWT files", XML.Exn.SCHEMA, getLine(), getCol());
+ Log.error(Template.class, "tabs are not allowed in XWT files ("+getLine()+":"+getCol()+")");
if ("static".equals(nameOfHeaderNodeBeingProcessed) || state == STATE_IN_TEMPLATE_NODE) {
if (t.content == null) {