Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs/data/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Inline fields on blocks can be loaded using the [field syntax](fields):
```js
// In queries and expressions, you can just reference the field directly:
@block and genre = "Fantasy"
@block and row["last reviewed"] > date(now) - dur(7d)
@block and $row["last reviewed"] > date(now) - dur(7d)

// In javascript, use the field API:
block.value("last reviewed")
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/data/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ You can reference fields directly by name in queries and datacore expressions. T
// You can also reference intrinsic fields (fields prefixed with `$`):
@block and $tags.contains("#test")

// Use the implicit 'row' in order to handle fields with spaces in their names:
@section and row["last reviewed"] >= date(now) - dur(7d)
// Use the implicit '$row' in order to handle fields with spaces in their names:
@section and $row["last reviewed"] >= date(now) - dur(7d)
```

## In Javascript
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/data/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ You can reference page fields in queries and expressions directly by case-insens

```js
@page and rating >= 7
@page and row["spaced field"].contains("thing")
@page and $row["spaced field"].contains("thing")
```

## In Javascript
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/data/sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Inline fields on sections can be loaded using the [field syntax](fields):

```js
// In queries and expressions, you can just reference the field directly:
@section and row["last reviewed"] > date(now) - dur(7d)
@section and $row["last reviewed"] > date(now) - dur(7d)

// In javascript, use the field API:
section.value("last reviewed")
Expand Down
4 changes: 2 additions & 2 deletions src/expression/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ export namespace Expressions {
return op == "<=" || op == "<" || op == ">" || op == ">=" || op == "!=" || op == "=";
}

/** Returns a set of all unbound variables (i.e., variables not provided by `row`, lambdas, or similar.) */
/** Returns a set of all unbound variables (i.e., variables not provided by `$row`, lambdas, or similar.) */
export function unboundVariables(expr: Expression, bound: Set<string> = new Set([ROW])): Set<string> {
switch (expr.type) {
case "binaryop":
// Special case `row["...."]`.
// Special case `$row["...."]`.
if (
expr.op === "index" &&
expr.left.type == "variable" &&
Expand Down