Skip to content

Commit

Permalink
rename meaning to call
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Aug 1, 2023
1 parent bbac5fc commit 5aa1aa9
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 10 deletions.
2 changes: 0 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# type

rename meaning to call

`TypeDefinition` can not `call`

`deftype`
Expand Down
2 changes: 1 addition & 1 deletion src/lang/definition/Definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { Mod } from "../mod"
export interface Definition {
mod: Mod
name: string
meaning(net: Net): void
call(net: Net): void
}
2 changes: 1 addition & 1 deletion src/lang/definitions/NetDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class NetDefinition implements Definition {
public words: Array<Word>,
) {}

meaning(net: Net): void {
call(net: Net): void {
applyWords(this.mod, net, this.words)
}
}
4 changes: 2 additions & 2 deletions src/lang/definitions/NodeDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class NodeDefinition implements Definition {
public output: Array<PortExp>,
) {}

meaning(net: Net): Node {
call(net: Net): Node {
const node = createNode(this.mod, this.name, this.input, this.output)

// Be careful about the order:
Expand All @@ -24,7 +24,7 @@ export class NodeDefinition implements Definition {
const top = net.ports.pop()
if (top === undefined) {
throw new Error(
`[NodeDefinition.meaning] I expect a port on top of the stack`,
`[NodeDefinition.call] I expect a port on top of the stack`,
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/lang/definitions/OperatorDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export class OperatorDefinition implements Definition {
constructor(
public mod: Mod,
public name: string,
public meaning: (net: Net) => void,
public call: (net: Net) => void,
) {}
}
2 changes: 1 addition & 1 deletion src/lang/definitions/TypeDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class TypeDefinition implements Definition {
public arity: number,
) {}

meaning(net: Net): void {
call(net: Net): void {
//
}
}
2 changes: 1 addition & 1 deletion src/lang/graph/closeFreePorts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export function closeFreePorts(net: Net): Node | undefined {
"*root*",
[...net.ports],
[],
).meaning(net)
).call(net)
}
2 changes: 1 addition & 1 deletion src/lang/words/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Call implements Word {
net.ports.push(found)
net.localPorts.delete(this.name)
} else {
lookupDefinitionOrFail(mod, this.name).meaning(net)
lookupDefinitionOrFail(mod, this.name).call(net)
}
}
}

0 comments on commit 5aa1aa9

Please sign in to comment.