public override void WriteTo(CCodeWriterBase c) { c.WriteMethodDeclaration(this.Method, true, this.MethodBodyOpt != null, containingNamespace: containingType.ContainingNamespace); if (this.MethodBodyOpt == null) { c.EndStatement(); } else { this.MethodBodyOpt.WriteTo(c); } }
public override void WriteTo(CCodeWriterBase c) { c.WriteMethodDeclaration(this.Method, true, this.MethodBodyOpt != null); if (this.MethodBodyOpt == null) { c.EndStatement(); } else { this.MethodBodyOpt.WriteTo(c); } }
/// <summary> /// </summary> /// <param name="c"> /// </param> /// <param name="newNonStaticMethod"> /// </param> /// <param name="nonStaticType"> /// </param> private static void WriteNewMethod(CCodeWriterBase c, IMethodSymbol newNonStaticMethod, NamedTypeImpl nonStaticType) { c.WriteMethodDeclaration(newNonStaticMethod, true, true); c.NewLine(); c.OpenBlock(); var objectCreationExpression = new ObjectCreationExpression { Type = nonStaticType, NewOperator = true }; foreach (var parameter in newNonStaticMethod.Parameters) { Expression parameterExpression = new Parameter { ParameterSymbol = parameter }; if (parameter.Name == "m") { parameterExpression = new Cast { Operand = parameterExpression, MapPointerCast = true, MapPointerCastTypeParameter1 = new Access { AccessType = Access.AccessTypes.DoubleColon, ReceiverOpt = new TypeExpression { Type = nonStaticType, TypeNameRequred = true }, Expression = new Parameter { ParameterSymbol = new ParameterImpl { Name = "_Memptr" } } }, MapPointerCastTypeParameter2 = new TypeExpression { Type = new TypeImpl { TypeKind = TypeKind.TypeParameter, Name = "_Memptr" } }, }; } objectCreationExpression.Arguments.Add(parameterExpression); } new ReturnStatement { ExpressionOpt = objectCreationExpression }.WriteTo(c); c.EndBlockWithoutNewLine(); c.EndStatement(); }
public override void WriteTo(CCodeWriterBase c) { CCodeWriterBase.SetLocalObjectIDGenerator(); c.Separate(); c.TextSpanNewLine(string.Format("// Method : {0}", this.Method.ToDisplayString())); c.WriteMethodDeclaration(this.Method, false); if (this.MethodBodyOpt != null) { this.MethodBodyOpt.WriteTo(c); } else { c.WriteMethodBody(this.BoundBody, this.Method); } }