Move some more functions to be declared in KCL (#6856)
* Move the leg functions to KCL Signed-off-by: Nick Cameron <nrc@ncameron.org> * Move array functions to KCL Signed-off-by: Nick Cameron <nrc@ncameron.org> * Move clone to KCL Signed-off-by: Nick Cameron <nrc@ncameron.org> * Add a function type Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -232,6 +232,8 @@ impl PrimitiveType {
|
||||
PrimitiveType::Number(suffix) => hasher.update(suffix.digestable_id()),
|
||||
PrimitiveType::Boolean => hasher.update(b"bool"),
|
||||
PrimitiveType::Tag => hasher.update(b"tag"),
|
||||
PrimitiveType::ImportedGeometry => hasher.update(b"ImportedGeometry"),
|
||||
PrimitiveType::Function => hasher.update(b"Fn"),
|
||||
}
|
||||
|
||||
hasher.finalize().into()
|
||||
|
@ -3197,6 +3197,10 @@ pub enum PrimitiveType {
|
||||
Boolean,
|
||||
/// A tag.
|
||||
Tag,
|
||||
/// Imported from other CAD system.
|
||||
ImportedGeometry,
|
||||
/// `Fn`, type of functions.
|
||||
Function,
|
||||
/// An identifier used as a type (not really a primitive type, but whatever).
|
||||
Named(Node<Identifier>),
|
||||
}
|
||||
@ -3210,6 +3214,8 @@ impl PrimitiveType {
|
||||
("tag", None) => Some(PrimitiveType::Tag),
|
||||
("number", None) => Some(PrimitiveType::Number(NumericSuffix::None)),
|
||||
("number", Some(s)) => Some(PrimitiveType::Number(s)),
|
||||
("ImportedGeometry", None) => Some(PrimitiveType::ImportedGeometry),
|
||||
("Fn", None) => Some(PrimitiveType::Function),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@ -3229,6 +3235,8 @@ impl fmt::Display for PrimitiveType {
|
||||
PrimitiveType::String => write!(f, "string"),
|
||||
PrimitiveType::Boolean => write!(f, "bool"),
|
||||
PrimitiveType::Tag => write!(f, "tag"),
|
||||
PrimitiveType::ImportedGeometry => write!(f, "ImportedGeometry"),
|
||||
PrimitiveType::Function => write!(f, "Fn"),
|
||||
PrimitiveType::Named(n) => write!(f, "{}", n.name),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user