(typeName string, labels []string)
| 33 | } |
| 34 | |
| 35 | func (b *Block) init(typeName string, labels []string) { |
| 36 | nameTok := newIdentToken(typeName) |
| 37 | nameObj := newIdentifier(nameTok) |
| 38 | b.leadComments = b.children.Append(newComments(nil)) |
| 39 | b.typeName = b.children.Append(nameObj) |
| 40 | labelsObj := newBlockLabels(labels) |
| 41 | b.labels = b.children.Append(labelsObj) |
| 42 | b.open = b.children.AppendUnstructuredTokens(Tokens{ |
| 43 | { |
| 44 | Type: hclsyntax.TokenOBrace, |
| 45 | Bytes: []byte{'{'}, |
| 46 | }, |
| 47 | { |
| 48 | Type: hclsyntax.TokenNewline, |
| 49 | Bytes: []byte{'\n'}, |
| 50 | }, |
| 51 | }) |
| 52 | body := newBody() // initially totally empty; caller can append to it subsequently |
| 53 | b.body = b.children.Append(body) |
| 54 | b.close = b.children.AppendUnstructuredTokens(Tokens{ |
| 55 | { |
| 56 | Type: hclsyntax.TokenCBrace, |
| 57 | Bytes: []byte{'}'}, |
| 58 | }, |
| 59 | { |
| 60 | Type: hclsyntax.TokenNewline, |
| 61 | Bytes: []byte{'\n'}, |
| 62 | }, |
| 63 | }) |
| 64 | } |
| 65 | |
| 66 | // Body returns the body that represents the content of the receiving block. |
| 67 | // |
no test coverage detected