@malloydata/malloy 0.0.427 → 0.0.428
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.
- package/dist/lang/ast/expressions/apply.d.ts +1 -1
- package/dist/lang/ast/expressions/apply.js +2 -2
- package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-boolean.js +1 -1
- package/dist/lang/ast/expressions/binary-numeric.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-numeric.js +1 -1
- package/dist/lang/ast/expressions/boolean.d.ts +1 -1
- package/dist/lang/ast/expressions/boolean.js +1 -1
- package/dist/lang/ast/expressions/case.d.ts +1 -1
- package/dist/lang/ast/expressions/case.js +1 -1
- package/dist/lang/ast/expressions/constant-expression.d.ts +2 -1
- package/dist/lang/ast/expressions/constant-expression.js +6 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.js +14 -7
- package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-alternation-tree.js +1 -1
- package/dist/lang/ast/expressions/expr-array-literal.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-array-literal.js +1 -1
- package/dist/lang/ast/expressions/expr-cast.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-cast.js +1 -1
- package/dist/lang/ast/expressions/expr-coalesce.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-coalesce.js +1 -1
- package/dist/lang/ast/expressions/expr-compare.d.ts +4 -4
- package/dist/lang/ast/expressions/expr-compare.js +4 -4
- package/dist/lang/ast/expressions/expr-count.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-count.js +1 -1
- package/dist/lang/ast/expressions/expr-filter-expr.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-filter-expr.js +1 -1
- package/dist/lang/ast/expressions/expr-func.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-func.js +1 -1
- package/dist/lang/ast/expressions/expr-given.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-given.js +1 -1
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
- package/dist/lang/ast/expressions/expr-id-reference.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-id-reference.js +1 -1
- package/dist/lang/ast/expressions/expr-minus.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-minus.js +1 -1
- package/dist/lang/ast/expressions/expr-not.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-not.js +1 -1
- package/dist/lang/ast/expressions/expr-now.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-now.js +1 -1
- package/dist/lang/ast/expressions/expr-null.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-null.js +14 -9
- package/dist/lang/ast/expressions/expr-number.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-number.js +1 -1
- package/dist/lang/ast/expressions/expr-parens.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-parens.js +5 -2
- package/dist/lang/ast/expressions/expr-props.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-props.js +1 -1
- package/dist/lang/ast/expressions/expr-record-literal.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-record-literal.js +1 -1
- package/dist/lang/ast/expressions/expr-regex.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-regex.js +1 -1
- package/dist/lang/ast/expressions/expr-string.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-string.js +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.js +1 -1
- package/dist/lang/ast/expressions/expr-time.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-time.js +1 -1
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-ungroup.js +1 -1
- package/dist/lang/ast/expressions/for-range.d.ts +1 -1
- package/dist/lang/ast/expressions/for-range.js +1 -1
- package/dist/lang/ast/expressions/partial-compare.d.ts +1 -1
- package/dist/lang/ast/expressions/partial-compare.js +1 -1
- package/dist/lang/ast/expressions/pick-when.d.ts +1 -1
- package/dist/lang/ast/expressions/pick-when.js +1 -1
- package/dist/lang/ast/expressions/range.d.ts +1 -1
- package/dist/lang/ast/expressions/range.js +1 -1
- package/dist/lang/ast/expressions/time-literal.d.ts +2 -2
- package/dist/lang/ast/expressions/time-literal.js +2 -2
- package/dist/lang/ast/field-space/parameter-space.d.ts +1 -0
- package/dist/lang/ast/field-space/parameter-space.js +6 -0
- package/dist/lang/ast/field-space/passthrough-space.d.ts +1 -0
- package/dist/lang/ast/field-space/passthrough-space.js +3 -0
- package/dist/lang/ast/field-space/static-space.d.ts +8 -0
- package/dist/lang/ast/field-space/static-space.js +14 -0
- package/dist/lang/ast/query-builders/index-builder.js +1 -1
- package/dist/lang/ast/query-properties/drill.d.ts +1 -1
- package/dist/lang/ast/query-properties/drill.js +1 -1
- package/dist/lang/ast/types/expression-def.d.ts +50 -23
- package/dist/lang/ast/types/expression-def.js +127 -65
- package/dist/lang/ast/types/field-space.d.ts +14 -0
- package/dist/lang/ast/types/field-space.js +36 -0
- package/dist/model/malloy_types.d.ts +0 -13
- package/dist/model/malloy_types.js +0 -19
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -39,7 +39,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.ExprDuration = exports.ExpressionDef = exports.ATNodeType = void 0;
|
|
41
41
|
exports.getMorphicValue = getMorphicValue;
|
|
42
|
-
exports.applyBinary = applyBinary;
|
|
43
42
|
exports.checkFilterExpression = checkFilterExpression;
|
|
44
43
|
const malloy_types_1 = require("../../../model/malloy_types");
|
|
45
44
|
const TDU = __importStar(require("../typedesc-utils"));
|
|
@@ -52,6 +51,31 @@ const binary_operators_1 = require("./binary_operators");
|
|
|
52
51
|
const malloy_filter_1 = require("@malloydata/malloy-filter");
|
|
53
52
|
class TypeMismatch extends Error {
|
|
54
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Mark a value as belonging to everyone. Writing into a memoized value writes
|
|
56
|
+
* into every other holder's copy and into whatever the IR already stored;
|
|
57
|
+
* freezing turns that from a silent miscompile into a TypeError naming the
|
|
58
|
+
* line which did it. Own fields only -- walking every Expr on every
|
|
59
|
+
* evaluation would cost more than the memo saves.
|
|
60
|
+
*/
|
|
61
|
+
function shareable(v) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
Object.freeze(v);
|
|
64
|
+
for (const share of [
|
|
65
|
+
v.value,
|
|
66
|
+
v.morphic,
|
|
67
|
+
v.refSummary,
|
|
68
|
+
(_a = v.refSummary) === null || _a === void 0 ? void 0 : _a.fieldUsage,
|
|
69
|
+
(_b = v.refSummary) === null || _b === void 0 ? void 0 : _b.givenUsage,
|
|
70
|
+
v.requiresGroupBy,
|
|
71
|
+
v.ungroupings,
|
|
72
|
+
]) {
|
|
73
|
+
if (share !== undefined) {
|
|
74
|
+
Object.freeze(share);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return v;
|
|
78
|
+
}
|
|
55
79
|
/** Node types in an alternation tree */
|
|
56
80
|
var ATNodeType;
|
|
57
81
|
(function (ATNodeType) {
|
|
@@ -62,9 +86,9 @@ var ATNodeType;
|
|
|
62
86
|
})(ATNodeType || (exports.ATNodeType = ATNodeType = {}));
|
|
63
87
|
/**
|
|
64
88
|
* Root node for any element in an expression. These essentially
|
|
65
|
-
* create a sub-tree in the larger AST.
|
|
66
|
-
*
|
|
67
|
-
*
|
|
89
|
+
* create a sub-tree in the larger AST. An ExpressionDef, when
|
|
90
|
+
* given a FieldSpace, can be evaluated to produce an ExprValue
|
|
91
|
+
* which is the IR for an Expr along with its type and other metadata.
|
|
68
92
|
*/
|
|
69
93
|
class ExpressionDef extends malloy_element_1.MalloyElement {
|
|
70
94
|
constructor() {
|
|
@@ -74,6 +98,53 @@ class ExpressionDef extends malloy_element_1.MalloyElement {
|
|
|
74
98
|
granular() {
|
|
75
99
|
return false;
|
|
76
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns the "translation" or Expr tree for SQL generation. When asking
|
|
103
|
+
* for a translation you may pass the types you can accept, allowing
|
|
104
|
+
* the translation code a chance to convert to match your expectations
|
|
105
|
+
* @param space Namespace for looking up field references
|
|
106
|
+
*
|
|
107
|
+
* THE RETURNED ExprValue IS SHARED -- TREAT IT AS IMMUTABLE. Asking twice
|
|
108
|
+
* yields the same object, so to derive a value from one, build a new one:
|
|
109
|
+
* `{...operand, type: 'boolean'}` or `computedExprValue({…, from: [operand]})`.
|
|
110
|
+
*
|
|
111
|
+
* DO NOT OVERRIDE THIS. Nodes implement `computeExpression`; an override
|
|
112
|
+
* here bypasses the memo, which for `+`/`-` chains is the difference
|
|
113
|
+
* between linear and exponential compile time.
|
|
114
|
+
*/
|
|
115
|
+
getExpression(fs) {
|
|
116
|
+
const initialGeneration = fs.generation();
|
|
117
|
+
if (this.memoValue !== undefined &&
|
|
118
|
+
this.memoFs === fs &&
|
|
119
|
+
this.memoGen === initialGeneration) {
|
|
120
|
+
return this.memoValue;
|
|
121
|
+
}
|
|
122
|
+
// If we get here and memoFs is set and memoGen is not set, then somewhere
|
|
123
|
+
// inside this expression is a recursive call asking this node for the
|
|
124
|
+
// value it is in the middle of computing. There is nothing to return and
|
|
125
|
+
// computing one would recurse again, so throw. An abandoned computation
|
|
126
|
+
// does not look like this -- see the finally below.
|
|
127
|
+
if (this.memoFs !== undefined && this.memoGen === undefined) {
|
|
128
|
+
throw this.internalError(`ExpressionDef.getExpression memoization failure on ${this.elementType}`);
|
|
129
|
+
}
|
|
130
|
+
this.memoFs = fs;
|
|
131
|
+
this.memoGen = undefined;
|
|
132
|
+
try {
|
|
133
|
+
const value = this.computeExpression(fs);
|
|
134
|
+
if (initialGeneration === fs.generation()) {
|
|
135
|
+
this.memoGen = initialGeneration;
|
|
136
|
+
this.memoValue = shareable(value);
|
|
137
|
+
}
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
if (this.memoGen === undefined) {
|
|
142
|
+
// Threw, or a name was rebound while we ran. Leave no stamp: a caller
|
|
143
|
+
// which recovers must get a fresh computation, not our remains.
|
|
144
|
+
this.memoFs = undefined;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
77
148
|
/**
|
|
78
149
|
* Some operators want to give the right hand value a chance to
|
|
79
150
|
* rewrite itself. This requests a translation for a rewrite,
|
|
@@ -110,17 +181,38 @@ class ExpressionDef extends malloy_element_1.MalloyElement {
|
|
|
110
181
|
return undefined;
|
|
111
182
|
}
|
|
112
183
|
/**
|
|
113
|
-
* This is the operation which makes partial comparison and value trees work
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* the
|
|
184
|
+
* This is the operation which makes partial comparison and value trees work.
|
|
185
|
+
* `this` is the RIGHT operand; the left arrives here as an argument. All of
|
|
186
|
+
* the magic of malloy expressions eventually flows through here, where an
|
|
187
|
+
* operator is applied to two values -- depending on the operator and the
|
|
188
|
+
* value types that may transform the values or even the operator.
|
|
189
|
+
*
|
|
190
|
+
* Specialized nodes like alternation trees and partial comparisons override
|
|
191
|
+
* this to control how the application gets generated. They are the reason
|
|
192
|
+
* the right operand is in charge: a partial has no bound left operand, and
|
|
193
|
+
* only learns it here.
|
|
117
194
|
* @param fs The symbol table
|
|
118
195
|
* @param op The operator being applied
|
|
119
|
-
* @param
|
|
196
|
+
* @param left The "other" (besides 'this') value
|
|
120
197
|
* @return The translated expression
|
|
121
198
|
*/
|
|
122
199
|
apply(fs, op, left, _warnOnComplexTree = false) {
|
|
123
|
-
|
|
200
|
+
if ((0, binary_operators_1.isEquality)(op)) {
|
|
201
|
+
return equality(fs, left, op, this);
|
|
202
|
+
}
|
|
203
|
+
if ((0, binary_operators_1.isComparison)(op)) {
|
|
204
|
+
return compare(fs, left, op, this);
|
|
205
|
+
}
|
|
206
|
+
if (op === '+' || op === '-') {
|
|
207
|
+
return delta(fs, left, op, this);
|
|
208
|
+
}
|
|
209
|
+
if (op === '*') {
|
|
210
|
+
return numeric(fs, left, op, this);
|
|
211
|
+
}
|
|
212
|
+
if (op === '/' || op === '%') {
|
|
213
|
+
return divmod(fs, left, op, this);
|
|
214
|
+
}
|
|
215
|
+
return left.loggedErrorExpr('unexpected-binary-operator', `Cannot use ${op} operator here`);
|
|
124
216
|
}
|
|
125
217
|
canSupportPartitionBy() {
|
|
126
218
|
return false;
|
|
@@ -178,7 +270,7 @@ class ExprDuration extends ExpressionDef {
|
|
|
178
270
|
}
|
|
179
271
|
return super.apply(fs, op, left);
|
|
180
272
|
}
|
|
181
|
-
|
|
273
|
+
computeExpression(fs) {
|
|
182
274
|
const num = this.n.getExpression(fs);
|
|
183
275
|
return (0, expr_value_1.computedErrorExprValue)({
|
|
184
276
|
dataType: { type: 'duration' },
|
|
@@ -402,6 +494,30 @@ function numeric(fs, left, op, right) {
|
|
|
402
494
|
}
|
|
403
495
|
return (0, ast_utils_1.errorFor)('numbers required');
|
|
404
496
|
}
|
|
497
|
+
function divmod(fs, left, op, right) {
|
|
498
|
+
const num = left.getExpression(fs);
|
|
499
|
+
const denom = right.getExpression(fs);
|
|
500
|
+
const noGo = unsupportError(left, num, right, denom);
|
|
501
|
+
if (noGo)
|
|
502
|
+
return noGo;
|
|
503
|
+
const err = errorCascade('number', num, denom);
|
|
504
|
+
if (err)
|
|
505
|
+
return err;
|
|
506
|
+
if (num.type !== 'number') {
|
|
507
|
+
left.logError('arithmetic-operation-type-mismatch', 'Numerator must be a number');
|
|
508
|
+
}
|
|
509
|
+
else if (denom.type !== 'number') {
|
|
510
|
+
right.logError('arithmetic-operation-type-mismatch', 'Denominator must be a number');
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
return (0, expr_value_1.computedExprValue)({
|
|
514
|
+
dataType: mergeNumberTypes(num, denom, op),
|
|
515
|
+
value: { node: op, kids: { left: num.value, right: denom.value } },
|
|
516
|
+
from: [num, denom],
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
return (0, ast_utils_1.errorFor)('divide type mismatch');
|
|
520
|
+
}
|
|
405
521
|
function delta(fs, left, op, right) {
|
|
406
522
|
const lhs = left.getExpression(fs);
|
|
407
523
|
const rhs = right.getExpression(fs);
|
|
@@ -430,60 +546,6 @@ function delta(fs, left, op, right) {
|
|
|
430
546
|
}
|
|
431
547
|
return numeric(fs, left, op, right);
|
|
432
548
|
}
|
|
433
|
-
/**
|
|
434
|
-
* All of the magic of malloy expressions eventually flows to here,
|
|
435
|
-
* where an operator is applied to two values. Depending on the
|
|
436
|
-
* operator and value types this may involve transformations of
|
|
437
|
-
* the values or even the operator.
|
|
438
|
-
* @param fs FieldSpace for the symbols
|
|
439
|
-
* @param left Left value
|
|
440
|
-
* @param op The operator
|
|
441
|
-
* @param right Right Value
|
|
442
|
-
* @return ExprValue of the expression
|
|
443
|
-
*/
|
|
444
|
-
function applyBinary(fs, left, op, right) {
|
|
445
|
-
if ((0, binary_operators_1.isEquality)(op)) {
|
|
446
|
-
return equality(fs, left, op, right);
|
|
447
|
-
}
|
|
448
|
-
if ((0, binary_operators_1.isComparison)(op)) {
|
|
449
|
-
return compare(fs, left, op, right);
|
|
450
|
-
}
|
|
451
|
-
if (op === '+' || op === '-') {
|
|
452
|
-
return delta(fs, left, op, right);
|
|
453
|
-
}
|
|
454
|
-
if (op === '*') {
|
|
455
|
-
return numeric(fs, left, op, right);
|
|
456
|
-
}
|
|
457
|
-
if (op === '/' || op === '%') {
|
|
458
|
-
const num = left.getExpression(fs);
|
|
459
|
-
const denom = right.getExpression(fs);
|
|
460
|
-
const noGo = unsupportError(left, num, right, denom);
|
|
461
|
-
if (noGo)
|
|
462
|
-
return noGo;
|
|
463
|
-
const err = errorCascade('number', num, denom);
|
|
464
|
-
if (err)
|
|
465
|
-
return err;
|
|
466
|
-
if (num.type !== 'number') {
|
|
467
|
-
left.logError('arithmetic-operation-type-mismatch', 'Numerator must be a number');
|
|
468
|
-
}
|
|
469
|
-
else if (denom.type !== 'number') {
|
|
470
|
-
right.logError('arithmetic-operation-type-mismatch', 'Denominator must be a number');
|
|
471
|
-
}
|
|
472
|
-
else {
|
|
473
|
-
const divmod = {
|
|
474
|
-
node: op,
|
|
475
|
-
kids: { left: num.value, right: denom.value },
|
|
476
|
-
};
|
|
477
|
-
return (0, expr_value_1.computedExprValue)({
|
|
478
|
-
dataType: mergeNumberTypes(num, denom, op),
|
|
479
|
-
value: divmod,
|
|
480
|
-
from: [num, denom],
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
return (0, ast_utils_1.errorFor)('divide type mismatch');
|
|
484
|
-
}
|
|
485
|
-
return left.loggedErrorExpr('unexpected-binary-operator', `Cannot use ${op} operator here`);
|
|
486
|
-
}
|
|
487
549
|
function errorCascade(type, ...es) {
|
|
488
550
|
if (es.some(e => e.type === 'error')) {
|
|
489
551
|
return (0, expr_value_1.computedExprValue)({
|
|
@@ -4,6 +4,14 @@ import type { QueryOperationSpace } from '../field-space/query-spaces';
|
|
|
4
4
|
import type { LookupResult } from './lookup-result';
|
|
5
5
|
import { MalloyElement } from './malloy-element';
|
|
6
6
|
import type { SpaceEntry } from './space-entry';
|
|
7
|
+
export declare function currentGeneration(): number;
|
|
8
|
+
/**
|
|
9
|
+
* Called by every field space operation that binds, rebinds or unbinds a
|
|
10
|
+
* name. Lazily materializing a space's entries from its StructDef is not
|
|
11
|
+
* such an operation -- the bindings were already logically present, so
|
|
12
|
+
* nothing a cache observed can have changed.
|
|
13
|
+
*/
|
|
14
|
+
export declare function noteRebinding(): void;
|
|
7
15
|
/**
|
|
8
16
|
* A FieldSpace is a hierarchy of namespaces, where the leaf nodes
|
|
9
17
|
* are fields. A FieldSpace can lookup fields, and generate a StructDef
|
|
@@ -20,6 +28,12 @@ export interface FieldSpace {
|
|
|
20
28
|
connectionName(): string;
|
|
21
29
|
isQueryFieldSpace(): this is QueryFieldSpace;
|
|
22
30
|
accessProtectionLevel(): AccessModifierLabel;
|
|
31
|
+
/**
|
|
32
|
+
* A value which changes whenever any name binding changes. A result
|
|
33
|
+
* computed by consulting this space may be reused only while this is
|
|
34
|
+
* unchanged. See `noteRebinding` above.
|
|
35
|
+
*/
|
|
36
|
+
generation(): number;
|
|
23
37
|
}
|
|
24
38
|
export interface SourceFieldSpace extends FieldSpace {
|
|
25
39
|
structDef(): SourceDef;
|
|
@@ -5,7 +5,43 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.FieldName = void 0;
|
|
8
|
+
exports.currentGeneration = currentGeneration;
|
|
9
|
+
exports.noteRebinding = noteRebinding;
|
|
8
10
|
const malloy_element_1 = require("./malloy-element");
|
|
11
|
+
/**
|
|
12
|
+
* Some field spaces are static, some are dynamic. We are computing a very
|
|
13
|
+
* conservative process wide "generation" which moves forward when any
|
|
14
|
+
* dynamic field space changes. We can be very certain that if the field space
|
|
15
|
+
* generation has not changed, computations depending on the contents of
|
|
16
|
+
* field spaces are still valid.
|
|
17
|
+
*
|
|
18
|
+
* A more fine grained validity is hard to compute and possibly a fragile
|
|
19
|
+
* computation. Spaces delegate to each other -- a passthrough wraps another
|
|
20
|
+
* space, a query output space resolves names through its input space -- so a
|
|
21
|
+
* per-space generation has to forward through every one of those paths, and a
|
|
22
|
+
* path we missed is a stale cache we never notice. We think this simple
|
|
23
|
+
* approach will be good enough for a long time, possibly forever.
|
|
24
|
+
*
|
|
25
|
+
* This does not cover a computation which reads something other than a field
|
|
26
|
+
* space. `GivenReference` ignores the FieldSpace it is handed and reads the
|
|
27
|
+
* Document namespace, which never moves this counter. Nothing is known to
|
|
28
|
+
* depend on that, since document definitions happen between statements, but
|
|
29
|
+
* do not assume a cache is covered here just because it consults a field
|
|
30
|
+
* space as well.
|
|
31
|
+
*/
|
|
32
|
+
let bindingGeneration = 0;
|
|
33
|
+
function currentGeneration() {
|
|
34
|
+
return bindingGeneration;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Called by every field space operation that binds, rebinds or unbinds a
|
|
38
|
+
* name. Lazily materializing a space's entries from its StructDef is not
|
|
39
|
+
* such an operation -- the bindings were already logically present, so
|
|
40
|
+
* nothing a cache observed can have changed.
|
|
41
|
+
*/
|
|
42
|
+
function noteRebinding() {
|
|
43
|
+
bindingGeneration += 1;
|
|
44
|
+
}
|
|
9
45
|
class FieldName extends malloy_element_1.MalloyElement {
|
|
10
46
|
constructor(name) {
|
|
11
47
|
super();
|
|
@@ -801,19 +801,6 @@ export declare function mkRefSummary({ fieldUsage, givenUsage, }: {
|
|
|
801
801
|
* untouched without each call site having to know about them.
|
|
802
802
|
*/
|
|
803
803
|
export declare function mapFieldUsage(rs: RefSummary | undefined, fn: (u: FieldUsageEntry) => FieldUsageEntry): RefSummary | undefined;
|
|
804
|
-
/**
|
|
805
|
-
* Mutating setter for a node's `fieldUsage`. When the node already has a
|
|
806
|
-
* `refSummary`, replaces just the `fieldUsage` slice (preserving `givenUsage`
|
|
807
|
-
* and any future RefSummary fields). When it doesn't, creates a fresh
|
|
808
|
-
* `refSummary` with the supplied usages.
|
|
809
|
-
*
|
|
810
|
-
* Use at sites that mutate an already-constructed IR node; for sites that
|
|
811
|
-
* build a node from a literal, write `{fieldUsage: [...]}` directly or use
|
|
812
|
-
* `mkRefSummary` for possibly-undefined inputs.
|
|
813
|
-
*/
|
|
814
|
-
export declare function setFieldUsage(target: {
|
|
815
|
-
refSummary?: RefSummary;
|
|
816
|
-
}, usages: FieldUsage): void;
|
|
817
804
|
export interface QuerySegment extends Filtered, Ordered, SegmentUsageSummary {
|
|
818
805
|
type: 'reduce' | 'project' | 'partial';
|
|
819
806
|
queryFields: QueryFieldDef[];
|
|
@@ -64,7 +64,6 @@ exports.fieldUsageFrom = fieldUsageFrom;
|
|
|
64
64
|
exports.givenUsageFrom = givenUsageFrom;
|
|
65
65
|
exports.mkRefSummary = mkRefSummary;
|
|
66
66
|
exports.mapFieldUsage = mapFieldUsage;
|
|
67
|
-
exports.setFieldUsage = setFieldUsage;
|
|
68
67
|
exports.isSegmentSQL = isSegmentSQL;
|
|
69
68
|
exports.isSegmentSource = isSegmentSource;
|
|
70
69
|
exports.isSourceRegistryReference = isSourceRegistryReference;
|
|
@@ -491,24 +490,6 @@ function mkRefSummary({ fieldUsage, givenUsage, }) {
|
|
|
491
490
|
function mapFieldUsage(rs, fn) {
|
|
492
491
|
return rs && { ...rs, fieldUsage: rs.fieldUsage.map(fn) };
|
|
493
492
|
}
|
|
494
|
-
/**
|
|
495
|
-
* Mutating setter for a node's `fieldUsage`. When the node already has a
|
|
496
|
-
* `refSummary`, replaces just the `fieldUsage` slice (preserving `givenUsage`
|
|
497
|
-
* and any future RefSummary fields). When it doesn't, creates a fresh
|
|
498
|
-
* `refSummary` with the supplied usages.
|
|
499
|
-
*
|
|
500
|
-
* Use at sites that mutate an already-constructed IR node; for sites that
|
|
501
|
-
* build a node from a literal, write `{fieldUsage: [...]}` directly or use
|
|
502
|
-
* `mkRefSummary` for possibly-undefined inputs.
|
|
503
|
-
*/
|
|
504
|
-
function setFieldUsage(target, usages) {
|
|
505
|
-
if (target.refSummary) {
|
|
506
|
-
target.refSummary.fieldUsage = usages;
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
target.refSummary = { fieldUsage: usages };
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
493
|
function isSegmentSQL(f) {
|
|
513
494
|
return 'sql' in f;
|
|
514
495
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.428";
|
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.428';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.428",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@malloydata/malloy-filter": "0.0.
|
|
55
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
56
|
-
"@malloydata/malloy-tag": "0.0.
|
|
54
|
+
"@malloydata/malloy-filter": "0.0.428",
|
|
55
|
+
"@malloydata/malloy-interfaces": "0.0.428",
|
|
56
|
+
"@malloydata/malloy-tag": "0.0.428",
|
|
57
57
|
"@noble/hashes": "^1.8.0",
|
|
58
58
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
59
59
|
"assert": "^2.0.0",
|