SLBaseExpr MarshalNamedTypeSpec(BaseDeclaration declContext, string name, NamedTypeSpec spec)
        {
            if (typeMapper.GetEntityForTypeSpec(spec) == null)
            {
                throw new NotImplementedException($"Unknown type {name}:{spec.ToString ()} in context {declContext.ToFullyQualifiedName (true)}");
            }
            bool isClass = NamedSpecIsClass(spec);

            if (isClass || spec.IsInOut)
            {
                imports.AddIfNotPresent("XamGlue");
                return(new SLFunctionCall("toIntPtr", false,
                                          new SLArgument(new SLIdentifier("value"), new SLIdentifier(name), true)));
            }

            if (TypeSpec.IsBuiltInValueType(spec))
            {
                return(new SLIdentifier(name));
            }

            // at this point, the value is either an enum or a struct, not passed by reference which we need to copy
            // into a local which we can then pass by reference.

            var bindingName = new SLIdentifier(MarshalEngine.Uniqueify(name, identifiersUsed));

            identifiersUsed.Add(bindingName.Name);
            var decl = new SLDeclaration(false, bindingName, typeMapper.TypeSpecMapper.MapType(declContext, imports, spec, false),
                                         new SLIdentifier(name), Visibility.None, false);
            var varBinding = new SLLine(decl);

            preMarshalCode.Add(varBinding);
            return(new SLAddressOf(bindingName, false));
        }
        public void TestEmbeddedClass()
        {
            NamedTypeSpec ns = TypeSpecParser.Parse("Swift.Dictionary<Swift.String, T>.Index") as NamedTypeSpec;

            Assert.IsNotNull(ns);
            Assert.IsNotNull(ns.InnerType);
            Assert.AreEqual("Index", ns.InnerType.Name);
            Assert.AreEqual("Swift.Dictionary<Swift.String, T>.Index", ns.ToString());
        }