Compare commits
5 Commits
nightly-v2
...
achalmers/
Author | SHA1 | Date | |
---|---|---|---|
7711bf768c | |||
83f74faaf7 | |||
0bb5797377 | |||
c3097aa334 | |||
2cd0fcc9a7 |
@ -38,7 +38,7 @@ test.describe('Point and click for boolean workflows', () => {
|
||||
path.resolve(
|
||||
__dirname,
|
||||
'../../',
|
||||
'./rust/kcl-lib/e2e/executor/inputs/boolean-setup-with'
|
||||
'./rust/kcl-lib/e2e/executor/inputs/boolean-setup-with-sketch-on-faces.kcl'
|
||||
),
|
||||
'utf-8'
|
||||
)
|
||||
|
@ -612,3 +612,12 @@ profile001 = startProfileAt([-12.34, 12.34], sketch002)
|
||||
const sketch002 = extrude(sketch002, length = ${[5, 5]} + 7)`
|
||||
await expect(page.locator('.cm-content')).toHaveText(result2.regExp)
|
||||
})
|
||||
|
||||
test.fixme(
|
||||
`Opening a share link in the web isn't blocked by the web warning banner`,
|
||||
async () => {
|
||||
// This test is not able to be run right now since we don't have a web-only setup for Playwright.
|
||||
// @franknoirot can implement it when that testing infra is set up. It should be a test to cover the fix from
|
||||
// modeling-app issue #6172.
|
||||
}
|
||||
)
|
||||
|
@ -19,9 +19,14 @@
|
||||
(self: super: {
|
||||
rustToolchain = super. rust-bin.stable.latest.default.override {
|
||||
targets = [ "wasm32-unknown-unknown" ];
|
||||
extensions = [ "rustfmt" "llvm-tools-preview" ];
|
||||
extensions = [ "rustfmt" "llvm-tools-preview" "rust-src" ];
|
||||
};
|
||||
})
|
||||
(self: super: {
|
||||
cargo-llvm-cov = super.cargo-llvm-cov.overrideAttrs(oa: {
|
||||
doCheck = false; doInstallCheck = false;
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
# Systems supported
|
||||
@ -34,7 +39,7 @@
|
||||
|
||||
# Helper to provide system-specific attributes
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
|
||||
pkgs = import nixpkgs { inherit overlays system; };
|
||||
pkgs = import nixpkgs { inherit overlays system; config.allowBroken = true; };
|
||||
});
|
||||
|
||||
in
|
||||
|
@ -918,13 +918,55 @@ impl Node<MemberExpression> {
|
||||
impl Node<BinaryExpression> {
|
||||
#[async_recursion]
|
||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let left_value = self.left.get_result(exec_state, ctx).await?;
|
||||
let right_value = self.right.get_result(exec_state, ctx).await?;
|
||||
let mut meta = left_value.metadata();
|
||||
meta.extend(right_value.metadata());
|
||||
let mut partial = self.right.get_result(exec_state, ctx).await?;
|
||||
let mut next = &self.left;
|
||||
let source_range = self.into();
|
||||
// Don't recurse through a big chain of binary operations, iterate instead.
|
||||
while let BinaryPart::BinaryExpression(next_binary_expr) = next {
|
||||
let metadata = partial.metadata();
|
||||
partial = do_binary_op(
|
||||
partial,
|
||||
next_binary_expr.right.get_result(exec_state, ctx).await?,
|
||||
next_binary_expr.operator,
|
||||
metadata,
|
||||
source_range,
|
||||
exec_state,
|
||||
ctx,
|
||||
)
|
||||
.await?;
|
||||
next = &next_binary_expr.left;
|
||||
}
|
||||
|
||||
let next_value = next.get_result(exec_state, ctx).await?;
|
||||
let mut meta = partial.metadata();
|
||||
meta.extend(next_value.metadata());
|
||||
|
||||
let value = do_binary_op(partial, next_value, self.operator, meta, self.into(), exec_state, ctx).await?;
|
||||
Ok(value)
|
||||
}
|
||||
}
|
||||
|
||||
fn warn_on_unknown(source_range: SourceRange, ty: &NumericType, verb: &str, exec_state: &mut ExecState) {
|
||||
if *CHECK_NUMERIC_TYPES && ty == &NumericType::Unknown {
|
||||
// TODO suggest how to fix this
|
||||
exec_state.warn(CompilationError::err(
|
||||
source_range,
|
||||
format!("{} numbers which have unknown or incompatible units.", verb),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
async fn do_binary_op(
|
||||
left_value: KclValue,
|
||||
right_value: KclValue,
|
||||
operator: BinaryOperator,
|
||||
meta: Vec<Metadata>,
|
||||
source_range: SourceRange,
|
||||
exec_state: &mut ExecState,
|
||||
ctx: &ExecutorContext,
|
||||
) -> Result<KclValue, KclError> {
|
||||
// First check if we are doing string concatenation.
|
||||
if self.operator == BinaryOperator::Add {
|
||||
if operator == BinaryOperator::Add {
|
||||
if let (KclValue::String { value: left, meta: _ }, KclValue::String { value: right, meta: _ }) =
|
||||
(&left_value, &right_value)
|
||||
{
|
||||
@ -936,26 +978,24 @@ impl Node<BinaryExpression> {
|
||||
}
|
||||
|
||||
// Then check if we have solids.
|
||||
if self.operator == BinaryOperator::Add || self.operator == BinaryOperator::Or {
|
||||
if operator == BinaryOperator::Add || operator == BinaryOperator::Or {
|
||||
if let (KclValue::Solid { value: left }, KclValue::Solid { value: right }) = (&left_value, &right_value) {
|
||||
let args = crate::std::Args::new(Default::default(), self.into(), ctx.clone(), None);
|
||||
let result =
|
||||
crate::std::csg::inner_union(vec![*left.clone(), *right.clone()], exec_state, args).await?;
|
||||
let args = crate::std::Args::new(Default::default(), source_range, ctx.clone(), None);
|
||||
let result = crate::std::csg::inner_union(vec![*left.clone(), *right.clone()], exec_state, args).await?;
|
||||
return Ok(result.into());
|
||||
}
|
||||
} else if self.operator == BinaryOperator::Sub {
|
||||
} else if operator == BinaryOperator::Sub {
|
||||
// Check if we have solids.
|
||||
if let (KclValue::Solid { value: left }, KclValue::Solid { value: right }) = (&left_value, &right_value) {
|
||||
let args = crate::std::Args::new(Default::default(), self.into(), ctx.clone(), None);
|
||||
let args = crate::std::Args::new(Default::default(), source_range, ctx.clone(), None);
|
||||
let result =
|
||||
crate::std::csg::inner_subtract(vec![*left.clone()], vec![*right.clone()], exec_state, args)
|
||||
.await?;
|
||||
crate::std::csg::inner_subtract(vec![*left.clone()], vec![*right.clone()], exec_state, args).await?;
|
||||
return Ok(result.into());
|
||||
}
|
||||
} else if self.operator == BinaryOperator::And {
|
||||
} else if operator == BinaryOperator::And {
|
||||
// Check if we have solids.
|
||||
if let (KclValue::Solid { value: left }, KclValue::Solid { value: right }) = (&left_value, &right_value) {
|
||||
let args = crate::std::Args::new(Default::default(), self.into(), ctx.clone(), None);
|
||||
let args = crate::std::Args::new(Default::default(), source_range, ctx.clone(), None);
|
||||
let result =
|
||||
crate::std::csg::inner_intersect(vec![*left.clone(), *right.clone()], exec_state, args).await?;
|
||||
return Ok(result.into());
|
||||
@ -963,7 +1003,7 @@ impl Node<BinaryExpression> {
|
||||
}
|
||||
|
||||
// Check if we are doing logical operations on booleans.
|
||||
if self.operator == BinaryOperator::Or || self.operator == BinaryOperator::And {
|
||||
if operator == BinaryOperator::Or || operator == BinaryOperator::And {
|
||||
let KclValue::Bool {
|
||||
value: left_value,
|
||||
meta: _,
|
||||
@ -974,7 +1014,7 @@ impl Node<BinaryExpression> {
|
||||
"Cannot apply logical operator to non-boolean value: {}",
|
||||
left_value.human_friendly_type()
|
||||
),
|
||||
source_ranges: vec![self.left.clone().into()],
|
||||
source_ranges: left_value.into(),
|
||||
}));
|
||||
};
|
||||
let KclValue::Bool {
|
||||
@ -987,10 +1027,10 @@ impl Node<BinaryExpression> {
|
||||
"Cannot apply logical operator to non-boolean value: {}",
|
||||
right_value.human_friendly_type()
|
||||
),
|
||||
source_ranges: vec![self.right.clone().into()],
|
||||
source_ranges: right_value.into(),
|
||||
}));
|
||||
};
|
||||
let raw_value = match self.operator {
|
||||
let raw_value = match operator {
|
||||
BinaryOperator::Or => left_value || right_value,
|
||||
BinaryOperator::And => left_value && right_value,
|
||||
_ => unreachable!(),
|
||||
@ -998,33 +1038,33 @@ impl Node<BinaryExpression> {
|
||||
return Ok(KclValue::Bool { value: raw_value, meta });
|
||||
}
|
||||
|
||||
let left = number_as_f64(&left_value, self.left.clone().into())?;
|
||||
let right = number_as_f64(&right_value, self.right.clone().into())?;
|
||||
let left = number_as_f64(&left_value, (&left_value).into())?;
|
||||
let right = number_as_f64(&right_value, (&left_value).into())?;
|
||||
|
||||
let value = match self.operator {
|
||||
let value = match operator {
|
||||
BinaryOperator::Add => {
|
||||
let (l, r, ty) = NumericType::combine_eq(left, right);
|
||||
self.warn_on_unknown(&ty, "Adding", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Adding", exec_state);
|
||||
KclValue::Number { value: l + r, meta, ty }
|
||||
}
|
||||
BinaryOperator::Sub => {
|
||||
let (l, r, ty) = NumericType::combine_eq(left, right);
|
||||
self.warn_on_unknown(&ty, "Subtracting", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Subtracting", exec_state);
|
||||
KclValue::Number { value: l - r, meta, ty }
|
||||
}
|
||||
BinaryOperator::Mul => {
|
||||
let (l, r, ty) = NumericType::combine_mul(left, right);
|
||||
self.warn_on_unknown(&ty, "Multiplying", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Multiplying", exec_state);
|
||||
KclValue::Number { value: l * r, meta, ty }
|
||||
}
|
||||
BinaryOperator::Div => {
|
||||
let (l, r, ty) = NumericType::combine_div(left, right);
|
||||
self.warn_on_unknown(&ty, "Dividing", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Dividing", exec_state);
|
||||
KclValue::Number { value: l / r, meta, ty }
|
||||
}
|
||||
BinaryOperator::Mod => {
|
||||
let (l, r, ty) = NumericType::combine_div(left, right);
|
||||
self.warn_on_unknown(&ty, "Modulo of", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Modulo of", exec_state);
|
||||
KclValue::Number { value: l % r, meta, ty }
|
||||
}
|
||||
BinaryOperator::Pow => KclValue::Number {
|
||||
@ -1034,51 +1074,39 @@ impl Node<BinaryExpression> {
|
||||
},
|
||||
BinaryOperator::Neq => {
|
||||
let (l, r, ty) = NumericType::combine_eq(left, right);
|
||||
self.warn_on_unknown(&ty, "Comparing", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Comparing", exec_state);
|
||||
KclValue::Bool { value: l != r, meta }
|
||||
}
|
||||
BinaryOperator::Gt => {
|
||||
let (l, r, ty) = NumericType::combine_eq(left, right);
|
||||
self.warn_on_unknown(&ty, "Comparing", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Comparing", exec_state);
|
||||
KclValue::Bool { value: l > r, meta }
|
||||
}
|
||||
BinaryOperator::Gte => {
|
||||
let (l, r, ty) = NumericType::combine_eq(left, right);
|
||||
self.warn_on_unknown(&ty, "Comparing", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Comparing", exec_state);
|
||||
KclValue::Bool { value: l >= r, meta }
|
||||
}
|
||||
BinaryOperator::Lt => {
|
||||
let (l, r, ty) = NumericType::combine_eq(left, right);
|
||||
self.warn_on_unknown(&ty, "Comparing", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Comparing", exec_state);
|
||||
KclValue::Bool { value: l < r, meta }
|
||||
}
|
||||
BinaryOperator::Lte => {
|
||||
let (l, r, ty) = NumericType::combine_eq(left, right);
|
||||
self.warn_on_unknown(&ty, "Comparing", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Comparing", exec_state);
|
||||
KclValue::Bool { value: l <= r, meta }
|
||||
}
|
||||
BinaryOperator::Eq => {
|
||||
let (l, r, ty) = NumericType::combine_eq(left, right);
|
||||
self.warn_on_unknown(&ty, "Comparing", exec_state);
|
||||
warn_on_unknown(source_range, &ty, "Comparing", exec_state);
|
||||
KclValue::Bool { value: l == r, meta }
|
||||
}
|
||||
BinaryOperator::And | BinaryOperator::Or => unreachable!(),
|
||||
};
|
||||
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
fn warn_on_unknown(&self, ty: &NumericType, verb: &str, exec_state: &mut ExecState) {
|
||||
if *CHECK_NUMERIC_TYPES && ty == &NumericType::Unknown {
|
||||
// TODO suggest how to fix this
|
||||
exec_state.warn(CompilationError::err(
|
||||
self.as_source_range(),
|
||||
format!("{} numbers which have unknown or incompatible units.", verb),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Node<UnaryExpression> {
|
||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
if self.operator == UnaryOperator::Not {
|
||||
|
@ -2832,7 +2832,7 @@ impl BinaryExpression {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, FromStr, Display)]
|
||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, ts_rs::TS, JsonSchema, FromStr, Display)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[display(style = "snake_case")]
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,6 @@ fn f(i) {
|
||||
return i * 2
|
||||
}
|
||||
|
||||
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60) + f(61) + f(62) + f(63) + f(64) + f(65) + f(66) + f(67) + f(68) + f(69) + f(70)
|
||||
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60) + f(61) + f(62) + f(63) + f(64) + f(65) + f(66) + f(67) + f(68) + f(69) + f(70) + f(71) + f(72) + f(73) + f(74) + f(75) + f(76) + f(77) + f(78) + f(79) + f(80) + f(81) + f(82) + f(83) + f(84) + f(85) + f(86) + f(87) + f(88) + f(89) + f(90) + f(91) + f(92) + f(93) + f(94) + f(95) + f(96) + f(97) + f(98) + f(99) + f(100)
|
||||
|
||||
assertEqual(x, 4970, 0.1, "Big sum")
|
||||
assertEqual(x, 10100, 0.1, "Big sum")
|
||||
|
@ -1278,6 +1278,546 @@ description: Operations executed add_lots.kcl
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
},
|
||||
{
|
||||
"type": "GroupBegin",
|
||||
"group": {
|
||||
"type": "FunctionCall",
|
||||
"name": "f",
|
||||
"functionSourceRange": [
|
||||
4,
|
||||
26,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {}
|
||||
},
|
||||
"sourceRange": []
|
||||
},
|
||||
{
|
||||
"type": "GroupEnd"
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ description: Variables in memory after executing add_lots.kcl
|
||||
},
|
||||
"x": {
|
||||
"type": "Number",
|
||||
"value": 4970.0,
|
||||
"value": 10100.0,
|
||||
"ty": {
|
||||
"type": "Default",
|
||||
"len": {
|
||||
|
@ -6,6 +6,6 @@ fn f(i) {
|
||||
return i * 2
|
||||
}
|
||||
|
||||
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60) + f(61) + f(62) + f(63) + f(64) + f(65) + f(66) + f(67) + f(68) + f(69) + f(70)
|
||||
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60) + f(61) + f(62) + f(63) + f(64) + f(65) + f(66) + f(67) + f(68) + f(69) + f(70) + f(71) + f(72) + f(73) + f(74) + f(75) + f(76) + f(77) + f(78) + f(79) + f(80) + f(81) + f(82) + f(83) + f(84) + f(85) + f(86) + f(87) + f(88) + f(89) + f(90) + f(91) + f(92) + f(93) + f(94) + f(95) + f(96) + f(97) + f(98) + f(99) + f(100)
|
||||
|
||||
assertEqual(x, 4970, 0.1, "Big sum")
|
||||
assertEqual(x, 10100, 0.1, "Big sum")
|
||||
|
@ -1705,6 +1705,10 @@ function createLengthIndicator({
|
||||
lengthIndicatorText.innerText = roundOff(length).toString()
|
||||
const lengthIndicatorWrapper = document.createElement('div')
|
||||
|
||||
lengthIndicatorWrapper.addEventListener('wheel', (e) => {
|
||||
// dispatch to cameraControls, without this mouse wheel wouldn't work when hovering this segment label
|
||||
sceneInfra.camControls.onMouseWheel(e)
|
||||
})
|
||||
// Double click workflow
|
||||
lengthIndicatorWrapper.ondblclick = () => {
|
||||
const selection = lengthIndicatorGroup.parent?.userData.selection
|
||||
|
@ -2,11 +2,15 @@ import { Dialog } from '@headlessui/react'
|
||||
import { useState } from 'react'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { CREATE_FILE_URL_PARAM } from '@src/lib/constants'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
import { useSearchParams } from 'react-router-dom'
|
||||
|
||||
const DownloadAppBanner = () => {
|
||||
const [searchParams] = useSearchParams()
|
||||
const settings = useSettings()
|
||||
const [isBannerDismissed, setIsBannerDismissed] = useState(
|
||||
searchParams.has(CREATE_FILE_URL_PARAM) ||
|
||||
settings.app.dismissWebBanner.current
|
||||
)
|
||||
|
||||
@ -43,7 +47,7 @@ const DownloadAppBanner = () => {
|
||||
<ActionButton
|
||||
Element="externalLink"
|
||||
to="https://zoo.dev/modeling-app/download"
|
||||
className="group text-warn-10 dark:!text-warn-10 pr-1 border-warn-70 hover:border-warn-80 dark:!border-warn-70 dark:hover:!border-warn-80 bg-warn-70 group-hover:bg-warn-80 dark:bg-warn-70 dark:group-hover:bg-warn-80"
|
||||
className="group !text-warn-10 pr-1 border-warn-70 hover:border-warn-80 dark:!border-warn-70 dark:hover:!border-warn-80 bg-warn-70 group-hover:bg-warn-80 dark:bg-warn-70 dark:group-hover:bg-warn-80"
|
||||
iconEnd={{
|
||||
icon: 'arrowRight',
|
||||
iconClassName: 'text-warn-10 dark:text-warn-10',
|
||||
|
@ -1,11 +1,14 @@
|
||||
import { useEffect } from 'react'
|
||||
import { useSearchParams } from 'react-router-dom'
|
||||
import { useLocation, useSearchParams } from 'react-router-dom'
|
||||
|
||||
import { useNetworkContext } from '@src/hooks/useNetworkContext'
|
||||
import { EngineConnectionStateType } from '@src/lang/std/engineConnection'
|
||||
import { base64ToString } from '@src/lib/base64'
|
||||
import type { ProjectsCommandSchema } from '@src/lib/commandBarConfigs/projectsCommandConfig'
|
||||
import { CREATE_FILE_URL_PARAM, DEFAULT_FILE_NAME } from '@src/lib/constants'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import type { FileLinkParams } from '@src/lib/links'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import { useSettings } from '@src/machines/appMachine'
|
||||
|
||||
// For initializing the command arguments, we actually want `method` to be undefined
|
||||
@ -26,13 +29,21 @@ export type CreateFileSchemaMethodOptional = Omit<
|
||||
export function useCreateFileLinkQuery(
|
||||
callback: (args: CreateFileSchemaMethodOptional) => void
|
||||
) {
|
||||
const { immediateState } = useNetworkContext()
|
||||
const { pathname } = useLocation()
|
||||
const [searchParams] = useSearchParams()
|
||||
const settings = useSettings()
|
||||
|
||||
useEffect(() => {
|
||||
const isHome = pathname === PATHS.HOME
|
||||
const createFileParam = searchParams.has(CREATE_FILE_URL_PARAM)
|
||||
|
||||
if (createFileParam) {
|
||||
if (
|
||||
createFileParam &&
|
||||
(immediateState.type ===
|
||||
EngineConnectionStateType.ConnectionEstablished ||
|
||||
isHome)
|
||||
) {
|
||||
const params: FileLinkParams = {
|
||||
code: base64ToString(
|
||||
decodeURIComponent(searchParams.get('code') ?? '')
|
||||
@ -54,5 +65,5 @@ export function useCreateFileLinkQuery(
|
||||
|
||||
callback(argDefaultValues)
|
||||
}
|
||||
}, [searchParams])
|
||||
}, [searchParams, immediateState])
|
||||
}
|
||||
|
Reference in New Issue
Block a user