mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 08:47:28 +01:00
Skip writeSaveDerivedVar if func ends with return
This commit is contained in:
1 parent
6a7a4d08e3
commit
21c87ce6b3
3 files changed
+23
-15
No files matched your search
@@ -834,6 +834,14 @@ func (n *Func) Out() *TypeExpr { return n.rhs.AsTypeExpr() }
|
||||
func (n *Func) Asserts() []*Node { return n.list1 }
|
||||
func (n *Func) Body() []*Node { return n.list2 }
|
||||
|
||||
func (n *Func) BodyEndsWithReturn() bool {
|
||||
if len(n.list2) == 0 {
|
||||
return false
|
||||
}
|
||||
end := n.list2[len(n.list2)-1]
|
||||
return (end.kind == KRet) && (end.AsRet().Keyword() == t.IDReturn)
|
||||
}
|
||||
|
||||
func NewFunc(flags Flags, filename string, line uint32, receiverName t.ID, funcName t.ID, in *Struct, out *TypeExpr, asserts []*Node, body []*Node) *Func {
|
||||
return &Func{
|
||||
kind: KFunc,
|
||||
|
||||
Reference in new issue
Block a user