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

Method emitPattern

compiler_expr.go:3323–3333  ·  view source on GitHub ↗
(pattern ast.Pattern, emitter func(target, init compiledExpr), putOnStack bool)

Source from the content-addressed store, hash-verified

3321}
3322
3323func (c *compiler) emitPattern(pattern ast.Pattern, emitter func(target, init compiledExpr), putOnStack bool) {
3324 switch pattern := pattern.(type) {
3325 case *ast.ObjectPattern:
3326 c.emitObjectPattern(pattern, emitter, putOnStack)
3327 case *ast.ArrayPattern:
3328 c.emitArrayPattern(pattern, emitter, putOnStack)
3329 default:
3330 c.assert(false, int(pattern.Idx0())-1, "unsupported Pattern: %T", pattern)
3331 panic("unreachable")
3332 }
3333}
3334
3335func (c *compiler) emitAssign(target ast.Expression, init compiledExpr, emitAssignSimple func(target, init compiledExpr)) {
3336 pattern, isPattern := target.(ast.Pattern)

Callers 6

emitAssignMethod · 0.95
compileTryStatementMethod · 0.95
compileForIntoMethod · 0.95
compileVarBindingMethod · 0.95
compileLexicalBindingMethod · 0.95
compileMethod · 0.80

Calls 4

emitObjectPatternMethod · 0.95
emitArrayPatternMethod · 0.95
assertMethod · 0.95
Idx0Method · 0.65

Tested by

no test coverage detected