Skip to content

Commit

Permalink
[Go] Fixes for updating component counts in irdecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanf committed Nov 3, 2023
1 parent 825e1fe commit fd24e98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sbe-tool/src/main/golang/otf/irdecoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ func (decoder *IrDecoder) updateComponentTokenCounts(tokens []Token) {
} else if strings.HasPrefix(signal.String(), "End") {
componentType := signal.String()[3:]
beginIndices := beginIndexMap[componentType]
beginIndex := beginIndices[0]
beginIndexMap[componentType] = beginIndices[1:]
last := len(beginIndices) - 1
beginIndex := beginIndices[last]
beginIndexMap[componentType] = beginIndices[:last]
componentTokenCount := int32((i - beginIndex) + 1)
tokens[beginIndex].componentTokenCount = componentTokenCount
token.componentTokenCount = componentTokenCount
Expand Down
8 changes: 8 additions & 0 deletions sbe-tool/src/main/golang/otf/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ func (token Token) TokenVersion() int32 {
return token.version
}

// ApplicableTypeName returns the name of the type that should be applied in context.
func (token Token) ApplicableTypeName() string {
if token.referencedName == "" {
return token.name
}
return token.referencedName
}

func (token Token) Encoding() Encoding {
return token.encoding
}
Expand Down

0 comments on commit fd24e98

Please sign in to comment.