dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pnet-developers] C# compiler bug-fix help


From: Kaushik Srenevasan
Subject: [Pnet-developers] C# compiler bug-fix help
Date: Mon, 16 Jan 2006 00:06:05 +0600
User-agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513)

Hi,

I've been trying to fix a C# compiler bug (https://savannah.gnu.org/bugs/?func=detailitem&item_id=7456) to familiarize myself with the codebase. The fix is to disallow a parameterless explicit constructor within a value type.

I have a couple of questions about this.

1. I'm trying to put this check into pnet/cscc/csharp/cs_decls.tc into ILNode_SemAnalysis(ILNode_MethodDeclaration) as follows...

if(ILMethod_IsConstructor(node->methodInfo) ||
           ILMethod_IsStaticConstructor(node->methodInfo))
{
        CSProcessAttrs(info, ILToProgramItem(node->methodInfo),
                           node->attributes, CS_ATTR_CONSTRUCTOR);

        /* added */

        if (ILClassIsValueType(
                ((ILNode_ClassDefn *)info->currentClass)->classInfo))
        {
        if(!CSGetMethodParamCount(ILToProgramItem(node->methodInfo)))
        {
                /* print error message */
        }
....

Is this the correct place to put it?

2. What is a good place to declare / define CSGetMethodParamCount ?

3. CSGetMethodParamCount will determine if this constructor takes any parameters by looking at the parameters field of an ILMethod * instance.

Is there a better way to do this?

Thanks,
Kaushik


reply via email to

[Prev in Thread] Current Thread [Next in Thread]