Closed desaikd closed 3 months ago
Do the generated unit tests exercise this new functionality?
Yes, it does. The nested_struct.isl
file contains a 2-level anonymous type/nested type for which the code generates, In Java the anonymous class into the parent class and for Rust the anonymous struct into parent struct's module.
As per the conversation in this PR and offline, it would be simpler to express sequence and scalar nested types as is instead of creating another nested class/struct for it. This will be implemented in a separate PR. Example ISL:
type::{
name: foo,
fields: {
sequence_type: { type: list, element: int },
scalar_type: { type: string }
}
}
Output Java:
class Foo {
private sequence_type: ArrayList<Integer>; // current impl would treat it as `NestedTypeX`
private scalar_type: String; // current impl would treat it as `NestedTypeY`
...
}
Issue #103:
Description of changes:
This PR works on first portion of #103 issue which is defining a namespace corresponding to parent type for anonymous types. As described in the issue:
AnonymousType1
) will be placed inside its parent class (e.g.Foo
) in the same namespace (e.g.Foo.AnonymousType1
)AnonymousType1
) will be placed inside its parent type module(e.g.foo
).Generated code:
List of changes:
AnonymousType
sAnonymousType
sAnonymousType
which will be used to render anonymous types as chilsren and modify setter methods to include base typesanonymous_type.templ
template to generate a child module for anonymous typesstruct.templ
to use anonymous_type templateBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.