[Swift-commit] r4739 - trunk/src/org/griphyn/vdl/karajan/lib

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Jul 2 21:09:19 CDT 2011


Author: hategan
Date: 2011-07-02 21:09:19 -0500 (Sat, 02 Jul 2011)
New Revision: 4739

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
Log:
fixed multi-dimensional array assignment

Modified: trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2011-07-03 02:08:41 UTC (rev 4738)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java	2011-07-03 02:09:19 UTC (rev 4739)
@@ -42,9 +42,8 @@
             // is a DSHandle. There is no need (I think? maybe numerical casting?)
             // for type conversion here; but would be useful to have
             // type checking.
-			value.waitFor();
 			
-   			deepCopy(leaf, value, stack);
+   			deepCopy(leaf, value, stack, 0);
 			
 			return null;
 		}
@@ -98,18 +97,19 @@
 	
     /** make dest look like source - if its a simple value, copy that
 	    and if its an array then recursively copy */
-	void deepCopy(DSHandle dest, DSHandle source, VariableStack stack) throws ExecutionException {
+	void deepCopy(DSHandle dest, DSHandle source, VariableStack stack, int level) throws ExecutionException {
+	    ((AbstractDataNode) source).waitFor();
 		if (source.getType().isPrimitive()) {
 			dest.setValue(source.getValue());
 		}
 		else if (source.getType().isArray()) {
 			PairIterator it;
-			if (stack.isDefined("it")) {
-			    it = (PairIterator) stack.getVar("it");
+			if (stack.isDefined("it" + level)) {
+			    it = (PairIterator) stack.getVar("it" + level);
 			}
 			else {
 			    it = new PairIterator(source.getArrayValue());
-			    stack.setVar("it", it);
+			    stack.setVar("it" + level, it);
 			}
 			while (it.hasNext()) {
 				Pair pair = (Pair) it.next();
@@ -129,8 +129,9 @@
 				catch (InvalidPathException ipe) {
 					throw new ExecutionException("Could not get destination field",ipe);
 				}
-				deepCopy(field, rhs, stack);
+				deepCopy(field, rhs, stack, level + 1);
 			}
+			stack.currentFrame().deleteVar("it" + level);
 			dest.closeShallow();
 		} 
 		else if (!source.getType().isComposite()) {
@@ -161,14 +162,11 @@
 		            stack.setVar("fc", fc);
 		            try {
 		                fc.start();
-		                throw new FutureNotYetAvailable(fc);
 		            }
-		            catch (FutureNotYetAvailable e) {
-		                throw e;
-		            }
 		            catch (Exception e) {
 		                throw new ExecutionException("Failed to start file copy", e);
 		            }
+		            throw new FutureNotYetAvailable(fc);
 		        }
 		    }
 		}




More information about the Swift-commit mailing list