santiagopg 02/04/22 09:34:31
Modified: java/src/org/apache/xalan/xsltc/compiler/util Tag:
jaxp-ri-1_2_0-fcs-branch MethodGenerator.java
Log:
Fixed bug in addLocalVariable() when the slot allocator was already
initialized.
Revision Changes Path
No revision
No revision
1.8.4.1 +15 -5
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/MethodGenerator.java
Index: MethodGenerator.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/MethodGenerator.java,v
retrieving revision 1.8
retrieving revision 1.8.4.1
diff -u -r1.8 -r1.8.4.1
--- MethodGenerator.java 1 Feb 2002 20:27:46 -0000 1.8
+++ MethodGenerator.java 22 Apr 2002 16:34:31 -0000 1.8.4.1
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: MethodGenerator.java,v 1.8 2002/02/01 20:27:46 tmiller Exp $
+ * @(#)$Id: MethodGenerator.java,v 1.8.4.1 2002/04/22 16:34:31 santiagopg
Exp $
*
* The Apache Software License, Version 1.1
*
@@ -103,6 +103,7 @@
private final Instruction _nextNode;
private SlotAllocator _slotAllocator;
+ private boolean _allocatorInit = false;
public MethodGenerator(int access_flags, Type return_type,
Type[] arg_types, String[] arg_names,
@@ -173,17 +174,26 @@
_slotAllocator = new SlotAllocator();
_slotAllocator.initialize(getLocalVariables());
+ _allocatorInit = true;
}
+ /**
+ * Allocates a local variable. If the slot allocator has already been
+ * initialized, then call addLocalVariable2() so that the new variable
+ * is known to the allocator. Failing to do this may cause the allocator
+ * to return a slot that is already in use.
+ */
public LocalVariableGen addLocalVariable(String name, Type type,
InstructionHandle start,
- InstructionHandle end) {
-
- return super.addLocalVariable(name, type, start, end);
+ InstructionHandle end)
+ {
+ return (_allocatorInit) ? addLocalVariable2(name, type, start)
+ : super.addLocalVariable(name, type, start, end);
}
public LocalVariableGen addLocalVariable2(String name, Type type,
- InstructionHandle start) {
+ InstructionHandle start)
+ {
return super.addLocalVariable(name, type,
_slotAllocator.allocateSlot(type),
start, null);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]