@mojir/lits 1.2.1 → 1.2.2-alpha.1
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/cli/cli.js +10 -1
- package/dist/cli/src/analyze/index.d.ts +2 -1
- package/dist/cli/src/index.d.ts +1 -0
- package/dist/index.esm.js +31 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +31 -1
- package/dist/lits.iife.js.map +1 -1
- package/dist/src/analyze/index.d.ts +2 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/testFramework.esm.js +10 -1
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +10 -1
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -92,7 +92,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
92
92
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
var version = "1.2.1";
|
|
95
|
+
var version = "1.2.2-alpha.1";
|
|
96
96
|
|
|
97
97
|
var AstNodeType;
|
|
98
98
|
(function (AstNodeType) {
|
|
@@ -6289,6 +6289,15 @@ function evaluateNumberAsFunction(fn, params, sourceCodeInfo) {
|
|
|
6289
6289
|
return toAny(param[fn]);
|
|
6290
6290
|
}
|
|
6291
6291
|
|
|
6292
|
+
// export function findUnresolvedIdentifiersInFunction(ast, contextStack, builtin: Builtin) => {
|
|
6293
|
+
// const astNodes = Array.isArray(ast) ? ast : ast.b
|
|
6294
|
+
// const unresolvedIdentifiers = new Set<UnresolvedIdentifier>()
|
|
6295
|
+
// for (const subNode of astNodes) {
|
|
6296
|
+
// findUnresolvedIdentifiersInAstNode(subNode, contextStack, builtin)
|
|
6297
|
+
// .forEach(symbol => unresolvedIdentifiers.add(symbol))
|
|
6298
|
+
// }
|
|
6299
|
+
// return unresolvedIdentifiers
|
|
6300
|
+
// }
|
|
6292
6301
|
var findUnresolvedIdentifiers = function (ast, contextStack, builtin) {
|
|
6293
6302
|
var e_1, _a;
|
|
6294
6303
|
var astNodes = Array.isArray(ast) ? ast : ast.b;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LitsParams } from '../Lits/Lits';
|
|
2
2
|
import type { Builtin } from '../builtin/interface';
|
|
3
3
|
import { type ContextStack } from '../evaluator/ContextStack';
|
|
4
|
-
import type { Ast, AstNode } from '../parser/interface';
|
|
4
|
+
import type { Ast, AstNode, LitsFunction } from '../parser/interface';
|
|
5
5
|
import type { Token } from '../tokenizer/interface';
|
|
6
6
|
export interface UnresolvedIdentifier {
|
|
7
7
|
symbol: string;
|
|
@@ -15,3 +15,4 @@ export interface Analysis {
|
|
|
15
15
|
}
|
|
16
16
|
export type FindUnresolvedIdentifiers = (ast: Ast | AstNode[], contextStack: ContextStack, builtin: Builtin) => UnresolvedIdentifiers;
|
|
17
17
|
export declare function analyze(ast: Ast, params: LitsParams): Analysis;
|
|
18
|
+
export declare function findUnresolvedIdentifiersInFunction(fun: LitsFunction, params: LitsParams): UnresolvedIdentifiers;
|
package/dist/cli/src/index.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export { apiReference, isDatatypeReference, isFunctionReference, isNormalExpress
|
|
|
14
14
|
export type { Argument, CommonReference, DatatypeReference, FunctionReference, Reference, ShorthandReference } from '../reference';
|
|
15
15
|
export type { ApiName, FunctionName, ShorthandName, DatatypeName } from '../reference/api';
|
|
16
16
|
export { isApiName, isDataType } from '../reference/api';
|
|
17
|
+
export { findUnresolvedIdentifiersInFunction } from './analyze';
|
package/dist/index.esm.js
CHANGED
|
@@ -2864,7 +2864,7 @@ var mathNormalExpression = {
|
|
|
2864
2864
|
},
|
|
2865
2865
|
};
|
|
2866
2866
|
|
|
2867
|
-
var version = "1.2.1";
|
|
2867
|
+
var version = "1.2.2-alpha.1";
|
|
2868
2868
|
|
|
2869
2869
|
var uuidTemplate = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
2870
2870
|
var xyRegexp = /[xy]/g;
|
|
@@ -6321,6 +6321,15 @@ function evaluateNumberAsFunction(fn, params, sourceCodeInfo) {
|
|
|
6321
6321
|
return toAny(param[fn]);
|
|
6322
6322
|
}
|
|
6323
6323
|
|
|
6324
|
+
// export function findUnresolvedIdentifiersInFunction(ast, contextStack, builtin: Builtin) => {
|
|
6325
|
+
// const astNodes = Array.isArray(ast) ? ast : ast.b
|
|
6326
|
+
// const unresolvedIdentifiers = new Set<UnresolvedIdentifier>()
|
|
6327
|
+
// for (const subNode of astNodes) {
|
|
6328
|
+
// findUnresolvedIdentifiersInAstNode(subNode, contextStack, builtin)
|
|
6329
|
+
// .forEach(symbol => unresolvedIdentifiers.add(symbol))
|
|
6330
|
+
// }
|
|
6331
|
+
// return unresolvedIdentifiers
|
|
6332
|
+
// }
|
|
6324
6333
|
var findUnresolvedIdentifiers = function (ast, contextStack, builtin) {
|
|
6325
6334
|
var e_1, _a;
|
|
6326
6335
|
var astNodes = Array.isArray(ast) ? ast : ast.b;
|
|
@@ -6929,6 +6938,26 @@ function analyze(ast, params) {
|
|
|
6929
6938
|
outcomes: calculateOutcomes(createContextStack(params), ast.b),
|
|
6930
6939
|
};
|
|
6931
6940
|
}
|
|
6941
|
+
function findUnresolvedIdentifiersInFunction(fun, params) {
|
|
6942
|
+
if (!isUserDefinedFunction(fun)) {
|
|
6943
|
+
return new Set();
|
|
6944
|
+
}
|
|
6945
|
+
var result = new Set();
|
|
6946
|
+
var contextStack = createContextStack(params);
|
|
6947
|
+
fun.o.forEach(function (overload) {
|
|
6948
|
+
var innerContextStack = contextStack.clone();
|
|
6949
|
+
var newContext = overload.as.mandatoryArguments.reduce(function (acc, arg) {
|
|
6950
|
+
acc[arg] = { value: null };
|
|
6951
|
+
return acc;
|
|
6952
|
+
}, {});
|
|
6953
|
+
if (overload.as.restArgument) {
|
|
6954
|
+
newContext[overload.as.restArgument] = { value: null };
|
|
6955
|
+
}
|
|
6956
|
+
var overloadSymbols = findUnresolvedIdentifiers(overload.b, innerContextStack.create(newContext), builtin);
|
|
6957
|
+
overloadSymbols.forEach(function (symbol) { return result.add(symbol); });
|
|
6958
|
+
});
|
|
6959
|
+
return result;
|
|
6960
|
+
}
|
|
6932
6961
|
|
|
6933
6962
|
function parseNumber(tokenStream, position) {
|
|
6934
6963
|
var _a;
|
|
@@ -15563,5 +15592,5 @@ function isDataType(arg) {
|
|
|
15563
15592
|
return dataTypes.includes(arg);
|
|
15564
15593
|
}
|
|
15565
15594
|
|
|
15566
|
-
export { AstNodeType, FunctionType, Lits, TokenType, apiReference, asLitsFunction, asNativeJsFunction, asUserDefinedFunction, assertLitsFunction, assertNativeJsFunction, assertUserDefinedFunction, createNativeJsFunction, isApiName, isBuiltinFunction, isDataType, isDatatypeReference, isFunctionReference, isLitsError, isLitsFunction, isNativeJsFunction, isNormalExpressionArgument, isShorthandReference, isSpecialExpressionArgument, isTypedValue, isUserDefinedFunction, normalExpressionKeys, reservedNames, specialExpressionKeys };
|
|
15595
|
+
export { AstNodeType, FunctionType, Lits, TokenType, apiReference, asLitsFunction, asNativeJsFunction, asUserDefinedFunction, assertLitsFunction, assertNativeJsFunction, assertUserDefinedFunction, createNativeJsFunction, findUnresolvedIdentifiersInFunction, isApiName, isBuiltinFunction, isDataType, isDatatypeReference, isFunctionReference, isLitsError, isLitsFunction, isNativeJsFunction, isNormalExpressionArgument, isShorthandReference, isSpecialExpressionArgument, isTypedValue, isUserDefinedFunction, normalExpressionKeys, reservedNames, specialExpressionKeys };
|
|
15567
15596
|
//# sourceMappingURL=index.esm.js.map
|