affinirum 1.3.0 → 1.4.0
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/README.md +156 -126
- package/dst/Affinirum.d.ts +1 -1
- package/dst/Affinirum.js +49 -53
- package/dst/Constants.js +10 -10
- package/dst/Functions.js +10 -10
- package/dst/ParserState.js +8 -8
- package/dst/atom/ArrayAtom.d.ts +3 -3
- package/dst/atom/ArrayAtom.js +14 -13
- package/dst/atom/FunctionAtom.d.ts +1 -1
- package/dst/atom/FunctionAtom.js +10 -8
- package/dst/atom/ObjectAtom.d.ts +3 -3
- package/dst/atom/ObjectAtom.js +14 -18
- package/dst/atom/PrimitiveAtom.js +3 -3
- package/dst/cjs/Affinirum.js +49 -53
- package/dst/cjs/Constants.js +10 -10
- package/dst/cjs/Functions.js +10 -10
- package/dst/cjs/ParserState.js +8 -8
- package/dst/cjs/atom/ArrayAtom.js +14 -13
- package/dst/cjs/atom/FunctionAtom.js +10 -8
- package/dst/cjs/atom/ObjectAtom.js +14 -18
- package/dst/cjs/atom/PrimitiveAtom.js +3 -3
- package/dst/cjs/node/ArrayNode.js +7 -3
- package/dst/cjs/node/{FunctionNode.js → CallNode.js} +5 -4
- package/dst/cjs/node/ObjectNode.js +4 -2
- package/dst/node/ArrayNode.d.ts +2 -1
- package/dst/node/ArrayNode.js +7 -3
- package/dst/node/{FunctionNode.d.ts → CallNode.d.ts} +1 -1
- package/dst/node/{FunctionNode.js → CallNode.js} +3 -2
- package/dst/node/ObjectNode.d.ts +1 -1
- package/dst/node/ObjectNode.js +4 -2
- package/package.json +1 -1
- /package/dst/cjs/{constant → native}/Aggregable.js +0 -0
- /package/dst/cjs/{constant → native}/Array.js +0 -0
- /package/dst/cjs/{constant → native}/Boolean.js +0 -0
- /package/dst/cjs/{constant → native}/Buffer.js +0 -0
- /package/dst/cjs/{constant → native}/Enumerable.js +0 -0
- /package/dst/cjs/{constant → native}/Float.js +0 -0
- /package/dst/cjs/{constant → native}/Integer.js +0 -0
- /package/dst/cjs/{constant → native}/Iterable.js +0 -0
- /package/dst/cjs/{constant → native}/Number.js +0 -0
- /package/dst/cjs/{constant → native}/Object.js +0 -0
- /package/dst/cjs/{constant → native}/String.js +0 -0
- /package/dst/cjs/{constant → native}/Timestamp.js +0 -0
- /package/dst/cjs/{constant → native}/Unknown.js +0 -0
- /package/dst/cjs/{constant → native}/notation/AN.js +0 -0
- /package/dst/cjs/{constant → native}/notation/JSON.js +0 -0
- /package/dst/{constant → native}/Aggregable.d.ts +0 -0
- /package/dst/{constant → native}/Aggregable.js +0 -0
- /package/dst/{constant → native}/Array.d.ts +0 -0
- /package/dst/{constant → native}/Array.js +0 -0
- /package/dst/{constant → native}/Boolean.d.ts +0 -0
- /package/dst/{constant → native}/Boolean.js +0 -0
- /package/dst/{constant → native}/Buffer.d.ts +0 -0
- /package/dst/{constant → native}/Buffer.js +0 -0
- /package/dst/{constant → native}/Enumerable.d.ts +0 -0
- /package/dst/{constant → native}/Enumerable.js +0 -0
- /package/dst/{constant → native}/Float.d.ts +0 -0
- /package/dst/{constant → native}/Float.js +0 -0
- /package/dst/{constant → native}/Integer.d.ts +0 -0
- /package/dst/{constant → native}/Integer.js +0 -0
- /package/dst/{constant → native}/Iterable.d.ts +0 -0
- /package/dst/{constant → native}/Iterable.js +0 -0
- /package/dst/{constant → native}/Number.d.ts +0 -0
- /package/dst/{constant → native}/Number.js +0 -0
- /package/dst/{constant → native}/Object.d.ts +0 -0
- /package/dst/{constant → native}/Object.js +0 -0
- /package/dst/{constant → native}/String.d.ts +0 -0
- /package/dst/{constant → native}/String.js +0 -0
- /package/dst/{constant → native}/Timestamp.d.ts +0 -0
- /package/dst/{constant → native}/Timestamp.js +0 -0
- /package/dst/{constant → native}/Unknown.d.ts +0 -0
- /package/dst/{constant → native}/Unknown.js +0 -0
- /package/dst/{constant → native}/notation/AN.d.ts +0 -0
- /package/dst/{constant → native}/notation/AN.js +0 -0
- /package/dst/{constant → native}/notation/JSON.d.ts +0 -0
- /package/dst/{constant → native}/notation/JSON.js +0 -0
|
@@ -8,10 +8,12 @@ const Type_js_1 = require("../Type.js");
|
|
|
8
8
|
class ObjectNode extends Node_js_1.Node {
|
|
9
9
|
_subnodes;
|
|
10
10
|
_type;
|
|
11
|
-
constructor(frame, _subnodes) {
|
|
11
|
+
constructor(frame, _subnodes, generic = false) {
|
|
12
12
|
super(frame);
|
|
13
13
|
this._subnodes = _subnodes;
|
|
14
|
-
this._type =
|
|
14
|
+
this._type = generic
|
|
15
|
+
? Type_js_1.Type.Object
|
|
16
|
+
: Type_js_1.Type.objectType(Object.fromEntries(_subnodes.filter(([i]) => i instanceof ConstantNode_js_1.ConstantNode && i.constant).map(([k, v]) => [k.evaluate(), v.type])));
|
|
15
17
|
}
|
|
16
18
|
get type() {
|
|
17
19
|
return this._type;
|
package/dst/node/ArrayNode.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { Value } from "../Value.js";
|
|
|
4
4
|
import { Type } from "../Type.js";
|
|
5
5
|
export declare class ArrayNode extends Node {
|
|
6
6
|
protected _subnodes: Node[];
|
|
7
|
-
|
|
7
|
+
protected _type: Type;
|
|
8
|
+
constructor(frame: ParserFrame, _subnodes: Node[], generic?: boolean);
|
|
8
9
|
get type(): Type;
|
|
9
10
|
compile(type: Type): Node;
|
|
10
11
|
evaluate(): Value;
|
package/dst/node/ArrayNode.js
CHANGED
|
@@ -4,15 +4,19 @@ import { ConstantNode } from "./ConstantNode.js";
|
|
|
4
4
|
import { Type } from "../Type.js";
|
|
5
5
|
export class ArrayNode extends Node {
|
|
6
6
|
_subnodes;
|
|
7
|
-
|
|
7
|
+
_type;
|
|
8
|
+
constructor(frame, _subnodes, generic = false) {
|
|
8
9
|
super(frame);
|
|
9
10
|
this._subnodes = _subnodes;
|
|
11
|
+
this._type = generic
|
|
12
|
+
? Type.Array
|
|
13
|
+
: Type.arrayType(_subnodes.map((i) => i.type));
|
|
10
14
|
}
|
|
11
15
|
get type() {
|
|
12
|
-
return
|
|
16
|
+
return this._type;
|
|
13
17
|
}
|
|
14
18
|
compile(type) {
|
|
15
|
-
this.reduceType(type);
|
|
19
|
+
this._type = this.reduceType(type);
|
|
16
20
|
let constant = true;
|
|
17
21
|
for (let i = 0; i < this._subnodes.length; ++i) {
|
|
18
22
|
this._subnodes[i] = this._subnodes[i].compile(Type.Unknown);
|
|
@@ -2,7 +2,7 @@ import { Node } from "../Node.js";
|
|
|
2
2
|
import { ParserFrame } from "../ParserFrame.js";
|
|
3
3
|
import { Value } from "../Value.js";
|
|
4
4
|
import { Type } from "../Type.js";
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class CallNode extends Node {
|
|
6
6
|
protected _fnode: Node;
|
|
7
7
|
protected _subnodes: Node[];
|
|
8
8
|
protected _type: Type;
|
|
@@ -4,7 +4,7 @@ import { ConstantNode } from "./ConstantNode.js";
|
|
|
4
4
|
import { ArrayNode } from "./ArrayNode.js";
|
|
5
5
|
import { Type } from "../Type.js";
|
|
6
6
|
import { JumpException } from "../JumpException.js";
|
|
7
|
-
export class
|
|
7
|
+
export class CallNode extends Node {
|
|
8
8
|
_fnode;
|
|
9
9
|
_subnodes;
|
|
10
10
|
_type;
|
|
@@ -31,7 +31,8 @@ export class FunctionNode extends Node {
|
|
|
31
31
|
if (this._fnode.constant) {
|
|
32
32
|
let constant = true;
|
|
33
33
|
for (let i = 0; i < this._subnodes.length; ++i) {
|
|
34
|
-
const
|
|
34
|
+
const argTypes = functionAtoms.map((a) => a.argType(i));
|
|
35
|
+
const argType = Type.union(...argTypes.filter((t) => t != null));
|
|
35
36
|
this._subnodes[i] = this._subnodes[i].compile(argType);
|
|
36
37
|
constant &&= this._subnodes[i].constant;
|
|
37
38
|
}
|
package/dst/node/ObjectNode.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Type } from "../Type.js";
|
|
|
5
5
|
export declare class ObjectNode extends Node {
|
|
6
6
|
protected _subnodes: [Node, Node][];
|
|
7
7
|
protected _type: Type;
|
|
8
|
-
constructor(frame: ParserFrame, _subnodes: [Node, Node][]);
|
|
8
|
+
constructor(frame: ParserFrame, _subnodes: [Node, Node][], generic?: boolean);
|
|
9
9
|
get type(): Type;
|
|
10
10
|
compile(type: Type): Node;
|
|
11
11
|
evaluate(): Value;
|
package/dst/node/ObjectNode.js
CHANGED
|
@@ -5,10 +5,12 @@ import { Type } from "../Type.js";
|
|
|
5
5
|
export class ObjectNode extends Node {
|
|
6
6
|
_subnodes;
|
|
7
7
|
_type;
|
|
8
|
-
constructor(frame, _subnodes) {
|
|
8
|
+
constructor(frame, _subnodes, generic = false) {
|
|
9
9
|
super(frame);
|
|
10
10
|
this._subnodes = _subnodes;
|
|
11
|
-
this._type =
|
|
11
|
+
this._type = generic
|
|
12
|
+
? Type.Object
|
|
13
|
+
: Type.objectType(Object.fromEntries(_subnodes.filter(([i]) => i instanceof ConstantNode && i.constant).map(([k, v]) => [k.evaluate(), v.type])));
|
|
12
14
|
}
|
|
13
15
|
get type() {
|
|
14
16
|
return this._type;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|