cluaupp 1.5.2 → 2.0.0-beta.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.
Files changed (195) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +27 -40
  3. package/api/generated/bench-latest.json +43 -21
  4. package/api/generated/lsp-index.json +1 -1
  5. package/api/manifests/roblox-target.manifest.json +5 -5
  6. package/api/normalized/roblox-target.profile.json +8729 -267
  7. package/api/roblox/luau-builtins.d.luau +185 -0
  8. package/api/roblox/surface.json +1 -0
  9. package/api/roblox-api.lock.json +11 -2
  10. package/bin/cluaupp.js +38 -0
  11. package/editors/vscode/syntaxes/clpp.tmLanguage.json +211 -0
  12. package/examples/README.md +9 -9
  13. package/examples/game/cluaupp.config.json +2 -2
  14. package/examples/game/default.project.json +4 -15
  15. package/examples/game/out/ReplicatedStorage/Shared/GameInfo.luau +8 -0
  16. package/examples/game/out/ReplicatedStorage/Shared/GameInfo.luau.map.json +13 -0
  17. package/examples/game/out/ServerScriptService/Leaderstats.server.luau +26 -0
  18. package/examples/game/out/ServerScriptService/Leaderstats.server.luau.map.json +13 -0
  19. package/examples/game/out/ServerScriptService/Main.server.luau +15 -0
  20. package/examples/game/out/ServerScriptService/Main.server.luau.map.json +13 -0
  21. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Main.client.luau +10 -0
  22. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Main.client.luau.map.json +13 -0
  23. package/examples/game/src/ReplicatedStorage/Shared/GameInfo.clp +1 -0
  24. package/examples/game/src/ServerScriptService/Leaderstats.server.clp +18 -0
  25. package/examples/game/src/ServerScriptService/Main.server.clp +9 -0
  26. package/examples/game/src/StarterPlayer/StarterPlayerScripts/Main.client.clp +4 -0
  27. package/generated/api/build-profile.js +1 -1
  28. package/generated/api/loader.js +2 -2
  29. package/generated/api/surface/build.js +328 -0
  30. package/generated/api/surface/luau-defs.js +595 -0
  31. package/generated/api/surface/model.js +8 -0
  32. package/generated/clpp/contract.js +6 -3
  33. package/generated/clpp/handshake.js +36 -0
  34. package/generated/clpp/modules.js +20 -9
  35. package/generated/clpp/runner.js +62 -31
  36. package/generated/compile.js +18 -1
  37. package/generated/compiler/ast.js +3 -0
  38. package/generated/compiler/checker/calls.js +999 -0
  39. package/generated/compiler/checker/checker.js +1215 -0
  40. package/generated/compiler/checker/exprs.js +791 -0
  41. package/generated/compiler/checker/flow.js +168 -0
  42. package/generated/compiler/checker/members.js +763 -0
  43. package/generated/compiler/checker/statements.js +792 -0
  44. package/generated/compiler/checker/symbols.js +90 -0
  45. package/generated/compiler/checker/typeops.js +348 -0
  46. package/generated/compiler/checker/yields.js +115 -0
  47. package/generated/compiler/diagnostics.js +138 -0
  48. package/generated/compiler/emit/emitter.js +2356 -0
  49. package/generated/compiler/emit/luau-types.js +137 -0
  50. package/generated/compiler/emit/names.js +130 -0
  51. package/generated/compiler/emit/runtime.js +432 -0
  52. package/generated/compiler/lexer.js +403 -0
  53. package/generated/compiler/parser.js +1881 -0
  54. package/generated/compiler/project.js +332 -0
  55. package/generated/compiler/roblox/api.js +388 -0
  56. package/generated/compiler/roblox/context.js +100 -0
  57. package/generated/compiler/source.js +59 -0
  58. package/generated/compiler/stdlib.js +232 -0
  59. package/generated/compiler/types.js +250 -0
  60. package/generated/target/build-cache.js +4 -4
  61. package/generated/target/gen-rojo-tree.js +15 -0
  62. package/generated/target/source-map.js +61 -8
  63. package/generated/target/studio-bridge.js +1 -0
  64. package/generated/utils/project.js +83 -25
  65. package/native/bin/.gitkeep +1 -0
  66. package/package.json +17 -6
  67. package/plugins/CluauppNav/Plugin.luau +28 -4
  68. package/rust/cluaupp/Cargo.lock +795 -0
  69. package/rust/cluaupp/Cargo.toml +17 -0
  70. package/rust/cluaupp/src/main.rs +717 -0
  71. package/scripts/postinstall-native.js +56 -0
  72. package/skills/README.md +3 -3
  73. package/skills/clpp-hive-flare/SKILL.md +30 -26
  74. package/skills/clpp-language/SKILL.md +67 -74
  75. package/skills/clpp-language/compiler.md +24 -36
  76. package/skills/clpp-style/SKILL.md +31 -44
  77. package/src/api/build-profile.ts +1 -1
  78. package/src/api/loader.ts +2 -2
  79. package/src/api/surface/build.ts +374 -0
  80. package/src/api/surface/luau-defs.ts +635 -0
  81. package/src/api/surface/model.ts +96 -0
  82. package/src/clpp/contract.ts +20 -3
  83. package/src/clpp/handshake.ts +25 -0
  84. package/src/clpp/modules.ts +17 -10
  85. package/src/clpp/runner.ts +52 -34
  86. package/src/compile.ts +20 -2
  87. package/src/compiler/ast.ts +336 -0
  88. package/src/compiler/checker/calls.ts +1025 -0
  89. package/src/compiler/checker/checker.ts +1352 -0
  90. package/src/compiler/checker/exprs.ts +805 -0
  91. package/src/compiler/checker/flow.ts +174 -0
  92. package/src/compiler/checker/members.ts +793 -0
  93. package/src/compiler/checker/statements.ts +802 -0
  94. package/src/compiler/checker/symbols.ts +219 -0
  95. package/src/compiler/checker/typeops.ts +355 -0
  96. package/src/compiler/checker/yields.ts +120 -0
  97. package/src/compiler/diagnostics.ts +163 -0
  98. package/src/compiler/emit/emitter.ts +2486 -0
  99. package/src/compiler/emit/luau-types.ts +143 -0
  100. package/src/compiler/emit/names.ts +130 -0
  101. package/src/compiler/emit/runtime.ts +438 -0
  102. package/src/compiler/lexer.ts +444 -0
  103. package/src/compiler/parser.ts +1943 -0
  104. package/src/compiler/project.ts +354 -0
  105. package/src/compiler/roblox/api.ts +408 -0
  106. package/src/compiler/roblox/context.ts +108 -0
  107. package/src/compiler/source.ts +67 -0
  108. package/src/compiler/stdlib.ts +256 -0
  109. package/src/compiler/types.ts +313 -0
  110. package/src/target/build-cache.ts +5 -8
  111. package/src/target/gen-rojo-tree.ts +15 -0
  112. package/src/target/source-map.ts +65 -27
  113. package/src/target/studio-bridge.ts +3 -0
  114. package/src/types.ts +3 -0
  115. package/src/utils/project.ts +79 -31
  116. package/templates/README.md +7 -0
  117. package/templates/{game → game-modern}/cluaupp.config.json +2 -2
  118. package/templates/{game → game-modern}/package.json +1 -2
  119. package/templates/game-modern/rokit.toml +2 -0
  120. package/templates/game-modern/src/ReplicatedStorage/Shared/GameInfo.clp +1 -0
  121. package/templates/game-modern/src/ServerScriptService/Handlers/Guard.server.clp +4 -0
  122. package/templates/game-modern/src/ServerScriptService/Main.server.clp +8 -0
  123. package/templates/game-modern/src/StarterPlayer/StarterPlayerScripts/Main.client.clp +4 -0
  124. package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau +0 -29
  125. package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau.map.json +0 -13
  126. package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau +0 -83
  127. package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau.map.json +0 -13
  128. package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau +0 -18
  129. package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau.map.json +0 -13
  130. package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau +0 -14
  131. package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau.map.json +0 -13
  132. package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau +0 -15
  133. package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau.map.json +0 -13
  134. package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau +0 -50
  135. package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau.map.json +0 -13
  136. package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau +0 -12
  137. package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau.map.json +0 -13
  138. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau +0 -16
  139. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau.map.json +0 -13
  140. package/examples/game/src/Client/Controllers/DataController.client.clpp +0 -7
  141. package/examples/game/src/Client/Main.client.clpp +0 -4
  142. package/examples/game/src/Declarations/Net.flare +0 -5
  143. package/examples/game/src/Include/GameTypes.clh +0 -40
  144. package/examples/game/src/Modules/Core/Guard.server.clpp +0 -7
  145. package/examples/game/src/Modules/Core/PlayerHandler.server.clpp +0 -23
  146. package/examples/game/src/Server/Boot/DataBoot.server.clpp +0 -13
  147. package/examples/game/src/Server/Main.server.clpp +0 -4
  148. package/templates/game/.clangd +0 -25
  149. package/templates/game/.vscode/extensions.json +0 -8
  150. package/templates/game/.vscode/settings.json +0 -17
  151. package/templates/game/Packages/.gitkeep +0 -0
  152. package/templates/game/compile_flags.txt +0 -6
  153. package/templates/game/default.project.json +0 -41
  154. package/templates/game/include/clpp/datatypes.clh +0 -575
  155. package/templates/game/include/clpp/generated/enums.clh +0 -4920
  156. package/templates/game/include/clpp/generated/instances.clh +0 -87182
  157. package/templates/game/include/clpp/libs/arrayindexer.clh +0 -12
  158. package/templates/game/include/clpp/libs/axiom.clh +0 -154
  159. package/templates/game/include/clpp/libs/bloom.clh +0 -58
  160. package/templates/game/include/clpp/libs/coil.clh +0 -37
  161. package/templates/game/include/clpp/libs/crest.clh +0 -22
  162. package/templates/game/include/clpp/libs/echo.clh +0 -52
  163. package/templates/game/include/clpp/libs/ember.clh +0 -17
  164. package/templates/game/include/clpp/libs/flare.clh +0 -65
  165. package/templates/game/include/clpp/libs/gleam.clh +0 -111
  166. package/templates/game/include/clpp/libs/guide.clh +0 -42
  167. package/templates/game/include/clpp/libs/helm.clh +0 -31
  168. package/templates/game/include/clpp/libs/hive.clh +0 -20
  169. package/templates/game/include/clpp/libs/keep.clh +0 -158
  170. package/templates/game/include/clpp/libs/lens.clh +0 -24
  171. package/templates/game/include/clpp/libs/mint.clh +0 -28
  172. package/templates/game/include/clpp/libs/net.clh +0 -31
  173. package/templates/game/include/clpp/libs/occlude.clh +0 -15
  174. package/templates/game/include/clpp/libs/pin.clh +0 -28
  175. package/templates/game/include/clpp/libs/promise.clh +0 -24
  176. package/templates/game/include/clpp/libs/roster.clh +0 -123
  177. package/templates/game/include/clpp/libs/shift.clh +0 -22
  178. package/templates/game/include/clpp/libs/spark.clh +0 -28
  179. package/templates/game/include/clpp/libs/stage.clh +0 -23
  180. package/templates/game/include/clpp/libs/sweep.clh +0 -23
  181. package/templates/game/include/clpp/libs/trace.clh +0 -18
  182. package/templates/game/include/clpp/libs/ward.clh +0 -19
  183. package/templates/game/include/clpp/libs.clh +0 -31
  184. package/templates/game/include/clpp/roblox.clh +0 -41
  185. package/templates/game/rokit.toml +0 -5
  186. package/templates/game/src/Client/Controllers/DataController.client.clpp +0 -7
  187. package/templates/game/src/Client/Main.client.clpp +0 -4
  188. package/templates/game/src/Declarations/Net.flare +0 -5
  189. package/templates/game/src/Include/GameTypes.clh +0 -40
  190. package/templates/game/src/Modules/Core/Guard.server.clpp +0 -7
  191. package/templates/game/src/Modules/Core/PlayerHandler.server.clpp +0 -24
  192. package/templates/game/src/Server/Boot/DataBoot.server.clpp +0 -13
  193. package/templates/game/src/Server/Main.server.clpp +0 -4
  194. package/templates/game/stylua.toml +0 -9
  195. package/templates/game/wally.toml +0 -12
@@ -0,0 +1,336 @@
1
+ /** CL++ syntax tree. The checker annotates nodes in place (`ty`, `res`, `sym`). */
2
+
3
+ import type { Span } from "./source.js";
4
+ import type { Type } from "./types.js";
5
+
6
+ // ---------- types as written ----------
7
+
8
+ export type TypeNode =
9
+ | { kind: "Named"; name: string; qualifier?: string; args: TypeNode[]; span: Span }
10
+ | { kind: "Literal"; value: string | number | boolean; span: Span }
11
+ | { kind: "Union"; members: TypeNode[]; span: Span }
12
+ | { kind: "Intersection"; members: TypeNode[]; span: Span }
13
+ | { kind: "Optional"; inner: TypeNode; span: Span }
14
+ | { kind: "Func"; params: TypeNode[]; ret: TypeNode | null; span: Span };
15
+
16
+ // ---------- expressions ----------
17
+
18
+ export interface ExprBase {
19
+ span: Span;
20
+ /** Type inferred by the checker. */
21
+ ty?: Type;
22
+ /** Resolution details for the emitter (what a name or member refers to). */
23
+ res?: Resolution;
24
+ /** CL++ value semantics: this read must be copied (struct/list/dictionary flowing into a new owner). */
25
+ copy?: boolean;
26
+ /** Type the checker narrowed this read to (`if (p != null)`), when it differs from the declared one. */
27
+ narrowedFrom?: Type;
28
+ }
29
+
30
+ export interface Arg {
31
+ name: string | null;
32
+ nameSpan?: Span;
33
+ value: Expr;
34
+ }
35
+
36
+ export interface Param {
37
+ name: string;
38
+ span: Span;
39
+ type: TypeNode | null;
40
+ variadic: boolean;
41
+ defaultValue: Expr | null;
42
+ /** Filled by the checker. */
43
+ ty?: Type;
44
+ sym?: SymbolRef;
45
+ }
46
+
47
+ export type Expr =
48
+ | (ExprBase & { kind: "Number"; value: number; isFloat: boolean; raw: string })
49
+ | (ExprBase & { kind: "String"; value: string })
50
+ | (ExprBase & { kind: "Template"; parts: Array<string | Expr> })
51
+ | (ExprBase & { kind: "Bool"; value: boolean })
52
+ | (ExprBase & { kind: "Null" })
53
+ | (ExprBase & { kind: "Name"; name: string; typeArgs: TypeNode[] | null })
54
+ | (ExprBase & { kind: "SelfField"; name: string; nameSpan: Span })
55
+ | (ExprBase & { kind: "Member"; object: Expr; name: string; nameSpan: Span; typeArgs: TypeNode[] | null })
56
+ | (ExprBase & { kind: "Scope"; object: Expr; name: string; nameSpan: Span })
57
+ | (ExprBase & { kind: "Index"; object: Expr; index: Expr })
58
+ | (ExprBase & { kind: "Call"; callee: Expr; args: Arg[]; legacyConnect?: boolean })
59
+ | (ExprBase & { kind: "New"; target: Expr; args: Arg[]; hasParens: boolean })
60
+ | (ExprBase & { kind: "Unary"; op: "-" | "not" | "~"; operand: Expr; loose: boolean })
61
+ | (ExprBase & { kind: "Binary"; op: BinaryOp; left: Expr; right: Expr; opSpan: Span })
62
+ | (ExprBase & { kind: "Ternary"; cond: Expr; then: Expr; else: Expr })
63
+ | (ExprBase & { kind: "Function"; params: Param[]; returnType: TypeNode | null; body: Stmt[] | Expr; isLambda: boolean; fn?: FuncInfo })
64
+ | (ExprBase & { kind: "Spawn"; call: Expr })
65
+ | (ExprBase & { kind: "Await"; operand: Expr })
66
+ | (ExprBase & { kind: "Thread"; call: Expr })
67
+ | (ExprBase & { kind: "Join"; operand: Expr })
68
+ | (ExprBase & { kind: "Move"; operand: Expr })
69
+ | (ExprBase & { kind: "PCall"; operand: Expr })
70
+ | (ExprBase & { kind: "Parallel"; calls: Expr[] })
71
+ | (ExprBase & { kind: "Update"; target: Expr; delta: 1 | -1; prefix: boolean })
72
+ | (ExprBase & { kind: "Cast"; operand: Expr; type: TypeNode })
73
+ | (ExprBase & { kind: "Error" });
74
+
75
+ export type BinaryOp =
76
+ | "+" | "-" | "*" | "/" | "%" | ".:" | ".."
77
+ | "==" | "!=" | "<" | "<=" | ">" | ">="
78
+ | "and" | "or"
79
+ | "&" | "|" | "^" | "shl" | "shr";
80
+
81
+ // ---------- statements ----------
82
+
83
+ export interface StmtBase {
84
+ span: Span;
85
+ attributes?: Attribute[];
86
+ }
87
+
88
+ export interface Attribute {
89
+ name: string;
90
+ args: string[];
91
+ span: Span;
92
+ }
93
+
94
+ export type DeclKind = "let" | "let mut" | "typed" | "auto" | "const" | "constexpr" | "observable" | "atomic" | "decltype";
95
+
96
+ export interface VarName {
97
+ name: string;
98
+ span: Span;
99
+ sym?: SymbolRef;
100
+ }
101
+
102
+ export interface MatchArm {
103
+ pattern: Pattern;
104
+ guard: Expr | null;
105
+ body: Stmt[];
106
+ span: Span;
107
+ }
108
+
109
+ export type Pattern =
110
+ | { kind: "Wildcard"; span: Span }
111
+ | { kind: "Value"; expr: Expr; span: Span }
112
+ | { kind: "Case"; name: string; qualifier: Expr | null; binding: VarName | null; span: Span; res?: Resolution; valueExpr?: Expr };
113
+
114
+ export interface SwitchCase {
115
+ test: Expr | null;
116
+ body: Stmt[];
117
+ span: Span;
118
+ }
119
+
120
+ export type Stmt =
121
+ | (StmtBase & {
122
+ kind: "Var";
123
+ declKind: DeclKind;
124
+ names: VarName[];
125
+ unpack: boolean;
126
+ declaredType: TypeNode | null;
127
+ decltypeOf: Expr | null;
128
+ init: Expr | null;
129
+ /** Top-level `const` hoisted by the checker. */
130
+ predeclared?: boolean;
131
+ })
132
+ | (StmtBase & { kind: "Assign"; target: Expr; op: "=" | "+=" | "-=" | "*=" | "/=" | "%="; value: Expr })
133
+ | (StmtBase & { kind: "Expr"; expr: Expr })
134
+ | (StmtBase & { kind: "If"; cond: Expr; letName: VarName | null; then: Stmt[]; else: Stmt[] | null })
135
+ | (StmtBase & { kind: "While"; cond: Expr; body: Stmt[] })
136
+ | (StmtBase & { kind: "For"; init: Stmt | null; cond: Expr | null; step: Stmt | null; body: Stmt[] })
137
+ | (StmtBase & { kind: "ForIn"; name: VarName; mutable: boolean; iterable: Expr; body: Stmt[]; declaredType?: TypeNode; iterKind?: IterKind; downcast?: boolean })
138
+ | (StmtBase & { kind: "Break" })
139
+ | (StmtBase & { kind: "Continue" })
140
+ | (StmtBase & { kind: "Return"; value: Expr | null })
141
+ | (StmtBase & { kind: "Switch"; subject: Expr; cases: SwitchCase[] })
142
+ | (StmtBase & { kind: "Match"; subject: Expr; arms: MatchArm[]; exhaustive?: boolean })
143
+ | (StmtBase & { kind: "Try"; body: Stmt[]; catchName: VarName | null; handler: Stmt[] })
144
+ | (StmtBase & { kind: "Output"; channel: "post" | "warn" | "report" | "cout"; value: Expr })
145
+ | (StmtBase & { kind: "Connect"; signal: Expr; handler: Expr; target?: "cl" | "rbx" })
146
+ | (StmtBase & { kind: "Signal"; name: VarName; params: TypeNode[] })
147
+ | (StmtBase & { kind: "Using"; module: string; member: string; memberSpan: Span; target?: Expr; sym?: SymbolRef })
148
+ | (StmtBase & { kind: "Block"; body: Stmt[] })
149
+ | (StmtBase & { kind: "Decl"; decl: Decl });
150
+
151
+ export type IterKind = "range" | "list" | "string" | "dict" | "roblox-array" | "generic";
152
+
153
+ // ---------- declarations ----------
154
+
155
+ export interface FuncDecl {
156
+ kind: "Func";
157
+ name: string;
158
+ nameSpan: Span;
159
+ span: Span;
160
+ typeParams: string[];
161
+ params: Param[];
162
+ returnType: TypeNode | null;
163
+ /** null = declaration only (`func f();`, `extern func`, abstract). */
164
+ body: Stmt[] | null;
165
+ isAsync: boolean;
166
+ isExtern: boolean;
167
+ isStatic: boolean;
168
+ isAbstract: boolean;
169
+ isOverride: boolean;
170
+ isFinal: boolean;
171
+ isPrivate: boolean;
172
+ operator: "+" | "-" | "[]" | null;
173
+ where: Array<{ name: string; type: TypeNode }>;
174
+ attributes: Attribute[];
175
+ doc?: string;
176
+ fn?: FuncInfo;
177
+ }
178
+
179
+ export interface FieldDecl {
180
+ name: string;
181
+ nameSpan: Span;
182
+ type: TypeNode;
183
+ isPrivate: boolean;
184
+ span: Span;
185
+ defaultValue?: Expr;
186
+ doc?: string;
187
+ }
188
+
189
+ export interface StructDecl {
190
+ kind: "Struct";
191
+ name: string;
192
+ nameSpan: Span;
193
+ span: Span;
194
+ typeParams: string[];
195
+ bases: TypeNode[];
196
+ fields: FieldDecl[];
197
+ methods: FuncDecl[];
198
+ isAbstract: boolean;
199
+ isFinal: boolean;
200
+ attributes: Attribute[];
201
+ doc?: string;
202
+ }
203
+
204
+ export interface EnumDecl {
205
+ kind: "Enum";
206
+ name: string;
207
+ nameSpan: Span;
208
+ span: Span;
209
+ cases: Array<{ name: string; span: Span; payload: TypeNode | null }>;
210
+ attributes: Attribute[];
211
+ doc?: string;
212
+ }
213
+
214
+ export interface VariantDecl {
215
+ kind: "Variant";
216
+ name: string;
217
+ nameSpan: Span;
218
+ span: Span;
219
+ alternatives: TypeNode[];
220
+ attributes: Attribute[];
221
+ }
222
+
223
+ export interface TypeAliasDecl {
224
+ kind: "TypeAlias";
225
+ name: string;
226
+ nameSpan: Span;
227
+ span: Span;
228
+ type: TypeNode;
229
+ attributes: Attribute[];
230
+ }
231
+
232
+ export interface NamespaceDecl {
233
+ kind: "Namespace";
234
+ name: string;
235
+ nameSpan: Span;
236
+ span: Span;
237
+ funcs: FuncDecl[];
238
+ attributes: Attribute[];
239
+ }
240
+
241
+ export interface LinkDecl {
242
+ kind: "Link";
243
+ /** `@clpp.axiom` (with the @) or the quoted path text. */
244
+ path: string;
245
+ isPackage: boolean;
246
+ alias: string;
247
+ aliasExplicit: boolean;
248
+ pathSpan: Span;
249
+ aliasSpan: Span;
250
+ span: Span;
251
+ attributes: Attribute[];
252
+ }
253
+
254
+ export type Decl = FuncDecl | StructDecl | EnumDecl | VariantDecl | TypeAliasDecl | NamespaceDecl | LinkDecl;
255
+
256
+ export interface Program {
257
+ file: string;
258
+ mode: "nonstrict" | "strict" | "nocheck";
259
+ directives: string[];
260
+ /** Declarations and statements in source order. */
261
+ body: Stmt[];
262
+ }
263
+
264
+ // ---------- checker annotations ----------
265
+
266
+ /** Opaque handle to a checker symbol. */
267
+ export interface SymbolRef {
268
+ id: number;
269
+ name: string;
270
+ /** Name used in the emitted Luau (after renaming collisions). */
271
+ luauName?: string;
272
+ }
273
+
274
+ export interface FuncInfo {
275
+ /** Is this function (or one it calls) able to yield? */
276
+ mayYield?: boolean;
277
+ isMethod?: boolean;
278
+ ownerStruct?: string;
279
+ selfMutated?: boolean;
280
+ capturesTopLevel?: boolean;
281
+ }
282
+
283
+ export type Resolution =
284
+ | { kind: "local"; sym: SymbolRef }
285
+ | { kind: "global"; luau: string }
286
+ | { kind: "service"; service: string }
287
+ | { kind: "func"; sym: SymbolRef }
288
+ | { kind: "struct"; name: string; sym: SymbolRef }
289
+ | { kind: "enum"; name: string; sym: SymbolRef }
290
+ | { kind: "enumCase"; enumName: string; index: number; hasPayload: boolean; anyPayload: boolean }
291
+ | { kind: "module"; alias: string; moduleId: string }
292
+ | { kind: "moduleMember"; alias: string; moduleId: string; member: string; memberKind: "func" | "const" | "struct" | "enum" | "value" }
293
+ | { kind: "const"; value: number | string | boolean | null }
294
+ | { kind: "field"; struct: string }
295
+ | { kind: "method"; struct: string; name: string; isStatic: boolean }
296
+ | { kind: "rbxProperty"; owner: string }
297
+ | { kind: "rbxMethod"; owner: string }
298
+ | { kind: "rbxEvent"; owner: string }
299
+ | { kind: "rbxChild"; owner: string; childName: string; safe: boolean }
300
+ | { kind: "rbxEnum"; enumName: string }
301
+ | { kind: "rbxEnumItem"; enumName: string; item: string }
302
+ | { kind: "datatypeStatic"; datatype: string; member: string }
303
+ | { kind: "datatypeMember"; datatype: string; member: string; isMethod: boolean }
304
+ | { kind: "library"; lib: string; member: string; stringMethod?: boolean }
305
+ | { kind: "vectorComponent"; component: string }
306
+ | { kind: "stdlib"; module: string; member: string }
307
+ | { kind: "builtin"; name: string }
308
+ | { kind: "signal"; sym: SymbolRef }
309
+ | { kind: "dynamic" }
310
+ | { kind: "luauMethod" }
311
+ | { kind: "sharedField"; name: string }
312
+ | { kind: "dataModel" }
313
+ | { kind: "call"; call: CallForm; args: Array<Expr | null>; variadicArgs?: Expr[] };
314
+
315
+ /** How the emitter lowers a call (decided by the checker). */
316
+ export type CallForm =
317
+ | { form: "call" }
318
+ | { form: "struct"; id: string }
319
+ | { form: "instance"; cls: string; props: Arg[]; parent: Expr | null }
320
+ | { form: "datatype"; name: string; props: Arg[] }
321
+ | { form: "enumCase"; enumId: string; index: number }
322
+ | { form: "some" }
323
+ | { form: "ok" }
324
+ | { form: "err" }
325
+ | { form: "variant" }
326
+ | { form: "builtin"; name: string; elemType?: Type }
327
+ | { form: "std"; module: string; fn: string }
328
+ | { form: "signalFire"; sym: SymbolRef }
329
+ | { form: "classArg"; cls: string; cast: boolean }
330
+ | { form: "cast"; to: Type }
331
+ | { form: "service"; service: string }
332
+ | { form: "convert"; to: "int" | "float" | "string" | "bool" }
333
+ | { form: "luauMethod" }
334
+ | { form: "stringMethod"; name: string }
335
+ | { form: "observe"; sym: SymbolRef }
336
+ | { form: "table"; keys: string[] };