(ctx gen.IListInitContext)
| 843 | } |
| 844 | |
| 845 | func (p *parser) visitListInit(ctx gen.IListInitContext) ([]ast.Expr, []int32) { |
| 846 | if ctx == nil { |
| 847 | return []ast.Expr{}, []int32{} |
| 848 | } |
| 849 | elements := ctx.GetElems() |
| 850 | result := make([]ast.Expr, len(elements)) |
| 851 | optionals := []int32{} |
| 852 | for i, e := range elements { |
| 853 | ex := p.Visit(e.GetE()).(ast.Expr) |
| 854 | if ex == nil { |
| 855 | return []ast.Expr{}, []int32{} |
| 856 | } |
| 857 | result[i] = ex |
| 858 | if e.GetOpt() != nil { |
| 859 | if !p.enableOptionalSyntax { |
| 860 | p.reportError(e.GetOpt(), "unsupported syntax '?'") |
| 861 | continue |
| 862 | } |
| 863 | optionals = append(optionals, int32(i)) |
| 864 | } |
| 865 | } |
| 866 | return result, optionals |
| 867 | } |
| 868 | |
| 869 | func (p *parser) visitSlice(expressions []gen.IExprContext) []ast.Expr { |
| 870 | if expressions == nil { |
no test coverage detected