@malloydata/malloy 0.0.208 → 0.0.209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -100,31 +100,28 @@ class ExprFunc extends expression_def_1.ExpressionDef {
|
|
|
100
100
|
return { found: func, error: undefined };
|
|
101
101
|
}
|
|
102
102
|
getPropsExpression(fs, props) {
|
|
103
|
-
var _a, _b, _c
|
|
103
|
+
var _a, _b, _c;
|
|
104
104
|
const argExprsWithoutImplicit = this.args.map(arg => arg.getExpression(fs));
|
|
105
105
|
if (this.isRaw) {
|
|
106
|
-
let collectType;
|
|
107
106
|
const funcCall = [`${this.name}(`];
|
|
108
|
-
|
|
109
|
-
if (
|
|
107
|
+
argExprsWithoutImplicit.forEach((expr, i) => {
|
|
108
|
+
if (i !== 0) {
|
|
110
109
|
funcCall.push(',');
|
|
111
110
|
}
|
|
112
|
-
else {
|
|
113
|
-
if ((0, malloy_types_1.isCastType)(expr.type)) {
|
|
114
|
-
collectType = expr.type;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
111
|
funcCall.push(expr.value);
|
|
118
|
-
}
|
|
112
|
+
});
|
|
119
113
|
funcCall.push(')');
|
|
120
|
-
const
|
|
114
|
+
const inferredType = (_a = argExprsWithoutImplicit[0]) !== null && _a !== void 0 ? _a : { type: 'number' };
|
|
115
|
+
const dataType = this.rawType
|
|
116
|
+
? { type: this.rawType }
|
|
117
|
+
: inferredType;
|
|
121
118
|
return (0, expr_value_1.computedExprValue)({
|
|
122
|
-
dataType
|
|
119
|
+
dataType,
|
|
123
120
|
value: (0, utils_1.composeSQLExpr)(funcCall),
|
|
124
121
|
from: argExprsWithoutImplicit,
|
|
125
122
|
});
|
|
126
123
|
}
|
|
127
|
-
const dialect = (
|
|
124
|
+
const dialect = (_b = fs.dialectObj()) === null || _b === void 0 ? void 0 : _b.name;
|
|
128
125
|
const { found: func, error } = this.findFunctionDef(dialect);
|
|
129
126
|
if (func === undefined) {
|
|
130
127
|
return (0, ast_utils_1.errorFor)(error);
|
|
@@ -132,7 +129,7 @@ class ExprFunc extends expression_def_1.ExpressionDef {
|
|
|
132
129
|
// Find the 'implicit argument' for aggregate functions called like `some_join.some_field.agg(...args)`
|
|
133
130
|
// where the full arg list is `(some_field, ...args)`.
|
|
134
131
|
let implicitExpr = undefined;
|
|
135
|
-
let structPath = (
|
|
132
|
+
let structPath = (_c = this.source) === null || _c === void 0 ? void 0 : _c.path;
|
|
136
133
|
if (this.source) {
|
|
137
134
|
const lookup = this.source.getField(fs);
|
|
138
135
|
const sourceFoot = lookup.found;
|
|
@@ -61,6 +61,9 @@ describe('expressions', () => {
|
|
|
61
61
|
test('function call', () => {
|
|
62
62
|
expect((0, test_translator_1.expr) `concat('foo')`).toTranslate();
|
|
63
63
|
});
|
|
64
|
+
test('raw function call codegen', () => {
|
|
65
|
+
expect((0, test_translator_1.expr) `special_function!(aweird, 'foo')`).compilesTo('special_function({aweird},{"foo"})');
|
|
66
|
+
});
|
|
64
67
|
describe('operators', () => {
|
|
65
68
|
test('addition', () => {
|
|
66
69
|
expect('42 + 7').compilesTo('{42 + 7}');
|
|
@@ -177,6 +177,17 @@ function eToStr(e, symbols) {
|
|
|
177
177
|
.map(o => `${subExpr(o)}`)
|
|
178
178
|
.join(',')}}}`;
|
|
179
179
|
}
|
|
180
|
+
case 'genericSQLExpr': {
|
|
181
|
+
let sql = '';
|
|
182
|
+
let i = 0;
|
|
183
|
+
for (; i < e.kids.args.length; i++) {
|
|
184
|
+
sql += `${e.src[i]}{${subExpr(e.kids.args[i])}}`;
|
|
185
|
+
}
|
|
186
|
+
if (i < e.src.length) {
|
|
187
|
+
sql += e.src[i];
|
|
188
|
+
}
|
|
189
|
+
return sql;
|
|
190
|
+
}
|
|
180
191
|
}
|
|
181
192
|
if ((0, model_1.exprHasKids)(e) && e.kids['left'] && e.kids['right']) {
|
|
182
193
|
return `{${subExpr(e.kids['left'])} ${e.node} ${subExpr(e.kids['right'])}}`;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.209";
|
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MALLOY_VERSION = void 0;
|
|
4
4
|
// generated with 'generate-version-file' script; do not edit manually
|
|
5
|
-
exports.MALLOY_VERSION = '0.0.
|
|
5
|
+
exports.MALLOY_VERSION = '0.0.209';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|