Closed desaikd closed 2 months ago
The model you have for an "entity" (type, struct, class, whatever) is a struct with common fields and an enum for the things that are different.
You may want to consider refactoring so that you have an enum as an "umbrella", and all of the data in the structs for the variants, even if there is some duplication.
I have changed the model to store all information on a data type with its own implementation (e.g. Scalar
, WrappedScalar
, Sequence
, Structure
). A new variant WrappedScalar
is added that can be used to represent a top level scalar type definition. A top level scalar type definition can have a name which is why its better to have it as a separate variant to have specific methods to it in WrappedScalar
.
For example given below ISL,
type::{
name: wrapped_scalar_type,
type: int
}
Corresponding generated code in Rust would look like following:
struct WrappedScalarType {
value: i64
}
Issue #, if available:
Description of changes:
This PR is adds a new model for code generator to make it simpler for getting information on nested types and element type in sequence.
List of changes:
DataModel
is a the new abstract data type that will be used by code generator to render templates.CodeGenType
is similar to the priorAbstractDataType
but more informative includes fields details and element type details.FullyQualifiedTypeName
andFullyQualifiedTypeReference
are used for storing all levels of the fully qualified name of the type.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.