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

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Thu Oct 3 12:39:43 CDT 2013


Author: hategan
Date: 2013-10-03 12:39:43 -0500 (Thu, 03 Oct 2013)
New Revision: 7126

Modified:
   trunk/src/org/griphyn/vdl/engine/Karajan.java
Log:
fix cast exception when array index is a string expression; this was coming from the check for array["*"] which wrongly assumed that if the index is of type string it must be a literal string (merged from 0.94)

Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java
===================================================================
--- trunk/src/org/griphyn/vdl/engine/Karajan.java	2013-10-03 17:35:00 UTC (rev 7125)
+++ trunk/src/org/griphyn/vdl/engine/Karajan.java	2013-10-03 17:39:43 UTC (rev 7126)
@@ -1502,10 +1502,14 @@
 			// and really, at this point type checking should be delegated to the type system
 			// instead of the ad-hoc string comparisons
 			if (datatype(arrayST).equals("string")) {
-                XmlString var = (XmlString) op.getAbstractExpressionArray(1);
-                if (var.getStringValue().equals("*")) {
-                    return parentST;
-                }
+			    XmlObject var = op.getAbstractExpressionArray(1);
+			    // make sure this is array["somestring"] rather than array[otherExpressionOfTypeString]
+			    if (var instanceof XmlString) {
+                    XmlString vars = (XmlString) var;
+                    if (vars.getStringValue().equals("*")) {
+                        return parentST;
+                    }
+			    }
             }
 			
 			if (!indexType.equals(declaredIndexType) 




More information about the Swift-commit mailing list