Wiki
Show
Ignore:
Timestamp:
08/24/10 03:12:39 (21 months ago)
Author:
Chuck.Esterbrook
Message:

Fixed: Bad code gen for structs containing ref types.
ticket:238
credit:hopscc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/BackEndClr/SharpGenerator.cobra

    r2409 r2420  
    15391539            sw.write(' = ') 
    15401540            _initExpr.writeSharpDef(sw) 
    1541         else if .type.isReference and not .type.nonNil inherits GenericParam 
     1541        else if _canInitDefault 
    15421542            sharpInit = .type.sharpInit 
    15431543            if sharpInit.length 
     
    15451545                sw.write(sharpInit) 
    15461546        sw.write(';\n') 
     1547         
     1548    def _canInitDefault as bool 
     1549        # In C#, struct members can't be explicitly init'ed on declaration 
     1550        if .parentBox inherits Struct, return false 
     1551        return .type.isReference and not .type.nonNil inherits GenericParam 
    15471552 
    15481553