Hello, I'm trying to experiment Rust with semicolon inference. For now, it can handle this, except the handling of call function that has return value at the last code of function that does not has return type isn't inserted semicolon yet
#![no_std]
fn return_i32() -> i32 {
let a = 10
let b = 20
a + b
}
fn no_return() {
let a =
return_i32
()
let b = 30
}
fn expect_i32() -> i32 {
let a = if 2 == 2 {
let b = return_i32()
b * 4
} else {
2 * 4
}
return_i32()
}
fn expect_no_return() {
return_i32()
}
The result :
#![feature(prelude_import)]
#![no_std]
#![no_std]
extern crate core;
#[prelude_import]
use ::core::prelude::rust_2015::*;
fn return_i32() -> i32 { let a = 10; let b = 20; a + b }
fn no_return() { let a = return_i32(); let b = 30; }
fn expect_i32() -> i32 {
let a = if 2 == 2 { let b = return_i32(); b * 4 } else { 2 * 4 };
return_i32()
}
// this should be added semicolon, I'm trying to implement it
fn expect_no_return() { return_i32() }
I need to get boolean info whether current function has return type or not, can anyone pinpoint in which code the parsing of function happens? With direct link to the github file