deterministic id generator per module (#5811)

* deterministic id generator per module

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* non

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* do not remake the planes if they are alreaady made;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* do not remake the planes if they are alreaady made;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* clippy

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-03-15 10:08:39 -07:00
committed by GitHub
parent 9c986d3aa8
commit 3f02bb2065
86 changed files with 955 additions and 918 deletions

View File

@ -14,6 +14,7 @@ import {
} from 'lang/wasm'
import { Operation } from '@rust/kcl-lib/bindings/Operation'
import { ModulePath } from '@rust/kcl-lib/bindings/ModulePath'
import { DefaultPlanes } from '@rust/kcl-lib/bindings/DefaultPlanes'
type ExtractKind<T> = T extends { kind: infer K } ? K : never
export class KCLError extends Error {
@ -24,6 +25,7 @@ export class KCLError extends Error {
artifactCommands: ArtifactCommand[]
artifactGraph: ArtifactGraph
filenames: { [x: number]: ModulePath | undefined }
defaultPlanes: DefaultPlanes | null
constructor(
kind: ExtractKind<RustKclError> | 'name',
@ -32,7 +34,8 @@ export class KCLError extends Error {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super()
this.kind = kind
@ -42,6 +45,7 @@ export class KCLError extends Error {
this.artifactCommands = artifactCommands
this.artifactGraph = artifactGraph
this.filenames = filenames
this.defaultPlanes = defaultPlanes
Object.setPrototypeOf(this, KCLError.prototype)
}
}
@ -53,7 +57,8 @@ export class KCLLexicalError extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'lexical',
@ -62,7 +67,8 @@ export class KCLLexicalError extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLSyntaxError.prototype)
}
@ -75,7 +81,8 @@ export class KCLInternalError extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'internal',
@ -84,7 +91,8 @@ export class KCLInternalError extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLSyntaxError.prototype)
}
@ -97,7 +105,8 @@ export class KCLSyntaxError extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'syntax',
@ -106,7 +115,8 @@ export class KCLSyntaxError extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLSyntaxError.prototype)
}
@ -119,7 +129,8 @@ export class KCLSemanticError extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'semantic',
@ -128,7 +139,8 @@ export class KCLSemanticError extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLSemanticError.prototype)
}
@ -141,7 +153,8 @@ export class KCLTypeError extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'type',
@ -150,7 +163,8 @@ export class KCLTypeError extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLTypeError.prototype)
}
@ -163,7 +177,8 @@ export class KCLIoError extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'io',
@ -172,7 +187,8 @@ export class KCLIoError extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLIoError.prototype)
}
@ -185,7 +201,8 @@ export class KCLUnexpectedError extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'unexpected',
@ -194,7 +211,8 @@ export class KCLUnexpectedError extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLUnexpectedError.prototype)
}
@ -207,7 +225,8 @@ export class KCLValueAlreadyDefined extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'name',
@ -216,7 +235,8 @@ export class KCLValueAlreadyDefined extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLValueAlreadyDefined.prototype)
}
@ -229,7 +249,8 @@ export class KCLUndefinedValueError extends KCLError {
operations: Operation[],
artifactCommands: ArtifactCommand[],
artifactGraph: ArtifactGraph,
filenames: { [x: number]: ModulePath | undefined }
filenames: { [x: number]: ModulePath | undefined },
defaultPlanes: DefaultPlanes | null
) {
super(
'name',
@ -238,7 +259,8 @@ export class KCLUndefinedValueError extends KCLError {
operations,
artifactCommands,
artifactGraph,
filenames
filenames,
defaultPlanes
)
Object.setPrototypeOf(this, KCLUndefinedValueError.prototype)
}
@ -262,7 +284,8 @@ export function lspDiagnosticsToKclErrors(
[],
[],
defaultArtifactGraph(),
{}
{},
null
)
)
.sort((a, b) => {