@tilua/parser 3.1.0 → 4.0.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 +29 -10
- package/dist/index.cjs +310 -33
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +310 -33
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -583,6 +583,10 @@ type Expression = Identifier | NilLiteral | BooleanLiteral | NumberLiteral | Str
|
|
|
583
583
|
* (and is empty when nothing was written). Its type is `any`. */
|
|
584
584
|
interface ErrorExpression extends BaseNode {
|
|
585
585
|
type: "ErrorExpression";
|
|
586
|
+
/** What was read before it broke: the `obj` of an `obj.` whose name is
|
|
587
|
+
* still to be typed. It is analysed as it stands, so `obj` keeps its
|
|
588
|
+
* type and its place among the names. */
|
|
589
|
+
expression?: Expression;
|
|
586
590
|
}
|
|
587
591
|
interface Identifier extends BaseNode {
|
|
588
592
|
type: "Identifier";
|
|
@@ -715,7 +719,9 @@ interface BinaryExpression extends BaseNode {
|
|
|
715
719
|
left: Expression;
|
|
716
720
|
right: Expression;
|
|
717
721
|
}
|
|
718
|
-
|
|
722
|
+
/** `typeof v` answers the name of what `v` is: Luau's `typeof`, with a table
|
|
723
|
+
* told apart as an `"array"` or an `"object"`. */
|
|
724
|
+
declare const UnaryOperators: readonly ["-", "not", "#", "typeof"];
|
|
719
725
|
interface UnaryExpression extends BaseNode {
|
|
720
726
|
type: "UnaryExpression";
|
|
721
727
|
operator: typeof UnaryOperators[number];
|
|
@@ -978,8 +984,7 @@ interface ParenthesizedTypeNode extends BaseNode {
|
|
|
978
984
|
type: "ParenthesizedTypeNode";
|
|
979
985
|
typeAnnotation: TypeNode;
|
|
980
986
|
}
|
|
981
|
-
/** `typeof x` / `typeof x.y
|
|
982
|
-
* (Luau's spelling): the type of a value. */
|
|
987
|
+
/** `typeof x` / `typeof x.y`, TypeScript's type query: the type of a value. */
|
|
983
988
|
interface TypeofTypeNode extends BaseNode {
|
|
984
989
|
type: "TypeofTypeNode";
|
|
985
990
|
expression: Expression;
|
|
@@ -1517,6 +1522,10 @@ interface TypeAnalysis {
|
|
|
1517
1522
|
* gave it (`declare metatable`), and which library declared that. A call
|
|
1518
1523
|
* missing here reached a member of the receiver's own. */
|
|
1519
1524
|
readonly methodSources: ReadonlyMap<MethodCallExpression, MethodSource>;
|
|
1525
|
+
/** Each `typeof v` whose `v`, where it is a table at all, is known by its
|
|
1526
|
+
* type to be an array or to be an object. One missing here has to be
|
|
1527
|
+
* told apart as the program runs. */
|
|
1528
|
+
readonly typeofTables: ReadonlyMap<Expression, "array" | "object">;
|
|
1520
1529
|
/** The members a value's metatable `__index` gives it — what an editor
|
|
1521
1530
|
* offers after `:`. Empty for a value no metatable matches. */
|
|
1522
1531
|
readonly metatableMembers: (type: Type) => ReadonlyMap<string, Type>;
|
package/dist/index.d.ts
CHANGED
|
@@ -583,6 +583,10 @@ type Expression = Identifier | NilLiteral | BooleanLiteral | NumberLiteral | Str
|
|
|
583
583
|
* (and is empty when nothing was written). Its type is `any`. */
|
|
584
584
|
interface ErrorExpression extends BaseNode {
|
|
585
585
|
type: "ErrorExpression";
|
|
586
|
+
/** What was read before it broke: the `obj` of an `obj.` whose name is
|
|
587
|
+
* still to be typed. It is analysed as it stands, so `obj` keeps its
|
|
588
|
+
* type and its place among the names. */
|
|
589
|
+
expression?: Expression;
|
|
586
590
|
}
|
|
587
591
|
interface Identifier extends BaseNode {
|
|
588
592
|
type: "Identifier";
|
|
@@ -715,7 +719,9 @@ interface BinaryExpression extends BaseNode {
|
|
|
715
719
|
left: Expression;
|
|
716
720
|
right: Expression;
|
|
717
721
|
}
|
|
718
|
-
|
|
722
|
+
/** `typeof v` answers the name of what `v` is: Luau's `typeof`, with a table
|
|
723
|
+
* told apart as an `"array"` or an `"object"`. */
|
|
724
|
+
declare const UnaryOperators: readonly ["-", "not", "#", "typeof"];
|
|
719
725
|
interface UnaryExpression extends BaseNode {
|
|
720
726
|
type: "UnaryExpression";
|
|
721
727
|
operator: typeof UnaryOperators[number];
|
|
@@ -978,8 +984,7 @@ interface ParenthesizedTypeNode extends BaseNode {
|
|
|
978
984
|
type: "ParenthesizedTypeNode";
|
|
979
985
|
typeAnnotation: TypeNode;
|
|
980
986
|
}
|
|
981
|
-
/** `typeof x` / `typeof x.y
|
|
982
|
-
* (Luau's spelling): the type of a value. */
|
|
987
|
+
/** `typeof x` / `typeof x.y`, TypeScript's type query: the type of a value. */
|
|
983
988
|
interface TypeofTypeNode extends BaseNode {
|
|
984
989
|
type: "TypeofTypeNode";
|
|
985
990
|
expression: Expression;
|
|
@@ -1517,6 +1522,10 @@ interface TypeAnalysis {
|
|
|
1517
1522
|
* gave it (`declare metatable`), and which library declared that. A call
|
|
1518
1523
|
* missing here reached a member of the receiver's own. */
|
|
1519
1524
|
readonly methodSources: ReadonlyMap<MethodCallExpression, MethodSource>;
|
|
1525
|
+
/** Each `typeof v` whose `v`, where it is a table at all, is known by its
|
|
1526
|
+
* type to be an array or to be an object. One missing here has to be
|
|
1527
|
+
* told apart as the program runs. */
|
|
1528
|
+
readonly typeofTables: ReadonlyMap<Expression, "array" | "object">;
|
|
1520
1529
|
/** The members a value's metatable `__index` gives it — what an editor
|
|
1521
1530
|
* offers after `:`. Empty for a value no metatable matches. */
|
|
1522
1531
|
readonly metatableMembers: (type: Type) => ReadonlyMap<string, Type>;
|