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

feat: Add TO_<CHAR,STRING> functions #1355

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

feat: Add TO_<CHAR,STRING> functions #1355

wants to merge 8 commits into from

Conversation

volsa
Copy link
Member

@volsa volsa commented Nov 12, 2024

This commit introduces the TO_CHAR, TO_WCHAR, TO_STRING and TO_WSTRING functions, all making use of already existing X_TO_Y functions.

EDIT: There's some issue with printf() statements giving incorrect validation errors, which needs to be fixed before this can be merged.

This commit introduces the `TO_CHAR`, `TO_WCHAR`, `TO_STRING` and `TO_WSTRING` functions, all
making use of already existing `X_TO_Y` functions.
@@ -701,12 +702,10 @@ impl AnnotationMapImpl {

/// annotates the given statement (using it's `get_id()`) with the given type-name
pub fn annotate(&mut self, s: &AstNode, annotation: StatementAnnotation) {
log::trace!("Annotation: {annotation:?} @ {s:?}");
Copy link
Member Author

@volsa volsa Nov 14, 2024

Choose a reason for hiding this comment

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

fyi I've previously introduced these trace statements but in hindsight I have to admit they're not as useful as I imagined (i.e. they're waaaaay too bloaty). A better approach would be a more concise representation but that's something I'll address (or not, who knows) when I have the pleasure to debug resolver bugs again :^)

Copy link
Member

Choose a reason for hiding this comment

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

soonTM

@volsa volsa marked this pull request as ready for review November 14, 2024 12:02
@volsa volsa requested review from mhasel and ghaith November 14, 2024 12:02
END_FUNCTION

FUNCTION TO_CHAR__STRING : CHAR
VAR_INPUT {ref}
Copy link
Member

Choose a reason for hiding this comment

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

The {ref} here is no longer necessary, since aggregate-type arguments are now always passed as pointers. Not blocking, we should probably change these for all occurances in the `stdlib

Copy link
Member Author

@volsa volsa Nov 14, 2024

Choose a reason for hiding this comment

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

Lets address this in another PR since I also forgot to remove the code-gen python scripts.


// -----------------------------------------------------------------------------------------------------------

FUNCTION TO_WCHAR<T: ANY> : WCHAR
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense here to constrict the generic type nature to ANY_INT?

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.

2 participants