greybel-interpreter 2.6.17 → 2.7.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/dist/types/function.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Operation } from '../operations/operation';
|
|
|
3
3
|
import { ObjectValue } from '../utils/object-value';
|
|
4
4
|
import { CustomValue } from './base';
|
|
5
5
|
export interface Callback {
|
|
6
|
-
(ctx: OperationContext, self: CustomValue, args: Map<string, CustomValue
|
|
6
|
+
(ctx: OperationContext, self: CustomValue, args: Map<string, CustomValue>): Promise<NonNullable<CustomValue>>;
|
|
7
7
|
}
|
|
8
8
|
export declare const DEFAULT_FUNCTION_NAME = "anonymous";
|
|
9
9
|
export declare const SELF_NAMESPACE = "self";
|
package/dist/types/function.js
CHANGED
|
@@ -18,7 +18,6 @@ const hash_1 = require("../utils/hash");
|
|
|
18
18
|
const object_value_1 = require("../utils/object-value");
|
|
19
19
|
const base_1 = require("./base");
|
|
20
20
|
const default_1 = require("./default");
|
|
21
|
-
const map_1 = require("./map");
|
|
22
21
|
const nil_1 = require("./nil");
|
|
23
22
|
const string_1 = require("./string");
|
|
24
23
|
exports.DEFAULT_FUNCTION_NAME = 'anonymous';
|
|
@@ -115,7 +114,7 @@ class CustomFunction extends base_1.CustomValue {
|
|
|
115
114
|
return this._nextContext;
|
|
116
115
|
}
|
|
117
116
|
run(self, args, callContext) {
|
|
118
|
-
var _a, _b, _c, _d
|
|
117
|
+
var _a, _b, _c, _d;
|
|
119
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
119
|
if (args.length > this.argumentDefs.length) {
|
|
121
120
|
throw new Error('Too many arguments.');
|
|
@@ -140,11 +139,10 @@ class CustomFunction extends base_1.CustomValue {
|
|
|
140
139
|
argMap.set(item.name, (_d = args[argIndex - selfParam]) !== null && _d !== void 0 ? _d : (yield item.defaultValue.handle(fnCtx)));
|
|
141
140
|
}
|
|
142
141
|
const selfValue = hasSelf ? self : selfWithinArgs;
|
|
143
|
-
const isa = (_e = this.getNextContext()) !== null && _e !== void 0 ? _e : (self instanceof map_1.CustomMap ? self.getIsa() : null);
|
|
144
142
|
if (selfValue) {
|
|
145
143
|
argMap.set(exports.SELF_NAMESPACE, selfValue);
|
|
146
144
|
}
|
|
147
|
-
const result = yield this.value(fnCtx !== null && fnCtx !== void 0 ? fnCtx : callContext, selfValue, argMap
|
|
145
|
+
const result = yield this.value(fnCtx !== null && fnCtx !== void 0 ? fnCtx : callContext, selfValue, argMap);
|
|
148
146
|
this._nextContext = null;
|
|
149
147
|
return result;
|
|
150
148
|
});
|