Changeset 1702

Show
Ignore:
Timestamp:
10/23/08 12:54:47 (3 months ago)
Author:
Chuck.Esterbrook
Message:

Added storage type specification for enums.

Location:
cobra/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Developer/IntermediateReleaseNotes.text

    r1700 r1702  
    11Post 0.8 
     2 
     3* Added storage type specification for enums: 
     4.code 
     5        enum Foo 
     6                of uint64 
     7                Bar 
     8                Baz 
    29 
    310* Added new install-from-workspace command in the Source directory. This makes installing out of a Subversion workspace very easy and reliable. Documentation is in the doc string at the top of InstallFromWorkspace.cobra. 
  • cobra/trunk/Source/CobraParser.cobra

    r1678 r1702  
    951951                isNames = .isDeclNames 
    952952                attribs = .hasAttribs 
    953                 if .peek.which=='OF' 
     953                if .optional('OF') 
    954954                        storageType = .typeId to ? 
    955955                docString = .docString 
  • cobra/trunk/Source/SharpGenerator.cobra

    r1701 r1702  
    835835                storageType = _storageType 
    836836                if storageType and storageType is not .compiler.intType 
    837                         sw.write(' [storageType.sharpRef]') 
     837                        # Cannot say UInt64 because: 
     838                        # C# error: Type byte, sbyte, short, ushort, int, uint, long, or ulong expected 
     839                        st = storageType to IntType 
     840                        branch st.size 
     841                                on  8, t = 'byte' 
     842                                on 16, t = 'short' 
     843                                on 32, t = 'int' 
     844                                on 64, t = 'long' 
     845                                else, throw FallThroughException(st) 
     846                        if not st.isSigned, t = 'u' + t 
     847                        sw.write(' : [t]') 
    838848                sw.write(' {\n') 
    839849                sw.indent 
  • cobra/trunk/Tests/100-basics/307-enums.cobra

    r1294 r1702  
    11enum Medium 
     2        of uint64 
    23        air 
    34        land