Skip to content
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

Feature/smooth casting (closes #122) #127

Merged
merged 7 commits into from
Sep 16, 2024
Merged

Conversation

JesusMcCloud
Copy link
Collaborator

@JesusMcCloud JesusMcCloud commented Sep 16, 2024

closes #122

@iaik-jheher iaik-jheher changed the base branch from main to development September 16, 2024 12:37
…nsable/asn1/Asn1Elements.kt

Co-authored-by: Jakob Heher <[email protected]>
…nsable/asn1/Asn1Elements.kt

Co-authored-by: Jakob Heher <[email protected]>
* @throws Asn1StructuralException if this element is not a primitive
*/
@Throws(Asn1StructuralException::class)
fun asPrimitive(): Asn1Primitive = casting { this as Asn1Primitive }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fun asPrimitive(): Asn1Primitive = casting { this as Asn1Primitive }
fun asPrimitive() = thisAs<Asn1Primitive>()

@JesusMcCloud
Copy link
Collaborator Author

incorporated your changes and now it compiles again too

Copy link
Collaborator

@iaik-jheher iaik-jheher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i still don't agree with the naming though

@JesusMcCloud JesusMcCloud merged commit 9464eb5 into development Sep 16, 2024
6 checks passed
JesusMcCloud added a commit that referenced this pull request Sep 20, 2024
* convenience casting of Asn1Elements to more specific subclasses

---------

Co-authored-by: Jakob Heher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ASN.1: introduce convenience casting functions to Asn1Element
2 participants