Results 1 to 3 of 3

Thread: strcuts and ["clr:property"]

  1. #1
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159

    structs and ["clr:property"]

    When the directive ["clr: property"] is used with structs, incorrect code is generated. Given this Slice definition:

    Code:
    ["clr:property"]
    struct Date {
      byte Day;
      byte Month;
      short Year;
    };
    The code generated for the struct constructor does not compile, returning the error "'this' object cannot be used before all of its fields are assigned to":

    Code:
    public Date(byte Day, byte Month, short Year)
    {
        this.Day = Day;
        this.Month = Month;
        this.Year = Year;
    }
    The assigments should be made to the fields, not the properties.

    Btw, is there a reason why private fields and method parameters in the C# code are capitalized? This is a very uncommon code style for C#.

    Karl
    Last edited by kwaclaw; 09-12-2007 at 10:14 AM. Reason: Typo
    Karl Waclawek

  2. #2
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Quote Originally Posted by kwaclaw View Post
    When the directive ["clr: property"] is used with structs, incorrect code is generated.
    Thanks for the bug report! I'll have a look at this.

    Btw, is there a reason why private fields and method parameters in the C# code are capitalized? This is a very uncommon code style for C#.
    They use whatever capitalization you use for the corresponding Slice identifier.

    Cheers,

    Michi.

  3. #3
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    I've posted a patch for this. Thanks for reporting the problem!

    Cheers,

    Michi.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 01-31-2011, 07:32 PM
  2. Replies: 1
    Last Post: 06-09-2009, 10:53 PM
  3. Replies: 1
    Last Post: 01-28-2009, 06:15 AM
  4. Replies: 4
    Last Post: 10-26-2006, 11:23 AM
  5. Replies: 1
    Last Post: 11-05-2004, 02:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •