diff --git a/parser/parser.go b/parser/parser.go index d5ccc6b..3a1f8e0 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -2,7 +2,6 @@ package parser import ( "fmt" - "reflect" "strconv" "strings" @@ -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) } diff --git a/variables_test.go b/variables_test.go index 55d0b02..a3d2c89 100644 --- a/variables_test.go +++ b/variables_test.go @@ -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" %>`