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

Method error

parser/error.go:72–91  ·  view source on GitHub ↗
(place interface{}, msg string, msgValues ...interface{})

Source from the content-addressed store, hash-verified

70}
71
72func (self *_parser) error(place interface{}, msg string, msgValues ...interface{}) *Error {
73 idx := file.Idx(0)
74 switch place := place.(type) {
75 case int:
76 idx = self.idxOf(place)
77 case file.Idx:
78 if place == 0 {
79 idx = self.idxOf(self.chrOffset)
80 } else {
81 idx = place
82 }
83 default:
84 panic(fmt.Errorf("error(%T, ...)", place))
85 }
86
87 position := self.position(idx)
88 msg = fmt.Sprintf(msg, msgValues...)
89 self.errors.Add(position, msg)
90 return self.errors[len(self.errors)-1]
91}
92
93func (self *_parser) errorUnexpected(idx file.Idx, chr rune) error {
94 if chr == -1 {

Calls 4

idxOfMethod · 0.95
positionMethod · 0.95
IdxTypeAlias · 0.92
AddMethod · 0.45

Tested by

no test coverage detected