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

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Sep 22 23:42:24 CDT 2012


Author: hategan
Date: 2012-09-22 23:42:23 -0500 (Sat, 22 Sep 2012)
New Revision: 5943

Modified:
   trunk/src/org/griphyn/vdl/engine/Karajan.java
Log:
enforce step being of the same type as to and from

Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java
===================================================================
--- trunk/src/org/griphyn/vdl/engine/Karajan.java	2012-09-20 21:05:59 UTC (rev 5942)
+++ trunk/src/org/griphyn/vdl/engine/Karajan.java	2012-09-23 04:42:23 UTC (rev 5943)
@@ -1440,11 +1440,14 @@
 			if (!fromType.equals(toType)) {
 			    throw new CompilationException("To and from range values must have the same type");
             }
+			if (stepST != null && !datatype(stepST).equals(fromType)) {
+			    throw new CompilationException("Step (" + datatype(stepST) + 
+			            ") must be of the same type as from and to (" + toType + ")");
+			}
 			if (stepST == null && (!fromType.equals("int") || !toType.equals("int"))) {
 				throw new CompilationException("Step in range specification can be omitted only when from and to types are int");
 			}
-			else if ((fromType.equals("int") && toType.equals("int")) &&
-					(stepST == null || datatype(stepST).equals("int"))) {
+			else if (fromType.equals("int") && toType.equals("int")) {
 				st.setAttribute("datatype", "int[int]");
 			}
 			else if (fromType.equals("float") && toType.equals("float") &&




More information about the Swift-commit mailing list