Turn on units of measure (BREAKING CHANGE) (#6343)
* Turn on uom checks Signed-off-by: Nick Cameron <nrc@ncameron.org> * Convert all lengths to mm for engine calls Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use sha2::{Digest as DigestTrait, Sha256};
|
||||
|
||||
use crate::parsing::ast::types::{
|
||||
Annotation, ArrayExpression, ArrayRangeExpression, Ascription, BinaryExpression, BinaryPart, BodyItem,
|
||||
Annotation, ArrayExpression, ArrayRangeExpression, AscribedExpression, BinaryExpression, BinaryPart, BodyItem,
|
||||
CallExpression, CallExpressionKw, DefaultParamVal, ElseIf, Expr, ExpressionStatement, FunctionExpression,
|
||||
Identifier, IfExpression, ImportItem, ImportSelector, ImportStatement, ItemVisibility, KclNone, LabelledExpression,
|
||||
Literal, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject, Name, ObjectExpression, ObjectProperty,
|
||||
@ -464,7 +464,7 @@ impl LabelledExpression {
|
||||
});
|
||||
}
|
||||
|
||||
impl Ascription {
|
||||
impl AscribedExpression {
|
||||
compute_digest!(|slf, hasher| {
|
||||
hasher.update(slf.expr.compute_digest());
|
||||
hasher.update(slf.ty.compute_digest());
|
||||
|
@ -819,7 +819,7 @@ pub enum Expr {
|
||||
UnaryExpression(BoxNode<UnaryExpression>),
|
||||
IfExpression(BoxNode<IfExpression>),
|
||||
LabelledExpression(BoxNode<LabelledExpression>),
|
||||
AscribedExpression(BoxNode<Ascription>),
|
||||
AscribedExpression(BoxNode<AscribedExpression>),
|
||||
None(Node<KclNone>),
|
||||
}
|
||||
|
||||
@ -1092,7 +1092,7 @@ impl LabelledExpression {
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct Ascription {
|
||||
pub struct AscribedExpression {
|
||||
pub expr: Expr,
|
||||
pub ty: Node<Type>,
|
||||
|
||||
@ -1101,12 +1101,12 @@ pub struct Ascription {
|
||||
pub digest: Option<Digest>,
|
||||
}
|
||||
|
||||
impl Ascription {
|
||||
pub(crate) fn new(expr: Expr, ty: Node<Type>) -> Node<Ascription> {
|
||||
impl AscribedExpression {
|
||||
pub(crate) fn new(expr: Expr, ty: Node<Type>) -> Node<AscribedExpression> {
|
||||
let start = expr.start();
|
||||
let end = ty.end;
|
||||
let module_id = expr.module_id();
|
||||
Node::new(Ascription { expr, ty, digest: None }, start, end, module_id)
|
||||
Node::new(AscribedExpression { expr, ty, digest: None }, start, end, module_id)
|
||||
}
|
||||
}
|
||||
|
||||
@ -3080,7 +3080,7 @@ impl PipeExpression {
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(tag = "p_type")]
|
||||
pub enum PrimitiveType {
|
||||
/// A string type.
|
||||
String,
|
||||
|
Reference in New Issue
Block a user