[Swift-commit] r3241 - trunk/src/org/griphyn/vdl/engine

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Feb 17 15:58:11 CST 2010


Author: hategan
Date: 2010-02-17 15:58:11 -0600 (Wed, 17 Feb 2010)
New Revision: 3241

Modified:
   trunk/src/org/griphyn/vdl/engine/Karajan.java
Log:
set selfclose attribute if this foreach is iterating on a variable which is written to in the body of the foreach

Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java
===================================================================
--- trunk/src/org/griphyn/vdl/engine/Karajan.java	2010-02-17 21:56:59 UTC (rev 3240)
+++ trunk/src/org/griphyn/vdl/engine/Karajan.java	2010-02-17 21:58:11 UTC (rev 3241)
@@ -743,11 +743,15 @@
 			statementsForSymbols(foreach.getBody(), innerScope);
 			statements(foreach.getBody(), innerScope);
 
+			String inVar = (String) inST.getAttribute("var");
 			Object statementID = new Integer(callID++);
 			Iterator scopeIterator = innerScope.getVariableIterator();
 			while(scopeIterator.hasNext()) {
 				String v=(String) scopeIterator.next();
 				scope.addWriter(v, statementID, true);
+				if (v.equals(inVar) && !innerScope.isVariableLocallyDefined(v)) {
+				    foreachST.setAttribute("selfClose", "true");
+				}
 			}
 			scope.appendStatement(foreachST);
 		} catch(CompilationException re) {




More information about the Swift-commit mailing list