greybel-interpreter 2.3.1 → 2.3.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.
|
@@ -38,6 +38,7 @@ function createResolve(item, target) {
|
|
|
38
38
|
const memberExpr = item;
|
|
39
39
|
const path = (0, lookup_path_1.lookupPath)(memberExpr);
|
|
40
40
|
if (path.length > 0 &&
|
|
41
|
+
path[0] instanceof greyscript_core_1.ASTMemberExpression &&
|
|
41
42
|
path[0].base instanceof greyscript_core_1.ASTIdentifier &&
|
|
42
43
|
hasOwnProperty.call(optResolveMap, path[0].base.name)) {
|
|
43
44
|
const OptResolve = optResolveMap[path[0].base.name];
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { ASTMemberExpression } from 'greyscript-core';
|
|
2
|
-
export
|
|
1
|
+
import { ASTBase, ASTMemberExpression } from 'greyscript-core';
|
|
2
|
+
export type PathItem = ASTBase & {
|
|
3
|
+
base: ASTBase;
|
|
4
|
+
};
|
|
5
|
+
export declare function lookupPath(item: ASTMemberExpression): PathItem[];
|
|
@@ -5,7 +5,9 @@ const greyscript_core_1 = require("greyscript-core");
|
|
|
5
5
|
function lookupPath(item) {
|
|
6
6
|
const path = [item];
|
|
7
7
|
let current = item.base;
|
|
8
|
-
while (current instanceof greyscript_core_1.ASTMemberExpression
|
|
8
|
+
while (current instanceof greyscript_core_1.ASTMemberExpression ||
|
|
9
|
+
current instanceof greyscript_core_1.ASTIndexExpression ||
|
|
10
|
+
current instanceof greyscript_core_1.ASTSliceExpression) {
|
|
9
11
|
path.unshift(current);
|
|
10
12
|
current = current.base;
|
|
11
13
|
}
|