Every line of 'golang spread operator' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.
4 func spread(values []int, size int, position *int) []int { 5 output := make([]int, size) 6 total := len(values) 7 if total == 1 { 8 // easy: copy it every where 9 for i := 0; i < size; i++ { 10 output[i] = values[0] 11 } 12 return output 13 } 14 value := 0 15 for i := 0; i < size; i++ { 16 output[i] = values[value] 17 if (i+1)%2^*position == 0 { 18 value++ 19 if value == total { 20 value = 0 21 } 22 } 23 } 24 *position++ 25 return output 26 }
66 func (v *Basegrulev3Visitor) VisitAndLogicOperator(ctx *AndLogicOperatorContext) interface{} { 67 return v.VisitChildren(ctx) 68 }
825 func spreadImp(thread *Thread, registers []Val, stack *Stack, pos Pos) error { 826 in, err := stack.Pop().Iter(pos) 827 828 if err != nil { 829 return err 830 } 831 832 return in.For(func(v Val, thread *Thread, pos Pos) error { 833 stack.Push(v) 834 return nil 835 }, thread, pos) 836 }
206 func (v *BaseFqlParserVisitor) VisitInOperator(ctx *InOperatorContext) interface{} { 207 return v.VisitChildren(ctx) 208 }
230 func parseSpreadElement(i *isolate, p param) *ast.SpreadElement { 231 chck := i.checkpoint() 232 233 if i.acceptOneOfTypes(token.Ellipsis) { 234 if assignmentExpr := parseAssignmentExpression(i, p.only(pYield|pAwait).add(pIn)); assignmentExpr != nil { 235 return &ast.SpreadElement{ 236 AssignmentExpression: assignmentExpr, 237 } 238 } 239 } 240 241 i.restore(chck) 242 return nil 243 }
475 func (s *LikeContext) LikeOp() ILikeOpContext { 476 var t = s.GetTypedRuleContext(reflect.TypeOf((*ILikeOpContext)(nil)).Elem(), 0) 477 478 if t == nil { 479 return nil 480 } 481 482 return t.(ILikeOpContext) 483 }
32 func visitBoundArithmetic(n *BoundArithmetic, pre, post BoundNodeVisitor) (BoundNode, error) { 33 exprs, err := visitBoundExprs(n.Exprs, pre, post) 34 if err != nil { 35 return nil, err 36 } 37 if len(exprs) == 0 { 38 return nil, nil 39 } 40 n.Exprs = exprs 41 return post(n) 42 }
2281 func (s *AddMinusOperatorsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { 2282 switch t := visitor.(type) { 2283 case grulev3Visitor: 2284 return t.VisitAddMinusOperators(s) 2285 2286 default: 2287 return t.VisitChildren(s) 2288 } 2289 }