[Swift-commit] r7076 - branches/release-0.94/src/org/griphyn/vdl/engine
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Mon Sep 16 21:36:25 CDT 2013
Author: hategan
Date: 2013-09-16 21:36:25 -0500 (Mon, 16 Sep 2013)
New Revision: 7076
Modified:
branches/release-0.94/src/org/griphyn/vdl/engine/Karajan.java
Log:
a bit of formatting
Modified: branches/release-0.94/src/org/griphyn/vdl/engine/Karajan.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/engine/Karajan.java 2013-09-17 02:36:01 UTC (rev 7075)
+++ branches/release-0.94/src/org/griphyn/vdl/engine/Karajan.java 2013-09-17 02:36:25 UTC (rev 7076)
@@ -524,32 +524,38 @@
QName expressionQName = new QName(namespaceURI, localName);
if (expressionQName.equals(VARIABLE_REFERENCE_EXPR)) {
paramST.setAttribute("expr", expressionToKarajan(param.getAbstractExpression(), scope));
- }
+ }
else {
- String parameterVariableName="swift#mapper#"+(internedIDCounter++);
+ String parameterVariableName = "swift#mapper#" + (internedIDCounter++);
// make template for variable declaration (need to compute type of this variable too?)
StringTemplate variableDeclarationST = template("variable");
// TODO factorise this and other code in variable()?
StringTemplate pmappingST = new StringTemplate("mapping");
pmappingST.setAttribute("descriptor", "concurrent_mapper");
+
StringTemplate pparamST = template("vdl_parameter");
pparamST.setAttribute("name", "prefix");
pparamST.setAttribute("expr", parameterVariableName + "-" +
UUIDGenerator.getInstance().generateRandomBasedUUID().toString());
pmappingST.setAttribute("params", pparamST);
+
variableDeclarationST.setAttribute("nil", Boolean.TRUE);
variableDeclarationST.setAttribute("name", parameterVariableName);
scope.bodyTemplate.setAttribute("declarations", variableDeclarationST);
- StringTemplate paramValueST=expressionToKarajan(param.getAbstractExpression(),scope);
+
+ StringTemplate paramValueST = expressionToKarajan(param.getAbstractExpression(), scope);
String paramValueType = datatype(paramValueST);
scope.addVariable(parameterVariableName, paramValueType, "Variable", param);
variableDeclarationST.setAttribute("type", paramValueType);
+
StringTemplate variableReferenceST = template("id");
- variableReferenceST.setAttribute("var",parameterVariableName);
+ variableReferenceST.setAttribute("var", parameterVariableName);
+
StringTemplate variableAssignmentST = template("assign");
- variableAssignmentST.setAttribute("var",variableReferenceST);
- variableAssignmentST.setAttribute("value",paramValueST);
+ variableAssignmentST.setAttribute("var", variableReferenceST);
+ variableAssignmentST.setAttribute("value", paramValueST);
scope.appendStatement(variableAssignmentST);
+
if (param.getAbstractExpression().getDomNode().getNodeName().equals("stringConstant")) {
StringTemplate valueST = template("sConst");
valueST.setAttribute("innervalue", param.getAbstractExpression().getDomNode().getFirstChild().getNodeValue());
@@ -1605,7 +1611,7 @@
type = expectedType;
}
else {
- throw new CompilationException("Cannot infer return type of procedure call");
+ throw new CompilationException("Cannot infer return type of procedure call for " + name);
}
}
subscope.addInternalVariable("swift#callintermediate", type, null);
More information about the Swift-commit
mailing list