@velarscript/compiler 0.10.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/LICENSE +201 -0
- package/README.md +70 -0
- package/dist/analyzer.d.ts +1175 -0
- package/dist/analyzer.d.ts.map +1 -0
- package/dist/analyzer.js +12130 -0
- package/dist/analyzer.js.map +1 -0
- package/dist/application-package-host.d.ts +28 -0
- package/dist/application-package-host.d.ts.map +1 -0
- package/dist/application-package-host.js +2 -0
- package/dist/application-package-host.js.map +1 -0
- package/dist/ast.d.ts +853 -0
- package/dist/ast.d.ts.map +1 -0
- package/dist/ast.js +245 -0
- package/dist/ast.js.map +1 -0
- package/dist/class-runtime.d.ts +6 -0
- package/dist/class-runtime.d.ts.map +1 -0
- package/dist/class-runtime.js +45 -0
- package/dist/class-runtime.js.map +1 -0
- package/dist/collection-lowering-runtime.d.ts +7 -0
- package/dist/collection-lowering-runtime.d.ts.map +1 -0
- package/dist/collection-lowering-runtime.js +952 -0
- package/dist/collection-lowering-runtime.js.map +1 -0
- package/dist/collection-runtime.d.ts +16 -0
- package/dist/collection-runtime.d.ts.map +1 -0
- package/dist/collection-runtime.js +231 -0
- package/dist/collection-runtime.js.map +1 -0
- package/dist/core-vocabulary.d.ts +141 -0
- package/dist/core-vocabulary.d.ts.map +1 -0
- package/dist/core-vocabulary.js +88 -0
- package/dist/core-vocabulary.js.map +1 -0
- package/dist/diagnostic.d.ts +42 -0
- package/dist/diagnostic.d.ts.map +1 -0
- package/dist/diagnostic.js +66 -0
- package/dist/diagnostic.js.map +1 -0
- package/dist/embedded-javascript.d.ts +74 -0
- package/dist/embedded-javascript.d.ts.map +1 -0
- package/dist/embedded-javascript.js +341 -0
- package/dist/embedded-javascript.js.map +1 -0
- package/dist/embedded-module.d.ts +11 -0
- package/dist/embedded-module.d.ts.map +1 -0
- package/dist/embedded-module.js +67 -0
- package/dist/embedded-module.js.map +1 -0
- package/dist/embedded-source.d.ts +19 -0
- package/dist/embedded-source.d.ts.map +1 -0
- package/dist/embedded-source.js +61 -0
- package/dist/embedded-source.js.map +1 -0
- package/dist/emitter.d.ts +188 -0
- package/dist/emitter.d.ts.map +1 -0
- package/dist/emitter.js +3254 -0
- package/dist/emitter.js.map +1 -0
- package/dist/error-runtime.d.ts +17 -0
- package/dist/error-runtime.d.ts.map +1 -0
- package/dist/error-runtime.js +109 -0
- package/dist/error-runtime.js.map +1 -0
- package/dist/extension.d.ts +373 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +25 -0
- package/dist/extension.js.map +1 -0
- package/dist/formatter.d.ts +13 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +1440 -0
- package/dist/formatter.js.map +1 -0
- package/dist/framework-host.d.ts +87 -0
- package/dist/framework-host.d.ts.map +1 -0
- package/dist/framework-host.js +2 -0
- package/dist/framework-host.js.map +1 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +932 -0
- package/dist/index.js.map +1 -0
- package/dist/interpolated-string.d.ts +47 -0
- package/dist/interpolated-string.d.ts.map +1 -0
- package/dist/interpolated-string.js +344 -0
- package/dist/interpolated-string.js.map +1 -0
- package/dist/json-runtime.d.ts +2 -0
- package/dist/json-runtime.d.ts.map +1 -0
- package/dist/json-runtime.js +193 -0
- package/dist/json-runtime.js.map +1 -0
- package/dist/language-guidance.d.ts +31 -0
- package/dist/language-guidance.d.ts.map +1 -0
- package/dist/language-guidance.js +187 -0
- package/dist/language-guidance.js.map +1 -0
- package/dist/lexer.d.ts +85 -0
- package/dist/lexer.d.ts.map +1 -0
- package/dist/lexer.js +1004 -0
- package/dist/lexer.js.map +1 -0
- package/dist/limits.d.ts +2 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +2 -0
- package/dist/limits.js.map +1 -0
- package/dist/mechanical-fix.d.ts +26 -0
- package/dist/mechanical-fix.d.ts.map +1 -0
- package/dist/mechanical-fix.js +61 -0
- package/dist/mechanical-fix.js.map +1 -0
- package/dist/narrowing-runtime.d.ts +5 -0
- package/dist/narrowing-runtime.d.ts.map +1 -0
- package/dist/narrowing-runtime.js +27 -0
- package/dist/narrowing-runtime.js.map +1 -0
- package/dist/number-runtime.d.ts +3 -0
- package/dist/number-runtime.d.ts.map +1 -0
- package/dist/number-runtime.js +37 -0
- package/dist/number-runtime.js.map +1 -0
- package/dist/parser.d.ts +245 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +3582 -0
- package/dist/parser.js.map +1 -0
- package/dist/primitive-runtime.d.ts +4 -0
- package/dist/primitive-runtime.d.ts.map +1 -0
- package/dist/primitive-runtime.js +39 -0
- package/dist/primitive-runtime.js.map +1 -0
- package/dist/promise-runtime.d.ts +6 -0
- package/dist/promise-runtime.d.ts.map +1 -0
- package/dist/promise-runtime.js +86 -0
- package/dist/promise-runtime.js.map +1 -0
- package/dist/reactive-bridge-runtime.d.ts +7 -0
- package/dist/reactive-bridge-runtime.d.ts.map +1 -0
- package/dist/reactive-bridge-runtime.js +112 -0
- package/dist/reactive-bridge-runtime.js.map +1 -0
- package/dist/runtime-abi.d.ts +24 -0
- package/dist/runtime-abi.d.ts.map +1 -0
- package/dist/runtime-abi.js +24 -0
- package/dist/runtime-abi.js.map +1 -0
- package/dist/semantic.d.ts +142 -0
- package/dist/semantic.d.ts.map +1 -0
- package/dist/semantic.js +845 -0
- package/dist/semantic.js.map +1 -0
- package/dist/source-names.d.ts +32 -0
- package/dist/source-names.d.ts.map +1 -0
- package/dist/source-names.js +101 -0
- package/dist/source-names.js.map +1 -0
- package/dist/source.d.ts +19 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +64 -0
- package/dist/source.js.map +1 -0
- package/dist/text-runtime.d.ts +2 -0
- package/dist/text-runtime.d.ts.map +1 -0
- package/dist/text-runtime.js +285 -0
- package/dist/text-runtime.js.map +1 -0
- package/dist/token.d.ts +19 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +51 -0
- package/dist/token.js.map +1 -0
- package/dist/type-registry-runtime.d.ts +7 -0
- package/dist/type-registry-runtime.d.ts.map +1 -0
- package/dist/type-registry-runtime.js +51 -0
- package/dist/type-registry-runtime.js.map +1 -0
- package/dist/type-validation-runtime.d.ts +17 -0
- package/dist/type-validation-runtime.d.ts.map +1 -0
- package/dist/type-validation-runtime.js +150 -0
- package/dist/type-validation-runtime.js.map +1 -0
- package/dist/types.d.ts +356 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1170 -0
- package/dist/types.js.map +1 -0
- package/dist/utf8-runtime.d.ts +7 -0
- package/dist/utf8-runtime.d.ts.map +1 -0
- package/dist/utf8-runtime.js +43 -0
- package/dist/utf8-runtime.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-lowering-runtime.js","sourceRoot":"","sources":["../src/collection-lowering-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAE5E,MAAM,CAAC,MAAM,gCAAgC,GAAG,+CAA+C,CAAC;AAEhG,qEAAqE;AACrE,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,2BAA2B;IAC3B,wBAAwB;IACxB,sBAAsB;IACtB,eAAe;IACf,0BAA0B;IAC1B,6BAA6B;IAC7B,4BAA4B;IAC5B,+BAA+B;IAC/B,+BAA+B;IAC/B,2BAA2B;IAC3B,+BAA+B;IAC/B,iBAAiB;IACjB,yBAAyB;IACzB,mBAAmB;IACnB,wBAAwB;IACxB,kBAAkB;IAClB,kBAAkB;IAClB,uBAAuB;IACvB,sBAAsB;IACtB,wBAAwB;IACxB,6EAA6E;IAC7E,uEAAuE;IACvE,4EAA4E;IAC5E,0EAA0E;IAC1E,qBAAqB;IACrB,mBAAmB;IACnB,cAAc;IACd,sBAAsB;IACtB,iBAAiB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yGAk1B8C,CAAC;AAE1G,MAAM,CAAC,MAAM,uCAAuC,GAAG,MAAM,CAAC,GAAG,CAAA;;EAE/D,6BAA6B,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SAC7D,IAAI,CAAC,SAAS,CAAC,4BAA4B,CAAC;;;;;;;;;;SAU5C,IAAI,CAAC,SAAS,CAAC,4BAA4B,CAAC;EACnD,iCAAiC;;EAEjC,iCAAiC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;CAEzE,CAAC,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Canonical generated runtime for collection identity and runtime-Type traversal. */
|
|
2
|
+
export declare const VELAR_COLLECTION_IDENTITY_RUNTIME: string;
|
|
3
|
+
/** Additional host traversal used only when a module emits runtime collection Types. */
|
|
4
|
+
export declare const VELAR_COLLECTION_TYPE_RUNTIME: string;
|
|
5
|
+
/** Host operations required by ordinary List validation and receiver methods. */
|
|
6
|
+
export declare const VELAR_COLLECTION_LIST_RUNTIME: string;
|
|
7
|
+
/** Host operations required by ordinary Set and Map construction and receiver methods. */
|
|
8
|
+
export declare const VELAR_COLLECTION_SET_MAP_RUNTIME: string;
|
|
9
|
+
/** Host operations required by ordinary Record validation and receiver methods. */
|
|
10
|
+
export declare const VELAR_COLLECTION_RECORD_RUNTIME: string;
|
|
11
|
+
export declare const VELAR_COLLECTION_HOST_MODULE = "velar/compiler-runtime-collections-v1";
|
|
12
|
+
/** Names consumed by module-local collection algorithms from the shared host ABI. */
|
|
13
|
+
export declare const VELAR_COLLECTION_HOST_EXPORTS: readonly ["__velarCollectionNativeArray", "__velarCollectionNativeMap", "__velarCollectionNativeSet", "__velarCollectionNativeObject", "__velarCollectionNativeTypeError", "__velarCollectionGetPrototypeOf", "__velarCollectionObjectPrototype", "__velarCollectionHostCall", "__velarIsMap", "__velarIsSet", "__velarIsRecord", "__velarCollectionListNativeRangeError", "__velarCollectionListIsArray", "__velarCollectionListGetOwnPropertyDescriptor", "__velarCollectionListOwnNames", "__velarCollectionListOwnSymbols", "__velarCollectionListDefineProperty", "__velarCollectionListObjectIs", "__velarCollectionListIsInteger", "__velarCollectionListIsNaN", "__velarCollectionListIsFinite", "__velarCollectionListMaximum", "__velarCollectionListMinimum", "__velarCollectionListHostJoin", "__velarCollectionListHostSort", "__velarCollectionListHostReverse", "__velarCollectionSetMapNativeRangeError", "__velarCollectionSetMapFreeze", "__velarCollectionSetMapSetSize", "__velarCollectionSetMapMapSize", "__velarCollectionSetMapSetAdd", "__velarCollectionSetMapSetHas", "__velarCollectionSetMapSetDelete", "__velarCollectionSetMapSetClear", "__velarCollectionSetMapSetValues", "__velarCollectionSetMapSetNext", "__velarCollectionSetMapMapGet", "__velarCollectionSetMapMapSet", "__velarCollectionSetMapMapHas", "__velarCollectionSetMapMapDelete", "__velarCollectionSetMapMapClear", "__velarCollectionSetMapMapKeys", "__velarCollectionSetMapMapValues", "__velarCollectionSetMapMapEntries", "__velarCollectionSetMapMapNext", "__velarCollectionRecordNativeRangeError", "__velarCollectionRecordGetOwnPropertyDescriptor", "__velarCollectionRecordOwnNames", "__velarCollectionRecordOwnSymbols", "__velarCollectionRecordDefineProperty", "__velarCollectionRecordObjectIs", "__velarCollectionRecordDeleteProperty", "__velarCollectionRecordFreeze"];
|
|
14
|
+
/** Project-shared immutable host operations for module-local collection algorithms. */
|
|
15
|
+
export declare const VELAR_COLLECTION_HOST_MODULE_SOURCE: string;
|
|
16
|
+
//# sourceMappingURL=collection-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-runtime.d.ts","sourceRoot":"","sources":["../src/collection-runtime.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,eAAO,MAAM,iCAAiC,QAuDjC,CAAC;AAEd,wFAAwF;AACxF,eAAO,MAAM,6BAA6B,QAc7B,CAAC;AAEd,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,QA+B7B,CAAC;AAEd,0FAA0F;AAC1F,eAAO,MAAM,gCAAgC,QAsChC,CAAC;AAEd,mFAAmF;AACnF,eAAO,MAAM,+BAA+B,QAe/B,CAAC;AAEd,eAAO,MAAM,4BAA4B,0CAA0C,CAAC;AAEpF,qFAAqF;AACrF,eAAO,MAAM,6BAA6B,YACxC,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,+BAA+B,EAC/B,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EAClC,2BAA2B,EAC3B,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,uCAAuC,EACvC,8BAA8B,EAC9B,+CAA+C,EAC/C,+BAA+B,EAC/B,iCAAiC,EACjC,qCAAqC,EACrC,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,+BAA+B,EAC/B,8BAA8B,EAC9B,8BAA8B,EAC9B,+BAA+B,EAC/B,+BAA+B,EAC/B,kCAAkC,EAClC,yCAAyC,EACzC,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EAChC,+BAA+B,EAC/B,+BAA+B,EAC/B,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EAClC,gCAAgC,EAChC,+BAA+B,EAC/B,+BAA+B,EAC/B,+BAA+B,EAC/B,kCAAkC,EAClC,iCAAiC,EACjC,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,gCAAgC,EAChC,yCAAyC,EACzC,iDAAiD,EACjD,iCAAiC,EACjC,mCAAmC,EACnC,uCAAuC,EACvC,iCAAiC,EACjC,uCAAuC,EACvC,+BAA+B,CACvB,CAAC;AAEX,uFAAuF;AACvF,eAAO,MAAM,mCAAmC,QAQnC,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/** Canonical generated runtime for collection identity and runtime-Type traversal. */
|
|
2
|
+
export const VELAR_COLLECTION_IDENTITY_RUNTIME = String.raw `
|
|
3
|
+
const __velarCollectionNativeArray = globalThis.Array;
|
|
4
|
+
const __velarCollectionNativeMap = globalThis.Map;
|
|
5
|
+
const __velarCollectionNativeSet = globalThis.Set;
|
|
6
|
+
const __velarCollectionNativeObject = globalThis.Object;
|
|
7
|
+
const __velarCollectionNativeReflect = globalThis.Reflect;
|
|
8
|
+
const __velarCollectionNativeWeakMap = globalThis.WeakMap;
|
|
9
|
+
const __velarCollectionNativeTypeError = globalThis.TypeError;
|
|
10
|
+
const __velarCollectionGetOwnPropertyDescriptor = __velarCollectionNativeObject.getOwnPropertyDescriptor;
|
|
11
|
+
const __velarCollectionReflectApply = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeReflect, "apply")?.value;
|
|
12
|
+
const __velarCollectionArrayIsArray = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeArray, "isArray")?.value;
|
|
13
|
+
const __velarCollectionGetPrototypeOf = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "getPrototypeOf")?.value;
|
|
14
|
+
const __velarCollectionObjectPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "prototype")?.value;
|
|
15
|
+
const __velarCollectionMapPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeMap, "prototype")?.value;
|
|
16
|
+
const __velarCollectionSetPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeSet, "prototype")?.value;
|
|
17
|
+
const __velarCollectionMapSize = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "size")?.get;
|
|
18
|
+
const __velarCollectionSetSize = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, "size")?.get;
|
|
19
|
+
function __velarCollectionHostCall(operation, receiver, arguments_) {
|
|
20
|
+
if (typeof operation !== "function" || typeof __velarCollectionReflectApply !== "function") throw new __velarCollectionNativeTypeError("The JavaScript collection runtime is unavailable");
|
|
21
|
+
return __velarCollectionReflectApply(operation, receiver, arguments_);
|
|
22
|
+
}
|
|
23
|
+
const __velarCollectionWeakMapPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeWeakMap, "prototype")?.value;
|
|
24
|
+
const __velarCollectionWeakMapGetOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionWeakMapPrototype, "get")?.value;
|
|
25
|
+
const __velarCollectionWeakMapSetOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionWeakMapPrototype, "set")?.value;
|
|
26
|
+
const __velarCollectionBrands = new __velarCollectionNativeWeakMap();
|
|
27
|
+
// The only unforgeable, cross-realm Map/Set test JavaScript offers is invoking
|
|
28
|
+
// the prototype 'size' getter and observing whether it throws, and a thrown and
|
|
29
|
+
// caught exception costs roughly 1.8us -- paid by every Set membership test,
|
|
30
|
+
// which probes Map first. Internal slots are fixed at construction, so the
|
|
31
|
+
// verdict can never change for a given object: probe once, then answer from a
|
|
32
|
+
// WeakMap. 0 = neither, 1 = Map, 2 = Set.
|
|
33
|
+
function __velarCollectionBrand(value) {
|
|
34
|
+
if (value === null || (typeof value !== "object" && typeof value !== "function")) return 0;
|
|
35
|
+
const known = __velarCollectionHostCall(__velarCollectionWeakMapGetOperation, __velarCollectionBrands, [value]);
|
|
36
|
+
if (known !== undefined) return known;
|
|
37
|
+
let brand = 0;
|
|
38
|
+
try { __velarCollectionHostCall(__velarCollectionMapSize, value, []); brand = 1; }
|
|
39
|
+
catch {
|
|
40
|
+
try { __velarCollectionHostCall(__velarCollectionSetSize, value, []); brand = 2; }
|
|
41
|
+
catch { brand = 0; }
|
|
42
|
+
}
|
|
43
|
+
__velarCollectionHostCall(__velarCollectionWeakMapSetOperation, __velarCollectionBrands, [value, brand]);
|
|
44
|
+
return brand;
|
|
45
|
+
}
|
|
46
|
+
function __velarIsMap(value) {
|
|
47
|
+
return __velarCollectionBrand(value) === 1;
|
|
48
|
+
}
|
|
49
|
+
function __velarIsSet(value) {
|
|
50
|
+
return __velarCollectionBrand(value) === 2;
|
|
51
|
+
}
|
|
52
|
+
function __velarIsRecord(value) {
|
|
53
|
+
if (value === null || typeof value !== "object" || __velarCollectionHostCall(__velarCollectionArrayIsArray, __velarCollectionNativeArray, [value])) return false;
|
|
54
|
+
const prototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [value]);
|
|
55
|
+
return prototype === __velarCollectionObjectPrototype || prototype === null;
|
|
56
|
+
}
|
|
57
|
+
`.trimStart();
|
|
58
|
+
/** Additional host traversal used only when a module emits runtime collection Types. */
|
|
59
|
+
export const VELAR_COLLECTION_TYPE_RUNTIME = String.raw `
|
|
60
|
+
const __velarCollectionOwnNames = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "getOwnPropertyNames")?.value;
|
|
61
|
+
const __velarCollectionOwnSymbols = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "getOwnPropertySymbols")?.value;
|
|
62
|
+
const __velarCollectionOwnKeys = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeReflect, "ownKeys")?.value;
|
|
63
|
+
const __velarCollectionMapEntries = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "entries")?.value;
|
|
64
|
+
const __velarCollectionSetValues = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, "values")?.value;
|
|
65
|
+
const __velarCollectionMapIteratorPrototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [__velarCollectionHostCall(__velarCollectionMapEntries, new __velarCollectionNativeMap(), [])]);
|
|
66
|
+
const __velarCollectionSetIteratorPrototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [__velarCollectionHostCall(__velarCollectionSetValues, new __velarCollectionNativeSet(), [])]);
|
|
67
|
+
const __velarCollectionMapIteratorNext = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapIteratorPrototype, "next")?.value;
|
|
68
|
+
const __velarCollectionSetIteratorNext = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetIteratorPrototype, "next")?.value;
|
|
69
|
+
function __velarCollectionMapTypeIterator(value) { return __velarCollectionHostCall(__velarCollectionMapEntries, value, []); }
|
|
70
|
+
function __velarCollectionSetTypeIterator(value) { return __velarCollectionHostCall(__velarCollectionSetValues, value, []); }
|
|
71
|
+
function __velarCollectionMapTypeNext(iterator) { return __velarCollectionHostCall(__velarCollectionMapIteratorNext, iterator, []); }
|
|
72
|
+
function __velarCollectionSetTypeNext(iterator) { return __velarCollectionHostCall(__velarCollectionSetIteratorNext, iterator, []); }
|
|
73
|
+
`.trimStart();
|
|
74
|
+
/** Host operations required by ordinary List validation and receiver methods. */
|
|
75
|
+
export const VELAR_COLLECTION_LIST_RUNTIME = String.raw `
|
|
76
|
+
const __velarCollectionListNativeNumber = globalThis.Number;
|
|
77
|
+
const __velarCollectionListNativeMath = globalThis.Math;
|
|
78
|
+
const __velarCollectionListNativeRangeError = globalThis.RangeError;
|
|
79
|
+
const __velarCollectionListArrayPrototype = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeArray, "prototype")?.value;
|
|
80
|
+
const __velarCollectionListOwnNamesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "getOwnPropertyNames")?.value;
|
|
81
|
+
const __velarCollectionListOwnSymbolsOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "getOwnPropertySymbols")?.value;
|
|
82
|
+
const __velarCollectionListDefinePropertyOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "defineProperty")?.value;
|
|
83
|
+
const __velarCollectionListObjectIsOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "is")?.value;
|
|
84
|
+
const __velarCollectionListIntegerOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeNumber, "isInteger")?.value;
|
|
85
|
+
const __velarCollectionListNaNOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeNumber, "isNaN")?.value;
|
|
86
|
+
const __velarCollectionListFiniteOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeNumber, "isFinite")?.value;
|
|
87
|
+
const __velarCollectionListMaximumOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeMath, "max")?.value;
|
|
88
|
+
const __velarCollectionListMinimumOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListNativeMath, "min")?.value;
|
|
89
|
+
const __velarCollectionListJoinOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListArrayPrototype, "join")?.value;
|
|
90
|
+
const __velarCollectionListSortOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListArrayPrototype, "sort")?.value;
|
|
91
|
+
const __velarCollectionListReverseOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionListArrayPrototype, "reverse")?.value;
|
|
92
|
+
function __velarCollectionListIsArray(value) { return __velarCollectionHostCall(__velarCollectionArrayIsArray, __velarCollectionNativeArray, [value]); }
|
|
93
|
+
function __velarCollectionListGetOwnPropertyDescriptor(value, key) { return __velarCollectionHostCall(__velarCollectionGetOwnPropertyDescriptor, __velarCollectionNativeObject, [value, key]); }
|
|
94
|
+
function __velarCollectionListOwnNames(value) { return __velarCollectionHostCall(__velarCollectionListOwnNamesOperation, __velarCollectionNativeObject, [value]); }
|
|
95
|
+
function __velarCollectionListOwnSymbols(value) { return __velarCollectionHostCall(__velarCollectionListOwnSymbolsOperation, __velarCollectionNativeObject, [value]); }
|
|
96
|
+
function __velarCollectionListDefineProperty(value, key, descriptor) { return __velarCollectionHostCall(__velarCollectionListDefinePropertyOperation, __velarCollectionNativeObject, [value, key, descriptor]); }
|
|
97
|
+
function __velarCollectionListObjectIs(left, right) { return __velarCollectionHostCall(__velarCollectionListObjectIsOperation, __velarCollectionNativeObject, [left, right]); }
|
|
98
|
+
function __velarCollectionListIsInteger(value) { return __velarCollectionHostCall(__velarCollectionListIntegerOperation, __velarCollectionListNativeNumber, [value]); }
|
|
99
|
+
function __velarCollectionListIsNaN(value) { return __velarCollectionHostCall(__velarCollectionListNaNOperation, __velarCollectionListNativeNumber, [value]); }
|
|
100
|
+
function __velarCollectionListIsFinite(value) { return __velarCollectionHostCall(__velarCollectionListFiniteOperation, __velarCollectionListNativeNumber, [value]); }
|
|
101
|
+
function __velarCollectionListMaximum(...values) { return __velarCollectionHostCall(__velarCollectionListMaximumOperation, __velarCollectionListNativeMath, values); }
|
|
102
|
+
function __velarCollectionListMinimum(...values) { return __velarCollectionHostCall(__velarCollectionListMinimumOperation, __velarCollectionListNativeMath, values); }
|
|
103
|
+
function __velarCollectionListHostJoin(value, separator) { return __velarCollectionHostCall(__velarCollectionListJoinOperation, value, [separator]); }
|
|
104
|
+
function __velarCollectionListHostSort(value, compare) { return __velarCollectionHostCall(__velarCollectionListSortOperation, value, [compare]); }
|
|
105
|
+
function __velarCollectionListHostReverse(value) { return __velarCollectionHostCall(__velarCollectionListReverseOperation, value, []); }
|
|
106
|
+
`.trimStart();
|
|
107
|
+
/** Host operations required by ordinary Set and Map construction and receiver methods. */
|
|
108
|
+
export const VELAR_COLLECTION_SET_MAP_RUNTIME = String.raw `
|
|
109
|
+
const __velarCollectionSetMapNativeRangeError = globalThis.RangeError;
|
|
110
|
+
const __velarCollectionSetMapFreezeOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "freeze")?.value;
|
|
111
|
+
const __velarCollectionSetAddOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, "add")?.value;
|
|
112
|
+
const __velarCollectionSetHasOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, "has")?.value;
|
|
113
|
+
const __velarCollectionSetDeleteOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, "delete")?.value;
|
|
114
|
+
const __velarCollectionSetClearOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, "clear")?.value;
|
|
115
|
+
const __velarCollectionSetValuesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetPrototype, "values")?.value;
|
|
116
|
+
const __velarCollectionMapGetOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "get")?.value;
|
|
117
|
+
const __velarCollectionMapSetOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "set")?.value;
|
|
118
|
+
const __velarCollectionMapHasOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "has")?.value;
|
|
119
|
+
const __velarCollectionMapDeleteOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "delete")?.value;
|
|
120
|
+
const __velarCollectionMapClearOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "clear")?.value;
|
|
121
|
+
const __velarCollectionMapKeysOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "keys")?.value;
|
|
122
|
+
const __velarCollectionMapValuesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "values")?.value;
|
|
123
|
+
const __velarCollectionMapEntriesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionMapPrototype, "entries")?.value;
|
|
124
|
+
const __velarCollectionSetMapMapIteratorPrototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [__velarCollectionHostCall(__velarCollectionMapEntriesOperation, new __velarCollectionNativeMap(), [])]);
|
|
125
|
+
const __velarCollectionSetMapSetIteratorPrototype = __velarCollectionHostCall(__velarCollectionGetPrototypeOf, __velarCollectionNativeObject, [__velarCollectionHostCall(__velarCollectionSetValuesOperation, new __velarCollectionNativeSet(), [])]);
|
|
126
|
+
const __velarCollectionSetMapMapIteratorNext = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetMapMapIteratorPrototype, "next")?.value;
|
|
127
|
+
const __velarCollectionSetMapSetIteratorNext = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionSetMapSetIteratorPrototype, "next")?.value;
|
|
128
|
+
function __velarCollectionSetMapFreeze(value) { return __velarCollectionHostCall(__velarCollectionSetMapFreezeOperation, __velarCollectionNativeObject, [value]); }
|
|
129
|
+
function __velarCollectionSetMapSetSize(value) { return __velarCollectionHostCall(__velarCollectionSetSize, value, []); }
|
|
130
|
+
function __velarCollectionSetMapMapSize(value) { return __velarCollectionHostCall(__velarCollectionMapSize, value, []); }
|
|
131
|
+
function __velarCollectionSetMapSetAdd(value, item) { return __velarCollectionHostCall(__velarCollectionSetAddOperation, value, [item]); }
|
|
132
|
+
function __velarCollectionSetMapSetHas(value, item) { return __velarCollectionHostCall(__velarCollectionSetHasOperation, value, [item]); }
|
|
133
|
+
function __velarCollectionSetMapSetDelete(value, item) { return __velarCollectionHostCall(__velarCollectionSetDeleteOperation, value, [item]); }
|
|
134
|
+
function __velarCollectionSetMapSetClear(value) { return __velarCollectionHostCall(__velarCollectionSetClearOperation, value, []); }
|
|
135
|
+
function __velarCollectionSetMapSetValues(value) { return __velarCollectionHostCall(__velarCollectionSetValuesOperation, value, []); }
|
|
136
|
+
function __velarCollectionSetMapSetNext(iterator) { return __velarCollectionHostCall(__velarCollectionSetMapSetIteratorNext, iterator, []); }
|
|
137
|
+
function __velarCollectionSetMapMapGet(value, key) { return __velarCollectionHostCall(__velarCollectionMapGetOperation, value, [key]); }
|
|
138
|
+
function __velarCollectionSetMapMapSet(value, key, item) { return __velarCollectionHostCall(__velarCollectionMapSetOperation, value, [key, item]); }
|
|
139
|
+
function __velarCollectionSetMapMapHas(value, key) { return __velarCollectionHostCall(__velarCollectionMapHasOperation, value, [key]); }
|
|
140
|
+
function __velarCollectionSetMapMapDelete(value, key) { return __velarCollectionHostCall(__velarCollectionMapDeleteOperation, value, [key]); }
|
|
141
|
+
function __velarCollectionSetMapMapClear(value) { return __velarCollectionHostCall(__velarCollectionMapClearOperation, value, []); }
|
|
142
|
+
function __velarCollectionSetMapMapKeys(value) { return __velarCollectionHostCall(__velarCollectionMapKeysOperation, value, []); }
|
|
143
|
+
function __velarCollectionSetMapMapValues(value) { return __velarCollectionHostCall(__velarCollectionMapValuesOperation, value, []); }
|
|
144
|
+
function __velarCollectionSetMapMapEntries(value) { return __velarCollectionHostCall(__velarCollectionMapEntriesOperation, value, []); }
|
|
145
|
+
function __velarCollectionSetMapMapNext(iterator) { return __velarCollectionHostCall(__velarCollectionSetMapMapIteratorNext, iterator, []); }
|
|
146
|
+
`.trimStart();
|
|
147
|
+
/** Host operations required by ordinary Record validation and receiver methods. */
|
|
148
|
+
export const VELAR_COLLECTION_RECORD_RUNTIME = String.raw `
|
|
149
|
+
const __velarCollectionRecordNativeRangeError = globalThis.RangeError;
|
|
150
|
+
const __velarCollectionRecordOwnNamesOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "getOwnPropertyNames")?.value;
|
|
151
|
+
const __velarCollectionRecordOwnSymbolsOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "getOwnPropertySymbols")?.value;
|
|
152
|
+
const __velarCollectionRecordDefinePropertyOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "defineProperty")?.value;
|
|
153
|
+
const __velarCollectionRecordObjectIsOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "is")?.value;
|
|
154
|
+
const __velarCollectionRecordDeletePropertyOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeReflect, "deleteProperty")?.value;
|
|
155
|
+
const __velarCollectionRecordFreezeOperation = __velarCollectionGetOwnPropertyDescriptor(__velarCollectionNativeObject, "freeze")?.value;
|
|
156
|
+
function __velarCollectionRecordGetOwnPropertyDescriptor(value, key) { return __velarCollectionHostCall(__velarCollectionGetOwnPropertyDescriptor, __velarCollectionNativeObject, [value, key]); }
|
|
157
|
+
function __velarCollectionRecordOwnNames(value) { return __velarCollectionHostCall(__velarCollectionRecordOwnNamesOperation, __velarCollectionNativeObject, [value]); }
|
|
158
|
+
function __velarCollectionRecordOwnSymbols(value) { return __velarCollectionHostCall(__velarCollectionRecordOwnSymbolsOperation, __velarCollectionNativeObject, [value]); }
|
|
159
|
+
function __velarCollectionRecordDefineProperty(value, key, descriptor) { return __velarCollectionHostCall(__velarCollectionRecordDefinePropertyOperation, __velarCollectionNativeObject, [value, key, descriptor]); }
|
|
160
|
+
function __velarCollectionRecordObjectIs(left, right) { return __velarCollectionHostCall(__velarCollectionRecordObjectIsOperation, __velarCollectionNativeObject, [left, right]); }
|
|
161
|
+
function __velarCollectionRecordDeleteProperty(value, key) { return __velarCollectionHostCall(__velarCollectionRecordDeletePropertyOperation, __velarCollectionNativeReflect, [value, key]); }
|
|
162
|
+
function __velarCollectionRecordFreeze(value) { return __velarCollectionHostCall(__velarCollectionRecordFreezeOperation, __velarCollectionNativeObject, [value]); }
|
|
163
|
+
`.trimStart();
|
|
164
|
+
export const VELAR_COLLECTION_HOST_MODULE = "velar/compiler-runtime-collections-v1";
|
|
165
|
+
/** Names consumed by module-local collection algorithms from the shared host ABI. */
|
|
166
|
+
export const VELAR_COLLECTION_HOST_EXPORTS = [
|
|
167
|
+
"__velarCollectionNativeArray",
|
|
168
|
+
"__velarCollectionNativeMap",
|
|
169
|
+
"__velarCollectionNativeSet",
|
|
170
|
+
"__velarCollectionNativeObject",
|
|
171
|
+
"__velarCollectionNativeTypeError",
|
|
172
|
+
"__velarCollectionGetPrototypeOf",
|
|
173
|
+
"__velarCollectionObjectPrototype",
|
|
174
|
+
"__velarCollectionHostCall",
|
|
175
|
+
"__velarIsMap",
|
|
176
|
+
"__velarIsSet",
|
|
177
|
+
"__velarIsRecord",
|
|
178
|
+
"__velarCollectionListNativeRangeError",
|
|
179
|
+
"__velarCollectionListIsArray",
|
|
180
|
+
"__velarCollectionListGetOwnPropertyDescriptor",
|
|
181
|
+
"__velarCollectionListOwnNames",
|
|
182
|
+
"__velarCollectionListOwnSymbols",
|
|
183
|
+
"__velarCollectionListDefineProperty",
|
|
184
|
+
"__velarCollectionListObjectIs",
|
|
185
|
+
"__velarCollectionListIsInteger",
|
|
186
|
+
"__velarCollectionListIsNaN",
|
|
187
|
+
"__velarCollectionListIsFinite",
|
|
188
|
+
"__velarCollectionListMaximum",
|
|
189
|
+
"__velarCollectionListMinimum",
|
|
190
|
+
"__velarCollectionListHostJoin",
|
|
191
|
+
"__velarCollectionListHostSort",
|
|
192
|
+
"__velarCollectionListHostReverse",
|
|
193
|
+
"__velarCollectionSetMapNativeRangeError",
|
|
194
|
+
"__velarCollectionSetMapFreeze",
|
|
195
|
+
"__velarCollectionSetMapSetSize",
|
|
196
|
+
"__velarCollectionSetMapMapSize",
|
|
197
|
+
"__velarCollectionSetMapSetAdd",
|
|
198
|
+
"__velarCollectionSetMapSetHas",
|
|
199
|
+
"__velarCollectionSetMapSetDelete",
|
|
200
|
+
"__velarCollectionSetMapSetClear",
|
|
201
|
+
"__velarCollectionSetMapSetValues",
|
|
202
|
+
"__velarCollectionSetMapSetNext",
|
|
203
|
+
"__velarCollectionSetMapMapGet",
|
|
204
|
+
"__velarCollectionSetMapMapSet",
|
|
205
|
+
"__velarCollectionSetMapMapHas",
|
|
206
|
+
"__velarCollectionSetMapMapDelete",
|
|
207
|
+
"__velarCollectionSetMapMapClear",
|
|
208
|
+
"__velarCollectionSetMapMapKeys",
|
|
209
|
+
"__velarCollectionSetMapMapValues",
|
|
210
|
+
"__velarCollectionSetMapMapEntries",
|
|
211
|
+
"__velarCollectionSetMapMapNext",
|
|
212
|
+
"__velarCollectionRecordNativeRangeError",
|
|
213
|
+
"__velarCollectionRecordGetOwnPropertyDescriptor",
|
|
214
|
+
"__velarCollectionRecordOwnNames",
|
|
215
|
+
"__velarCollectionRecordOwnSymbols",
|
|
216
|
+
"__velarCollectionRecordDefineProperty",
|
|
217
|
+
"__velarCollectionRecordObjectIs",
|
|
218
|
+
"__velarCollectionRecordDeleteProperty",
|
|
219
|
+
"__velarCollectionRecordFreeze",
|
|
220
|
+
];
|
|
221
|
+
/** Project-shared immutable host operations for module-local collection algorithms. */
|
|
222
|
+
export const VELAR_COLLECTION_HOST_MODULE_SOURCE = String.raw `
|
|
223
|
+
${VELAR_COLLECTION_IDENTITY_RUNTIME}
|
|
224
|
+
${VELAR_COLLECTION_LIST_RUNTIME}
|
|
225
|
+
${VELAR_COLLECTION_SET_MAP_RUNTIME}
|
|
226
|
+
${VELAR_COLLECTION_RECORD_RUNTIME}
|
|
227
|
+
export {
|
|
228
|
+
${VELAR_COLLECTION_HOST_EXPORTS.map((name) => ` ${name},`).join("\n")}
|
|
229
|
+
};
|
|
230
|
+
`.trimStart();
|
|
231
|
+
//# sourceMappingURL=collection-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-runtime.js","sourceRoot":"","sources":["../src/collection-runtime.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;C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B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,kCAAkC;IAClC,iCAAiC;IACjC,gCAAgC;IAChC,kCAAkC;IAClC,mCAAmC;IACnC,gCAAgC;IAChC,yCAAyC;IACzC,iDAAiD;IACjD,iCAAiC;IACjC,mCAAmC;IACnC,uCAAuC;IACvC,iCAAiC;IACjC,uCAAuC;IACvC,+BAA+B;CACvB,CAAC;AAEX,uFAAuF;AACvF,MAAM,CAAC,MAAM,mCAAmC,GAAG,MAAM,CAAC,GAAG,CAAA;EAC3D,iCAAiC;EACjC,6BAA6B;EAC7B,gCAAgC;EAChC,+BAA+B;;EAE/B,6BAA6B,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;CAErE,CAAC,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* D57 rules 134/135 and D62 rules 157/158: the one roster of Core's own
|
|
3
|
+
* vocabulary — the permanent (resident) namespaces, the prelude names that
|
|
4
|
+
* need no import, the contextual keywords, and the numeric suffixes.
|
|
5
|
+
*
|
|
6
|
+
* Every place that has to know the whole vocabulary derives it from here: the
|
|
7
|
+
* analyzer's builtin table is keyed by these names, and `source-names.ts`
|
|
8
|
+
* refuses them as binding spellings by reading this roster rather than by
|
|
9
|
+
* restating it. Before that, the refusal list was a hand-kept copy of the
|
|
10
|
+
* JavaScript globals, so `Math` was protected only because it happens to be a
|
|
11
|
+
* JavaScript global too, while `Json`, `Promise`, `Text`, `equals`, and
|
|
12
|
+
* `range` were not protected at all. Adding a namespace or a prelude name
|
|
13
|
+
* here is now the whole change; nothing downstream can stay behind.
|
|
14
|
+
*
|
|
15
|
+
* The contextual keywords arrived the same way and worse: D62 rule 157 found
|
|
16
|
+
* four partial copies (`parser.ts` knew one word by table and the rest as
|
|
17
|
+
* inline literals, `formatter.ts` knew two, `language-server.ts` knew six) and
|
|
18
|
+
* **no original at all**, so charter §3's cross-cutting claim — that each of
|
|
19
|
+
* these words is an ordinary name in seven positions — named a set nothing
|
|
20
|
+
* could enumerate. It is enumerable here now.
|
|
21
|
+
*
|
|
22
|
+
* This module deliberately holds names and plain data — no imports — so the
|
|
23
|
+
* lexer-facing `source-names.ts`, the lexer, the parser, the formatter and the
|
|
24
|
+
* analyzer can all read it without a cycle between them.
|
|
25
|
+
*/
|
|
26
|
+
/** The namespaces that are always in scope and are not values (D51 rule 106). */
|
|
27
|
+
export declare const PERMANENT_NAMESPACE_NAMES: readonly ["Json", "Promise", "Text", "Math"];
|
|
28
|
+
/** The prelude functions that need no import (D47 rule 81, D50 rule 90). */
|
|
29
|
+
export declare const CORE_PRELUDE_NAMES: readonly ["number", "str", "print", "equals", "range"];
|
|
30
|
+
export type PermanentNamespaceName = (typeof PERMANENT_NAMESPACE_NAMES)[number];
|
|
31
|
+
export type CorePreludeName = (typeof CORE_PRELUDE_NAMES)[number];
|
|
32
|
+
export type CoreVocabularyName = PermanentNamespaceName | CorePreludeName;
|
|
33
|
+
/** The full Core vocabulary: no binding may spell one of these (D57 rule 135). */
|
|
34
|
+
export declare const CORE_VOCABULARY_NAMES: readonly CoreVocabularyName[];
|
|
35
|
+
export declare function isPermanentNamespaceName(name: string): name is PermanentNamespaceName;
|
|
36
|
+
/**
|
|
37
|
+
* D62 rule 157: one entry per word the lexer emits as an ordinary identifier
|
|
38
|
+
* and the Core parser claims as syntax in one shape and nowhere else.
|
|
39
|
+
*
|
|
40
|
+
* Membership is decided by *live* syntax. A word the parser recognizes only in
|
|
41
|
+
* order to reject it is not here: `init` (the removed `init:` block), `set`
|
|
42
|
+
* (VelarScript has no setters), `default` (no default export), and `invert`
|
|
43
|
+
* (the removed toggle statement) are spellings the language does not have, and
|
|
44
|
+
* requiring a tour or an editor to offer them would resurrect them. `dispose`
|
|
45
|
+
* is not here either — it is only ever read after `@`, which is the separate
|
|
46
|
+
* closed `@name` vocabulary of D43 item 67.
|
|
47
|
+
*/
|
|
48
|
+
export interface CoreContextualKeyword {
|
|
49
|
+
/** The spelling, as the lexer emits it. */
|
|
50
|
+
readonly word: string;
|
|
51
|
+
/** The one shape the parser claims it in, for the reader of this file. */
|
|
52
|
+
readonly shape: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether, at the head of a statement line, what follows the word opens a
|
|
55
|
+
* fresh expression rather than being applied to it. This is the question the
|
|
56
|
+
* formatter's spacing and the arrow-brace statement scan both ask, and the
|
|
57
|
+
* answer is not "is it a keyword": `constructor(name: string):` occupies a
|
|
58
|
+
* declaration's *name* slot, so its `(` binds tight exactly as `def f(`
|
|
59
|
+
* does, while `match (value):` and `case -1:` keep the separating space.
|
|
60
|
+
*/
|
|
61
|
+
readonly statementSubjectFollows: boolean;
|
|
62
|
+
}
|
|
63
|
+
export declare const CORE_CONTEXTUAL_KEYWORDS: readonly [{
|
|
64
|
+
readonly word: "as";
|
|
65
|
+
readonly shape: "an import alias and a match binding: 'import {a as b}', 'case Shape.circle as c:'";
|
|
66
|
+
readonly statementSubjectFollows: false;
|
|
67
|
+
}, {
|
|
68
|
+
readonly word: "case";
|
|
69
|
+
readonly shape: "a match branch: 'case Status.done:'";
|
|
70
|
+
readonly statementSubjectFollows: true;
|
|
71
|
+
}, {
|
|
72
|
+
readonly word: "constructor";
|
|
73
|
+
readonly shape: "a class's construction member: 'constructor(name: string):'";
|
|
74
|
+
readonly statementSubjectFollows: false;
|
|
75
|
+
}, {
|
|
76
|
+
readonly word: "from";
|
|
77
|
+
readonly shape: "the module an import or a re-export reads: 'import {a} from \"./m.vel\"'";
|
|
78
|
+
readonly statementSubjectFollows: false;
|
|
79
|
+
}, {
|
|
80
|
+
readonly word: "get";
|
|
81
|
+
readonly shape: "a class getter: 'get empty() -> bool:'";
|
|
82
|
+
readonly statementSubjectFollows: false;
|
|
83
|
+
}, {
|
|
84
|
+
readonly word: "match";
|
|
85
|
+
readonly shape: "a match statement: 'match value:'";
|
|
86
|
+
readonly statementSubjectFollows: true;
|
|
87
|
+
}, {
|
|
88
|
+
readonly word: "readonly";
|
|
89
|
+
readonly shape: "a read-only record field or type: 'readonly tags: List<string>'";
|
|
90
|
+
readonly statementSubjectFollows: false;
|
|
91
|
+
}, {
|
|
92
|
+
readonly word: "test";
|
|
93
|
+
readonly shape: "a test declaration: 'test \"a name\":'";
|
|
94
|
+
readonly statementSubjectFollows: false;
|
|
95
|
+
}, {
|
|
96
|
+
readonly word: "type";
|
|
97
|
+
readonly shape: "a record type or a type alias: 'type User:', 'type Id = string'";
|
|
98
|
+
readonly statementSubjectFollows: false;
|
|
99
|
+
}, {
|
|
100
|
+
readonly word: "using";
|
|
101
|
+
readonly shape: "a scoped resource binding: 'using file = open(path)'";
|
|
102
|
+
readonly statementSubjectFollows: false;
|
|
103
|
+
}];
|
|
104
|
+
export type CoreContextualKeywordWord = (typeof CORE_CONTEXTUAL_KEYWORDS)[number]["word"];
|
|
105
|
+
/**
|
|
106
|
+
* The roster keyed by its own spellings, so a consumer names a word instead of
|
|
107
|
+
* restating it: `CORE_WORDS.type` stops compiling the moment `type` leaves the
|
|
108
|
+
* roster, which is what makes the derivation hold in both directions.
|
|
109
|
+
*/
|
|
110
|
+
export declare const CORE_WORDS: {
|
|
111
|
+
readonly [Word in CoreContextualKeywordWord]: Word;
|
|
112
|
+
};
|
|
113
|
+
/** The roster as bare spellings, for the consumers that need only the set. */
|
|
114
|
+
export declare const CORE_CONTEXTUAL_KEYWORD_WORDS: readonly CoreContextualKeywordWord[];
|
|
115
|
+
/**
|
|
116
|
+
* The words that stand where a keyword stands at the head of a statement line.
|
|
117
|
+
* The formatter's spacing and the parser's arrow-brace scan both read this,
|
|
118
|
+
* rather than each keeping the two-word copy D62 rule 157 found in them.
|
|
119
|
+
*/
|
|
120
|
+
export declare const CORE_STATEMENT_HEAD_KEYWORDS: readonly CoreContextualKeywordWord[];
|
|
121
|
+
/**
|
|
122
|
+
* D39-52 and D62 rule 158: the numeric suffixes Core owns on its own. Both are
|
|
123
|
+
* Duration literals — `250ms`, `3s`. Extensions add visual units on top, and
|
|
124
|
+
* the Web extension happens to republish these two through `LOOK_UNIT_TYPES`,
|
|
125
|
+
* which is the only reason the coverage gate could see them at all before this
|
|
126
|
+
* roster existed; a Core-only checkout checked neither.
|
|
127
|
+
*/
|
|
128
|
+
export declare const CORE_NUMERIC_SUFFIXES: readonly ["ms", "s"];
|
|
129
|
+
export type CoreNumericSuffix = (typeof CORE_NUMERIC_SUFFIXES)[number];
|
|
130
|
+
/**
|
|
131
|
+
* D55 rule 120: the declaration forms that take `<T>`, as one roster. Every
|
|
132
|
+
* refusal aimed at a form that does not take one names this list rather than
|
|
133
|
+
* spelling its own copy — the copies are what made "only 'def' functions take
|
|
134
|
+
* '<T>'" outlive the ruling that stopped being true. The tour-coverage gate
|
|
135
|
+
* reads the same roster, so a form added here without an example goes red.
|
|
136
|
+
*/
|
|
137
|
+
export declare const TYPE_PARAMETER_DECLARATION_FORMS: readonly ["def", "type"];
|
|
138
|
+
export type TypeParameterDeclarationForm = (typeof TYPE_PARAMETER_DECLARATION_FORMS)[number];
|
|
139
|
+
/** "'def' functions and 'type' records" — the one phrasing of the roster above. */
|
|
140
|
+
export declare function typeParameterDeclarationFormsPhrase(): string;
|
|
141
|
+
//# sourceMappingURL=core-vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-vocabulary.d.ts","sourceRoot":"","sources":["../src/core-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,YAAI,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAEtF,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,YAAI,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAEzF,MAAM,MAAM,sBAAsB,GAAG,CAAC,OA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H,eAAO,MAAM,4BAA4B,EAAE,SAAS,yBAAyB,EAEhD,CAAC;AAE9B;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,YAAI,IAAI,EAAE,GAAG,CAAU,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,YAAI,KAAK,EAAE,MAAM,CAAU,CAAC;AACzE,MAAM,MAAM,4BAA4B,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7F,mFAAmF;AACnF,wBAAgB,mCAAmC,IAAI,MAAM,CAI5D"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* D57 rules 134/135 and D62 rules 157/158: the one roster of Core's own
|
|
3
|
+
* vocabulary — the permanent (resident) namespaces, the prelude names that
|
|
4
|
+
* need no import, the contextual keywords, and the numeric suffixes.
|
|
5
|
+
*
|
|
6
|
+
* Every place that has to know the whole vocabulary derives it from here: the
|
|
7
|
+
* analyzer's builtin table is keyed by these names, and `source-names.ts`
|
|
8
|
+
* refuses them as binding spellings by reading this roster rather than by
|
|
9
|
+
* restating it. Before that, the refusal list was a hand-kept copy of the
|
|
10
|
+
* JavaScript globals, so `Math` was protected only because it happens to be a
|
|
11
|
+
* JavaScript global too, while `Json`, `Promise`, `Text`, `equals`, and
|
|
12
|
+
* `range` were not protected at all. Adding a namespace or a prelude name
|
|
13
|
+
* here is now the whole change; nothing downstream can stay behind.
|
|
14
|
+
*
|
|
15
|
+
* The contextual keywords arrived the same way and worse: D62 rule 157 found
|
|
16
|
+
* four partial copies (`parser.ts` knew one word by table and the rest as
|
|
17
|
+
* inline literals, `formatter.ts` knew two, `language-server.ts` knew six) and
|
|
18
|
+
* **no original at all**, so charter §3's cross-cutting claim — that each of
|
|
19
|
+
* these words is an ordinary name in seven positions — named a set nothing
|
|
20
|
+
* could enumerate. It is enumerable here now.
|
|
21
|
+
*
|
|
22
|
+
* This module deliberately holds names and plain data — no imports — so the
|
|
23
|
+
* lexer-facing `source-names.ts`, the lexer, the parser, the formatter and the
|
|
24
|
+
* analyzer can all read it without a cycle between them.
|
|
25
|
+
*/
|
|
26
|
+
/** The namespaces that are always in scope and are not values (D51 rule 106). */
|
|
27
|
+
export const PERMANENT_NAMESPACE_NAMES = ["Json", "Promise", "Text", "Math"];
|
|
28
|
+
/** The prelude functions that need no import (D47 rule 81, D50 rule 90). */
|
|
29
|
+
export const CORE_PRELUDE_NAMES = ["number", "str", "print", "equals", "range"];
|
|
30
|
+
/** The full Core vocabulary: no binding may spell one of these (D57 rule 135). */
|
|
31
|
+
export const CORE_VOCABULARY_NAMES = [
|
|
32
|
+
...PERMANENT_NAMESPACE_NAMES,
|
|
33
|
+
...CORE_PRELUDE_NAMES,
|
|
34
|
+
];
|
|
35
|
+
export function isPermanentNamespaceName(name) {
|
|
36
|
+
return PERMANENT_NAMESPACE_NAMES.includes(name);
|
|
37
|
+
}
|
|
38
|
+
export const CORE_CONTEXTUAL_KEYWORDS = [
|
|
39
|
+
{ word: "as", shape: "an import alias and a match binding: 'import {a as b}', 'case Shape.circle as c:'", statementSubjectFollows: false },
|
|
40
|
+
{ word: "case", shape: "a match branch: 'case Status.done:'", statementSubjectFollows: true },
|
|
41
|
+
{ word: "constructor", shape: "a class's construction member: 'constructor(name: string):'", statementSubjectFollows: false },
|
|
42
|
+
{ word: "from", shape: "the module an import or a re-export reads: 'import {a} from \"./m.vel\"'", statementSubjectFollows: false },
|
|
43
|
+
{ word: "get", shape: "a class getter: 'get empty() -> bool:'", statementSubjectFollows: false },
|
|
44
|
+
{ word: "match", shape: "a match statement: 'match value:'", statementSubjectFollows: true },
|
|
45
|
+
{ word: "readonly", shape: "a read-only record field or type: 'readonly tags: List<string>'", statementSubjectFollows: false },
|
|
46
|
+
{ word: "test", shape: "a test declaration: 'test \"a name\":'", statementSubjectFollows: false },
|
|
47
|
+
{ word: "type", shape: "a record type or a type alias: 'type User:', 'type Id = string'", statementSubjectFollows: false },
|
|
48
|
+
{ word: "using", shape: "a scoped resource binding: 'using file = open(path)'", statementSubjectFollows: false },
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* The roster keyed by its own spellings, so a consumer names a word instead of
|
|
52
|
+
* restating it: `CORE_WORDS.type` stops compiling the moment `type` leaves the
|
|
53
|
+
* roster, which is what makes the derivation hold in both directions.
|
|
54
|
+
*/
|
|
55
|
+
export const CORE_WORDS = Object.freeze(Object.fromEntries(CORE_CONTEXTUAL_KEYWORDS.map((entry) => [entry.word, entry.word])));
|
|
56
|
+
/** The roster as bare spellings, for the consumers that need only the set. */
|
|
57
|
+
export const CORE_CONTEXTUAL_KEYWORD_WORDS = CORE_CONTEXTUAL_KEYWORDS.map((entry) => entry.word);
|
|
58
|
+
/**
|
|
59
|
+
* The words that stand where a keyword stands at the head of a statement line.
|
|
60
|
+
* The formatter's spacing and the parser's arrow-brace scan both read this,
|
|
61
|
+
* rather than each keeping the two-word copy D62 rule 157 found in them.
|
|
62
|
+
*/
|
|
63
|
+
export const CORE_STATEMENT_HEAD_KEYWORDS = CORE_CONTEXTUAL_KEYWORDS
|
|
64
|
+
.filter((entry) => entry.statementSubjectFollows)
|
|
65
|
+
.map((entry) => entry.word);
|
|
66
|
+
/**
|
|
67
|
+
* D39-52 and D62 rule 158: the numeric suffixes Core owns on its own. Both are
|
|
68
|
+
* Duration literals — `250ms`, `3s`. Extensions add visual units on top, and
|
|
69
|
+
* the Web extension happens to republish these two through `LOOK_UNIT_TYPES`,
|
|
70
|
+
* which is the only reason the coverage gate could see them at all before this
|
|
71
|
+
* roster existed; a Core-only checkout checked neither.
|
|
72
|
+
*/
|
|
73
|
+
export const CORE_NUMERIC_SUFFIXES = ["ms", "s"];
|
|
74
|
+
/**
|
|
75
|
+
* D55 rule 120: the declaration forms that take `<T>`, as one roster. Every
|
|
76
|
+
* refusal aimed at a form that does not take one names this list rather than
|
|
77
|
+
* spelling its own copy — the copies are what made "only 'def' functions take
|
|
78
|
+
* '<T>'" outlive the ruling that stopped being true. The tour-coverage gate
|
|
79
|
+
* reads the same roster, so a form added here without an example goes red.
|
|
80
|
+
*/
|
|
81
|
+
export const TYPE_PARAMETER_DECLARATION_FORMS = ["def", "type"];
|
|
82
|
+
/** "'def' functions and 'type' records" — the one phrasing of the roster above. */
|
|
83
|
+
export function typeParameterDeclarationFormsPhrase() {
|
|
84
|
+
const described = { def: "'def' functions", type: "'type' records" };
|
|
85
|
+
const forms = TYPE_PARAMETER_DECLARATION_FORMS.map((form) => described[form]);
|
|
86
|
+
return forms.length <= 1 ? forms.join("") : `${forms.slice(0, -1).join(", ")} and ${forms.at(-1)}`;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=core-vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-vocabulary.js","sourceRoot":"","sources":["../src/core-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAEtF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAMzF,kFAAkF;AAClF,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE,GAAG,yBAAyB;IAC5B,GAAG,kBAAkB;CACtB,CAAC;AAEF,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,OAAQ,yBAA+C,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC;AA8BD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,mFAAmF,EA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AEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAyC,wBAAwB;KACvG,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC;KAChD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,GAAG,CAAU,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;AAGzE,mFAAmF;AACnF,MAAM,UAAU,mCAAmC;IACjD,MAAM,SAAS,GAAiD,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACnH,MAAM,KAAK,GAAG,gCAAgC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrG,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SourceText, Span } from "./source.ts";
|
|
2
|
+
/**
|
|
3
|
+
* D38 §48: the mechanical rewrite a diagnostic already knows. A fix is
|
|
4
|
+
* registered only where the diagnostic names one correct replacement and no
|
|
5
|
+
* judgment is involved, so applying it is a spelling change and never a guess
|
|
6
|
+
* about intent. `velar fix` applies these, and an editor offers each one as a
|
|
7
|
+
* quick fix; every other diagnostic stays advice the author acts on.
|
|
8
|
+
*/
|
|
9
|
+
export interface DiagnosticEdit {
|
|
10
|
+
/** The replaced range. It may be wider than the diagnostic span (surrounding whitespace a deletion should take with it), and empty to insert. */
|
|
11
|
+
readonly span: Span;
|
|
12
|
+
/** The exact replacement text; the empty string deletes the range. */
|
|
13
|
+
readonly text: string;
|
|
14
|
+
}
|
|
15
|
+
export interface DiagnosticFix {
|
|
16
|
+
/** The edits of one rewrite; they never overlap and are applied together or not at all. */
|
|
17
|
+
readonly edits: readonly DiagnosticEdit[];
|
|
18
|
+
/** Imperative editor title, e.g. "Use VelarScript strict equality '=='". */
|
|
19
|
+
readonly title: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Diagnostic {
|
|
22
|
+
readonly code: string;
|
|
23
|
+
readonly message: string;
|
|
24
|
+
readonly span: Span;
|
|
25
|
+
/**
|
|
26
|
+
* Marks a guidance diagnostic whose compile stage internally recovered as
|
|
27
|
+
* the guided spelling, so later stages still run and can report their own
|
|
28
|
+
* guidance in the same compile. Compilation still fails: recovered
|
|
29
|
+
* diagnostics count toward the zero-diagnostics gate for code generation.
|
|
30
|
+
*/
|
|
31
|
+
readonly recovered?: boolean;
|
|
32
|
+
/** The mechanical rewrite this diagnostic names, when it names exactly one. */
|
|
33
|
+
readonly fix?: DiagnosticFix;
|
|
34
|
+
}
|
|
35
|
+
export declare function diagnostic(code: string, message: string, span: Span, fix?: DiagnosticFix): Diagnostic;
|
|
36
|
+
export declare function recoveredDiagnostic(code: string, message: string, span: Span, fix?: DiagnosticFix): Diagnostic;
|
|
37
|
+
/** Builds the one-edit mechanical rewrite of `span` to `text`. */
|
|
38
|
+
export declare function mechanicalFix(span: Span, text: string, title: string): DiagnosticFix;
|
|
39
|
+
/** Builds a mechanical rewrite whose one spelling change needs more than one edit. */
|
|
40
|
+
export declare function mechanicalEdits(edits: readonly DiagnosticEdit[], title: string): DiagnosticFix;
|
|
41
|
+
export declare function formatDiagnostic(source: SourceText, item: Diagnostic): string;
|
|
42
|
+
//# sourceMappingURL=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