예제 #1
0
        public override void WriteTo(CCodeWriterBase c)
        {
            c.Separate();

            c.TextSpan(string.Format("// adapter: {0}", Method));
            c.NewLine();

            foreach (var statement in this.typeDefs)
            {
                statement.WriteTo(c);
            }

            var namedTypeSymbol = (INamedTypeSymbol)this.type;

            if (namedTypeSymbol.IsGenericType)
            {
                c.WriteTemplateDeclaration(namedTypeSymbol);
                c.NewLine();
            }

            c.WriteMethodReturn(Method, true);
            c.WriteMethodNamespace(namedTypeSymbol);
            c.WriteMethodName(Method, false, interfaceWrapperMethodSpecialCase: true);
            c.WriteMethodParameters(Method, true, MethodBodyOpt != null);

            if (MethodBodyOpt == null)
            {
                c.EndStatement();
            }
            else
            {
                MethodBodyOpt.WriteTo(c);
            }
        }
 public override void WriteTo(CCodeWriterBase c)
 {
     c.WriteType(Method.ContainingType, valueTypeAsClass: true);
     c.WhiteSpace();
     c.TextSpan("operator->()");
     MethodBodyOpt.WriteTo(c);
 }
 public override void WriteTo(CCodeWriterBase c)
 {
     c.TextSpan("virtual operator");
     c.WhiteSpace();
     c.WriteType(this.interfaceSymbol);
     c.TextSpan("()");
     MethodBodyOpt.WriteTo(c);
 }
 public override void WriteTo(CCodeWriterBase c)
 {
     // write boxing function
     c.TextSpan("inline");
     c.WhiteSpace();
     c.WriteType(this.type, valueTypeAsClass: true);
     c.WhiteSpace();
     c.TextSpan("__box(");
     c.WriteType(this.type);
     c.WhiteSpace();
     c.TextSpan("value)");
     MethodBodyOpt.WriteTo(c);
 }
 public override void WriteTo(CCodeWriterBase c)
 {
     c.WriteMethodPrefixes(Method, true);
     c.TextSpan("operator object*");
     c.WriteMethodParameters(Method, true, MethodBodyOpt != null);
     c.WriteMethodSuffixes(Method, true);
     if (MethodBodyOpt == null)
     {
         c.EndStatement();
     }
     else
     {
         MethodBodyOpt.WriteTo(c);
     }
 }
        public override void WriteTo(CCodeWriterBase c)
        {
            c.TextSpan("operator");
            c.WhiteSpace();
            if (Method.ContainingType.IsIntPtrType())
            {
                c.TextSpan("void*");
            }
            else
            {
                c.WriteType(Method.ContainingType);
            }

            c.TextSpan("()");
            MethodBodyOpt.WriteTo(c);
        }
예제 #7
0
        public override void WriteTo(CCodeWriterBase c)
        {
            c.TextSpan("void* operator new (size_t _size");
            if (this.withExtraParams)
            {
                c.TextSpan(", int32_t _customSize");
            }

            if (this.debugVersion)
            {
                c.TextSpan(", const char* _file, int _line");
            }

            c.TextSpan(")");

            MethodBodyOpt.WriteTo(c);
        }
        public override void WriteTo(CCodeWriterBase c)
        {
            c.TextSpan(string.Format("// adapter: {0}", Method));
            c.NewLine();

            foreach (var statement in this.typeDefs)
            {
                statement.WriteTo(c);
            }

            c.WriteMethodReturn(Method, true);
            c.WriteMethodName(Method, allowKeywords: false, interfaceWrapperMethodSpecialCase: true);
            c.WriteMethodParameters(Method, true, MethodBodyOpt != null);

            if (MethodBodyOpt == null)
            {
                c.EndStatement();
            }
            else
            {
                MethodBodyOpt.WriteTo(c);
            }
        }
예제 #9
0
 public override void WriteTo(CCodeWriterBase c)
 {
     c.TextSpan("void* operator new (size_t _size, void* _ptr)");
     MethodBodyOpt.WriteTo(c);
 }
 public override void WriteTo(CCodeWriterBase c)
 {
     c.TextSpan("operator object*()");
     MethodBodyOpt.WriteTo(c);
 }
 public override void WriteTo(CCodeWriterBase c)
 {
     c.TextSpan("void* operator new (size_t _size, int32_t _customSize)");
     MethodBodyOpt.WriteTo(c);
 }