func (codegen *_CodeGen) typePrefix(typeDecl ast.TypeDecl) string { langs := gslang.FindAnnotations(typeDecl.Module(), "gslang.Package") compiler := codegen.compiler for _, lang := range langs { langName, ok := lang.Args.NamedArg("Lang") if ok && compiler.Eval().EvalString(langName) == "objc" { packageName, ok := lang.Args.NamedArg("Name") if ok && compiler.Eval().EvalString(packageName) == typeDecl.Package() { redirect, ok := lang.Args.NamedArg("Redirect") if ok { prefix := compiler.Eval().EvalString(redirect) if codegen.script.Name() != typeDecl.Script() { v := fmt.Sprintf("#import <%s>\n\n", filepath.Join(strings.Replace(typeDecl.Package(), ".", "/", -1), filepath.Base(typeDecl.Script())+".h")) codegen.imports[typeDecl.FullName()] = v } return prefix } } } } return "" }
func (codegen *_CodeGen) title(typeDecl ast.TypeDecl) string { return codegen.typePrefix(typeDecl) + strings.Title(typeDecl.Name()) }