jslike 1.7.1 → 1.7.2
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/esm/interpreter/interpreter.js +6 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/package.json +1 -1
|
@@ -141,6 +141,9 @@ export class Interpreter {
|
|
|
141
141
|
|
|
142
142
|
if (node.callee.type === 'MemberExpression') {
|
|
143
143
|
thisContext = await this.evaluateAsync(node.callee.object, env);
|
|
144
|
+
if (node.callee.optional && (thisContext === null || thisContext === undefined)) {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
144
147
|
const prop = node.callee.computed
|
|
145
148
|
? await this.evaluateAsync(node.callee.property, env)
|
|
146
149
|
: node.callee.property.name;
|
|
@@ -1230,6 +1233,9 @@ export class Interpreter {
|
|
|
1230
1233
|
if (node.callee.type === 'MemberExpression') {
|
|
1231
1234
|
// For method calls like obj.method(), set this to obj
|
|
1232
1235
|
thisContext = this.evaluate(node.callee.object, env);
|
|
1236
|
+
if (node.callee.optional && (thisContext === null || thisContext === undefined)) {
|
|
1237
|
+
return undefined;
|
|
1238
|
+
}
|
|
1233
1239
|
const prop = node.callee.computed
|
|
1234
1240
|
? this.evaluate(node.callee.property, env)
|
|
1235
1241
|
: node.callee.property.name;
|
package/dist/index.cjs
CHANGED
|
@@ -6579,6 +6579,9 @@ var Interpreter = class _Interpreter {
|
|
|
6579
6579
|
let methodName = null;
|
|
6580
6580
|
if (node.callee.type === "MemberExpression") {
|
|
6581
6581
|
thisContext = await this.evaluateAsync(node.callee.object, env);
|
|
6582
|
+
if (node.callee.optional && (thisContext === null || thisContext === void 0)) {
|
|
6583
|
+
return void 0;
|
|
6584
|
+
}
|
|
6582
6585
|
const prop = node.callee.computed ? await this.evaluateAsync(node.callee.property, env) : node.callee.property.name;
|
|
6583
6586
|
callee = thisContext[prop];
|
|
6584
6587
|
methodName = prop;
|
|
@@ -7447,6 +7450,9 @@ var Interpreter = class _Interpreter {
|
|
|
7447
7450
|
let methodName = null;
|
|
7448
7451
|
if (node.callee.type === "MemberExpression") {
|
|
7449
7452
|
thisContext = this.evaluate(node.callee.object, env);
|
|
7453
|
+
if (node.callee.optional && (thisContext === null || thisContext === void 0)) {
|
|
7454
|
+
return void 0;
|
|
7455
|
+
}
|
|
7450
7456
|
const prop = node.callee.computed ? this.evaluate(node.callee.property, env) : node.callee.property.name;
|
|
7451
7457
|
callee = thisContext[prop];
|
|
7452
7458
|
methodName = prop;
|
package/dist/index.d.cts
CHANGED
|
@@ -7306,6 +7306,9 @@ class Interpreter {
|
|
|
7306
7306
|
|
|
7307
7307
|
if (node.callee.type === 'MemberExpression') {
|
|
7308
7308
|
thisContext = await this.evaluateAsync(node.callee.object, env);
|
|
7309
|
+
if (node.callee.optional && (thisContext === null || thisContext === undefined)) {
|
|
7310
|
+
return undefined;
|
|
7311
|
+
}
|
|
7309
7312
|
const prop = node.callee.computed
|
|
7310
7313
|
? await this.evaluateAsync(node.callee.property, env)
|
|
7311
7314
|
: node.callee.property.name;
|
|
@@ -8395,6 +8398,9 @@ class Interpreter {
|
|
|
8395
8398
|
if (node.callee.type === 'MemberExpression') {
|
|
8396
8399
|
// For method calls like obj.method(), set this to obj
|
|
8397
8400
|
thisContext = this.evaluate(node.callee.object, env);
|
|
8401
|
+
if (node.callee.optional && (thisContext === null || thisContext === undefined)) {
|
|
8402
|
+
return undefined;
|
|
8403
|
+
}
|
|
8398
8404
|
const prop = node.callee.computed
|
|
8399
8405
|
? this.evaluate(node.callee.property, env)
|
|
8400
8406
|
: node.callee.property.name;
|
package/dist/index.d.ts
CHANGED
|
@@ -7306,6 +7306,9 @@ class Interpreter {
|
|
|
7306
7306
|
|
|
7307
7307
|
if (node.callee.type === 'MemberExpression') {
|
|
7308
7308
|
thisContext = await this.evaluateAsync(node.callee.object, env);
|
|
7309
|
+
if (node.callee.optional && (thisContext === null || thisContext === undefined)) {
|
|
7310
|
+
return undefined;
|
|
7311
|
+
}
|
|
7309
7312
|
const prop = node.callee.computed
|
|
7310
7313
|
? await this.evaluateAsync(node.callee.property, env)
|
|
7311
7314
|
: node.callee.property.name;
|
|
@@ -8395,6 +8398,9 @@ class Interpreter {
|
|
|
8395
8398
|
if (node.callee.type === 'MemberExpression') {
|
|
8396
8399
|
// For method calls like obj.method(), set this to obj
|
|
8397
8400
|
thisContext = this.evaluate(node.callee.object, env);
|
|
8401
|
+
if (node.callee.optional && (thisContext === null || thisContext === undefined)) {
|
|
8402
|
+
return undefined;
|
|
8403
|
+
}
|
|
8398
8404
|
const prop = node.callee.computed
|
|
8399
8405
|
? this.evaluate(node.callee.property, env)
|
|
8400
8406
|
: node.callee.property.name;
|
package/dist/index.js
CHANGED
|
@@ -6545,6 +6545,9 @@ var Interpreter = class _Interpreter {
|
|
|
6545
6545
|
let methodName = null;
|
|
6546
6546
|
if (node.callee.type === "MemberExpression") {
|
|
6547
6547
|
thisContext = await this.evaluateAsync(node.callee.object, env);
|
|
6548
|
+
if (node.callee.optional && (thisContext === null || thisContext === void 0)) {
|
|
6549
|
+
return void 0;
|
|
6550
|
+
}
|
|
6548
6551
|
const prop = node.callee.computed ? await this.evaluateAsync(node.callee.property, env) : node.callee.property.name;
|
|
6549
6552
|
callee = thisContext[prop];
|
|
6550
6553
|
methodName = prop;
|
|
@@ -7413,6 +7416,9 @@ var Interpreter = class _Interpreter {
|
|
|
7413
7416
|
let methodName = null;
|
|
7414
7417
|
if (node.callee.type === "MemberExpression") {
|
|
7415
7418
|
thisContext = this.evaluate(node.callee.object, env);
|
|
7419
|
+
if (node.callee.optional && (thisContext === null || thisContext === void 0)) {
|
|
7420
|
+
return void 0;
|
|
7421
|
+
}
|
|
7416
7422
|
const prop = node.callee.computed ? this.evaluate(node.callee.property, env) : node.callee.property.name;
|
|
7417
7423
|
callee = thisContext[prop];
|
|
7418
7424
|
methodName = prop;
|