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:
Jonathan Tran
2024-12-16 13:10:31 -05:00
committed by GitHub
parent efe8089b08
commit da301ba862
110 changed files with 6638 additions and 57 deletions

View File

@ -9,6 +9,7 @@ describe('test kclErrToDiagnostic', () => {
kind: 'semantic', kind: 'semantic',
msg: 'Semantic error', msg: 'Semantic error',
sourceRange: [0, 1, true], sourceRange: [0, 1, true],
operations: [],
}, },
{ {
name: '', name: '',
@ -16,6 +17,7 @@ describe('test kclErrToDiagnostic', () => {
kind: 'type', kind: 'type',
msg: 'Type error', msg: 'Type error',
sourceRange: [4, 5, true], sourceRange: [4, 5, true],
operations: [],
}, },
] ]
const diagnostics = kclErrorsToDiagnostics(errors) const diagnostics = kclErrorsToDiagnostics(errors)

View File

@ -6,85 +6,94 @@ import { Diagnostic as LspDiagnostic } from 'vscode-languageserver-protocol'
import { Text } from '@codemirror/state' import { Text } from '@codemirror/state'
import { EditorView } from 'codemirror' import { EditorView } from 'codemirror'
import { SourceRange } from 'lang/wasm' import { SourceRange } from 'lang/wasm'
import { Operation } from 'wasm-lib/kcl/bindings/Operation'
type ExtractKind<T> = T extends { kind: infer K } ? K : never type ExtractKind<T> = T extends { kind: infer K } ? K : never
export class KCLError extends Error { export class KCLError extends Error {
kind: ExtractKind<RustKclError> | 'name' kind: ExtractKind<RustKclError> | 'name'
sourceRange: SourceRange sourceRange: SourceRange
msg: string msg: string
operations: Operation[]
constructor( constructor(
kind: ExtractKind<RustKclError> | 'name', kind: ExtractKind<RustKclError> | 'name',
msg: string, msg: string,
sourceRange: SourceRange sourceRange: SourceRange,
operations: Operation[]
) { ) {
super() super()
this.kind = kind this.kind = kind
this.msg = msg this.msg = msg
this.sourceRange = sourceRange this.sourceRange = sourceRange
this.operations = operations
Object.setPrototypeOf(this, KCLError.prototype) Object.setPrototypeOf(this, KCLError.prototype)
} }
} }
export class KCLLexicalError extends KCLError { export class KCLLexicalError extends KCLError {
constructor(msg: string, sourceRange: SourceRange) { constructor(msg: string, sourceRange: SourceRange, operations: Operation[]) {
super('lexical', msg, sourceRange) super('lexical', msg, sourceRange, operations)
Object.setPrototypeOf(this, KCLSyntaxError.prototype) Object.setPrototypeOf(this, KCLSyntaxError.prototype)
} }
} }
export class KCLInternalError extends KCLError { export class KCLInternalError extends KCLError {
constructor(msg: string, sourceRange: SourceRange) { constructor(msg: string, sourceRange: SourceRange, operations: Operation[]) {
super('internal', msg, sourceRange) super('internal', msg, sourceRange, operations)
Object.setPrototypeOf(this, KCLSyntaxError.prototype) Object.setPrototypeOf(this, KCLSyntaxError.prototype)
} }
} }
export class KCLSyntaxError extends KCLError { export class KCLSyntaxError extends KCLError {
constructor(msg: string, sourceRange: SourceRange) { constructor(msg: string, sourceRange: SourceRange, operations: Operation[]) {
super('syntax', msg, sourceRange) super('syntax', msg, sourceRange, operations)
Object.setPrototypeOf(this, KCLSyntaxError.prototype) Object.setPrototypeOf(this, KCLSyntaxError.prototype)
} }
} }
export class KCLSemanticError extends KCLError { export class KCLSemanticError extends KCLError {
constructor(msg: string, sourceRange: SourceRange) { constructor(msg: string, sourceRange: SourceRange, operations: Operation[]) {
super('semantic', msg, sourceRange) super('semantic', msg, sourceRange, operations)
Object.setPrototypeOf(this, KCLSemanticError.prototype) Object.setPrototypeOf(this, KCLSemanticError.prototype)
} }
} }
export class KCLTypeError extends KCLError { export class KCLTypeError extends KCLError {
constructor(msg: string, sourceRange: SourceRange) { constructor(msg: string, sourceRange: SourceRange, operations: Operation[]) {
super('type', msg, sourceRange) super('type', msg, sourceRange, operations)
Object.setPrototypeOf(this, KCLTypeError.prototype) Object.setPrototypeOf(this, KCLTypeError.prototype)
} }
} }
export class KCLUnimplementedError extends KCLError { export class KCLUnimplementedError extends KCLError {
constructor(msg: string, sourceRange: SourceRange) { constructor(msg: string, sourceRange: SourceRange, operations: Operation[]) {
super('unimplemented', msg, sourceRange) super('unimplemented', msg, sourceRange, operations)
Object.setPrototypeOf(this, KCLUnimplementedError.prototype) Object.setPrototypeOf(this, KCLUnimplementedError.prototype)
} }
} }
export class KCLUnexpectedError extends KCLError { export class KCLUnexpectedError extends KCLError {
constructor(msg: string, sourceRange: SourceRange) { constructor(msg: string, sourceRange: SourceRange, operations: Operation[]) {
super('unexpected', msg, sourceRange) super('unexpected', msg, sourceRange, operations)
Object.setPrototypeOf(this, KCLUnexpectedError.prototype) Object.setPrototypeOf(this, KCLUnexpectedError.prototype)
} }
} }
export class KCLValueAlreadyDefined extends KCLError { export class KCLValueAlreadyDefined extends KCLError {
constructor(key: string, sourceRange: SourceRange) { constructor(key: string, sourceRange: SourceRange, operations: Operation[]) {
super('name', `Key ${key} was already defined elsewhere`, sourceRange) super(
'name',
`Key ${key} was already defined elsewhere`,
sourceRange,
operations
)
Object.setPrototypeOf(this, KCLValueAlreadyDefined.prototype) Object.setPrototypeOf(this, KCLValueAlreadyDefined.prototype)
} }
} }
export class KCLUndefinedValueError extends KCLError { export class KCLUndefinedValueError extends KCLError {
constructor(key: string, sourceRange: SourceRange) { constructor(key: string, sourceRange: SourceRange, operations: Operation[]) {
super('name', `Key ${key} has not been defined`, sourceRange) super('name', `Key ${key} has not been defined`, sourceRange, operations)
Object.setPrototypeOf(this, KCLUndefinedValueError.prototype) Object.setPrototypeOf(this, KCLUndefinedValueError.prototype)
} }
} }
@ -100,11 +109,12 @@ export function lspDiagnosticsToKclErrors(
return diagnostics return diagnostics
.flatMap( .flatMap(
({ range, message }) => ({ range, message }) =>
new KCLError('unexpected', message, [ new KCLError(
posToOffset(doc, range.start)!, 'unexpected',
posToOffset(doc, range.end)!, message,
true, [posToOffset(doc, range.start)!, posToOffset(doc, range.end)!, true],
]) []
)
) )
.sort((a, b) => { .sort((a, b) => {
const c = a.sourceRange[0] const c = a.sourceRange[0]

View File

@ -480,7 +480,8 @@ const theExtrude = startSketchOn('XY')
new KCLError( new KCLError(
'undefined_value', 'undefined_value',
'memory item key `myVarZ` is not defined', 'memory item key `myVarZ` is not defined',
[129, 135, true] [129, 135, true],
[]
) )
) )
}) })

View File

@ -43,6 +43,7 @@ import { Node } from 'wasm-lib/kcl/bindings/Node'
import { CompilationError } from 'wasm-lib/kcl/bindings/CompilationError' import { CompilationError } from 'wasm-lib/kcl/bindings/CompilationError'
import { SourceRange as RustSourceRange } from 'wasm-lib/kcl/bindings/SourceRange' import { SourceRange as RustSourceRange } from 'wasm-lib/kcl/bindings/SourceRange'
import { getAllCurrentSettings } from 'lib/settings/settingsUtils' 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 { Configuration } from 'wasm-lib/kcl/bindings/Configuration'
export type { Program } from '../wasm-lib/kcl/bindings/Program' export type { Program } from '../wasm-lib/kcl/bindings/Program'
@ -220,7 +221,8 @@ export const parse = (code: string | Error): ParseResult | Error => {
return new KCLError( return new KCLError(
parsed.kind, parsed.kind,
parsed.msg, parsed.msg,
sourceRangeFromRust(parsed.sourceRanges[0]) sourceRangeFromRust(parsed.sourceRanges[0]),
[]
) )
} }
} }
@ -539,11 +541,12 @@ export const _executor = async (
return execStateFromRaw(execState) return execStateFromRaw(execState)
} catch (e: any) { } catch (e: any) {
console.log(e) console.log(e)
const parsed: RustKclError = JSON.parse(e.toString()) const parsed: KclErrorWithOutputs = JSON.parse(e.toString())
const kclError = new KCLError( const kclError = new KCLError(
parsed.kind, parsed.error.kind,
parsed.msg, parsed.error.msg,
sourceRangeFromRust(parsed.sourceRanges[0]) sourceRangeFromRust(parsed.error.sourceRanges[0]),
parsed.operations
) )
return Promise.reject(kclError) return Promise.reject(kclError)
@ -602,7 +605,8 @@ export const modifyAstForSketch = async (
const kclError = new KCLError( const kclError = new KCLError(
parsed.kind, parsed.kind,
parsed.msg, parsed.msg,
sourceRangeFromRust(parsed.sourceRanges[0]) sourceRangeFromRust(parsed.sourceRanges[0]),
[]
) )
console.log(kclError) console.log(kclError)
@ -670,7 +674,8 @@ export function programMemoryInit(): ProgramMemory | Error {
return new KCLError( return new KCLError(
parsed.kind, parsed.kind,
parsed.msg, parsed.msg,
sourceRangeFromRust(parsed.sourceRanges[0]) sourceRangeFromRust(parsed.sourceRanges[0]),
[]
) )
} }
} }

View File

@ -40,6 +40,12 @@ struct StdlibMetadata {
#[serde(default)] #[serde(default)]
deprecated: bool, deprecated: bool,
/// Whether the function is displayed in the feature tree.
/// If true, calls to the function will be available for display.
/// If false, calls to the function will never be displayed.
#[serde(default)]
feature_tree_operation: bool,
/// If true, expects keyword arguments. /// If true, expects keyword arguments.
/// If false, expects positional arguments. /// If false, expects positional arguments.
#[serde(default)] #[serde(default)]
@ -244,6 +250,12 @@ fn do_stdlib_inner(
quote! { false } quote! { false }
}; };
let feature_tree_operation = if metadata.feature_tree_operation {
quote! { true }
} else {
quote! { false }
};
let uses_keyword_arguments = if metadata.keywords { let uses_keyword_arguments = if metadata.keywords {
quote! { true } quote! { true }
} else { } else {
@ -470,6 +482,10 @@ fn do_stdlib_inner(
#deprecated #deprecated
} }
fn feature_tree_operation(&self) -> bool {
#feature_tree_operation
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
#code_blocks #code_blocks
} }

View File

@ -118,6 +118,10 @@ impl crate::docs::StdLibFn for SomeFn {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["someFn()"]; let code_blocks = vec!["someFn()"];
code_blocks code_blocks

View File

@ -118,6 +118,10 @@ impl crate::docs::StdLibFn for SomeFn {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["someFn()"]; let code_blocks = vec!["someFn()"];
code_blocks code_blocks

View File

@ -156,6 +156,10 @@ impl crate::docs::StdLibFn for Show {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec![ let code_blocks = vec![
"This is another code block.\nyes sirrr.\nshow", "This is another code block.\nyes sirrr.\nshow",

View File

@ -119,6 +119,10 @@ impl crate::docs::StdLibFn for Show {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["This is code.\nIt does other shit.\nshow"]; let code_blocks = vec!["This is code.\nIt does other shit.\nshow"];
code_blocks code_blocks

View File

@ -157,6 +157,10 @@ impl crate::docs::StdLibFn for MyFunc {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec![ let code_blocks = vec![
"This is another code block.\nyes sirrr.\nmyFunc", "This is another code block.\nyes sirrr.\nmyFunc",

View File

@ -167,6 +167,10 @@ impl crate::docs::StdLibFn for LineTo {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec![ let code_blocks = vec![
"This is another code block.\nyes sirrr.\nlineTo", "This is another code block.\nyes sirrr.\nlineTo",

View File

@ -156,6 +156,10 @@ impl crate::docs::StdLibFn for Min {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec![ let code_blocks = vec![
"This is another code block.\nyes sirrr.\nmin", "This is another code block.\nyes sirrr.\nmin",

View File

@ -119,6 +119,10 @@ impl crate::docs::StdLibFn for Show {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["This is code.\nIt does other shit.\nshow"]; let code_blocks = vec!["This is code.\nIt does other shit.\nshow"];
code_blocks code_blocks

View File

@ -119,6 +119,10 @@ impl crate::docs::StdLibFn for Import {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["This is code.\nIt does other shit.\nimport"]; let code_blocks = vec!["This is code.\nIt does other shit.\nimport"];
code_blocks code_blocks

View File

@ -119,6 +119,10 @@ impl crate::docs::StdLibFn for Import {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["This is code.\nIt does other shit.\nimport"]; let code_blocks = vec!["This is code.\nIt does other shit.\nimport"];
code_blocks code_blocks

View File

@ -119,6 +119,10 @@ impl crate::docs::StdLibFn for Import {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["This is code.\nIt does other shit.\nimport"]; let code_blocks = vec!["This is code.\nIt does other shit.\nimport"];
code_blocks code_blocks

View File

@ -119,6 +119,10 @@ impl crate::docs::StdLibFn for Show {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["This is code.\nIt does other shit.\nshow"]; let code_blocks = vec!["This is code.\nIt does other shit.\nshow"];
code_blocks code_blocks

View File

@ -111,6 +111,10 @@ impl crate::docs::StdLibFn for SomeFunction {
false false
} }
fn feature_tree_operation(&self) -> bool {
false
}
fn examples(&self) -> Vec<String> { fn examples(&self) -> Vec<String> {
let code_blocks = vec!["someFunction()"]; let code_blocks = vec!["someFunction()"];
code_blocks code_blocks

View File

@ -165,6 +165,9 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
/// If the function is deprecated. /// If the function is deprecated.
fn deprecated(&self) -> bool; fn deprecated(&self) -> bool;
/// If the function should appear in the feature tree.
fn feature_tree_operation(&self) -> bool;
/// Any example code blocks. /// Any example code blocks.
fn examples(&self) -> Vec<String>; fn examples(&self) -> Vec<String>;

View File

@ -3,6 +3,7 @@ use thiserror::Error;
use tower_lsp::lsp_types::{Diagnostic, DiagnosticSeverity}; use tower_lsp::lsp_types::{Diagnostic, DiagnosticSeverity};
use crate::{ use crate::{
execution::Operation,
lsp::IntoDiagnostic, lsp::IntoDiagnostic,
source_range::{ModuleId, SourceRange}, source_range::{ModuleId, SourceRange},
}; };
@ -18,6 +19,48 @@ pub enum ExecError {
BadPng(String), BadPng(String),
} }
/// How did the KCL execution fail, with extra state.
#[cfg_attr(target_arch = "wasm32", expect(dead_code))]
#[derive(Debug)]
pub struct ExecErrorWithState {
pub error: ExecError,
pub exec_state: crate::ExecState,
}
impl ExecErrorWithState {
#[cfg_attr(target_arch = "wasm32", expect(dead_code))]
pub fn new(error: ExecError, exec_state: crate::ExecState) -> Self {
Self { error, exec_state }
}
}
impl From<ExecError> for ExecErrorWithState {
fn from(error: ExecError) -> Self {
Self {
error,
exec_state: Default::default(),
}
}
}
impl From<KclError> for ExecErrorWithState {
fn from(error: KclError) -> Self {
Self {
error: error.into(),
exec_state: Default::default(),
}
}
}
impl From<ConnectionError> for ExecErrorWithState {
fn from(error: ConnectionError) -> Self {
Self {
error: error.into(),
exec_state: Default::default(),
}
}
}
/// How did KCL client fail to connect to the engine /// How did KCL client fail to connect to the engine
#[derive(thiserror::Error, Debug)] #[derive(thiserror::Error, Debug)]
pub enum ConnectionError { pub enum ConnectionError {
@ -57,6 +100,21 @@ pub enum KclError {
Internal(KclErrorDetails), Internal(KclErrorDetails),
} }
#[derive(Error, Debug, Serialize, Deserialize, ts_rs::TS, Clone, PartialEq, Eq)]
#[error("{error}")]
#[ts(export)]
#[serde(rename_all = "camelCase")]
pub struct KclErrorWithOutputs {
pub error: KclError,
pub operations: Vec<Operation>,
}
impl KclErrorWithOutputs {
pub fn new(error: KclError, operations: Vec<Operation>) -> Self {
Self { error, operations }
}
}
#[derive(thiserror::Error, Debug)] #[derive(thiserror::Error, Debug)]
#[error("{}", self.error.get_message())] #[error("{}", self.error.get_message())]
pub struct Report { pub struct Report {

View File

@ -0,0 +1,134 @@
use indexmap::IndexMap;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::{docs::StdLibFn, std::get_stdlib_fn, SourceRange};
/// A CAD modeling operation for display in the feature tree, AKA operations
/// timeline.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, ts_rs::TS, JsonSchema)]
#[ts(export)]
#[serde(tag = "type")]
pub enum Operation {
#[serde(rename_all = "camelCase")]
StdLibCall {
/// The standard library function being called.
#[serde(flatten)]
std_lib_fn: StdLibFnRef,
/// The unlabeled argument to the function.
unlabeled_arg: Option<OpArg>,
/// The labeled keyword arguments to the function.
labeled_args: IndexMap<String, OpArg>,
/// The source range of the operation in the source code.
source_range: SourceRange,
/// True if the operation resulted in an error.
#[serde(default, skip_serializing_if = "is_false")]
is_error: bool,
},
#[serde(rename_all = "camelCase")]
UserDefinedFunctionCall {
/// The name of the user-defined function being called. Anonymous
/// functions have no name.
name: Option<String>,
/// The location of the function being called so that there's enough
/// info to go to its definition.
function_source_range: SourceRange,
/// The unlabeled argument to the function.
unlabeled_arg: Option<OpArg>,
/// The labeled keyword arguments to the function.
labeled_args: IndexMap<String, OpArg>,
/// The source range of the operation in the source code.
source_range: SourceRange,
},
UserDefinedFunctionReturn,
}
impl Operation {
/// If the variant is `StdLibCall`, set the `is_error` field.
pub(crate) fn set_std_lib_call_is_error(&mut self, is_err: bool) {
match self {
Self::StdLibCall { ref mut is_error, .. } => *is_error = is_err,
Self::UserDefinedFunctionCall { .. } | Self::UserDefinedFunctionReturn => {}
}
}
}
/// An argument to a CAD modeling operation.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, ts_rs::TS, JsonSchema)]
#[ts(export)]
#[serde(rename_all = "camelCase")]
pub struct OpArg {
/// The KCL code expression for the argument. This is used in the UI so
/// that the user can edit the expression.
source_range: SourceRange,
}
impl OpArg {
pub(crate) fn new(source_range: SourceRange) -> Self {
Self { source_range }
}
}
/// A reference to a standard library function. This exists to implement
/// `PartialEq` and `Eq` for `Operation`.
#[derive(Debug, Clone, Deserialize, Serialize, ts_rs::TS, JsonSchema)]
#[ts(export)]
#[serde(rename_all = "camelCase")]
pub struct StdLibFnRef {
// The following doc comment gets inlined into Operation, overriding what's
// there, in the generated TS. We serialize to its name. Renaming the
// field to "name" allows it to match the other variant.
/// The standard library function being called.
#[serde(
rename = "name",
serialize_with = "std_lib_fn_name",
deserialize_with = "std_lib_fn_from_name"
)]
#[ts(type = "string", rename = "name")]
pub std_lib_fn: Box<dyn StdLibFn>,
}
impl StdLibFnRef {
pub(crate) fn new(std_lib_fn: Box<dyn StdLibFn>) -> Self {
Self { std_lib_fn }
}
}
impl From<&Box<dyn StdLibFn>> for StdLibFnRef {
fn from(std_lib_fn: &Box<dyn StdLibFn>) -> Self {
Self::new(std_lib_fn.clone())
}
}
impl PartialEq for StdLibFnRef {
fn eq(&self, other: &Self) -> bool {
self.std_lib_fn.name() == other.std_lib_fn.name()
}
}
impl Eq for StdLibFnRef {}
#[expect(clippy::borrowed_box, reason = "Explicit Box is needed for serde")]
fn std_lib_fn_name<S>(std_lib_fn: &Box<dyn StdLibFn>, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let name = std_lib_fn.name();
serializer.serialize_str(&name)
}
fn std_lib_fn_from_name<'de, D>(deserializer: D) -> Result<Box<dyn StdLibFn>, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
if let Some(std_lib_fn) = get_stdlib_fn(&s) {
Ok(std_lib_fn)
} else {
Err(serde::de::Error::custom(format!("not a KCL stdlib function: {}", s)))
}
}
fn is_false(b: &bool) -> bool {
!*b
}

View File

@ -19,6 +19,8 @@ use crate::{
}, },
}; };
use super::cad_op::{OpArg, Operation};
const FLOAT_TO_INT_MAX_DELTA: f64 = 0.01; const FLOAT_TO_INT_MAX_DELTA: f64 = 0.01;
impl BinaryPart { impl BinaryPart {
@ -385,10 +387,45 @@ impl Node<CallExpressionKw> {
); );
match ctx.stdlib.get_either(fn_name) { match ctx.stdlib.get_either(fn_name) {
FunctionKind::Core(func) => { FunctionKind::Core(func) => {
let op = if func.feature_tree_operation() {
let op_labeled_args = args
.kw_args
.labeled
.iter()
.map(|(k, v)| (k.clone(), OpArg::new(v.source_range)))
.collect();
Some(Operation::StdLibCall {
std_lib_fn: (&func).into(),
unlabeled_arg: args.kw_args.unlabeled.as_ref().map(|arg| OpArg::new(arg.source_range)),
labeled_args: op_labeled_args,
source_range: callsite,
is_error: false,
})
} else {
None
};
// Attempt to call the function. // Attempt to call the function.
let mut result = func.std_lib_fn()(exec_state, args).await?; let result = {
update_memory_for_tags_of_geometry(&mut result, exec_state)?; // Don't early-return in this block.
Ok(result) let result = func.std_lib_fn()(exec_state, args).await;
if let Some(mut op) = op {
op.set_std_lib_call_is_error(result.is_err());
// Track call operation. We do this after the call
// since things like patternTransform may call user code
// before running, and we will likely want to use the
// return value. The call takes ownership of the args,
// so we need to build the op before the call.
exec_state.operations.push(op);
}
result
};
let mut return_value = result?;
update_memory_for_tags_of_geometry(&mut return_value, exec_state)?;
Ok(return_value)
} }
FunctionKind::UserDefined => { FunctionKind::UserDefined => {
let source_range = SourceRange::from(self); let source_range = SourceRange::from(self);
@ -397,6 +434,21 @@ impl Node<CallExpressionKw> {
let func = exec_state.memory.get(fn_name, source_range)?.clone(); let func = exec_state.memory.get(fn_name, source_range)?.clone();
let fn_dynamic_state = exec_state.dynamic_state.merge(&exec_state.memory); let fn_dynamic_state = exec_state.dynamic_state.merge(&exec_state.memory);
// Track call operation.
let op_labeled_args = args
.kw_args
.labeled
.iter()
.map(|(k, v)| (k.clone(), OpArg::new(v.source_range)))
.collect();
exec_state.operations.push(Operation::UserDefinedFunctionCall {
name: Some(fn_name.clone()),
function_source_range: func.function_def_source_range().unwrap_or_default(),
unlabeled_arg: args.kw_args.unlabeled.as_ref().map(|arg| OpArg::new(arg.source_range)),
labeled_args: op_labeled_args,
source_range: callsite,
});
let return_value = { let return_value = {
let previous_dynamic_state = std::mem::replace(&mut exec_state.dynamic_state, fn_dynamic_state); let previous_dynamic_state = std::mem::replace(&mut exec_state.dynamic_state, fn_dynamic_state);
let result = func let result = func
@ -423,6 +475,9 @@ impl Node<CallExpressionKw> {
}) })
})?; })?;
// Track return operation.
exec_state.operations.push(Operation::UserDefinedFunctionReturn);
Ok(result) Ok(result)
} }
} }
@ -433,6 +488,7 @@ impl Node<CallExpression> {
#[async_recursion] #[async_recursion]
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> { pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
let fn_name = &self.callee.name; let fn_name = &self.callee.name;
let callsite = SourceRange::from(self);
let mut fn_args: Vec<Arg> = Vec::with_capacity(self.arguments.len()); let mut fn_args: Vec<Arg> = Vec::with_capacity(self.arguments.len());
@ -446,14 +502,50 @@ impl Node<CallExpression> {
let arg = Arg::new(value, SourceRange::from(arg_expr)); let arg = Arg::new(value, SourceRange::from(arg_expr));
fn_args.push(arg); fn_args.push(arg);
} }
let fn_args = fn_args; // remove mutability
match ctx.stdlib.get_either(fn_name) { match ctx.stdlib.get_either(fn_name) {
FunctionKind::Core(func) => { FunctionKind::Core(func) => {
let op = if func.feature_tree_operation() {
let op_labeled_args = func
.args(false)
.iter()
.zip(&fn_args)
.map(|(k, v)| (k.name.clone(), OpArg::new(v.source_range)))
.collect();
Some(Operation::StdLibCall {
std_lib_fn: (&func).into(),
unlabeled_arg: None,
labeled_args: op_labeled_args,
source_range: callsite,
is_error: false,
})
} else {
None
};
// Attempt to call the function. // Attempt to call the function.
let args = crate::std::Args::new(fn_args, self.into(), ctx.clone()); let args = crate::std::Args::new(fn_args, self.into(), ctx.clone());
let mut result = func.std_lib_fn()(exec_state, args).await?; let result = {
update_memory_for_tags_of_geometry(&mut result, exec_state)?; // Don't early-return in this block.
Ok(result) let result = func.std_lib_fn()(exec_state, args).await;
if let Some(mut op) = op {
op.set_std_lib_call_is_error(result.is_err());
// Track call operation. We do this after the call
// since things like patternTransform may call user code
// before running, and we will likely want to use the
// return value. The call takes ownership of the args,
// so we need to build the op before the call.
exec_state.operations.push(op);
}
result
};
let mut return_value = result?;
update_memory_for_tags_of_geometry(&mut return_value, exec_state)?;
Ok(return_value)
} }
FunctionKind::UserDefined => { FunctionKind::UserDefined => {
let source_range = SourceRange::from(self); let source_range = SourceRange::from(self);
@ -462,6 +554,16 @@ impl Node<CallExpression> {
let func = exec_state.memory.get(fn_name, source_range)?.clone(); let func = exec_state.memory.get(fn_name, source_range)?.clone();
let fn_dynamic_state = exec_state.dynamic_state.merge(&exec_state.memory); let fn_dynamic_state = exec_state.dynamic_state.merge(&exec_state.memory);
// Track call operation.
exec_state.operations.push(Operation::UserDefinedFunctionCall {
name: Some(fn_name.clone()),
function_source_range: func.function_def_source_range().unwrap_or_default(),
unlabeled_arg: None,
// TODO: Add the arguments for legacy positional parameters.
labeled_args: Default::default(),
source_range: callsite,
});
let return_value = { let return_value = {
let previous_dynamic_state = std::mem::replace(&mut exec_state.dynamic_state, fn_dynamic_state); let previous_dynamic_state = std::mem::replace(&mut exec_state.dynamic_state, fn_dynamic_state);
let result = func.call_fn(fn_args, exec_state, ctx.clone()).await.map_err(|e| { let result = func.call_fn(fn_args, exec_state, ctx.clone()).await.map_err(|e| {
@ -485,6 +587,9 @@ impl Node<CallExpression> {
}) })
})?; })?;
// Track return operation.
exec_state.operations.push(Operation::UserDefinedFunctionReturn);
Ok(result) Ok(result)
} }
} }

View File

@ -202,6 +202,15 @@ impl KclValue {
} }
} }
pub(crate) fn function_def_source_range(&self) -> Option<SourceRange> {
let KclValue::Function { expression, .. } = self else {
return None;
};
// TODO: It would be nice if we could extract the source range starting
// at the fn, but that's the variable declaration.
Some(expression.as_source_range())
}
pub(crate) fn get_solid_set(&self) -> Result<SolidSet> { pub(crate) fn get_solid_set(&self) -> Result<SolidSet> {
match self { match self {
KclValue::Solid(e) => Ok(SolidSet::Solid(e.clone())), KclValue::Solid(e) => Ok(SolidSet::Solid(e.clone())),

View File

@ -24,6 +24,7 @@ pub use function_param::FunctionParam;
pub use kcl_value::{KclObjectFields, KclValue}; pub use kcl_value::{KclObjectFields, KclValue};
pub(crate) mod cache; pub(crate) mod cache;
mod cad_op;
mod exec_ast; mod exec_ast;
mod function_param; mod function_param;
mod kcl_value; mod kcl_value;
@ -42,6 +43,9 @@ use crate::{
ExecError, Program, ExecError, Program,
}; };
// Re-exports.
pub use cad_op::Operation;
/// State for executing a program. /// State for executing a program.
#[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)] #[ts(export)]
@ -65,6 +69,9 @@ pub struct ExecState {
pub path_to_source_id: IndexMap<std::path::PathBuf, ModuleId>, pub path_to_source_id: IndexMap<std::path::PathBuf, ModuleId>,
/// Map from module ID to module info. /// Map from module ID to module info.
pub module_infos: IndexMap<ModuleId, ModuleInfo>, pub module_infos: IndexMap<ModuleId, ModuleInfo>,
/// Operations that have been performed in execution order, for display in
/// the Feature Tree.
pub operations: Vec<Operation>,
} }
impl ExecState { impl ExecState {

View File

@ -81,7 +81,7 @@ mod wasm;
pub use coredump::CoreDump; pub use coredump::CoreDump;
pub use engine::{EngineManager, ExecutionKind}; pub use engine::{EngineManager, ExecutionKind};
pub use errors::{CompilationError, ConnectionError, ExecError, KclError}; pub use errors::{CompilationError, ConnectionError, ExecError, KclError, KclErrorWithOutputs};
pub use execution::{ pub use execution::{
cache::{CacheInformation, OldAstState}, cache::{CacheInformation, OldAstState},
ExecState, ExecutorContext, ExecutorSettings, ExecState, ExecutorContext, ExecutorSettings,

View File

@ -91,7 +91,7 @@ async fn execute(test_name: &str, render_to_png: bool) {
) )
.await; .await;
match exec_res { match exec_res {
Ok((program_memory, png)) => { Ok((program_memory, ops, png)) => {
if render_to_png { if render_to_png {
twenty_twenty::assert_image(format!("tests/{test_name}/rendered_model.png"), &png, 0.99); twenty_twenty::assert_image(format!("tests/{test_name}/rendered_model.png"), &png, 0.99);
} }
@ -104,9 +104,12 @@ async fn execute(test_name: &str, render_to_png: bool) {
".environments[].**[].z[]" => rounded_redaction(4), ".environments[].**[].z[]" => rounded_redaction(4),
}); });
}); });
assert_snapshot(test_name, "Operations executed", || {
insta::assert_json_snapshot!("ops", ops);
});
} }
Err(e) => { Err(e) => {
match e { match e.error {
crate::errors::ExecError::Kcl(error) => { crate::errors::ExecError::Kcl(error) => {
// Snapshot the KCL error with a fancy graphical report. // Snapshot the KCL error with a fancy graphical report.
// This looks like a Cargo compile error, with arrows pointing // This looks like a Cargo compile error, with arrows pointing
@ -122,6 +125,10 @@ async fn execute(test_name: &str, render_to_png: bool) {
assert_snapshot(test_name, "Error from executing", || { assert_snapshot(test_name, "Error from executing", || {
insta::assert_snapshot!("execution_error", report); insta::assert_snapshot!("execution_error", report);
}); });
assert_snapshot(test_name, "Operations executed", || {
insta::assert_json_snapshot!("ops", e.exec_state.operations);
});
} }
e => { e => {
// These kinds of errors aren't expected to occur. We don't // These kinds of errors aren't expected to occur. We don't

View File

@ -98,6 +98,7 @@ pub async fn chamfer(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ``` /// ```
#[stdlib { #[stdlib {
name = "chamfer", name = "chamfer",
feature_tree_operation = true,
}] }]
async fn inner_chamfer( async fn inner_chamfer(
data: ChamferData, data: ChamferData,

View File

@ -75,7 +75,8 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// example = extrude(10, exampleSketch) /// example = extrude(10, exampleSketch)
/// ``` /// ```
#[stdlib { #[stdlib {
name = "extrude" name = "extrude",
feature_tree_operation = true,
}] }]
async fn inner_extrude( async fn inner_extrude(
length: f64, length: f64,

View File

@ -119,6 +119,7 @@ pub async fn fillet(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ``` /// ```
#[stdlib { #[stdlib {
name = "fillet", name = "fillet",
feature_tree_operation = true,
}] }]
async fn inner_fillet( async fn inner_fillet(
data: FilletData, data: FilletData,

View File

@ -53,6 +53,7 @@ pub async fn helix(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// ``` /// ```
#[stdlib { #[stdlib {
name = "helix", name = "helix",
feature_tree_operation = true,
}] }]
async fn inner_helix( async fn inner_helix(
data: HelixData, data: HelixData,

View File

@ -177,6 +177,7 @@ pub async fn import(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ``` /// ```
#[stdlib { #[stdlib {
name = "import", name = "import",
feature_tree_operation = true,
tags = [], tags = [],
}] }]
async fn inner_import( async fn inner_import(

View File

@ -111,6 +111,7 @@ pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// ``` /// ```
#[stdlib { #[stdlib {
name = "loft", name = "loft",
feature_tree_operation = true,
keywords = true, keywords = true,
unlabeled_first = true, unlabeled_first = true,
arg_docs = { arg_docs = {

View File

@ -285,8 +285,9 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
/// |> patternTransform(3, transform, %) /// |> patternTransform(3, transform, %)
/// ``` /// ```
#[stdlib { #[stdlib {
name = "patternTransform", name = "patternTransform",
}] feature_tree_operation = true,
}]
async fn inner_pattern_transform<'a>( async fn inner_pattern_transform<'a>(
total_instances: u32, total_instances: u32,
transform_function: FunctionParam<'a>, transform_function: FunctionParam<'a>,
@ -322,8 +323,8 @@ async fn inner_pattern_transform<'a>(
/// |> patternTransform2d(4, transform, %) /// |> patternTransform2d(4, transform, %)
/// ``` /// ```
#[stdlib { #[stdlib {
name = "patternTransform2d", name = "patternTransform2d",
}] }]
async fn inner_pattern_transform_2d<'a>( async fn inner_pattern_transform_2d<'a>(
total_instances: u32, total_instances: u32,
transform_function: FunctionParam<'a>, transform_function: FunctionParam<'a>,
@ -762,6 +763,7 @@ pub async fn pattern_linear_3d(exec_state: &mut ExecState, args: Args) -> Result
/// ``` /// ```
#[stdlib { #[stdlib {
name = "patternLinear3d", name = "patternLinear3d",
feature_tree_operation = true,
}] }]
async fn inner_pattern_linear_3d( async fn inner_pattern_linear_3d(
data: LinearPattern3dData, data: LinearPattern3dData,
@ -981,6 +983,7 @@ pub async fn pattern_circular_3d(exec_state: &mut ExecState, args: Args) -> Resu
/// ``` /// ```
#[stdlib { #[stdlib {
name = "patternCircular3d", name = "patternCircular3d",
feature_tree_operation = true,
}] }]
async fn inner_pattern_circular_3d( async fn inner_pattern_circular_3d(
data: CircularPattern3dData, data: CircularPattern3dData,

View File

@ -142,6 +142,7 @@ pub async fn offset_plane(exec_state: &mut ExecState, args: Args) -> Result<KclV
#[stdlib { #[stdlib {
name = "offsetPlane", name = "offsetPlane",
feature_tree_operation = true,
}] }]
async fn inner_offset_plane( async fn inner_offset_plane(
std_plane: StandardPlane, std_plane: StandardPlane,

View File

@ -242,6 +242,7 @@ pub async fn revolve(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ``` /// ```
#[stdlib { #[stdlib {
name = "revolve", name = "revolve",
feature_tree_operation = true,
}] }]
async fn inner_revolve( async fn inner_revolve(
data: RevolveData, data: RevolveData,

View File

@ -176,6 +176,7 @@ pub async fn shell(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// ``` /// ```
#[stdlib { #[stdlib {
name = "shell", name = "shell",
feature_tree_operation = true,
}] }]
async fn inner_shell( async fn inner_shell(
data: ShellData, data: ShellData,
@ -302,6 +303,7 @@ pub async fn hollow(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
/// ``` /// ```
#[stdlib { #[stdlib {
name = "hollow", name = "hollow",
feature_tree_operation = true,
}] }]
async fn inner_hollow( async fn inner_hollow(
thickness: f64, thickness: f64,

View File

@ -1061,6 +1061,7 @@ pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<K
/// ``` /// ```
#[stdlib { #[stdlib {
name = "startSketchOn", name = "startSketchOn",
feature_tree_operation = true,
}] }]
async fn inner_start_sketch_on( async fn inner_start_sketch_on(
data: SketchData, data: SketchData,
@ -2218,6 +2219,7 @@ pub async fn hole(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
/// ``` /// ```
#[stdlib { #[stdlib {
name = "hole", name = "hole",
feature_tree_operation = true,
}] }]
async fn inner_hole( async fn inner_hole(
hole_sketch: SketchSet, hole_sketch: SketchSet,

View File

@ -79,6 +79,7 @@ pub async fn sweep(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
/// ``` /// ```
#[stdlib { #[stdlib {
name = "sweep", name = "sweep",
feature_tree_operation = true,
}] }]
async fn inner_sweep( async fn inner_sweep(
data: SweepData, data: SweepData,

View File

@ -3,7 +3,8 @@
use std::path::PathBuf; use std::path::PathBuf;
use crate::{ use crate::{
execution::{new_zoo_client, ExecutorContext, ExecutorSettings, ProgramMemory}, errors::ExecErrorWithState,
execution::{new_zoo_client, ExecutorContext, ExecutorSettings, Operation, ProgramMemory},
settings::types::UnitLength, settings::types::UnitLength,
ConnectionError, ExecError, Program, ConnectionError, ExecError, Program,
}; };
@ -24,7 +25,10 @@ pub async fn execute_and_snapshot(
) -> Result<image::DynamicImage, ExecError> { ) -> Result<image::DynamicImage, ExecError> {
let ctx = new_context(units, true, project_directory).await?; let ctx = new_context(units, true, project_directory).await?;
let program = Program::parse_no_errs(code)?; let program = Program::parse_no_errs(code)?;
do_execute_and_snapshot(&ctx, program).await.map(|(_state, snap)| snap) do_execute_and_snapshot(&ctx, program)
.await
.map(|(_state, snap)| snap)
.map_err(|err| err.error)
} }
/// Executes a kcl program and takes a snapshot of the result. /// Executes a kcl program and takes a snapshot of the result.
@ -33,11 +37,11 @@ pub async fn execute_and_snapshot_ast(
ast: Program, ast: Program,
units: UnitLength, units: UnitLength,
project_directory: Option<PathBuf>, project_directory: Option<PathBuf>,
) -> Result<(ProgramMemory, image::DynamicImage), ExecError> { ) -> Result<(ProgramMemory, Vec<Operation>, image::DynamicImage), ExecErrorWithState> {
let ctx = new_context(units, true, project_directory).await?; let ctx = new_context(units, true, project_directory).await?;
do_execute_and_snapshot(&ctx, ast) do_execute_and_snapshot(&ctx, ast)
.await .await
.map(|(state, snap)| (state.memory, snap)) .map(|(state, snap)| (state.memory, state.operations, snap))
} }
pub async fn execute_and_snapshot_no_auth( pub async fn execute_and_snapshot_no_auth(
@ -47,17 +51,21 @@ pub async fn execute_and_snapshot_no_auth(
) -> Result<image::DynamicImage, ExecError> { ) -> Result<image::DynamicImage, ExecError> {
let ctx = new_context(units, false, project_directory).await?; let ctx = new_context(units, false, project_directory).await?;
let program = Program::parse_no_errs(code)?; let program = Program::parse_no_errs(code)?;
do_execute_and_snapshot(&ctx, program).await.map(|(_state, snap)| snap) do_execute_and_snapshot(&ctx, program)
.await
.map(|(_state, snap)| snap)
.map_err(|err| err.error)
} }
async fn do_execute_and_snapshot( async fn do_execute_and_snapshot(
ctx: &ExecutorContext, ctx: &ExecutorContext,
program: Program, program: Program,
) -> Result<(crate::execution::ExecState, image::DynamicImage), ExecError> { ) -> Result<(crate::execution::ExecState, image::DynamicImage), ExecErrorWithState> {
let mut exec_state = Default::default(); let mut exec_state = Default::default();
let snapshot_png_bytes = ctx let snapshot_png_bytes = ctx
.execute_and_prepare_snapshot(&program, &mut exec_state) .execute_and_prepare_snapshot(&program, &mut exec_state)
.await? .await
.map_err(|err| ExecErrorWithState::new(err, exec_state.clone()))?
.contents .contents
.0; .0;
@ -65,7 +73,8 @@ async fn do_execute_and_snapshot(
let img = image::ImageReader::new(std::io::Cursor::new(snapshot_png_bytes)) let img = image::ImageReader::new(std::io::Cursor::new(snapshot_png_bytes))
.with_guessed_format() .with_guessed_format()
.map_err(|e| ExecError::BadPng(e.to_string())) .map_err(|e| ExecError::BadPng(e.to_string()))
.and_then(|x| x.decode().map_err(|e| ExecError::BadPng(e.to_string())))?; .and_then(|x| x.decode().map_err(|e| ExecError::BadPng(e.to_string())))
.map_err(|err| ExecErrorWithState::new(err, exec_state.clone()))?;
Ok((exec_state, img)) Ok((exec_state, img))
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed angled_line.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
260,
261,
0
]
},
"sketch_set": {
"sourceRange": [
263,
264,
0
]
}
},
"name": "extrude",
"sourceRange": [
252,
265,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed argument_error.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_push.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_push_fail.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_index_oob.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_range_expr.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_range_negative_expr.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,78 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed basic_fillet_cube_close_opposite.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
181,
183,
0
]
},
"sketch_set": {
"sourceRange": [
185,
186,
0
]
}
},
"name": "extrude",
"sourceRange": [
173,
187,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
200,
275,
0
]
},
"solid": {
"sourceRange": [
277,
278,
0
]
}
},
"name": "fillet",
"sourceRange": [
193,
279,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,78 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed basic_fillet_cube_end.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
172,
174,
0
]
},
"sketch_set": {
"sourceRange": [
176,
177,
0
]
}
},
"name": "extrude",
"sourceRange": [
164,
178,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
191,
264,
0
]
},
"solid": {
"sourceRange": [
266,
267,
0
]
}
},
"name": "fillet",
"sourceRange": [
184,
268,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,78 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed basic_fillet_cube_next_adjacent.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
190,
192,
0
]
},
"sketch_set": {
"sourceRange": [
194,
195,
0
]
}
},
"name": "extrude",
"sourceRange": [
182,
196,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
209,
280,
0
]
},
"solid": {
"sourceRange": [
282,
283,
0
]
}
},
"name": "fillet",
"sourceRange": [
202,
284,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,78 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed basic_fillet_cube_previous_adjacent.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
190,
192,
0
]
},
"sketch_set": {
"sourceRange": [
194,
195,
0
]
}
},
"name": "extrude",
"sourceRange": [
182,
196,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
209,
284,
0
]
},
"solid": {
"sourceRange": [
286,
287,
0
]
}
},
"name": "fillet",
"sourceRange": [
202,
288,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,78 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed basic_fillet_cube_start.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
172,
174,
0
]
},
"sketch_set": {
"sourceRange": [
176,
177,
0
]
}
},
"name": "extrude",
"sourceRange": [
164,
178,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
191,
229,
0
]
},
"solid": {
"sourceRange": [
231,
232,
0
]
}
},
"name": "fillet",
"sourceRange": [
184,
233,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed big_number_angle_to_match_length_x.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
182,
184,
0
]
},
"sketch_set": {
"sourceRange": [
186,
187,
0
]
}
},
"name": "extrude",
"sourceRange": [
174,
188,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed big_number_angle_to_match_length_y.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
182,
184,
0
]
},
"sketch_set": {
"sourceRange": [
186,
187,
0
]
}
},
"name": "extrude",
"sourceRange": [
174,
188,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,104 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed circular_pattern3d_a_pattern.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
30,
34,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
16,
35,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
158,
159,
0
]
},
"sketch_set": {
"sourceRange": [
161,
162,
0
]
}
},
"name": "extrude",
"sourceRange": [
150,
163,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
190,
245,
0
]
},
"solid_set": {
"sourceRange": [
247,
260,
0
]
}
},
"name": "patternLinear3d",
"sourceRange": [
174,
261,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
290,
406,
0
]
},
"solid_set": {
"sourceRange": [
408,
414,
0
]
}
},
"name": "patternCircular3d",
"sourceRange": [
272,
415,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed comparisons.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed comparisons_multiple.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed computed_var.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed cube.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "cube",
"functionSourceRange": [
7,
322,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
333,
349,
0
]
},
{
"labeledArgs": {
"length": {
"sourceRange": [
310,
316,
0
]
},
"sketch_set": {
"sourceRange": [
318,
319,
0
]
}
},
"name": "extrude",
"sourceRange": [
302,
320,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed double_map_fn.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,464 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed fillet-and-shell.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
764,
768,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
750,
769,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
963,
973,
0
]
},
"sketch_set": {
"sourceRange": [
975,
976,
0
]
}
},
"name": "extrude",
"sourceRange": [
955,
977,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
990,
1189,
0
]
},
"solid": {
"sourceRange": [
1191,
1192,
0
]
}
},
"name": "fillet",
"sourceRange": [
983,
1193,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionCall",
"name": "m25Screw",
"functionSourceRange": [
1206,
1442,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
1444,
1573,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1247,
1251,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
1233,
1252,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
1350,
1395,
0
]
},
"sketch": {
"sourceRange": [
1397,
1398,
0
]
}
},
"name": "hole",
"sourceRange": [
1345,
1399,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1415,
1421,
0
]
},
"sketch_set": {
"sourceRange": [
1423,
1424,
0
]
}
},
"name": "extrude",
"sourceRange": [
1407,
1425,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "m25Screw",
"functionSourceRange": [
1206,
1442,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
1575,
1702,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1247,
1251,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
1233,
1252,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
1350,
1395,
0
]
},
"sketch": {
"sourceRange": [
1397,
1398,
0
]
}
},
"name": "hole",
"sourceRange": [
1345,
1399,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1415,
1421,
0
]
},
"sketch_set": {
"sourceRange": [
1423,
1424,
0
]
}
},
"name": "extrude",
"sourceRange": [
1407,
1425,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "m25Screw",
"functionSourceRange": [
1206,
1442,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
1704,
1829,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1247,
1251,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
1233,
1252,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
1350,
1395,
0
]
},
"sketch": {
"sourceRange": [
1397,
1398,
0
]
}
},
"name": "hole",
"sourceRange": [
1345,
1399,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1415,
1421,
0
]
},
"sketch_set": {
"sourceRange": [
1423,
1424,
0
]
}
},
"name": "extrude",
"sourceRange": [
1407,
1425,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "m25Screw",
"functionSourceRange": [
1206,
1442,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
1831,
1958,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1247,
1251,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
1233,
1252,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
1350,
1395,
0
]
},
"sketch": {
"sourceRange": [
1397,
1398,
0
]
}
},
"name": "hole",
"sourceRange": [
1345,
1399,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1415,
1421,
0
]
},
"sketch_set": {
"sourceRange": [
1423,
1424,
0
]
}
},
"name": "extrude",
"sourceRange": [
1407,
1425,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1966,
2016,
0
]
},
"solid_set": {
"sourceRange": [
2018,
2022,
0
]
}
},
"name": "shell",
"sourceRange": [
1960,
2023,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,71 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed function_sketch.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "box",
"functionSourceRange": [
6,
205,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
215,
228,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
42,
46,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
28,
47,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
182,
183,
0
]
},
"sketch_set": {
"sourceRange": [
185,
186,
0
]
}
},
"name": "extrude",
"sourceRange": [
174,
187,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
}
]

View File

@ -0,0 +1,71 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed function_sketch_with_position.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "box",
"functionSourceRange": [
6,
203,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
213,
234,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
45,
49,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
31,
50,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
180,
181,
0
]
},
"sketch_set": {
"sourceRange": [
183,
184,
0
]
}
},
"name": "extrude",
"sourceRange": [
172,
185,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
}
]

View File

@ -0,0 +1,78 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed helix_ccw.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
92,
94,
0
]
},
"sketch_set": {
"sourceRange": [
96,
97,
0
]
}
},
"name": "extrude",
"sourceRange": [
84,
98,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
110,
184,
0
]
},
"solid": {
"sourceRange": [
186,
187,
0
]
}
},
"name": "helix",
"sourceRange": [
104,
188,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,59 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed i_shape.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"hole_sketch": {
"sourceRange": [
2348,
2353,
0
]
},
"sketch": {
"sourceRange": [
2355,
2356,
0
]
}
},
"name": "hole",
"sourceRange": [
2343,
2357,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
2371,
2374,
0
]
},
"sketch_set": {
"sourceRange": [
2376,
2377,
0
]
}
},
"name": "extrude",
"sourceRange": [
2363,
2378,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed if_else.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed import_constant.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed import_cycle1.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed import_export.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed import_glob.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,27 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed import_side_effect.kcl
snapshot_kind: text
---
[
{
"isError": true,
"labeledArgs": {
"data": {
"sourceRange": [
95,
99,
1
]
}
},
"name": "startSketchOn",
"sourceRange": [
81,
100,
1
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed index_of_array.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed invalid_index_fractional.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed invalid_index_negative.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed invalid_index_str.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed invalid_member_object.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed invalid_member_object_prop.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed kittycad_svg.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
20,
24,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
6,
25,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
15826,
15827,
0
]
},
"sketch_set": {
"sourceRange": [
15829,
15830,
0
]
}
},
"name": "extrude",
"sourceRange": [
15818,
15831,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,59 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed kw_fn.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "increment",
"functionSourceRange": [
12,
35,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
85,
97,
0
]
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "add",
"functionSourceRange": [
43,
77,
0
],
"unlabeledArg": {
"sourceRange": [
110,
111,
0
]
},
"labeledArgs": {
"delta": {
"sourceRange": [
121,
122,
0
]
}
},
"sourceRange": [
106,
123,
0
]
},
{
"type": "UserDefinedFunctionReturn"
}
]

View File

@ -0,0 +1,31 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed kw_fn_too_few_args.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "add",
"functionSourceRange": [
6,
31,
0
],
"unlabeledArg": null,
"labeledArgs": {
"x": {
"sourceRange": [
49,
50,
0
]
}
},
"sourceRange": [
41,
51,
0
]
}
]

View File

@ -0,0 +1,31 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed kw_fn_unlabeled_but_has_label.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "add",
"functionSourceRange": [
6,
29,
0
],
"unlabeledArg": null,
"labeledArgs": {
"x": {
"sourceRange": [
45,
46,
0
]
}
},
"sourceRange": [
37,
47,
0
]
}
]

View File

@ -0,0 +1,59 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed kw_fn_with_defaults.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "increment",
"functionSourceRange": [
12,
45,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
53,
65,
0
]
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "increment",
"functionSourceRange": [
12,
45,
0
],
"unlabeledArg": {
"sourceRange": [
88,
89,
0
]
},
"labeledArgs": {
"by": {
"sourceRange": [
96,
98,
0
]
}
},
"sourceRange": [
78,
99,
0
]
},
{
"type": "UserDefinedFunctionReturn"
}
]

View File

@ -0,0 +1,104 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed linear_pattern3d_a_pattern.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
30,
34,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
16,
35,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
158,
159,
0
]
},
"sketch_set": {
"sourceRange": [
161,
162,
0
]
}
},
"name": "extrude",
"sourceRange": [
150,
163,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
190,
245,
0
]
},
"solid_set": {
"sourceRange": [
247,
260,
0
]
}
},
"name": "patternLinear3d",
"sourceRange": [
174,
261,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
288,
343,
0
]
},
"solid_set": {
"sourceRange": [
345,
351,
0
]
}
},
"name": "patternLinear3d",
"sourceRange": [
272,
352,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed mike_stress_test.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
74110,
74111,
0
]
},
"sketch_set": {
"sourceRange": [
74113,
74114,
0
]
}
},
"name": "extrude",
"sourceRange": [
74102,
74115,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed neg_xz_plane.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
29,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
30,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
141,
146,
0
]
},
"sketch_set": {
"sourceRange": [
148,
149,
0
]
}
},
"name": "extrude",
"sourceRange": [
133,
150,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed non_string_key_of_object.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed object_prop_not_found.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed parametric.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
242,
246,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
228,
247,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
458,
463,
0
]
},
"sketch_set": {
"sourceRange": [
465,
466,
0
]
}
},
"name": "extrude",
"sourceRange": [
450,
467,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,33 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed parametric_with_tan_arc.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"length": {
"sourceRange": [
588,
593,
0
]
},
"sketch_set": {
"sourceRange": [
595,
596,
0
]
}
},
"name": "extrude",
"sourceRange": [
580,
597,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,246 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed pentagon_fillet_sugar.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
154,
158,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
140,
159,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
389,
403,
0
]
},
"sketch_set": {
"sourceRange": [
405,
406,
0
]
}
},
"name": "extrude",
"sourceRange": [
381,
407,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionCall",
"name": "circl",
"functionSourceRange": [
417,
567,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
574,
588,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
452,
453,
0
]
},
"tag": {
"sourceRange": [
455,
459,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
438,
460,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"length": {
"sourceRange": [
616,
626,
0
]
},
"sketch_set": {
"sourceRange": [
628,
629,
0
]
}
},
"name": "extrude",
"sourceRange": [
608,
630,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
643,
763,
0
]
},
"solid": {
"sourceRange": [
765,
766,
0
]
}
},
"name": "fillet",
"sourceRange": [
636,
767,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionCall",
"name": "circl",
"functionSourceRange": [
417,
567,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
773,
786,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
452,
453,
0
]
},
"tag": {
"sourceRange": [
455,
459,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
438,
460,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"length": {
"sourceRange": [
814,
824,
0
]
},
"sketch_set": {
"sourceRange": [
826,
827,
0
]
}
},
"name": "extrude",
"sourceRange": [
806,
828,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
841,
961,
0
]
},
"solid": {
"sourceRange": [
963,
964,
0
]
}
},
"name": "fillet",
"sourceRange": [
834,
965,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,71 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed pipe_as_arg.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "double",
"functionSourceRange": [
333,
355,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
408,
417,
0
]
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "cube",
"functionSourceRange": [
7,
322,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
394,
426,
0
]
},
{
"labeledArgs": {
"length": {
"sourceRange": [
310,
316,
0
]
},
"sketch_set": {
"sourceRange": [
318,
319,
0
]
}
},
"name": "extrude",
"sourceRange": [
302,
320,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed pipe_substitution_inside_function_called_from_pipeline.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,97 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed poop_chute.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
196,
201,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
182,
202,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
822,
940,
0
]
},
"sketch": {
"sourceRange": [
942,
951,
0
]
}
},
"name": "revolve",
"sourceRange": [
814,
952,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
980,
985,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
966,
986,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1601,
1621,
0
]
},
"sketch_set": {
"sourceRange": [
1623,
1624,
0
]
}
},
"name": "extrude",
"sourceRange": [
1593,
1625,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed property_of_object.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,90 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed riddle_small.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "t",
"functionSourceRange": [
20,
66,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
102,
107,
0
]
},
{
"type": "UserDefinedFunctionReturn"
},
{
"type": "UserDefinedFunctionCall",
"name": "t",
"functionSourceRange": [
20,
66,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
125,
130,
0
]
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"data": {
"sourceRange": [
155,
159,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
141,
160,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
286,
287,
0
]
},
"sketch_set": {
"sourceRange": [
289,
290,
0
]
}
},
"name": "extrude",
"sourceRange": [
278,
291,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,222 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed sketch-on-chamfer-two-times-different-order.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
26,
30,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
12,
31,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
447,
450,
0
]
},
"sketch_set": {
"sourceRange": [
452,
461,
0
]
}
},
"name": "extrude",
"sourceRange": [
439,
462,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
475,
506,
0
]
},
"solid": {
"sourceRange": [
508,
509,
0
]
}
},
"name": "fillet",
"sourceRange": [
468,
510,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
524,
591,
0
]
},
"solid": {
"sourceRange": [
593,
594,
0
]
},
"tag": {
"sourceRange": [
596,
602,
0
]
}
},
"name": "chamfer",
"sourceRange": [
516,
603,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
617,
648,
0
]
},
"solid": {
"sourceRange": [
650,
651,
0
]
},
"tag": {
"sourceRange": [
653,
659,
0
]
}
},
"name": "chamfer",
"sourceRange": [
609,
660,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
688,
698,
0
]
},
"tag": {
"sourceRange": [
700,
705,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
674,
706,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1127,
1137,
0
]
},
"tag": {
"sourceRange": [
1139,
1144,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
1113,
1145,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1563,
1565,
0
]
},
"sketch_set": {
"sourceRange": [
1567,
1576,
0
]
}
},
"name": "extrude",
"sourceRange": [
1555,
1577,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,222 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed sketch-on-chamfer-two-times.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
26,
30,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
12,
31,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
447,
450,
0
]
},
"sketch_set": {
"sourceRange": [
452,
461,
0
]
}
},
"name": "extrude",
"sourceRange": [
439,
462,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
475,
506,
0
]
},
"solid": {
"sourceRange": [
508,
509,
0
]
}
},
"name": "fillet",
"sourceRange": [
468,
510,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
524,
555,
0
]
},
"solid": {
"sourceRange": [
557,
558,
0
]
},
"tag": {
"sourceRange": [
560,
566,
0
]
}
},
"name": "chamfer",
"sourceRange": [
516,
567,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
581,
648,
0
]
},
"solid": {
"sourceRange": [
650,
651,
0
]
},
"tag": {
"sourceRange": [
653,
659,
0
]
}
},
"name": "chamfer",
"sourceRange": [
573,
660,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
688,
698,
0
]
},
"tag": {
"sourceRange": [
700,
705,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
674,
706,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1127,
1137,
0
]
},
"tag": {
"sourceRange": [
1139,
1144,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
1113,
1145,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1563,
1565,
0
]
},
"sketch_set": {
"sourceRange": [
1567,
1576,
0
]
}
},
"name": "extrude",
"sourceRange": [
1555,
1577,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,135 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed sketch_in_object.kcl
snapshot_kind: text
---
[
{
"type": "UserDefinedFunctionCall",
"name": "test",
"functionSourceRange": [
7,
161,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
393,
399,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
35,
39,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
21,
40,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"length": {
"sourceRange": [
415,
418,
0
]
},
"sketch_set": {
"sourceRange": [
420,
421,
0
]
}
},
"name": "extrude",
"sourceRange": [
407,
422,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionCall",
"name": "test2",
"functionSourceRange": [
171,
387,
0
],
"unlabeledArg": null,
"labeledArgs": {},
"sourceRange": [
429,
436,
0
]
},
{
"labeledArgs": {
"data": {
"sourceRange": [
231,
235,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
217,
236,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"type": "UserDefinedFunctionReturn"
},
{
"labeledArgs": {
"length": {
"sourceRange": [
467,
469,
0
]
},
"sketch_set": {
"sourceRange": [
471,
472,
0
]
}
},
"name": "extrude",
"sourceRange": [
459,
473,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,104 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed sketch_on_face.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
193,
194,
0
]
},
"sketch_set": {
"sourceRange": [
196,
197,
0
]
}
},
"name": "extrude",
"sourceRange": [
185,
198,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
224,
231,
0
]
},
"tag": {
"sourceRange": [
233,
237,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
210,
238,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
364,
365,
0
]
},
"sketch_set": {
"sourceRange": [
367,
368,
0
]
}
},
"name": "extrude",
"sourceRange": [
356,
369,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,156 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed sketch_on_face_after_fillets_referencing_face.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
1006,
1010,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
992,
1011,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1280,
1285,
0
]
},
"sketch_set": {
"sourceRange": [
1287,
1288,
0
]
}
},
"name": "extrude",
"sourceRange": [
1272,
1289,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1302,
1382,
0
]
},
"solid": {
"sourceRange": [
1384,
1385,
0
]
}
},
"name": "fillet",
"sourceRange": [
1295,
1386,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1399,
1491,
0
]
},
"solid": {
"sourceRange": [
1493,
1494,
0
]
}
},
"name": "fillet",
"sourceRange": [
1392,
1495,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
1523,
1530,
0
]
},
"tag": {
"sourceRange": [
1532,
1537,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
1509,
1538,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
1740,
1742,
0
]
},
"sketch_set": {
"sourceRange": [
1744,
1745,
0
]
}
},
"name": "extrude",
"sourceRange": [
1732,
1746,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

Some files were not shown because too many files have changed in this diff Show More