Skip to content

Commit

Permalink
parser: avoid making double memory allocation for multi-return types
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jan 24, 2025
1 parent a9c8280 commit 1d74849
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions std/jule/parser/parser.jule
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,7 @@ impl parser {
ret params
}

fn buildMultiRetType(mut &self, mut &tokens: []&token::Token, mut &i: int): (t: &ast::RetType, ok: bool) {
t = new(ast::RetType)
fn buildMultiRetType(mut &self, mut &t: &ast::RetType, mut &tokens: []&token::Token, mut &i: int): (ok: bool) {
i++
if i >= len(tokens) {
i--
Expand Down Expand Up @@ -725,7 +724,7 @@ impl parser {
token = tokens[i]
match token.Id {
| token::Id.LParent:
t, ok = self.buildMultiRetType(tokens, i)
ok = self.buildMultiRetType(t, tokens, i)
ret
| token::Id.LBrace:
self.pushErr(token, build::LogMsg.MissingType)
Expand Down

0 comments on commit 1d74849

Please sign in to comment.