Skip to content

Commit

Permalink
Merge remote-tracking branch 'keysolutions/devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
dop251 committed Nov 3, 2018
2 parents 7239ea9 + f57e8d5 commit c7a914b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions parser/expression.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package parser

import (

"github.com/dop251/goja/ast"
"github.com/dop251/goja/file"
"github.com/dop251/goja/token"
Expand Down Expand Up @@ -399,7 +398,7 @@ func (self *_parser) parseLeftHandSideExpression() ast.Expression {
for {
if self.token == token.PERIOD {
left = self.parseDotMember(left)
} else if self.token == token.LEFT_BRACE {
} else if self.token == token.LEFT_BRACKET {
left = self.parseBracketMember(left)
} else {
break
Expand Down
4 changes: 4 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ func TestParserErr(t *testing.T) {

test("abc: while (true) { abc: while (true) {} }", "(anonymous): Line 1:21 Label 'abc' already exists")

test(`if(0) { do { } while(0) } else { do { } while(0) }`, nil)

test(`if(0) do { } while(0); else do { } while(0)`, nil)

if false {
// TODO When strict mode is implemented
test("(function () { 'use strict'; delete abc; }())", "")
Expand Down
3 changes: 3 additions & 0 deletions parser/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ func (self *_parser) parseDoWhileStatement() ast.Statement {
self.expect(token.LEFT_PARENTHESIS)
node.Test = self.parseExpression()
self.expect(token.RIGHT_PARENTHESIS)
if self.token == token.SEMICOLON {
self.next()
}

return node
}
Expand Down

0 comments on commit c7a914b

Please sign in to comment.