Skip to content

Commit

Permalink
Revert "Fix uninitialized variables"
Browse files Browse the repository at this point in the history
  • Loading branch information
sio4 committed Jan 10, 2023
1 parent 01712da commit 1a6802f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
5 changes: 1 addition & 4 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
12 changes: 0 additions & 12 deletions variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,7 @@ func Test_Let_Reassignment(t *testing.T) {
r.NoError(err)
r.Equal("bar\n \n \nbaz", strings.TrimSpace(s))
}
func Test_Let_Ident_NotInitialized(t *testing.T) {
r := require.New(t)
input := `<% let foo
if (foo){
foo = 1
}
%>`

ctx := NewContext()

_, err := Render(input, ctx)
r.Error(err)
}
func Test_Let_Reassignment_UnknownIdent(t *testing.T) {
r := require.New(t)
input := `<% foo = "baz" %>`
Expand Down

0 comments on commit 1a6802f

Please sign in to comment.