FileDocCategorySizeDatePackage
SyntaxTreeNode.javaAPI DocJava SE 5 API29815Fri Aug 26 14:55:36 BST 2005com.sun.org.apache.xalan.internal.xsltc.compiler

SyntaxTreeNode

public abstract class SyntaxTreeNode extends Object implements Constants
author
Jacek Ambroziak
author
Santiago Pericas-Geertsen
author
G. Todd Miller
author
Morten Jorensen
author
Erwin Bolwidt
author
John Howard

Fields Summary
private Parser
_parser
protected SyntaxTreeNode
_parent
private Stylesheet
_stylesheet
private Template
_template
private final Vector
_contents
protected QName
_qname
private int
_line
protected com.sun.org.apache.xalan.internal.xsltc.runtime.AttributeList
_attributes
private Hashtable
_prefixMapping
protected static final SyntaxTreeNode
Dummy
protected static final int
IndentIncrement
private static final char[]
_spaces
Constructors Summary
public SyntaxTreeNode()
Creates a new SyntaxTreeNode with a 'null' QName and no source file line number reference.


                        
      
	_line = 0;
	_qname = null;
    
public SyntaxTreeNode(int line)
Creates a new SyntaxTreeNode with a 'null' QName.

param
line Source file line number reference

	_line = line;
	_qname = null;
    
public SyntaxTreeNode(String uri, String prefix, String local)
Creates a new SyntaxTreeNode with no source file line number reference.

param
uri The element's namespace URI
param
prefix The element's namespace prefix
param
local The element's local name

	_line = 0;
	setQName(uri, prefix, local);
    
Methods Summary
protected voidaddAttribute(java.lang.String qname, java.lang.String value)

        _attributes.add(qname, value);
    
protected final voidaddElement(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode element)
Adds a child node to this syntax tree node.

param
element is the new child node.

	_contents.addElement(element);
	element.setParent(this);
    
protected voidaddPrefixMapping(java.lang.String prefix, java.lang.String uri)
Adds a single prefix mapping to this syntax tree node.

param
prefix Namespace prefix.
param
uri Namespace URI.

	if (_prefixMapping == null)
	    _prefixMapping = new Hashtable();
	_prefixMapping.put(prefix, uri);
    
protected voidcompileResultTree(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen)
Utility method used by parameters and variables to store result trees

param
classGen BCEL Java class generator
param
methodGen BCEL Java method generator

	final ConstantPoolGen cpg = classGen.getConstantPool();
	final InstructionList il = methodGen.getInstructionList();
	final Stylesheet stylesheet = classGen.getStylesheet();

	boolean isSimple = isSimpleRTF(this);
	boolean isAdaptive = false;
	if (!isSimple) {
	    isAdaptive = isAdaptiveRTF(this);
	}
	
	int rtfType = isSimple ? DOM.SIMPLE_RTF
	                       : (isAdaptive ? DOM.ADAPTIVE_RTF : DOM.TREE_RTF);
	
	// Save the current handler base on the stack
	il.append(methodGen.loadHandler());

	final String DOM_CLASS = classGen.getDOMClass();

	// Create new instance of DOM class (with RTF_INITIAL_SIZE nodes)
	//int index = cpg.addMethodref(DOM_IMPL, "<init>", "(I)V");
	//il.append(new NEW(cpg.addClass(DOM_IMPL)));
	
	il.append(methodGen.loadDOM());
	int index = cpg.addInterfaceMethodref(DOM_INTF,
				 "getResultTreeFrag",
				 "(IIZ)" + DOM_INTF_SIG);
	il.append(new PUSH(cpg, RTF_INITIAL_SIZE));
	il.append(new PUSH(cpg, rtfType));
	il.append(new PUSH(cpg, stylesheet.callsNodeset()));
	il.append(new INVOKEINTERFACE(index,4));
	
	il.append(DUP);

	// Overwrite old handler with DOM handler
	index = cpg.addInterfaceMethodref(DOM_INTF,
				 "getOutputDomBuilder",
				 "()" + TRANSLET_OUTPUT_SIG);

	il.append(new INVOKEINTERFACE(index,1));
	il.append(DUP);
	il.append(methodGen.storeHandler());

	// Call startDocument on the new handler
	il.append(methodGen.startDocument());

	// Instantiate result tree fragment
	translateContents(classGen, methodGen);

	// Call endDocument on the new handler
	il.append(methodGen.loadHandler());
	il.append(methodGen.endDocument());

	// Check if we need to wrap the DOMImpl object in a DOMAdapter object.
	// DOMAdapter is not needed if the RTF is a simple RTF and the nodeset()
	// function is not used.
	if (stylesheet.callsNodeset()
	    && !DOM_CLASS.equals(DOM_IMPL_CLASS)) {
	    // new com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter(DOMImpl,String[]);
	    index = cpg.addMethodref(DOM_ADAPTER_CLASS,
				     "<init>",
				     "("+DOM_INTF_SIG+
				     "["+STRING_SIG+
				     "["+STRING_SIG+
				     "[I"+
				     "["+STRING_SIG+")V");
	    il.append(new NEW(cpg.addClass(DOM_ADAPTER_CLASS)));
	    il.append(new DUP_X1());
	    il.append(SWAP);

	    /*
	     * Give the DOM adapter an empty type mapping if the nodeset
	     * extension function is never called.
	     */
	    if (!stylesheet.callsNodeset()) {
		il.append(new ICONST(0));
		il.append(new ANEWARRAY(cpg.addClass(STRING)));
		il.append(DUP);
		il.append(DUP);
		il.append(new ICONST(0));
		il.append(new NEWARRAY(BasicType.INT));
		il.append(SWAP);
		il.append(new INVOKESPECIAL(index));
	    }
	    else {
		// Push name arrays on the stack
		il.append(ALOAD_0);
		il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
					   NAMES_INDEX,
					   NAMES_INDEX_SIG))); 
		il.append(ALOAD_0);
		il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
					   URIS_INDEX,
					   URIS_INDEX_SIG))); 
		il.append(ALOAD_0);
		il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
					   TYPES_INDEX,
					   TYPES_INDEX_SIG))); 
		il.append(ALOAD_0);
		il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
					   NAMESPACE_INDEX,
					   NAMESPACE_INDEX_SIG)));

		// Initialized DOM adapter
		il.append(new INVOKESPECIAL(index));

		// Add DOM adapter to MultiDOM class by calling addDOMAdapter()
		il.append(DUP);
		il.append(methodGen.loadDOM());
		il.append(new CHECKCAST(cpg.addClass(classGen.getDOMClass())));
		il.append(SWAP);
		index = cpg.addMethodref(MULTI_DOM_CLASS,
					 "addDOMAdapter",
					 "(" + DOM_ADAPTER_SIG + ")I");
		il.append(new INVOKEVIRTUAL(index));
		il.append(POP);		// ignore mask returned by addDOMAdapter
	    }
	}

	// Restore old handler base from stack
	il.append(SWAP);
	il.append(methodGen.storeHandler());
    
protected booleancontextDependent()
Returns true if this expression/instruction depends on the context. By default, every expression/instruction depends on the context unless it overrides this method. Currently used to determine if result trees are compiled using procedures or little DOMs (result tree fragments).

return
'true' if this node depends on the context.

	return true;
    
protected booleandependentContents()
Return true if any of the expressions/instructions in the contents of this node is context dependent.

return
'true' if the contents of this node is context dependent.

	final int n = elementCount();
	for (int i = 0; i < n; i++) {
	    final SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i);
	    if (item.contextDependent()) {
		return true;
	    }
	}
	return false;
    
public voiddisplay(int indent)
Displays the contents of this syntax tree node (to stdout). This method is intended for debugging _only_, and should be overridden by all syntax tree node implementations.

param
indent Indentation level for syntax tree levels.

	displayContents(indent);
    
protected voiddisplayContents(int indent)
Displays the contents of this syntax tree node (to stdout). This method is intended for debugging _only_ !!!

param
indent Indentation level for syntax tree levels.

	final int n = elementCount();
	for (int i = 0; i < n; i++) {
	    SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i);
	    item.display(indent);
	}
    
protected final java.lang.ObjectelementAt(int pos)
Returns a child node at a given position.

param
pos The child node's position.
return
The child node.

	return _contents.elementAt(pos);
    
protected final intelementCount()
Returns the number of children this node has.

return
Number of child nodes.

	return _contents.size();
    
protected final java.util.Enumerationelements()
Returns an Enumeration of all child nodes of this node.

return
An Enumeration of all child nodes of this node.

	return _contents.elements();
    
protected java.lang.StringgetAttribute(java.lang.String qname)
Returns a value for an attribute from the source element.

param
qname The QName of the attribute to return.
return
The value of the attribute of name 'qname'.

	if (_attributes == null) {
	    return EMPTYSTRING;
	}
	final String value = _attributes.getValue(qname);
	return (value == null || value.equals(EMPTYSTRING)) ? 
	    EMPTYSTRING : value;
    
protected java.lang.StringgetAttribute(java.lang.String prefix, java.lang.String localName)

        return getAttribute(prefix + ':" + localName);
    
protected org.xml.sax.AttributesgetAttributes()
Returns a list of all attributes declared for the element represented by this syntax tree node.

return
Attributes for this syntax tree node

	return(_attributes);
    
protected final java.util.VectorgetContents()
Returns a Vector containing all the child nodes of this node.

return
A Vector containing all the child nodes of this node.

	return _contents;
    
protected intgetImportPrecedence()
Get the import precedence of this element. The import precedence equals the import precedence of the stylesheet in which this element occured.

return
The import precedence of this syntax tree node.

	Stylesheet stylesheet = getStylesheet();
	if (stylesheet == null) return Integer.MIN_VALUE;
	return stylesheet.getImportPrecedence();
    
public final intgetLineNumber()
Get the source file line number for this element. If unavailable, lookup in ancestors.

return
The source file line number.

        if (_line > 0) return _line;
        SyntaxTreeNode parent = getParent();
        return (parent != null) ? parent.getLineNumber() : 0;
    
protected final com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNodegetParent()
Returns this syntax tree node's parent node.

return
The parent syntax tree node.

	return _parent;
    
public final com.sun.org.apache.xalan.internal.xsltc.compiler.ParsergetParser()
Returns this node's XSLT parser.

return
The XSLT parser.

	return _parser;
    
protected java.util.HashtablegetPrefixMapping()
Returns a Hashtable containing the prefix mappings that were declared for this element. This does not include all prefix mappings in scope, so one may have to check ancestor elements to get all mappings that are in in scope.

return
Prefix mappings (for this element only).

	return _prefixMapping;
    
protected com.sun.org.apache.xalan.internal.xsltc.compiler.QNamegetQName()
Set the QName for the SyntaxTreeNode

param
qname The QName for the syntax tree node

	return(_qname);
    
public com.sun.org.apache.xalan.internal.xsltc.compiler.StylesheetgetStylesheet()
Get the Stylesheet node that represents the element that this node occured under.

return
The Stylesheet ancestor node of this node.

	if (_stylesheet == null) {
	    SyntaxTreeNode parent = this;
	    while (parent != null) {
		if (parent instanceof Stylesheet)
		    return((Stylesheet)parent);
		parent = parent.getParent();
	    }
	    _stylesheet = (Stylesheet)parent;
	}
	return(_stylesheet);
    
protected final com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTablegetSymbolTable()
Returns the XSLT parser's symbol table.

return
Symbol table.

	return (_parser == null) ? null : _parser.getSymbolTable();
    
protected com.sun.org.apache.xalan.internal.xsltc.compiler.TemplategetTemplate()
Get the Template node that represents the element that this node occured under. Note that this method will return 'null' for nodes that represent top-level elements.

return
The Template ancestor node of this node or 'null'.

	if (_template == null) {
	    SyntaxTreeNode parent = this;
	    while ((parent != null) && (!(parent instanceof Template)))
		parent = parent.getParent();
	    _template = (Template)parent;
	}
	return(_template);
    
protected final com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTCgetXSLTC()
Returns a reference to the XSLTC (XSLT compiler) in use.

return
XSLTC - XSLT compiler.

	return _parser.getXSLTC();
    
protected booleanhasAttribute(java.lang.String qname)

	return (_attributes != null && _attributes.getValue(qname) != null);
    
protected final booleanhasContents()
Tells you if this node has any child nodes.

return
'true' if this node has any children.

	return elementCount() > 0;
    
protected final voidindent(int indent)
Set the indentation level for debug output.

param
indent Indentation level for syntax tree levels.

	System.out.print(new String(_spaces, 0, indent));
    
private booleanisAdaptiveRTF(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode node)
Return true if the node represents an adaptive RTF. A node is an adaptive RTF if each children is a Text element or it is or .

param
node A node
return
true if the node content can be considered as an adaptive RTF.

        
        Vector contents = node.getContents();
        for (int i = 0; i < contents.size(); i++) {
            SyntaxTreeNode item = (SyntaxTreeNode)contents.elementAt(i);
            if (!isTextElement(item, true))
                return false;
        }
        
        return true;
    
protected final booleanisDummy()
Returns 'true' if this syntax tree node is the Sentinal node.

return
'true' if this syntax tree node is the Sentinal node.

        return this == Dummy;
    
private booleanisSimpleRTF(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode node)
Return true if the node represents a simple RTF. A node is a simple RTF if all children only produce Text value.

param
node A node
return
true if the node content can be considered as a simple RTF.

        
        Vector contents = node.getContents();
        for (int i = 0; i < contents.size(); i++) {
            SyntaxTreeNode item = (SyntaxTreeNode)contents.elementAt(i);
            if (!isTextElement(item, false))
                return false;
        }
        
        return true;
    
private booleanisTextElement(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode node, boolean doExtendedCheck)
Return true if the node only produces Text content. A node is a Text element if it is Text, xsl:value-of, xsl:number, or a combination of these nested in a control instruction (xsl:if or xsl:choose). If the doExtendedCheck flag is true, xsl:call-template and xsl:apply-templates are also considered as Text elements.

param
node A node
param
doExtendedCheck If this flag is true, and are also considered as Text elements.
return
true if the node of Text type

        if (node instanceof ValueOf || node instanceof Number
            || node instanceof Text)
        {
            return true;
        }
        else if (node instanceof If) {
            return doExtendedCheck ? isAdaptiveRTF(node) : isSimpleRTF(node);
        }
        else if (node instanceof Choose) {
            Vector contents = node.getContents();
            for (int i = 0; i < contents.size(); i++) {
                SyntaxTreeNode item = (SyntaxTreeNode)contents.elementAt(i);
                if (item instanceof Text || 
                     ((item instanceof When || item instanceof Otherwise)
                     && ((doExtendedCheck && isAdaptiveRTF(item))
                         || (!doExtendedCheck && isSimpleRTF(item)))))
                    continue;
                else
                    return false;
            }
            return true;
        }
        else if (doExtendedCheck && 
                  (node instanceof CallTemplate
                   || node instanceof ApplyTemplates))
            return true;
        else
            return false;
    
protected final com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNodelastChild()
Returns this element's last child

return
The child node.

	if (_contents.size() == 0) return null;
	return (SyntaxTreeNode)_contents.lastElement();
    
protected java.lang.StringlookupNamespace(java.lang.String prefix)
Returns any namespace URI that is in scope for a given prefix. This method checks namespace mappings for this element, and if necessary for ancestor elements as well (ie. if the prefix maps to an URI in this scope then you'll definately get the URI from this method).

param
prefix Namespace prefix.
return
Namespace URI.

	// Initialise the output (default is 'null' for undefined)
	String uri = null;

	// First look up the prefix/uri mapping in our own hashtable...
	if (_prefixMapping != null)
	    uri = (String)_prefixMapping.get(prefix);
	// ... but if we can't find it there we ask our parent for the mapping
	if ((uri == null) && (_parent != null)) {
	    uri = _parent.lookupNamespace(prefix);
	    if ((prefix == Constants.EMPTYSTRING) && (uri == null))
		uri = Constants.EMPTYSTRING;
	}
	// ... and then we return whatever URI we've got.
	return(uri);
    
protected java.lang.StringlookupPrefix(java.lang.String uri)
Returns any namespace prefix that is mapped to a prefix in the current scope. This method checks namespace mappings for this element, and if necessary for ancestor elements as well (ie. if the URI is declared within the current scope then you'll definately get the prefix from this method). Note that this is a very slow method and consequentially it should only be used strictly when needed.

param
uri Namespace URI.
return
Namespace prefix.

	// Initialise the output (default is 'null' for undefined)
	String prefix = null;

	// First look up the prefix/uri mapping in our own hashtable...
	if ((_prefixMapping != null) &&
	    (_prefixMapping.contains(uri))) {
	    Enumeration prefixes = _prefixMapping.keys();
	    while (prefixes.hasMoreElements()) {
		prefix = (String)prefixes.nextElement();
		String mapsTo = (String)_prefixMapping.get(prefix);
		if (mapsTo.equals(uri)) return(prefix);
	    }
	}
	// ... but if we can't find it there we ask our parent for the mapping
	else if (_parent != null) {
	    prefix = _parent.lookupPrefix(uri);
	    if ((uri == Constants.EMPTYSTRING) && (prefix == null))
		prefix = Constants.EMPTYSTRING;
	}
	return(prefix);
    
protected final voidparseChildren(com.sun.org.apache.xalan.internal.xsltc.compiler.Parser parser)
Parse all children of this syntax tree node. This method is normally called by the parseContents() method.

param
parser reference to the XSLT parser


	Vector locals = null;	// only create when needed
	
	final int count = _contents.size();
	for (int i=0; i<count; i++) {
	    SyntaxTreeNode child = (SyntaxTreeNode)_contents.elementAt(i);
	    parser.getSymbolTable().setCurrentNode(child);
	    child.parseContents(parser);
	    // if variable or parameter, add it to scope
	    final QName varOrParamName = updateScope(parser, child);
	    if (varOrParamName != null) {
		if (locals == null) {
		    locals = new Vector(2);
		}
		locals.addElement(varOrParamName);
	    }
	}

	parser.getSymbolTable().setCurrentNode(this);

	// after the last element, remove any locals from scope
	if (locals != null) {
	    final int nLocals = locals.size();
	    for (int i = 0; i < nLocals; i++) {
		parser.removeVariable((QName)locals.elementAt(i));
	    }
	}
    
public voidparseContents(com.sun.org.apache.xalan.internal.xsltc.compiler.Parser parser)
Parse the contents of this syntax tree nodes (child nodes, XPath expressions, patterns and functions). The default behaviour is to parser the syntax tree node's children (since there are no common expressions, patterns, etc. that can be handled in this base class.

param
parser reference to the XSLT parser

	parseChildren(parser);
    
protected final voidremoveElement(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode element)
Removed a child node of this syntax tree node.

param
element is the child node to remove.

	_contents.remove(element);
	element.setParent(null);
    
protected voidreportError(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode element, com.sun.org.apache.xalan.internal.xsltc.compiler.Parser parser, java.lang.String errorCode, java.lang.String message)
Report an error to the parser.

param
element The element in which the error occured (normally 'this' but it could also be an expression/pattern/etc.)
param
parser The XSLT parser to report the error to.
param
error The error code (from util/ErrorMsg).
param
message Any additional error message.

	final ErrorMsg error = new ErrorMsg(errorCode, message, element);
        parser.reportError(Constants.ERROR, error);
    
protected voidreportWarning(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode element, com.sun.org.apache.xalan.internal.xsltc.compiler.Parser parser, java.lang.String errorCode, java.lang.String message)
Report a recoverable error to the parser.

param
element The element in which the error occured (normally 'this' but it could also be an expression/pattern/etc.)
param
parser The XSLT parser to report the error to.
param
error The error code (from util/ErrorMsg).
param
message Any additional error message.

	final ErrorMsg error = new ErrorMsg(errorCode, message, element);
        parser.reportError(Constants.WARNING, error);
    
protected voidsetAttributes(com.sun.org.apache.xalan.internal.xsltc.runtime.AttributeList attributes)
Set the attributes for this SyntaxTreeNode.

param
attributes Attributes for the element. Must be passed in as an implementation of org.xml.sax.Attributes.

	_attributes = attributes;
    
protected final voidsetFirstElement(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode element)
Inserts the first child node of this syntax tree node. The existing children are shifted back one position.

param
element is the new child node.

	_contents.insertElementAt(element,0);
	element.setParent(this);
    
protected final voidsetLineNumber(int line)
Set the source file line number for this element

param
line The source file line number.

	_line = line;
    
protected voidsetParent(com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode parent)
Set this syntax tree node's parent node

param
parent The parent node.

	if (_parent == null)
	    _parent = parent;
    
protected voidsetParser(com.sun.org.apache.xalan.internal.xsltc.compiler.Parser parser)
Set this node's parser. The parser (the XSLT parser) gives this syntax tree node access to the symbol table and XPath parser.

param
parser The XSLT parser.

	_parser = parser;
    
protected voidsetPrefixMapping(java.util.Hashtable mapping)
Sets the prefix mapping for the namespaces that were declared in this element. This does not include all prefix mappings in scope, so one may have to check ancestor elements to get all mappings that are in in scope. The prefixes must be passed in as a Hashtable that maps namespace prefixes (String objects) to namespace URIs (also String).

param
mapping The Hashtable containing the mappings.

	_prefixMapping = mapping;
    
protected voidsetQName(com.sun.org.apache.xalan.internal.xsltc.compiler.QName qname)
Set the QName for the syntax tree node.

param
qname The QName for the syntax tree node

	_qname = qname;
    
protected voidsetQName(java.lang.String uri, java.lang.String prefix, java.lang.String localname)
Set the QName for the SyntaxTreeNode

param
uri The element's namespace URI
param
prefix The element's namespace prefix
param
local The element's local name

	_qname = new QName(uri, prefix, localname);
    
public abstract voidtranslate(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen)
Translate this abstract syntax tree node into JVM bytecodes.

param
classGen BCEL Java class generator
param
methodGen BCEL Java method generator

protected voidtranslateContents(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen)
Call translate() on all child syntax tree nodes.

param
classGen BCEL Java class generator
param
methodGen BCEL Java method generator

	// Call translate() on all child nodes
	final int n = elementCount();
	for (int i = 0; i < n; i++) {
	    final SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i);
	    item.translate(classGen, methodGen);
	}

	// After translation, unmap any registers for any variables/parameters
	// that were declared in this scope. Performing this unmapping in the
	// same AST scope as the declaration deals with the problems of
	// references falling out-of-scope inside the for-each element.
	// (the cause of which being 'lazy' register allocation for references)
	for (int i = 0; i < n; i++) {
	    if( _contents.elementAt(i) instanceof VariableBase) {
		final VariableBase var = (VariableBase)_contents.elementAt(i);
		var.unmapRegister(methodGen);
	    }
	}
    
public abstract com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypetypeCheck(com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTable stable)
Type check the children of this node. The type check phase may add coercions (CastExpr) to the AST.

param
stable The compiler/parser's symbol table

protected com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypetypeCheckContents(com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTable stable)
Call typeCheck() on all child syntax tree nodes.

param
stable The compiler/parser's symbol table

	final int n = elementCount();
	for (int i = 0; i < n; i++) {
	    SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i);
	    item.typeCheck(stable);
	}
	return Type.Void;
    
protected com.sun.org.apache.xalan.internal.xsltc.compiler.QNameupdateScope(com.sun.org.apache.xalan.internal.xsltc.compiler.Parser parser, com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode node)
Add a node to the current scope and return name of a variable or parameter if the node represents a variable or a parameter.

	if (node instanceof Variable) {
	    final Variable var = (Variable)node;
	    parser.addVariable(var);
	    return var.getName();
	}
	else if (node instanceof Param) {
	    final Param param = (Param)node;
	    parser.addParameter(param);
	    return param.getName();
	}
	else {
	    return null;
	}