jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableBase.java
changeset 12458 d601e4bba306
parent 12457 c348e06f0e82
equal deleted inserted replaced
12457:c348e06f0e82 12458:d601e4bba306
    82     public void addReference(VariableRefBase vref) {
    82     public void addReference(VariableRefBase vref) {
    83         _refs.addElement(vref);
    83         _refs.addElement(vref);
    84     }
    84     }
    85 
    85 
    86     /**
    86     /**
    87      * Remove a reference to this variable. Called by VariableRef when this
       
    88      * variable goes out of scope.
       
    89      */
       
    90     public void removeReference(VariableRefBase vref) {
       
    91         _refs.remove(vref);
       
    92     }
       
    93 
       
    94     /**
       
    95      * When a variable is overriden by another, e.g. via xsl:import,
    87      * When a variable is overriden by another, e.g. via xsl:import,
    96      * its references need to be copied or otherwise it may be
    88      * its references need to be copied or otherwise it may be
    97      * compiled away as dead code. This method can be used for that
    89      * compiled away as dead code. This method can be used for that
    98      * purpose.
    90      * purpose.
    99      */
    91      */
   119     /**
   111     /**
   120      * Remove the mapping of this variable to a register.
   112      * Remove the mapping of this variable to a register.
   121      * Called when we leave the AST scope of the variable's declaration
   113      * Called when we leave the AST scope of the variable's declaration
   122      */
   114      */
   123     public void unmapRegister(MethodGenerator methodGen) {
   115     public void unmapRegister(MethodGenerator methodGen) {
   124         if (_refs.isEmpty() && (_local != null)) {
   116         if (_local != null) {
   125             _local.setEnd(methodGen.getInstructionList().getEnd());
   117             _local.setEnd(methodGen.getInstructionList().getEnd());
   126             methodGen.removeLocalVariable(_local);
   118             methodGen.removeLocalVariable(_local);
   127             _refs = null;
   119             _refs = null;
   128             _local = null;
   120             _local = null;
   129         }
   121         }