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

AOT compile regexp for records #542

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

smitssjors
Copy link
Contributor

TypeCompiler.Compile(Type.Record(Type.String(), Type.Any())).Code()

Gives

const local_0 = new RegExp(/^(.*)$/)
// ...

But I belive that literal notoation would be better. Thus

const local_0 = /^(.*)$/

@sinclairzx81
Copy link
Owner

@smitssjors Hi, thanks for the PR

This looks good to me. I see I'm actually using this string embedding for the other types (String, TemplateLiteral), so it makes sense to use it for Record types also :)

Will merge this one through and will publish shortly.
Many thanks!
S

@sinclairzx81 sinclairzx81 merged commit 0762bd3 into sinclairzx81:master Aug 25, 2023
9 checks passed
@sinclairzx81 sinclairzx81 mentioned this pull request Aug 25, 2023
@sinclairzx81
Copy link
Owner

@smitssjors Hiya,

Updates published on @sinclair/[email protected]

Thanks again for the PR!
Cheers
S

@smitssjors smitssjors deleted the aot-regex branch August 25, 2023 09:35
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