You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2007/09/07 18:10:13 UTC

svn commit: r573623 - /ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java

Author: mriou
Date: Fri Sep  7 09:10:12 2007
New Revision: 573623

URL: http://svn.apache.org/viewvc?rev=573623&view=rev
Log:
Fixed forEach, the counter variable wasn't properly created.

Modified:
    ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java

Modified: ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java?rev=573623&r1=573622&r2=573623&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java Fri Sep  7 09:10:12 2007
@@ -33,6 +33,7 @@
 import org.apache.ode.bpel.o.OScope;
 import org.apache.ode.bpel.o.OXsdTypeVarType;
 import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.utils.Namespaces;
 
 /**
  * Generates code for <code>&lt;forEach&gt;</code> activities.
@@ -69,14 +70,17 @@
         if (s.getVariableDecl(forEach.getCounterName()) != null)
             throw new CompilationException(__cmsgs.errForEachAndScopeVariableRedundant(forEach.getCounterName()).setSource(src));
 
-        OXsdTypeVarType counterVarType = new OXsdTypeVarType(_context.getOProcess());
-        counterVarType.xsdType = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "unsignedInt");
-        OScope.Variable countervar = new OScope.Variable(_context.getOProcess(),counterVarType);
-        
+        OXsdTypeVarType counterType = new OXsdTypeVarType(oforEach.getOwner());
+        counterType.simple = true;
+        counterType.xsdType = new QName(Namespaces.XML_SCHEMA, "int");
+        OScope.Variable counterVar = new OScope.Variable(oforEach.getOwner(), counterType);
+        counterVar.name = forEach.getCounterName();
+
         if (__log.isDebugEnabled()) __log.debug("Compiling forEach inner scope.");
-        oforEach.innerScope = _context.compileSLC(forEach.getChild(), new OScope.Variable[]{countervar});
+        oforEach.innerScope = _context.compileSLC(forEach.getChild(), new OScope.Variable[]{counterVar});
 
-        oforEach.counterVariable = oforEach.innerScope.getLocalVariable(forEach.getCounterName());
+        // oforEach.innerScope.addLocalVariable(counterVar);
+        oforEach.counterVariable = counterVar;
     }
 
 }