Cleans up ReturnClause
diff --git a/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js b/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
index 1b4f754..4584bcc 100644
--- a/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
+++ b/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
@@ -199,10 +199,6 @@
AQLClause.prototype.val = function() {
var value = this._properties["clause"];
-
- if (this._properties.hasOwnProperty("return")) {
- value += " return " + this._properties["return"].val();
- }
return value;
};
@@ -281,9 +277,13 @@
AQLClause.call(this);
this._properties["clause"] = "return ";
+
if (expression instanceof AExpression || expression instanceof AQLClause) {
this._properties["clause"] += expression.val();
- } else if ( Object.getPrototypeOf( expression ) === Object.prototype ) {
+
+ } else if ( typeof expression == "object" && Object.getPrototypeOf( expression ) === Object.prototype ) {
+
+ // TODO Null object check
this._properties["clause"] += "{";
var returnStatements = [];
@@ -299,19 +299,16 @@
this._properties["clause"] += "}";
} else {
- this._properties["clause"] += new AExpression().set(expression).val();
+ this._properties["clause"] += new AQLClause().set(expression).val();
}
return this;
}
+
ReturnClause.prototype = Object.create(AQLClause.prototype);
ReturnClause.prototype.constructor = ReturnClause;
-ReturnClause.prototype.val = function () {
- return this._properties["clause"];
-};
-
// WhereClause
//