Skip to content

Commit 61b914e

Browse files
committed
[Go] Fixes for updating component counts in irdecoder
1 parent c8a6edc commit 61b914e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

sbe-tool/src/main/golang/otf/irdecoder.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,9 @@ func (decoder *IrDecoder) updateComponentTokenCounts(tokens []Token) {
330330
} else if strings.HasPrefix(signal.String(), "End") {
331331
componentType := signal.String()[3:]
332332
beginIndices := beginIndexMap[componentType]
333-
beginIndex := beginIndices[0]
334-
beginIndexMap[componentType] = beginIndices[1:]
333+
last := len(beginIndices) - 1
334+
beginIndex := beginIndices[last]
335+
beginIndexMap[componentType] = beginIndices[:last]
335336
componentTokenCount := int32((i - beginIndex) + 1)
336337
tokens[beginIndex].componentTokenCount = componentTokenCount
337338
token.componentTokenCount = componentTokenCount

sbe-tool/src/main/golang/otf/token.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ func (token Token) TokenVersion() int32 {
104104
return token.version
105105
}
106106

107+
// ApplicableTypeName returns the name of the type that should be applied in context.
108+
func (token Token) ApplicableTypeName() string {
109+
if token.referencedName == "" {
110+
return token.name
111+
}
112+
return token.referencedName
113+
}
114+
107115
func (token Token) Encoding() Encoding {
108116
return token.encoding
109117
}

0 commit comments

Comments
 (0)