Add tracking of operations for the feature tree (#4746)
* Add operations tracking for the timeline * Change to only track certain stdlib functions as operations * Update gen files * Add operations to simulation snapshot tests * Add tracking of positional function calls * Fix generated field names to be camel case in TS * Fix generated TS field names to match and better docs * Fix order of ops with patternTransform * Fix sweep to be included * Add new expected test outputs * Add tracking for startSketchOn * Update ops output to include startSketchOn * Fix serde field name * Fix output field name * Add tracking of operations that fail * Add snapshots of operations even when there's a KCL execution error * Add ops output for error executions * Add operations output to executor error * Update op source ranges * Remove tracking of circle() and polygon() since they're not needed * Update output without circle and polygon * Fix to track patternCircular3d and patternLinear3d * Remove tracking for mirror2d * Update ops output * Fix to track the correct source range of function definitions --------- Co-authored-by: Frank Noirot <frank@zoo.dev>
This commit is contained in:
@ -43,6 +43,7 @@ import { Node } from 'wasm-lib/kcl/bindings/Node'
|
||||
import { CompilationError } from 'wasm-lib/kcl/bindings/CompilationError'
|
||||
import { SourceRange as RustSourceRange } from 'wasm-lib/kcl/bindings/SourceRange'
|
||||
import { getAllCurrentSettings } from 'lib/settings/settingsUtils'
|
||||
import { KclErrorWithOutputs } from 'wasm-lib/kcl/bindings/KclErrorWithOutputs'
|
||||
|
||||
export type { Configuration } from 'wasm-lib/kcl/bindings/Configuration'
|
||||
export type { Program } from '../wasm-lib/kcl/bindings/Program'
|
||||
@ -220,7 +221,8 @@ export const parse = (code: string | Error): ParseResult | Error => {
|
||||
return new KCLError(
|
||||
parsed.kind,
|
||||
parsed.msg,
|
||||
sourceRangeFromRust(parsed.sourceRanges[0])
|
||||
sourceRangeFromRust(parsed.sourceRanges[0]),
|
||||
[]
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -539,11 +541,12 @@ export const _executor = async (
|
||||
return execStateFromRaw(execState)
|
||||
} catch (e: any) {
|
||||
console.log(e)
|
||||
const parsed: RustKclError = JSON.parse(e.toString())
|
||||
const parsed: KclErrorWithOutputs = JSON.parse(e.toString())
|
||||
const kclError = new KCLError(
|
||||
parsed.kind,
|
||||
parsed.msg,
|
||||
sourceRangeFromRust(parsed.sourceRanges[0])
|
||||
parsed.error.kind,
|
||||
parsed.error.msg,
|
||||
sourceRangeFromRust(parsed.error.sourceRanges[0]),
|
||||
parsed.operations
|
||||
)
|
||||
|
||||
return Promise.reject(kclError)
|
||||
@ -602,7 +605,8 @@ export const modifyAstForSketch = async (
|
||||
const kclError = new KCLError(
|
||||
parsed.kind,
|
||||
parsed.msg,
|
||||
sourceRangeFromRust(parsed.sourceRanges[0])
|
||||
sourceRangeFromRust(parsed.sourceRanges[0]),
|
||||
[]
|
||||
)
|
||||
|
||||
console.log(kclError)
|
||||
@ -670,7 +674,8 @@ export function programMemoryInit(): ProgramMemory | Error {
|
||||
return new KCLError(
|
||||
parsed.kind,
|
||||
parsed.msg,
|
||||
sourceRangeFromRust(parsed.sourceRanges[0])
|
||||
sourceRangeFromRust(parsed.sourceRanges[0]),
|
||||
[]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user