Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Mido-sys committed Jan 11, 2023
1 parent 22c45d8 commit 79cc8e1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package parser

import (
"fmt"
"reflect"
"strconv"
"strings"

Expand Down Expand Up @@ -108,9 +107,7 @@ func (p *parser) parseProgram() *ast.Program {
}
}

if stmt != nil &&
(reflect.ValueOf(stmt).Kind() == reflect.Ptr && !reflect.ValueOf(stmt).IsNil()) &&
strings.TrimSpace(stmt.String()) != "" {
if stmt != nil && strings.TrimSpace(stmt.String()) != "" {
program.Statements = append(program.Statements, stmt)
}

Expand Down Expand Up @@ -162,6 +159,9 @@ func (p *parser) parseStatement() ast.Statement {
switch p.curToken.Type {
case token.LET:
l := p.parseLetStatement()
if l == nil {
return nil
}
return l
case token.S_START:
p.nextToken()
Expand Down Expand Up @@ -202,7 +202,7 @@ func (p *parser) parseLetStatement() *ast.LetStatement {
stmt.Name = &ast.Identifier{TokenAble: ast.TokenAble{Token: p.curToken}, Value: p.curToken.Literal}

if !p.expectPeek(token.ASSIGN) {
return nil
return stmt
}

p.nextToken()
Expand Down

0 comments on commit 79cc8e1

Please sign in to comment.