MCPcopy Create free account
hub / github.com/dop251/goja / parseObjectLiteral

Method parseObjectLiteral

parser/expression.go:519–540  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

517}
518
519func (self *_parser) parseObjectLiteral() *ast.ObjectLiteral {
520 var value []ast.Property
521 idx0 := self.expect(token.LEFT_BRACE)
522 for self.token != token.RIGHT_BRACE && self.token != token.EOF {
523 property := self.parseObjectProperty()
524 if property != nil {
525 value = append(value, property)
526 }
527 if self.token != token.RIGHT_BRACE {
528 self.expect(token.COMMA)
529 } else {
530 break
531 }
532 }
533 idx1 := self.expect(token.RIGHT_BRACE)
534
535 return &ast.ObjectLiteral{
536 LeftBrace: idx0,
537 RightBrace: idx1,
538 Value: value,
539 }
540}
541
542func (self *_parser) parseArrayLiteral() *ast.ArrayLiteral {
543

Callers 2

Calls 2

expectMethod · 0.95
parseObjectPropertyMethod · 0.95

Tested by

no test coverage detected