MCPcopy Create free account
hub / github.com/brimdata/super / cloneState

Method cloneState

compiler/parser/parser.go:25045–25059  ·  view source on GitHub ↗

clone and return parser current state.

()

Source from the content-addressed store, hash-verified

25043
25044// clone and return parser current state.
25045func (p *parser) cloneState() storeDict {
25046 if p.debug {
25047 defer p.out(p.in("cloneState"))
25048 }
25049
25050 state := statePool.Get().(storeDict)
25051 for k, v := range p.cur.state {
25052 if c, ok := v.(Cloner); ok {
25053 state[k] = c.Clone()
25054 } else {
25055 state[k] = v
25056 }
25057 }
25058 return state
25059}
25060
25061// restore parser current state to the state storeDict.
25062// every restoreState should applied only one time for every cloned state

Callers 8

parseActionExprMethod · 0.95
parseAndCodeExprMethod · 0.95
parseAndExprMethod · 0.95
parseChoiceExprMethod · 0.95
parseNotCodeExprMethod · 0.95
parseNotExprMethod · 0.95
parseSeqExprMethod · 0.95

Calls 4

outMethod · 0.95
inMethod · 0.95
GetMethod · 0.65
CloneMethod · 0.65

Tested by

no test coverage detected