当前位置: 首页>>代码示例>>Golang>>正文


Golang Function.GetOpensType方法代码示例

本文整理汇总了Golang中tritium/proto.Function.GetOpensType方法的典型用法代码示例。如果您正苦于以下问题:Golang Function.GetOpensType方法的具体用法?Golang Function.GetOpensType怎么用?Golang Function.GetOpensType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tritium/proto.Function的用法示例。


在下文中一共展示了Function.GetOpensType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: resolveNativeDeclaration

// can't re-use the legacy native function resolver because it's a method of a
// type that provides its own helpers and contextual data, all of which would
// be too hard to reproduce
func (pkgr *Packager) resolveNativeDeclaration(f *tp.Function, path string) {
	// first we should check that the signature refers to something that actually exists
	sigStr := strings.Replace(f.Stub(pkgr.Package), ",", ".", -1)
	if whale.LookupBuiltIn(sigStr) == nil {
		panic(fmt.Sprintf("attempt to provide signature for nonexistent native function `%s` in `%s`", sigStr, path))
	}

	// now turn the type names into the appropriate numeric ids
	if returnType := f.GetReturnType(); len(returnType) > 0 {
		f.ReturnTypeId = proto.Int32(int32(pkgr.TypeMap[returnType]))
		f.ReturnType = nil
	}
	if scopeType := f.GetScopeType(); len(scopeType) > 0 {
		f.ScopeTypeId = proto.Int32(int32(pkgr.TypeMap[scopeType]))
		f.ScopeType = nil
	}
	if opensType := f.GetOpensType(); len(opensType) > 0 {
		f.OpensTypeId = proto.Int32(int32(pkgr.TypeMap[opensType]))
		f.OpensType = nil
	}
	for _, arg := range f.Args {
		if typeName := arg.GetTypeString(); len(typeName) > 0 {
			arg.TypeId = proto.Int32(int32(pkgr.TypeMap[typeName]))
			arg.TypeString = nil
		}
	}
}
开发者ID:jcgill81,项目名称:tritium,代码行数:30,代码来源:packager.go

示例2: printFunction

func printFunction(f *tp.Function, indLvl int) {
	printIndent("Name -> %v", indLvl, f.GetName())
	printIndent("Description -> %v", indLvl, f.GetDescription())
	printIndent("Filename -> %v", indLvl, f.GetFilename())
	printIndent("Line Number -> %v", indLvl, f.GetLineNumber())
	printIndent("Namespace -> %v", indLvl, f.GetNamespace())
	printIndent("Scope Type Id -> %v", indLvl, f.GetScopeTypeId())
	printIndent("Scope Type -> %v", indLvl, f.GetScopeType())
	printIndent("Return Type Id -> %v", indLvl, f.GetReturnTypeId())
	printIndent("Return Type -> %v", indLvl, f.GetReturnType())
	printIndent("Opens Type Id -> %v", indLvl, f.GetOpensTypeId())
	printIndent("Opens Type -> %v", indLvl, f.GetOpensType())
	printIndent("BuiltIn -> %v", indLvl, f.GetBuiltIn())
	printIndent("Arguments:", indLvl)
	for ind, item := range f.GetArgs() {
		printIndent("Argument[%d] -> %v", indLvl, ind, item)
	}
	printIndent("Instruction:", indLvl)
	printInstruction(f.GetInstruction(), indLvl+1)
}
开发者ID:nmakiya,项目名称:tritium,代码行数:20,代码来源:slugviewer.go


注:本文中的tritium/proto.Function.GetOpensType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。