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

Adds while expressions #63

Merged
merged 3 commits into from
Nov 24, 2019
Merged

Adds while expressions #63

merged 3 commits into from
Nov 24, 2019

Conversation

baszalmstra
Copy link
Collaborator

@baszalmstra baszalmstra commented Nov 23, 2019

This PR adds while expressions to Mun.

The following code should work properly.

fn fibonacci(n:int):int {
    let a = 0;
    let b = 1;
    let i = 1;
    while i <= n {
        let sum = a + b;
        a = b;
        b = sum;
        i += 1;
    };
    a
}
  • Implement parsing of while expressions.
  • Implement proper type inferencing and diagnostics
    • Do not allow break expression with values inside while
  • Implement code generation for the while statement

Depends on #62

@baszalmstra baszalmstra self-assigned this Nov 23, 2019
@codecov
Copy link

codecov bot commented Nov 23, 2019

Codecov Report

Merging #63 into master will increase coverage by 0.21%.
The diff coverage is 84.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #63      +/-   ##
==========================================
+ Coverage   71.34%   71.55%   +0.21%     
==========================================
  Files         106      106              
  Lines        7073     7203     +130     
==========================================
+ Hits         5046     5154     +108     
- Misses       2027     2049      +22
Impacted Files Coverage Δ
...ates/mun_syntax/src/parsing/grammar/expressions.rs 94.85% <100%> (+0.22%) ⬆️
crates/mun_syntax/src/syntax_kind/generated.rs 79.45% <100%> (+0.11%) ⬆️
crates/mun_runtime/src/test.rs 96% <100%> (+0.23%) ⬆️
crates/mun_syntax/src/tests/parser.rs 98.24% <100%> (+0.09%) ⬆️
crates/mun_hir/src/ty/tests.rs 96.03% <100%> (+0.12%) ⬆️
crates/mun_codegen/src/test.rs 100% <100%> (ø) ⬆️
crates/mun_hir/src/diagnostics.rs 16.45% <20%> (+0.23%) ⬆️
crates/mun_syntax/src/ast/generated.rs 56.45% <66.66%> (+0.28%) ⬆️
crates/mun_hir/src/expr.rs 76.76% <82.6%> (+0.7%) ⬆️
crates/mun_hir/src/ty/infer.rs 77.42% <94.28%> (+0.46%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 103c621...6160d84. Read the comment docs.

@baszalmstra baszalmstra changed the title WIP: Adds while expressions Adds while expressions Nov 23, 2019
@baszalmstra baszalmstra marked this pull request as ready for review November 23, 2019 20:12
@baszalmstra baszalmstra requested a review from Wodann November 23, 2019 20:12
@baszalmstra
Copy link
Collaborator Author

While statements

crates/mun_codegen/src/ir/body.rs Show resolved Hide resolved
crates/mun_hir/src/ty/tests.rs Outdated Show resolved Hide resolved
@baszalmstra baszalmstra merged commit 34d3073 into mun-lang:master Nov 24, 2019
@baszalmstra baszalmstra deleted the while branch November 24, 2019 18:23
@Wodann Wodann added this to the Mun v0.2 milestone May 14, 2020
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