Beispiel #1
0
func indexOf(t *types.Type, ts []*types.Type) int16 {
	for i, tt := range ts {
		if tt.Name() == t.Name() {
			return int16(i)
		}
	}
	return -1
}
func isUnionOfRefOfCommitType(t *types.Type) bool {
	if t.Kind() != types.UnionKind {
		return false
	}
	for _, et := range t.Desc.(types.CompoundDesc).ElemTypes {
		if !isRefOfCommitType(et) {
			return false
		}
	}
	return true
}
Beispiel #3
0
func fieldTypeFromCommit(t *types.Type, fieldName string) *types.Type {
	d.Chk.True(t.Kind() == types.StructKind && t.Desc.(types.StructDesc).Name == "Commit")
	return t.Desc.(types.StructDesc).Field(fieldName)
}
Beispiel #4
0
func isRefOfCommitType(t *types.Type) bool {
	return t.Kind() == types.RefKind && IsCommitType(getRefElementType(t))
}
Beispiel #5
0
func getRefElementType(t *types.Type) *types.Type {
	d.Chk.True(t.Kind() == types.RefKind)
	return t.Desc.(types.CompoundDesc).ElemTypes[0]
}