Skip to content

Improve the situation regarding boolean operations.#1234

Merged
windelbouwman merged 1 commit into
masterfrom
short-circuit-evaluation
Aug 12, 2019
Merged

Improve the situation regarding boolean operations.#1234
windelbouwman merged 1 commit into
masterfrom
short-circuit-evaluation

Conversation

@windelbouwman
Copy link
Copy Markdown
Contributor

This implements the boolean short circuit logic in line with cpython and micropython.

Copy link
Copy Markdown
Member

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

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

Nice! Good job on figuring this out 😃

Comment thread compiler/src/compile.rs
true_label: Option<Label>,
false_label: Option<Label>,
context: EvalContext,
condition: bool,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd recommend moving condition to the first argument and removing the second underscore in the function name so it can read better, e.g. you can see compile_jumpif(true, ...) compiles a JumpIfTrue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The way I intended this to read was: compile_jump_if(expression, true, target) means: Jump if the expression is true to target.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll leave this for now like it is. Thanks for the idea!

@windelbouwman windelbouwman merged commit d83cfb4 into master Aug 12, 2019
@windelbouwman windelbouwman deleted the short-circuit-evaluation branch September 1, 2019 09:36
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