本文整理汇总了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
}
}
}
示例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)
}