()
| 97 | } |
| 98 | |
| 99 | func (mb mergedBodies) JustAttributes() (Attributes, Diagnostics) { |
| 100 | attrs := make(map[string]*Attribute) |
| 101 | var diags Diagnostics |
| 102 | |
| 103 | for _, body := range mb { |
| 104 | thisAttrs, thisDiags := body.JustAttributes() |
| 105 | |
| 106 | if len(thisDiags) != 0 { |
| 107 | diags = append(diags, thisDiags...) |
| 108 | } |
| 109 | |
| 110 | for name, attr := range thisAttrs { |
| 111 | if existing := attrs[name]; existing != nil { |
| 112 | diags = diags.Append(&Diagnostic{ |
| 113 | Severity: DiagError, |
| 114 | Summary: "Duplicate argument", |
| 115 | Detail: fmt.Sprintf( |
| 116 | "Argument %q was already set at %s", |
| 117 | name, existing.NameRange.String(), |
| 118 | ), |
| 119 | Subject: &attr.NameRange, |
| 120 | }) |
| 121 | continue |
| 122 | } |
| 123 | |
| 124 | attrs[name] = attr |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | return attrs, diags |
| 129 | } |
| 130 | |
| 131 | func (mb mergedBodies) MissingItemRange() Range { |
| 132 | if len(mb) == 0 { |
nothing calls this directly
no test coverage detected