Check for function not returning a vlue when it should
git-svn-id: http://picoc.googlecode.com/svn/trunk@366 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
c920ea1771
commit
be2ba2cb5f
|
@ -1320,8 +1320,8 @@ void ExpressionParseFunctionCall(struct ParseState *Parser, struct ExpressionSta
|
|||
if (ParseStatement(&FuncParser) != ParseResultOk)
|
||||
ProgramFail(&FuncParser, "function body expected");
|
||||
|
||||
if (FuncValue->Val->FuncDef.ReturnType != ReturnValue->Typ)
|
||||
ProgramFail(&FuncParser, "return value is %t instead of %t", ReturnValue->Typ, FuncValue->Val->FuncDef.ReturnType);
|
||||
if (FuncValue->Val->FuncDef.ReturnType != &VoidType && FuncParser.Mode == RunModeRun)
|
||||
ProgramFail(&FuncParser, "no value returned from a function returning %t", FuncValue->Val->FuncDef.ReturnType);
|
||||
|
||||
VariableStackFramePop(Parser);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue