You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: any.go
    path of file: ./repos/gapid/gapil/compiler
    
    the code of the file until where you have to start completion: // Copyright (C) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you ma
    
func (c *C) rtti(ty semantic.Type) codegen.Global {
	if existing, ok := c.T.rttis[ty]; ok {
		return existing
	}

	typename := fmt.Sprint(ty)

	fields := map[string]interface{}{
		RTTITypeName: c.M.Scalar(typename),
		RTTIKind:     rttiKind(ty),
	}

	if t, ok := ty.(semantic.Owned); ok {
		if api, ok := t.Owner().(*semantic.API); ok {
			fields[RTTIAPIIndex] = c.M.Scalar(uint32(api.Index))
			switch ty := ty.(type) {
			case *semantic.Class:
				fields[RTTITypeIndex] = c.M.Scalar(api.ClassIndex(ty))
			case *semantic.Enum:
				fields[RTTITypeIndex] = c.M.Scalar(api.EnumIndex(ty))
			case *semantic.Slice:
				fields[RTTITypeIndex] = c.M.Scalar(api.SliceIndex(ty))
			case *semantic.Map:
				fields[RTTITypeIndex] = c.M.Scalar(api.MapIndex(ty))
			}
		}
	}

	if refRel, ok := c.refRels.tys[ty]; ok {
		if _, isSlice := ty.(*semantic.Slice); isSlice {
			// TODO: The refrels of a slice pass by value, yet we'll pass by
			// pointer!
			fail("Slices cannot currently be boxed in anys")
		}
		fields[RTTIReference] = refRel.reference
		fields[RTTIRelease] = refRel.release
	}

	rtti := c.M.Global(typename+"-rtti", c.M.ConstStruct(c.T.RTTI, fields))
	c.T.rttis[ty] = rtti
	return rtti
}