示例#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
}
示例#3
0
文件: commit.go 项目: Richardphp/noms
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)
}
示例#4
0
文件: commit.go 项目: Richardphp/noms
func isRefOfCommitType(t *types.Type) bool {
	return t.Kind() == types.RefKind && IsCommitType(getRefElementType(t))
}
示例#5
0
文件: commit.go 项目: Richardphp/noms
func getRefElementType(t *types.Type) *types.Type {
	d.Chk.True(t.Kind() == types.RefKind)
	return t.Desc.(types.CompoundDesc).ElemTypes[0]
}