(name string, expr *Expression)
| 23 | } |
| 24 | |
| 25 | func (a *Attribute) init(name string, expr *Expression) { |
| 26 | expr.assertUnattached() |
| 27 | |
| 28 | nameTok := newIdentToken(name) |
| 29 | nameObj := newIdentifier(nameTok) |
| 30 | a.leadComments = a.children.Append(newComments(nil)) |
| 31 | a.name = a.children.Append(nameObj) |
| 32 | a.children.AppendUnstructuredTokens(Tokens{ |
| 33 | { |
| 34 | Type: hclsyntax.TokenEqual, |
| 35 | Bytes: []byte{'='}, |
| 36 | }, |
| 37 | }) |
| 38 | a.expr = a.children.Append(expr) |
| 39 | a.expr.list = a.children |
| 40 | a.lineComments = a.children.Append(newComments(nil)) |
| 41 | a.children.AppendUnstructuredTokens(Tokens{ |
| 42 | { |
| 43 | Type: hclsyntax.TokenNewline, |
| 44 | Bytes: []byte{'\n'}, |
| 45 | }, |
| 46 | }) |
| 47 | } |
| 48 | |
| 49 | func (a *Attribute) Expr() *Expression { |
| 50 | return a.expr.content.(*Expression) |
nothing calls this directly
no test coverage detected