-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds changes for sequence data type #144
base: new-model-changes
Are you sure you want to change the base?
Adds changes for sequence data type #144
Conversation
368d711
to
d716c37
Compare
Sequence(Sequence), | ||
// Represents a sequence type which also has anme attached to it and is nominally distinct from its element type. | ||
WrappedSequence(WrappedSequence), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to have to create corresponding Wrapped*
variants for all of the non-wrapped variants? Why/why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I think its in general there are only 3 types structure, sequence and scalar. Where only nested structure would have a name but scalar and sequence would not have name. Hence to separate out whether they are named or not I have them as a separate variant. I think having them separate allows us to perform specific operations for these types which will be stored as property instead of entirely different class in the generated code.
e.g. For below ISL:
type::{
name: my_type,
fields: {
foo: {type: list, element: string} // this will not create a new nested class in the generated code
}
}
Here's the generated code in Java:
class MyType {
private java.util.ArrayList<String> foo;
...
}
whereas for structure type like following:
type::{
name: my_type,
fields: {
foo: {
fields: {
bar: string
}
}
}
}
Here's the generated code in Java, which creates a new nested type for this nested structure:
class MyType {
private NestedType1 foo;
...
class NestedType1 {
private String bar;
...
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved pending changes to the issues Matt raised.
* Sequences should store the fully qualified type reference with appropriate sequence data type. e.g. For Java, it should store the element type in an `ArrayList` in the `FullyqualifiedtypeReference`.
* Adds checks for duplicate `element` and `type` constraint * Adds doc comment changes
Issue #, if available:
Description of changes:
This PR works on adding new model changes following up on #135. This Pr only contains changes for
Sequence
. This PR disables Rust support until the entire functionality for the new model change is supported and uses feature branchnew-model-changes
as target.List of changes:
Generator changes:
build_wrapped_sequence_from_constraints
which is used for constructing named sequence data type as data model.build_sequence_from_constraints
which is used for constructing nested sequence data type as data model. (Doesn't have a name)is_nested
flag inconvert_isl_type_def_to_data_model_node
which can be used to either call wrapped sequence or sequence ADT construction.sequence
construction to move the common logic at the beginning of the method.Model changes:
Sequence
andWrappedSequence
ADT to represent the underlying sequence type withbase_type
and its name withname
field.Adds templates changes for
java/sequence.templ
Generated code:
The generated code still stays the same only the template changes to use the new model. (Only added sequence files for checking this change, other files remain same)
Generated Java code can be found here.
Tests:
sequence
test cases.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.