Skip to content

Commit 456f713

Browse files
authored
Merge pull request #71 from mkantor/rename-utility-function
Rename a utility function
2 parents 6cdf6a9 + f7b921a commit 456f713

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

src/language/semantics/expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const isExpression = (
1414
/^@[^@]/.test(node['0']) &&
1515
(!('1' in node) || typeof node[1] === 'object' || typeof node[1] === 'string')
1616

17-
export const isExpressionWithArgument = <Keyword extends `@${string}`>(
17+
export const isKeywordExpressionWithArgument = <Keyword extends `@${string}`>(
1818
keyword: Keyword,
1919
node: Molecule | SemanticGraph,
2020
): node is {

src/language/semantics/expressions/apply-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import either, { type Either } from '@matt.kantor/either'
22
import type { ElaborationError } from '../../errors.js'
33
import type { Molecule } from '../../parsing.js'
4-
import { isExpressionWithArgument } from '../expression.js'
4+
import { isKeywordExpressionWithArgument } from '../expression.js'
55
import { makeObjectNode, type ObjectNode } from '../object-node.js'
66
import { type SemanticGraph } from '../semantic-graph.js'
77
import { readArgumentsFromExpression } from './expression-utilities.js'
@@ -17,7 +17,7 @@ export type ApplyExpression = ObjectNode & {
1717
export const readApplyExpression = (
1818
node: SemanticGraph | Molecule,
1919
): Either<ElaborationError, ApplyExpression> =>
20-
isExpressionWithArgument('@apply', node)
20+
isKeywordExpressionWithArgument('@apply', node)
2121
? either.map(
2222
readArgumentsFromExpression(node, ['function', 'argument']),
2323
([f, argument]) => makeApplyExpression({ function: f, argument }),

src/language/semantics/expressions/check-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import either, { type Either } from '@matt.kantor/either'
22
import type { ElaborationError } from '../../errors.js'
33
import type { Molecule } from '../../parsing.js'
4-
import { isExpressionWithArgument } from '../expression.js'
4+
import { isKeywordExpressionWithArgument } from '../expression.js'
55
import { makeObjectNode, type ObjectNode } from '../object-node.js'
66
import { type SemanticGraph } from '../semantic-graph.js'
77
import { readArgumentsFromExpression } from './expression-utilities.js'
@@ -17,7 +17,7 @@ export type CheckExpression = ObjectNode & {
1717
export const readCheckExpression = (
1818
node: SemanticGraph | Molecule,
1919
): Either<ElaborationError, CheckExpression> =>
20-
isExpressionWithArgument('@check', node)
20+
isKeywordExpressionWithArgument('@check', node)
2121
? either.map(
2222
readArgumentsFromExpression(node, ['value', 'type']),
2323
([value, type]) => makeCheckExpression({ value, type }),

src/language/semantics/expressions/function-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import either, { type Either } from '@matt.kantor/either'
22
import type { ElaborationError } from '../../errors.js'
33
import type { Atom, Molecule } from '../../parsing.js'
4-
import { isExpressionWithArgument } from '../expression.js'
4+
import { isKeywordExpressionWithArgument } from '../expression.js'
55
import { makeObjectNode, type ObjectNode } from '../object-node.js'
66
import { serialize, type SemanticGraph } from '../semantic-graph.js'
77
import {
@@ -20,7 +20,7 @@ export type FunctionExpression = ObjectNode & {
2020
export const readFunctionExpression = (
2121
node: SemanticGraph | Molecule,
2222
): Either<ElaborationError, FunctionExpression> =>
23-
isExpressionWithArgument('@function', node)
23+
isKeywordExpressionWithArgument('@function', node)
2424
? either.flatMap(
2525
readArgumentsFromExpression(node, ['parameter', 'body']),
2626
([parameter, body]): Either<ElaborationError, FunctionExpression> =>

src/language/semantics/expressions/if-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import either, { type Either } from '@matt.kantor/either'
22
import type { ElaborationError } from '../../errors.js'
33
import type { Molecule } from '../../parsing.js'
4-
import { isExpressionWithArgument } from '../expression.js'
4+
import { isKeywordExpressionWithArgument } from '../expression.js'
55
import { makeObjectNode, type ObjectNode } from '../object-node.js'
66
import { type SemanticGraph } from '../semantic-graph.js'
77
import { readArgumentsFromExpression } from './expression-utilities.js'
@@ -19,7 +19,7 @@ export type IfExpression = ObjectNode & {
1919
export const readIfExpression = (
2020
node: SemanticGraph | Molecule,
2121
): Either<ElaborationError, IfExpression> =>
22-
isExpressionWithArgument('@if', node)
22+
isKeywordExpressionWithArgument('@if', node)
2323
? either.map(
2424
readArgumentsFromExpression(node, ['condition', 'then', 'else']),
2525
([condition, then, otherwise]) =>

src/language/semantics/expressions/index-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import either, { type Either } from '@matt.kantor/either'
22
import type { ElaborationError } from '../../errors.js'
33
import type { Molecule } from '../../parsing.js'
4-
import { isExpressionWithArgument } from '../expression.js'
4+
import { isKeywordExpressionWithArgument } from '../expression.js'
55
import { keyPathFromObjectNodeOrMolecule } from '../key-path.js'
66
import {
77
isObjectNode,
@@ -25,7 +25,7 @@ export type IndexExpression = ObjectNode & {
2525
export const readIndexExpression = (
2626
node: SemanticGraph | Molecule,
2727
): Either<ElaborationError, IndexExpression> =>
28-
isExpressionWithArgument('@index', node)
28+
isKeywordExpressionWithArgument('@index', node)
2929
? either.flatMap(
3030
readArgumentsFromExpression(node, ['object', 'query']),
3131
([o, q]) => {

src/language/semantics/expressions/lookup-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import either, { type Either } from '@matt.kantor/either'
22
import type { ElaborationError } from '../../errors.js'
33
import type { Atom, Molecule } from '../../parsing.js'
4-
import { isExpressionWithArgument } from '../expression.js'
4+
import { isKeywordExpressionWithArgument } from '../expression.js'
55
import { keyPathToMolecule, type NonEmptyKeyPath } from '../key-path.js'
66
import { makeObjectNode, type ObjectNode } from '../object-node.js'
77
import {
@@ -24,7 +24,7 @@ export type LookupExpression = ObjectNode & {
2424
export const readLookupExpression = (
2525
node: SemanticGraph | Molecule,
2626
): Either<ElaborationError, LookupExpression> =>
27-
isExpressionWithArgument('@lookup', node)
27+
isKeywordExpressionWithArgument('@lookup', node)
2828
? either.flatMap(readArgumentsFromExpression(node, ['key']), ([key]) => {
2929
if (typeof key !== 'string') {
3030
return either.makeLeft({

src/language/semantics/expressions/runtime-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import either, { type Either } from '@matt.kantor/either'
22
import type { ElaborationError } from '../../errors.js'
33
import type { Molecule } from '../../parsing.js'
4-
import { isExpressionWithArgument } from '../expression.js'
4+
import { isKeywordExpressionWithArgument } from '../expression.js'
55
import { isFunctionNode } from '../function-node.js'
66
import { makeObjectNode, type ObjectNode } from '../object-node.js'
77
import {
@@ -23,7 +23,7 @@ export type RuntimeExpression = ObjectNode & {
2323
export const readRuntimeExpression = (
2424
node: SemanticGraph | Molecule,
2525
): Either<ElaborationError, RuntimeExpression> =>
26-
isExpressionWithArgument('@runtime', node)
26+
isKeywordExpressionWithArgument('@runtime', node)
2727
? either.flatMap(readArgumentsFromExpression(node, ['function']), ([f]) => {
2828
const runtimeFunction = asSemanticGraph(f)
2929
if (

0 commit comments

Comments
 (0)