semantifold 0.3.0 → 0.5.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 +61 -15
- package/build/index.d.ts +52 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +60 -8
- package/build/src/artifact-path.d.ts +23 -1
- package/build/src/artifact-path.d.ts.map +1 -1
- package/build/src/artifact-path.js +45 -3
- package/build/src/artifacts.d.ts.map +1 -1
- package/build/src/artifacts.js +66 -1
- package/build/src/backends/android.d.ts +49 -0
- package/build/src/backends/android.d.ts.map +1 -0
- package/build/src/backends/android.js +1274 -0
- package/build/src/backends/c-validation.d.ts.map +1 -1
- package/build/src/backends/c-validation.js +7 -3
- package/build/src/backends/cpp-validation.d.ts.map +1 -1
- package/build/src/backends/cpp-validation.js +7 -3
- package/build/src/backends/csharp.js +7 -1
- package/build/src/backends/dart-runtime.d.ts +2 -0
- package/build/src/backends/dart-runtime.d.ts.map +1 -0
- package/build/src/backends/dart-runtime.js +41 -0
- package/build/src/backends/dart.d.ts +20 -0
- package/build/src/backends/dart.d.ts.map +1 -0
- package/build/src/backends/dart.js +321 -0
- package/build/src/backends/effects.d.ts +60 -0
- package/build/src/backends/effects.d.ts.map +1 -0
- package/build/src/backends/effects.js +746 -0
- package/build/src/backends/go.js +18 -4
- package/build/src/backends/identifiers.d.ts +36 -4
- package/build/src/backends/identifiers.d.ts.map +1 -1
- package/build/src/backends/identifiers.js +160 -10
- package/build/src/backends/index.d.ts.map +1 -1
- package/build/src/backends/index.js +27 -4
- package/build/src/backends/ios.d.ts +68 -0
- package/build/src/backends/ios.d.ts.map +1 -0
- package/build/src/backends/ios.js +1503 -0
- package/build/src/backends/java.d.ts.map +1 -1
- package/build/src/backends/java.js +429 -36
- package/build/src/backends/javascript.d.ts +6 -0
- package/build/src/backends/javascript.d.ts.map +1 -1
- package/build/src/backends/javascript.js +380 -24
- package/build/src/backends/kotlin-runtime.d.ts +3 -0
- package/build/src/backends/kotlin-runtime.d.ts.map +1 -0
- package/build/src/backends/kotlin-runtime.js +29 -0
- package/build/src/backends/kotlin.d.ts +33 -0
- package/build/src/backends/kotlin.d.ts.map +1 -0
- package/build/src/backends/kotlin.js +138 -0
- package/build/src/backends/native-validation.d.ts +2 -2
- package/build/src/backends/native-validation.d.ts.map +1 -1
- package/build/src/backends/native-validation.js +2 -2
- package/build/src/backends/ordered-expressions.d.ts.map +1 -1
- package/build/src/backends/ordered-expressions.js +39 -7
- package/build/src/backends/php-stdlib-support.d.ts +19 -0
- package/build/src/backends/php-stdlib-support.d.ts.map +1 -0
- package/build/src/backends/php-stdlib-support.js +227 -0
- package/build/src/backends/php.d.ts.map +1 -1
- package/build/src/backends/php.js +448 -33
- package/build/src/backends/program.d.ts +83 -0
- package/build/src/backends/program.d.ts.map +1 -0
- package/build/src/backends/program.js +1309 -0
- package/build/src/backends/python.js +7 -1
- package/build/src/backends/ruby.d.ts.map +1 -1
- package/build/src/backends/ruby.js +310 -24
- package/build/src/backends/rust-runtime.d.ts +7 -0
- package/build/src/backends/rust-runtime.d.ts.map +1 -0
- package/build/src/backends/rust-runtime.js +32 -0
- package/build/src/backends/rust-validation.d.ts +9 -0
- package/build/src/backends/rust-validation.d.ts.map +1 -0
- package/build/src/backends/rust-validation.js +78 -0
- package/build/src/backends/rust.d.ts +24 -0
- package/build/src/backends/rust.d.ts.map +1 -0
- package/build/src/backends/rust.js +344 -0
- package/build/src/backends/scalars.d.ts +14 -6
- package/build/src/backends/scalars.d.ts.map +1 -1
- package/build/src/backends/scalars.js +167 -17
- package/build/src/backends/shared.d.ts +23 -4
- package/build/src/backends/shared.d.ts.map +1 -1
- package/build/src/backends/shared.js +2174 -62
- package/build/src/backends/stdlib-support.d.ts +14 -0
- package/build/src/backends/stdlib-support.d.ts.map +1 -0
- package/build/src/backends/stdlib-support.js +237 -0
- package/build/src/backends/swift-runtime.d.ts +3 -0
- package/build/src/backends/swift-runtime.d.ts.map +1 -0
- package/build/src/backends/swift-runtime.js +14 -0
- package/build/src/backends/swift.d.ts +8 -0
- package/build/src/backends/swift.d.ts.map +1 -0
- package/build/src/backends/swift.js +127 -0
- package/build/src/backends/typescript.d.ts.map +1 -1
- package/build/src/backends/typescript.js +344 -24
- package/build/src/backends/wasm.d.ts +43 -0
- package/build/src/backends/wasm.d.ts.map +1 -0
- package/build/src/backends/wasm.js +2164 -0
- package/build/src/backends/writer.d.ts +255 -4
- package/build/src/backends/writer.d.ts.map +1 -1
- package/build/src/backends/writer.js +491 -3
- package/build/src/diagnostic.d.ts +4 -3
- package/build/src/diagnostic.d.ts.map +1 -1
- package/build/src/diagnostic.js +5 -3
- package/build/src/frontends/c.d.ts.map +1 -1
- package/build/src/frontends/c.js +5 -3
- package/build/src/frontends/cpp.d.ts.map +1 -1
- package/build/src/frontends/cpp.js +5 -3
- package/build/src/frontends/csharp.d.ts.map +1 -1
- package/build/src/frontends/csharp.js +7 -3
- package/build/src/frontends/dart.d.ts +10 -0
- package/build/src/frontends/dart.d.ts.map +1 -0
- package/build/src/frontends/dart.js +913 -0
- package/build/src/frontends/index.d.ts +3 -1
- package/build/src/frontends/index.d.ts.map +1 -1
- package/build/src/frontends/index.js +15 -5
- package/build/src/frontends/java.d.ts +110 -1
- package/build/src/frontends/java.d.ts.map +1 -1
- package/build/src/frontends/java.js +1725 -70
- package/build/src/frontends/javascript-typescript.d.ts +69 -1
- package/build/src/frontends/javascript-typescript.d.ts.map +1 -1
- package/build/src/frontends/javascript-typescript.js +1825 -93
- package/build/src/frontends/kotlin.d.ts +10 -0
- package/build/src/frontends/kotlin.d.ts.map +1 -0
- package/build/src/frontends/kotlin.js +685 -0
- package/build/src/frontends/php.d.ts +118 -1
- package/build/src/frontends/php.d.ts.map +1 -1
- package/build/src/frontends/php.js +1583 -76
- package/build/src/frontends/program.d.ts +74 -0
- package/build/src/frontends/program.d.ts.map +1 -0
- package/build/src/frontends/program.js +989 -0
- package/build/src/frontends/ruby.d.ts +68 -1
- package/build/src/frontends/ruby.d.ts.map +1 -1
- package/build/src/frontends/ruby.js +1446 -101
- package/build/src/frontends/rust-parser.d.ts +11 -0
- package/build/src/frontends/rust-parser.d.ts.map +1 -0
- package/build/src/frontends/rust-parser.js +15 -0
- package/build/src/frontends/rust.d.ts +14 -0
- package/build/src/frontends/rust.d.ts.map +1 -0
- package/build/src/frontends/rust.js +715 -0
- package/build/src/frontends/scalars.d.ts +10 -0
- package/build/src/frontends/scalars.d.ts.map +1 -1
- package/build/src/frontends/scalars.js +28 -2
- package/build/src/frontends/swift.d.ts +10 -0
- package/build/src/frontends/swift.d.ts.map +1 -0
- package/build/src/frontends/swift.js +860 -0
- package/build/src/frontends/types.d.ts +186 -0
- package/build/src/frontends/types.d.ts.map +1 -0
- package/build/src/frontends/types.js +634 -0
- package/build/src/language-registry.d.ts +46 -4
- package/build/src/language-registry.d.ts.map +1 -1
- package/build/src/language-registry.js +177 -13
- package/build/src/mapping.d.ts +2 -2
- package/build/src/mapping.d.ts.map +1 -1
- package/build/src/mapping.js +31 -10
- package/build/src/semantic/capabilities.d.ts +66 -0
- package/build/src/semantic/capabilities.d.ts.map +1 -0
- package/build/src/semantic/capabilities.js +649 -0
- package/build/src/semantic/effects.d.ts +26 -0
- package/build/src/semantic/effects.d.ts.map +1 -0
- package/build/src/semantic/effects.js +764 -0
- package/build/src/semantic/generics.d.ts +23 -0
- package/build/src/semantic/generics.d.ts.map +1 -0
- package/build/src/semantic/generics.js +61 -0
- package/build/src/semantic/lifetime.d.ts +37 -0
- package/build/src/semantic/lifetime.d.ts.map +1 -0
- package/build/src/semantic/lifetime.js +527 -0
- package/build/src/semantic/provenance.d.ts +9 -2
- package/build/src/semantic/provenance.d.ts.map +1 -1
- package/build/src/semantic/provenance.js +462 -20
- package/build/src/semantic/scalars.d.ts +11 -0
- package/build/src/semantic/scalars.d.ts.map +1 -1
- package/build/src/semantic/scalars.js +16 -1
- package/build/src/semantic/stdlib.d.ts +254 -0
- package/build/src/semantic/stdlib.d.ts.map +1 -0
- package/build/src/semantic/stdlib.js +880 -0
- package/build/src/semantic/types.d.ts +3108 -178
- package/build/src/semantic/types.d.ts.map +1 -1
- package/build/src/semantic/types.js +730 -15
- package/build/src/semantic/validate.d.ts +85 -5
- package/build/src/semantic/validate.d.ts.map +1 -1
- package/build/src/semantic/validate.js +2576 -98
- package/build/src/stdlib-facades.d.ts +304 -0
- package/build/src/stdlib-facades.d.ts.map +1 -0
- package/build/src/stdlib-facades.js +1167 -0
- package/build/src/stdlib-negotiation.d.ts +69 -0
- package/build/src/stdlib-negotiation.d.ts.map +1 -0
- package/build/src/stdlib-negotiation.js +403 -0
- package/build/src/stdlib-providers.d.ts +72 -0
- package/build/src/stdlib-providers.d.ts.map +1 -0
- package/build/src/stdlib-providers.js +339 -0
- package/build/src/toolchains.d.ts +55 -1
- package/build/src/toolchains.d.ts.map +1 -1
- package/build/src/toolchains.js +15 -4
- package/docs/android.md +79 -0
- package/docs/architecture.md +47 -13
- package/docs/dart.md +60 -0
- package/docs/goals.md +3 -3
- package/docs/ios.md +121 -0
- package/docs/kotlin.md +42 -0
- package/docs/language-support.md +238 -26
- package/docs/multi-file-modules.md +52 -0
- package/docs/parser-qualification.md +121 -8
- package/docs/plans/2026-09-05-standard-library-portability.md +10 -10
- package/docs/rust.md +88 -0
- package/docs/source-maps.md +17 -7
- package/docs/specification.md +5 -0
- package/docs/standard-library-portability.md +39 -8
- package/docs/swift.md +44 -0
- package/docs/testing.md +381 -4
- package/docs/webassembly.md +52 -0
- package/index.js +66 -8
- package/node_modules/semantifold-tree-sitter-legacy-internal/README.md +2 -2
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/LICENSE +21 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/README.md +45 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/binding.gyp +30 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/bindings/node/binding.cc +20 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/bindings/node/binding_test.js +9 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/bindings/node/index.d.ts +28 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/bindings/node/index.js +11 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/grammar.js +1630 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/package.json +64 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/darwin-arm64/tree-sitter-rust.node +0 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/darwin-x64/tree-sitter-rust.node +0 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/linux-arm64/tree-sitter-rust.node +0 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/linux-x64/tree-sitter-rust.node +0 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/win32-arm64/tree-sitter-rust.node +0 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/prebuilds/win32-x64/tree-sitter-rust.node +0 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/queries/highlights.scm +159 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/queries/injections.scm +9 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/queries/tags.scm +60 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/grammar.json +9405 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/node-types.json +5399 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/parser.c +192569 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/scanner.c +393 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/tree_sitter/alloc.h +54 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/tree_sitter/array.h +290 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/src/tree_sitter/parser.h +266 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/tree-sitter-rust.wasm +0 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-rust/tree-sitter.json +53 -0
- package/node_modules/semantifold-tree-sitter-legacy-internal/package.json +3 -2
- package/node_modules/semantifold-tree-sitter-legacy-internal/src/c.js +5 -4
- package/package.json +5 -2
- package/src/artifact-path.js +47 -2
- package/src/artifacts.js +67 -0
- package/src/backends/android.js +1370 -0
- package/src/backends/c-validation.js +6 -1
- package/src/backends/cpp-validation.js +6 -1
- package/src/backends/csharp.js +3 -0
- package/src/backends/dart-runtime.js +41 -0
- package/src/backends/dart.js +326 -0
- package/src/backends/effects.js +705 -0
- package/src/backends/go.js +14 -2
- package/src/backends/identifiers.js +166 -9
- package/src/backends/index.js +27 -2
- package/src/backends/ios.js +1612 -0
- package/src/backends/java.js +454 -36
- package/src/backends/javascript.js +389 -23
- package/src/backends/kotlin-runtime.js +29 -0
- package/src/backends/kotlin.js +144 -0
- package/src/backends/native-validation.js +1 -1
- package/src/backends/ordered-expressions.js +40 -6
- package/src/backends/php-stdlib-support.js +239 -0
- package/src/backends/php.js +469 -32
- package/src/backends/program.js +1408 -0
- package/src/backends/python.js +3 -0
- package/src/backends/ruby.js +326 -23
- package/src/backends/rust-runtime.js +34 -0
- package/src/backends/rust-validation.js +75 -0
- package/src/backends/rust.js +335 -0
- package/src/backends/scalars.js +141 -16
- package/src/backends/shared.js +2314 -115
- package/src/backends/stdlib-support.js +234 -0
- package/src/backends/swift-runtime.js +14 -0
- package/src/backends/swift.js +132 -0
- package/src/backends/typescript.js +349 -23
- package/src/backends/wasm.js +2208 -0
- package/src/backends/writer.js +545 -2
- package/src/diagnostic.js +4 -2
- package/src/frontends/c.js +4 -2
- package/src/frontends/cpp.js +4 -2
- package/src/frontends/csharp.js +4 -2
- package/src/frontends/dart.js +963 -0
- package/src/frontends/index.js +14 -4
- package/src/frontends/java.js +1977 -69
- package/src/frontends/javascript-typescript.js +2046 -102
- package/src/frontends/kotlin.js +713 -0
- package/src/frontends/php.js +1725 -79
- package/src/frontends/program.js +1062 -0
- package/src/frontends/ruby.js +1624 -98
- package/src/frontends/rust-parser.js +18 -0
- package/src/frontends/rust.js +714 -0
- package/src/frontends/scalars.js +31 -1
- package/src/frontends/swift.js +893 -0
- package/src/frontends/types.js +750 -0
- package/src/language-registry.js +182 -12
- package/src/mapping.js +33 -9
- package/src/semantic/capabilities.js +671 -0
- package/src/semantic/effects.js +737 -0
- package/src/semantic/generics.js +58 -0
- package/src/semantic/lifetime.js +517 -0
- package/src/semantic/provenance.js +412 -19
- package/src/semantic/scalars.js +17 -0
- package/src/semantic/stdlib.js +921 -0
- package/src/semantic/types.js +810 -14
- package/src/semantic/validate.js +2934 -209
- package/src/stdlib-facades.js +1211 -0
- package/src/stdlib-negotiation.js +446 -0
- package/src/stdlib-providers.js +377 -0
- package/src/toolchains.js +16 -3
package/src/backends/go.js
CHANGED
|
@@ -98,7 +98,12 @@ function validateLocalReads(module) {
|
|
|
98
98
|
declarations.push(statement)
|
|
99
99
|
collectIdentifierReads(statement.initializer, reads)
|
|
100
100
|
} else if (statement.kind == "IfStatement") collectIdentifierReads(statement.condition, reads)
|
|
101
|
-
else
|
|
101
|
+
else if (statement.kind == "AssignmentStatement" || statement.kind == "ExpressionStatement" ||
|
|
102
|
+
statement.kind == "PrintStatement" || statement.kind == "ReturnStatement") {
|
|
103
|
+
const expression = statement.expression
|
|
104
|
+
|
|
105
|
+
if (expression) collectIdentifierReads(expression, reads)
|
|
106
|
+
}
|
|
102
107
|
})
|
|
103
108
|
for (const declaration of declarations) {
|
|
104
109
|
if (!reads.has(declaration.name)) {
|
|
@@ -243,16 +248,23 @@ function emitStatement(writer, statement, indent, path) {
|
|
|
243
248
|
return emitLocal(writer, statement, indent, path)
|
|
244
249
|
}
|
|
245
250
|
if (statement.kind == "IfStatement") return emitIf(writer, statement, indent, path, true)
|
|
251
|
+
if (statement.kind == "ExpressionStatement") throw new TypeError("Go Task 005 expression statement reached emission.")
|
|
252
|
+
if (statement.kind == "BreakStatement" || statement.kind == "ContinueStatement" || statement.kind == "ForEachStatement") {
|
|
253
|
+
throw new TypeError("Unsupported Go statement reached emission.")
|
|
254
|
+
}
|
|
246
255
|
writer.synthetic(indent, "indentation", [statement], [path])
|
|
247
256
|
if (statement.kind == "ReturnStatement") {
|
|
257
|
+
if (!statement.expression) throw new TypeError("Go bare return reached emission.")
|
|
248
258
|
writer.mapped("return", {mappingKind: "anchor", node: statement, path})
|
|
249
259
|
writer.synthetic(" ", "return spacing", [statement], [path])
|
|
250
260
|
emitExpression(writer, statement.expression, path + "/expression", "go", identity)
|
|
251
|
-
} else {
|
|
261
|
+
} else if (statement.kind == "PrintStatement") {
|
|
252
262
|
writer.mapped("fmt.Println", {mappingKind: "anchor", node: statement, path})
|
|
253
263
|
writer.mapped("(", {mappingKind: "anchor", node: statement, path})
|
|
254
264
|
emitExpression(writer, statement.expression, path + "/expression", "go", identity)
|
|
255
265
|
writer.mapped(")", {mappingKind: "anchor", node: statement, path})
|
|
266
|
+
} else {
|
|
267
|
+
throw new TypeError("Unsupported Go statement reached emission after preflight.")
|
|
256
268
|
}
|
|
257
269
|
writer.synthetic("\n", "line break", [statement], [path])
|
|
258
270
|
}
|
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import {unsupportedCapability} from "../diagnostic.js"
|
|
4
4
|
|
|
5
|
-
/** @type {Record<import("../semantic/types.js").
|
|
5
|
+
/** @type {Record<Exclude<import("../semantic/types.js").BackendLanguage, "ios">, RegExp>} */
|
|
6
6
|
const identifierPatterns = {
|
|
7
|
+
android: /^(?:_|\p{L})(?:_|\p{L}|\p{Nd})*$/u,
|
|
8
|
+
dart: /^(?:_|\p{L})(?:_|\p{L}|\p{Nd})*$/u,
|
|
9
|
+
kotlin: /^(?:_|\p{L})(?:_|\p{L}|\p{Nd})*$/u,
|
|
10
|
+
swift: /^(?:_|\p{XID_Start})(?:_|\p{XID_Continue})*$/u,
|
|
11
|
+
rust: /^[A-Za-z_][A-Za-z0-9_]*$/u,
|
|
7
12
|
cpp: /^[A-Za-z][A-Za-z0-9_]*$/u,
|
|
8
13
|
c: /^[A-Za-z][A-Za-z0-9_]*$/u,
|
|
9
14
|
csharp: /^[A-Za-z_][A-Za-z0-9_]*$/u,
|
|
@@ -13,11 +18,48 @@ const identifierPatterns = {
|
|
|
13
18
|
php: /^[A-Za-z_][A-Za-z0-9_]*$/u,
|
|
14
19
|
python: /^(?:_|\p{XID_Start})(?:_|\p{XID_Continue})*$/u,
|
|
15
20
|
ruby: /^[a-z_][A-Za-z0-9_]*$/u,
|
|
16
|
-
typescript: /^[A-Za-z_$][A-Za-z0-9_$]*$/u
|
|
21
|
+
typescript: /^[A-Za-z_$][A-Za-z0-9_$]*$/u,
|
|
22
|
+
wasm: /^(?:[$_]|\p{XID_Start})(?:[$_]|\p{XID_Continue})*$/u
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
/** @type {Record<import("../semantic/types.js").
|
|
25
|
+
/** @type {Record<Exclude<import("../semantic/types.js").BackendLanguage, "ios">, Set<string>>} */
|
|
20
26
|
const reservedWords = {
|
|
27
|
+
android: new Set([
|
|
28
|
+
"as", "break", "class", "continue", "do", "else", "false", "for", "fun", "if", "in", "interface", "is", "null",
|
|
29
|
+
"object", "package", "return", "super", "this", "throw", "true", "try", "typealias", "typeof", "val", "var", "when",
|
|
30
|
+
"while", "_", "main", "println", "Long", "Boolean", "String", "Math", "ArithmeticException"
|
|
31
|
+
]),
|
|
32
|
+
dart: new Set([
|
|
33
|
+
"Function", "Never", "Object", "RangeError", "String", "abstract", "as", "assert", "async", "await", "base",
|
|
34
|
+
"bool", "break", "case", "catch", "class", "const", "continue", "covariant", "default", "deferred", "do",
|
|
35
|
+
"double", "dynamic", "else", "enum", "export", "extends", "extension", "external", "factory", "false", "final",
|
|
36
|
+
"finally", "for", "get", "hide", "if", "implements", "import", "in", "int", "interface", "is", "late", "library",
|
|
37
|
+
"main", "mixin", "native", "new", "null", "num", "of", "on", "operator", "part", "print", "required", "rethrow",
|
|
38
|
+
"return", "sealed", "set", "show", "static", "super", "switch", "sync", "this", "throw", "true", "try", "typedef",
|
|
39
|
+
"var", "void", "when", "while", "with", "yield", "BigInt", "_"
|
|
40
|
+
]),
|
|
41
|
+
kotlin: new Set([
|
|
42
|
+
"as", "break", "class", "continue", "do", "else", "false", "for", "fun", "if", "in", "interface", "is", "null",
|
|
43
|
+
"object", "package", "return", "super", "this", "throw", "true", "try", "typealias", "typeof", "val", "var", "when",
|
|
44
|
+
"while", "_", "main", "println", "Long", "Boolean", "String", "Math", "ArithmeticException"
|
|
45
|
+
]),
|
|
46
|
+
swift: new Set([
|
|
47
|
+
"Any", "Self", "Type", "Protocol", "actor", "any", "as", "associatedtype", "associativity", "async", "await", "borrowing",
|
|
48
|
+
"break", "case", "catch", "class", "consume", "consuming", "continue", "convenience", "copy", "default", "defer", "deinit",
|
|
49
|
+
"didSet", "distributed", "do", "dynamic", "else", "enum", "extension", "fallthrough", "false", "fileprivate", "final", "for",
|
|
50
|
+
"func", "get", "guard", "if", "import", "in", "indirect", "infix", "init", "inout", "internal", "is", "isolated", "lazy",
|
|
51
|
+
"let", "macro", "mutating", "nil", "nonisolated", "nonmutating", "open", "operator", "optional", "override", "package",
|
|
52
|
+
"postfix", "precedence", "precedencegroup", "prefix", "private", "protocol", "public", "repeat", "required", "rethrows", "return",
|
|
53
|
+
"safe", "self", "sending", "set", "some", "static", "struct", "subscript", "super", "switch", "throws", "true", "try",
|
|
54
|
+
"typealias", "unowned", "unsafe", "var", "weak", "where", "while", "willSet", "yield", "_", "Bool", "Int", "Int64", "String",
|
|
55
|
+
"Swift", "main", "print"
|
|
56
|
+
]),
|
|
57
|
+
rust: new Set([
|
|
58
|
+
"as", "async", "await", "break", "const", "continue", "crate", "dyn", "else", "enum", "extern", "false", "fn", "for", "if", "impl", "in",
|
|
59
|
+
"let", "loop", "match", "mod", "move", "mut", "pub", "ref", "return", "self", "Self", "static", "struct", "super", "trait", "true", "type",
|
|
60
|
+
"unsafe", "use", "where", "while", "abstract", "become", "box", "do", "final", "macro", "override", "priv", "typeof", "unsized", "virtual",
|
|
61
|
+
"yield", "try", "union", "_", "main", "String", "std", "i64", "bool"
|
|
62
|
+
]),
|
|
21
63
|
cpp: new Set([
|
|
22
64
|
"alignas", "alignof", "and", "and_eq", "asm", "auto", "bitand", "bitor", "bool", "break", "case", "catch", "char", "char8_t", "char16_t", "char32_t", "class", "compl", "concept", "const", "consteval", "constexpr", "constinit", "const_cast", "continue", "co_await", "co_return", "co_yield", "decltype", "default", "delete", "do", "double", "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq", "private", "protected", "public", "register", "reinterpret_cast", "requires", "return", "short", "signed", "sizeof", "static", "static_assert", "static_cast", "struct", "switch", "template", "this", "thread_local", "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq", "std", "string", "numeric_limits",
|
|
23
65
|
// The qualified libstdc++ <string> include chain also exposes these global names.
|
|
@@ -108,7 +150,8 @@ const reservedWords = {
|
|
|
108
150
|
"override", "package", "private", "protected", "public", "readonly", "require", "return", "satisfies", "set",
|
|
109
151
|
"static", "string", "super", "switch", "symbol", "this", "throw", "true", "try", "type", "typeof", "undefined",
|
|
110
152
|
"unique", "unknown", "using", "var", "void", "while", "with", "yield"
|
|
111
|
-
])
|
|
153
|
+
]),
|
|
154
|
+
wasm: new Set()
|
|
112
155
|
}
|
|
113
156
|
|
|
114
157
|
const phpInvalidParameterBindings = new Set([
|
|
@@ -116,9 +159,61 @@ const phpInvalidParameterBindings = new Set([
|
|
|
116
159
|
])
|
|
117
160
|
const phpInvalidAssignedBindings = new Set(["GLOBALS", "this"])
|
|
118
161
|
|
|
162
|
+
/** @type {Readonly<Partial<Record<import("../semantic/types.js").BackendLanguage, Set<string>>>>} */
|
|
163
|
+
const reservedTypeNames = Object.freeze({
|
|
164
|
+
java: new Set(["Boolean", "Integer", "Main", "Math", "Object", "String", "System"]),
|
|
165
|
+
javascript: new Set(["Array", "Boolean", "Map", "Math", "Number", "Object", "Reflect", "String"]),
|
|
166
|
+
php: new Set([
|
|
167
|
+
"addressinfo", "allowdynamicproperties", "appenditerator", "argumentcounterror", "arithmeticerror", "arrayaccess",
|
|
168
|
+
"arrayiterator", "arrayobject", "assertionerror", "attribute", "backedenum", "badfunctioncallexception",
|
|
169
|
+
"badmethodcallexception", "cachingiterator",
|
|
170
|
+
"callbackfilteriterator", "closedgeneratorexception", "closure", "compileerror", "countable", "dateerror", "dateexception",
|
|
171
|
+
"dateinterval", "dateinvalidoperationexception", "dateinvalidtimezoneexception", "datemalformedintervalstringexception",
|
|
172
|
+
"datemalformedperiodstringexception", "datemalformedstringexception", "dateobjecterror", "dateperiod", "daterangeerror",
|
|
173
|
+
"datetime", "datetimeimmutable", "datetimeinterface", "datetimezone", "deflatecontext", "delayedtargetvalidation",
|
|
174
|
+
"deprecated", "directory", "directoryiterator", "divisionbyzeroerror", "domainexception", "emptyiterator", "error",
|
|
175
|
+
"errorexception", "exception", "ffi", "fiber", "fibererror", "filesystemiterator", "filteriterator", "finfo", "generator",
|
|
176
|
+
"globiterator", "hashcontext", "infiniteiterator", "inflatecontext", "internaliterator", "invalidargumentexception",
|
|
177
|
+
"iterator", "iteratoraggregate", "iteratoriterator", "jsonexception", "jsonserializable", "lengthexception",
|
|
178
|
+
"libxmlerror", "limititerator", "logicexception", "multipleiterator", "nodiscard", "norewinditerator",
|
|
179
|
+
"opensslasymmetrickey", "opensslcertificate", "opensslcertificatesigningrequest",
|
|
180
|
+
"outofboundsexception", "outofrangeexception", "outeriterator", "overflowexception", "override", "parentiterator",
|
|
181
|
+
"parseerror", "pdo", "pdoexception", "pdorow", "pdostatement", "phar", "phardata", "pharexception", "pharfileinfo",
|
|
182
|
+
"php_user_filter", "phptoken", "propertyhooktype", "rangeexception", "recursivearrayiterator", "recursivecachingiterator",
|
|
183
|
+
"recursivecallbackfilteriterator",
|
|
184
|
+
"recursivedirectoryiterator", "recursivefilteriterator", "recursiveiterator", "recursiveiteratoriterator",
|
|
185
|
+
"recursiveregexiterator", "recursivetreeiterator", "reflection", "reflectionattribute", "reflectionclass",
|
|
186
|
+
"reflectionclassconstant", "reflectionconstant", "reflectionenum", "reflectionenumbackedcase", "reflectionenumunitcase",
|
|
187
|
+
"reflectionexception", "reflectionextension", "reflectionfiber", "reflectionfunction", "reflectionfunctionabstract",
|
|
188
|
+
"reflectiongenerator", "reflectionintersectiontype", "reflectionmethod", "reflectionnamedtype", "reflectionobject",
|
|
189
|
+
"reflectionparameter", "reflectionproperty", "reflectionreference", "reflectiontype", "reflectionuniontype",
|
|
190
|
+
"reflectionzendextension", "reflector", "regexiterator", "requestparsebodyexception", "returntypewillchange",
|
|
191
|
+
"roundingmode", "runtimeexception", "seekableiterator", "sensitiveparameter", "sensitiveparametervalue", "serializable",
|
|
192
|
+
"sessionhandler", "sessionhandlerinterface", "sessionidinterface", "sessionupdatetimestamphandlerinterface", "shmop",
|
|
193
|
+
"socket", "sodiumexception", "spldoublylinkedlist", "splfileinfo",
|
|
194
|
+
"splfileobject", "splfixedarray", "splheap", "splmaxheap", "splminheap", "splobjectstorage", "splobserver",
|
|
195
|
+
"splpriorityqueue", "splqueue", "splstack", "splsubject", "spltempfileobject", "stdclass", "streambucket", "stringable",
|
|
196
|
+
"sysvmessagequeue", "sysvsemaphore", "sysvsharedmemory", "throwable", "traversable", "typeerror", "underflowexception",
|
|
197
|
+
"unexpectedvalueexception", "unhandledmatcherror", "unitenum", "valueerror", "weakmap", "weakreference"
|
|
198
|
+
]),
|
|
199
|
+
ruby: new Set([
|
|
200
|
+
"ArgumentError", "Array", "BasicObject", "Binding", "Class", "ClosedQueueError", "Comparable", "Complex", "Data", "Dir",
|
|
201
|
+
"Encoding", "EncodingError", "Enumerable", "Enumerator", "EOFError", "Errno", "Exception", "FalseClass", "Fiber",
|
|
202
|
+
"FiberError", "File", "FileTest", "Float", "FrozenError", "GC", "Hash", "IO", "IOError", "IndexError", "Integer",
|
|
203
|
+
"Interrupt", "Kernel", "KeyError", "LoadError", "LocalJumpError", "Marshal", "MatchData", "Math", "Method", "Module",
|
|
204
|
+
"Mutex", "NameError", "NilClass", "NoMemoryError", "NoMethodError", "NotImplementedError", "Numeric", "Object",
|
|
205
|
+
"ObjectSpace", "Proc", "Process", "Queue", "Ractor", "Random", "Range", "Rational", "Regexp", "RegexpError", "RubyVM",
|
|
206
|
+
"RuntimeError", "ScriptError", "SecurityError", "Signal", "SignalException", "SizedQueue", "StandardError", "StopIteration",
|
|
207
|
+
"String", "Struct", "Symbol", "SyntaxError", "SystemCallError", "SystemExit", "SystemStackError", "Thread", "ThreadError",
|
|
208
|
+
"ThreadGroup", "Time", "TracePoint", "TrueClass", "TypeError", "UnboundMethod", "UncaughtThrowError", "Warning",
|
|
209
|
+
"ZeroDivisionError"
|
|
210
|
+
]),
|
|
211
|
+
typescript: new Set(["Array", "Boolean", "Map", "Math", "Number", "Object", "ReadonlyArray", "ReadonlyMap", "Reflect", "String"])
|
|
212
|
+
})
|
|
213
|
+
|
|
119
214
|
/**
|
|
120
215
|
* Validates an identifier against the target backend's deliberately narrow lexical contract.
|
|
121
|
-
* @param {import("../semantic/types.js").
|
|
216
|
+
* @param {import("../semantic/types.js").BackendLanguage} language - Target language.
|
|
122
217
|
* @param {unknown} name - Candidate semantic identifier.
|
|
123
218
|
* @param {string} role - Identifier role for diagnostics.
|
|
124
219
|
* @param {import("../semantic/types.js").SourceLocation | undefined} location - Originating location.
|
|
@@ -128,11 +223,16 @@ export function validateTargetIdentifier(language, name, role, location) {
|
|
|
128
223
|
if (typeof name != "string") unsupportedCapability(language, `${role} identifier`, location)
|
|
129
224
|
|
|
130
225
|
const reservedName = language == "php" ? name.toLowerCase() : name
|
|
226
|
+
const syntaxLanguage = language == "ios" ? "swift" : language
|
|
131
227
|
|
|
132
|
-
if (!identifierPatterns[
|
|
228
|
+
if (!identifierPatterns[syntaxLanguage].test(name) || reservedWords[syntaxLanguage].has(reservedName) ||
|
|
133
229
|
language == "python" && name.normalize("NFKC") != name ||
|
|
134
230
|
language == "c" && !isCIdentifier(name) ||
|
|
135
|
-
language == "
|
|
231
|
+
language == "rust" && !isRustIdentifier(name) ||
|
|
232
|
+
language == "cpp" && !isCppIdentifier(name) ||
|
|
233
|
+
language == "dart" && !isDartIdentifier(name) ||
|
|
234
|
+
language == "swift" && (!isSwiftIdentifier(name) || name.normalize("NFC") != name) ||
|
|
235
|
+
language == "kotlin" && (!isKotlinIdentifier(name) || name.normalize("NFC") != name)) {
|
|
136
236
|
unsupportedCapability(language, `${role} identifier '${name}'`, location)
|
|
137
237
|
}
|
|
138
238
|
}
|
|
@@ -150,7 +250,7 @@ export function isCIdentifier(name) {
|
|
|
150
250
|
|
|
151
251
|
/**
|
|
152
252
|
* Validates a binding identifier against target restrictions beyond general identifier syntax.
|
|
153
|
-
* @param {import("../semantic/types.js").
|
|
253
|
+
* @param {import("../semantic/types.js").BackendLanguage} language - Target language.
|
|
154
254
|
* @param {unknown} name - Candidate semantic identifier.
|
|
155
255
|
* @param {string} role - Binding role for diagnostics.
|
|
156
256
|
* @param {import("../semantic/types.js").SourceLocation | undefined} location - Originating location.
|
|
@@ -162,7 +262,7 @@ export function validateTargetBindingIdentifier(language, name, role, location)
|
|
|
162
262
|
const invalidTypeScriptBinding = language == "typescript" && (name == "arguments" || name == "eval")
|
|
163
263
|
const invalidPhpVariable = language == "php" && typeof name == "string" &&
|
|
164
264
|
((role == "parameter" && phpInvalidParameterBindings.has(name)) ||
|
|
165
|
-
((role == "local" || role == "assignment target") && phpInvalidAssignedBindings.has(name)))
|
|
265
|
+
((role == "local" || role == "assignment target" || role == "catch binding") && phpInvalidAssignedBindings.has(name)))
|
|
166
266
|
const invalidRubyBinding = language == "ruby" && typeof name == "string" && /^_[1-9]$/u.test(name)
|
|
167
267
|
|
|
168
268
|
if (invalidTypeScriptBinding || invalidPhpVariable || invalidRubyBinding) {
|
|
@@ -170,6 +270,25 @@ export function validateTargetBindingIdentifier(language, name, role, location)
|
|
|
170
270
|
}
|
|
171
271
|
}
|
|
172
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Validates a nominal record/type declaration name for the original-five targets.
|
|
275
|
+
* @param {import("../semantic/types.js").BackendLanguage} language - Backend language.
|
|
276
|
+
* @param {unknown} name - Candidate type name.
|
|
277
|
+
* @param {import("../semantic/types.js").SourceLocation | undefined} location - Declaration location.
|
|
278
|
+
* @returns {void}
|
|
279
|
+
*/
|
|
280
|
+
export function validateTargetTypeIdentifier(language, name, location) {
|
|
281
|
+
if (typeof name != "string" || !/^[A-Z][A-Za-z0-9_]*$/u.test(name)) {
|
|
282
|
+
unsupportedCapability(language, `record type identifier '${String(name)}'`, location)
|
|
283
|
+
}
|
|
284
|
+
const reservedName = language == "php" ? name.toLowerCase() : name
|
|
285
|
+
const syntaxLanguage = language == "ios" ? "swift" : language
|
|
286
|
+
|
|
287
|
+
if (reservedWords[syntaxLanguage].has(reservedName) || reservedTypeNames[language]?.has(reservedName)) {
|
|
288
|
+
unsupportedCapability(language, `record type identifier '${name}'`, location)
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
173
292
|
/**
|
|
174
293
|
* Protects C++ keywords, the actual included C library names/macros and the scaffold namespace.
|
|
175
294
|
* @param {string} name - Caller scalar binding or function name.
|
|
@@ -178,3 +297,41 @@ export function validateTargetBindingIdentifier(language, name, role, location)
|
|
|
178
297
|
export function isCppIdentifier(name) {
|
|
179
298
|
return isCIdentifier(name) && !name.includes("__") && !reservedWords.cpp.has(name)
|
|
180
299
|
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Protects the edition-2021 scalar, entry and exact helper environment in both directions.
|
|
303
|
+
* @param {string} name - Caller-owned function or binding name.
|
|
304
|
+
* @returns {boolean} Whether ordinary Rust syntax can represent the name safely.
|
|
305
|
+
*/
|
|
306
|
+
export function isRustIdentifier(name) {
|
|
307
|
+
return identifierPatterns.rust.test(name) && !reservedWords.rust.has(name) && !name.startsWith("semantifold_")
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Protects Swift keywords, scalar names, entry plumbing, and target-only helper names.
|
|
312
|
+
* @param {string} name - Caller-owned function or binding name.
|
|
313
|
+
* @returns {boolean} Whether ordinary unescaped Swift syntax can preserve the name.
|
|
314
|
+
*/
|
|
315
|
+
export function isSwiftIdentifier(name) {
|
|
316
|
+
return identifierPatterns.swift.test(name) && !reservedWords.swift.has(name) && !name.startsWith("semantifold_")
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Protects Kotlin keywords, JVM scalar/scaffold names, and target-only helper names.
|
|
321
|
+
* @param {string} name - Caller-owned function or binding name.
|
|
322
|
+
* @returns {boolean} Whether ordinary unescaped Kotlin syntax can preserve the name.
|
|
323
|
+
*/
|
|
324
|
+
export function isKotlinIdentifier(name) {
|
|
325
|
+
return identifierPatterns.kotlin.test(name) && !reservedWords.kotlin.has(name) && !name.startsWith("semantifold_") &&
|
|
326
|
+
!name.startsWith("SEMANTIFOLD_")
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Protects Dart keywords, VM scalar/scaffold names, and compiler-owned helpers.
|
|
331
|
+
* @param {string} name - Caller-owned function or binding name.
|
|
332
|
+
* @returns {boolean} Whether ordinary Dart syntax can preserve the name.
|
|
333
|
+
*/
|
|
334
|
+
export function isDartIdentifier(name) {
|
|
335
|
+
return identifierPatterns.dart.test(name) && !reservedWords.dart.has(name) &&
|
|
336
|
+
!name.startsWith("_semantifold") && name.normalize("NFC") == name
|
|
337
|
+
}
|
package/src/backends/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {validateNativeGraph} from "./native-validation.js"
|
|
|
7
7
|
import {validateBackendModule} from "./shared.js"
|
|
8
8
|
import {SourceWriter} from "./writer.js"
|
|
9
9
|
import {finalizeMapping, toSourceMapV3} from "../mapping.js"
|
|
10
|
+
import {preflightEffectCapabilities} from "./effects.js"
|
|
10
11
|
const syntheticArtifactBase = Object.freeze(["__semantifold_artifacts__"])
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -38,12 +39,30 @@ export function generateArtifactSource({language, filename, mapDirective = "none
|
|
|
38
39
|
if (record.artifactMultiplicity != "single") unsupportedRole(language, "single-text backend", module?.location)
|
|
39
40
|
if (filename === undefined) filename = record.defaultFilename
|
|
40
41
|
if (sourceMapFilename === undefined) sourceMapFilename = `${filename}.map`
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const genericDeclaration = [...module?.records ?? [], ...module?.functions ?? []]
|
|
43
|
+
.find((declaration) => (declaration?.typeParameters?.length ?? 0) > 0)
|
|
44
|
+
|
|
45
|
+
if (genericDeclaration && !record.features.typeParametersAndGenerics) {
|
|
46
|
+
unsupportedCapability(/** @type {import("../semantic/types.js").BackendLanguage} */ (language),
|
|
47
|
+
"Task 012 type parameters and generics", genericDeclaration.location ?? module.location)
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(module?.records) && module.records.length > 0 && !record.features.closedRecords) {
|
|
50
|
+
unsupportedCapability(/** @type {import("../semantic/types.js").BackendLanguage} */ (language),
|
|
51
|
+
"Task 009 closed records", module.records[0].location ?? module.location)
|
|
52
|
+
}
|
|
53
|
+
preflightEffectCapabilities(module, /** @type {import("../semantic/types.js").BackendLanguage} */ (language))
|
|
54
|
+
if (language == "cpp" || language == "kotlin" || language == "swift") validateNativeGraph(module, language)
|
|
55
|
+
validateBackendModule(module, /** @type {import("../semantic/types.js").BackendLanguage} */ (language))
|
|
43
56
|
|
|
44
57
|
if (language == "cpp" && (mapDirective != "none" || sourceMapFilename != "program.cpp.map")) {
|
|
45
58
|
unsupportedCapability(language, "CPP map directive or alternate source-map filename", module.location)
|
|
46
59
|
}
|
|
60
|
+
if (language == "swift" && (mapDirective != "none" || sourceMapFilename != "program.swift.map")) {
|
|
61
|
+
unsupportedCapability(language, "Swift map directive or alternate source-map filename", module.location)
|
|
62
|
+
}
|
|
63
|
+
if (language == "kotlin" && (mapDirective != "none" || sourceMapFilename != "Program.kt.map")) {
|
|
64
|
+
unsupportedCapability(language, "Kotlin map directive or alternate source-map filename", module.location)
|
|
65
|
+
}
|
|
47
66
|
|
|
48
67
|
if (!isValidFilenameMetadata(filename)) {
|
|
49
68
|
throw new TypeError("Generated filename must be a non-empty single-line string.")
|
|
@@ -52,6 +71,8 @@ export function generateArtifactSource({language, filename, mapDirective = "none
|
|
|
52
71
|
throw new TypeError("Source map filename must be a non-empty single-line string.")
|
|
53
72
|
}
|
|
54
73
|
if (language == "cpp" && filename != "program.cpp") unsupportedCapability(language, "artifact filename other than program.cpp", module.location)
|
|
74
|
+
if (language == "swift" && filename != "program.swift") unsupportedCapability(language, "artifact filename other than program.swift", module.location)
|
|
75
|
+
if (language == "kotlin" && filename != "Program.kt") unsupportedCapability(language, "artifact filename other than Program.kt", module.location)
|
|
55
76
|
if (language == "java" && filename.split(/[\\/]/u).at(-1) != "Main.java") {
|
|
56
77
|
unsupportedCapability(language, "artifact filename basename other than Main.java", module.location)
|
|
57
78
|
}
|
|
@@ -81,6 +102,10 @@ export function generateArtifactSource({language, filename, mapDirective = "none
|
|
|
81
102
|
|
|
82
103
|
const mapping = finalizeMapping(writer.finish())
|
|
83
104
|
|
|
105
|
+
if (language == "swift" || language == "kotlin") {
|
|
106
|
+
languageRegistry.resolve(language, "frontend", module.location)({filename, source: mapping.generated.content})
|
|
107
|
+
}
|
|
108
|
+
|
|
84
109
|
return {
|
|
85
110
|
code: mapping.generated.content,
|
|
86
111
|
filename,
|