mirror of
https://github.com/SpaceManiac/SpacemanDMM.git
synced 2025-12-23 05:36:47 +00:00
added warning for return x in spawn context (#228)
This commit is contained in:
parent
13fd304f04
commit
650daa0eb0
1 changed files with 5 additions and 0 deletions
|
|
@ -1281,6 +1281,11 @@ impl<'o, 's> AnalyzeProc<'o, 's> {
|
|||
},
|
||||
Statement::Return(Some(expr)) => {
|
||||
// TODO: factor in the previous return type if there was one
|
||||
if self.inside_newcontext > 0 {
|
||||
error(location, "returning a value in a spawn has no effect")
|
||||
.set_severity(Severity::Warning)
|
||||
.register(self.context);
|
||||
}
|
||||
let return_type = self.visit_expression(location, expr, None, local_vars);
|
||||
local_vars.get_mut(".").unwrap().analysis = return_type;
|
||||
return ControlFlow { returns: true, continues: false, breaks: false, fuzzy: false }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue