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

Try to wrap Engine compile function #29

Merged
merged 5 commits into from
Feb 10, 2023

Conversation

dottorblaster
Copy link
Collaborator

As above, I'm trying to just wrap engine.compile().

@dottorblaster dottorblaster marked this pull request as ready for review February 10, 2023 11:04
use rhai::AST;

pub struct ASTResource {
pub ast: Mutex<AST>,
Copy link
Collaborator

@fabriziosestito fabriziosestito Feb 10, 2023

Choose a reason for hiding this comment

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

probably for AST is worth using RwLock instead, let's keep this on the radar

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

test "should not compile an invalid expression" do
engine = Engine.new()

assert {:error, {:parsing, "parsing error"}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing = Engine.compile(engine, "$#!")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

LOL

@fabriziosestito fabriziosestito merged commit 89547ce into rhaiscript:main Feb 10, 2023
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.

None yet

2 participants