summaryrefslogtreecommitdiff
path: root/vendor/github.com/bytedance/sonic/ast/api_amd64.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-06-01 22:20:16 +0100
committerLibravatar GitHub <noreply@github.com>2023-06-01 22:20:16 +0100
commit55aacaf4b07c1921061245cbaa3d307e97cf3c29 (patch)
treed969c5d9728566de1e794e19c5b19d3b660f790e /vendor/github.com/bytedance/sonic/ast/api_amd64.go
parent[chore/frontend] refactor header templating, add apple-touch-icon (#1850) (diff)
downloadgotosocial-55aacaf4b07c1921061245cbaa3d307e97cf3c29.tar.xz
[chore]: Bump github.com/gin-gonic/gin from 1.9.0 to 1.9.1 (#1855)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/bytedance/sonic/ast/api_amd64.go')
-rw-r--r--vendor/github.com/bytedance/sonic/ast/api_amd64.go29
1 files changed, 27 insertions, 2 deletions
diff --git a/vendor/github.com/bytedance/sonic/ast/api_amd64.go b/vendor/github.com/bytedance/sonic/ast/api_amd64.go
index 6b3458aee..3047f59c3 100644
--- a/vendor/github.com/bytedance/sonic/ast/api_amd64.go
+++ b/vendor/github.com/bytedance/sonic/ast/api_amd64.go
@@ -1,5 +1,20 @@
// +build amd64,go1.15,!go1.21
+/*
+ * Copyright 2022 ByteDance Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ast
@@ -17,10 +32,12 @@ import (
var typeByte = rt.UnpackEface(byte(0)).Type
+//go:nocheckptr
func quote(buf *[]byte, val string) {
*buf = append(*buf, '"')
if len(val) == 0 {
*buf = append(*buf, '"')
+ return
}
sp := rt.IndexChar(val, 0)
@@ -99,7 +116,9 @@ func (self *Parser) skipFast() (int, types.ParsingError) {
}
func (self *Parser) getByPath(path ...interface{}) (int, types.ParsingError) {
- start := native.GetByPath(&self.s, &self.p, &path)
+ fsm := types.NewStateMachine()
+ start := native.GetByPath(&self.s, &self.p, &path, fsm)
+ types.FreeStateMachine(fsm)
runtime.KeepAlive(path)
if start < 0 {
return self.p, types.ParsingError(-start)
@@ -107,7 +126,6 @@ func (self *Parser) getByPath(path ...interface{}) (int, types.ParsingError) {
return start, 0
}
-
func (self *Searcher) GetByPath(path ...interface{}) (Node, error) {
var err types.ParsingError
var start int
@@ -115,6 +133,13 @@ func (self *Searcher) GetByPath(path ...interface{}) (Node, error) {
self.parser.p = 0
start, err = self.parser.getByPath(path...)
if err != 0 {
+ // for compatibility with old version
+ if err == types.ERR_NOT_FOUND {
+ return Node{}, ErrNotExist
+ }
+ if err == types.ERR_UNSUPPORT_TYPE {
+ panic("path must be either int(>=0) or string")
+ }
return Node{}, self.parser.syntaxError(err)
}