Skip to content
Open
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
1 change: 1 addition & 0 deletions docs/expressions/expression_trees.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ Properties:

- `fn: Node | string` (read-only) The object or function name which to invoke.
- `args: Node[]`
- `name: string` The name of the function

Examples:

Expand Down
10 changes: 9 additions & 1 deletion test/generated-code-tests/entry/mainAny.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert'
import * as mainAny from '../../../src/entry/mainAny.js'
import * as factoriesAny from '../../../src/factoriesAny.js'
import { createSnapshotFromFactories, validateBundle, validateTypeOf } from '../../../src/utils/snapshot.js'
const { create, all, add, matrix, isObject, isMatrix, pi, speedOfLight, sqrt, evaluate, chain, reviver, Complex, addDependencies } = mainAny
const { create, all, add, matrix, isObject, isMatrix, pi, speedOfLight, sqrt, evaluate, chain, reviver, Complex, FunctionNode, SymbolNode, ConstantNode, addDependencies } = mainAny

const {
expectedInstanceStructure,
Expand Down Expand Up @@ -146,6 +146,14 @@ describe('mainAny', function () {
assert.deepStrictEqual(obj, c)
})

it('should have the full FunctionNode interface', () => {
const funcname = 'myfunc'
const myfunc =
new FunctionNode(
new SymbolNode(funcname), [new ConstantNode(2), new ConstantNode(3)])
assert.strictEqual(myfunc.name, funcname)
})

// TODO: test export of errors
// TODO: test export of classes
})
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ declare namespace math {
interface FunctionNode extends MathNodeCommon {
type: 'FunctionNode';
isFunctionNode: true;
name: string;
fn: SymbolNode;
args: MathNode[];
}
Expand Down