Ticket #379: EnumDecl-writeSharpDef.patch
File EnumDecl-writeSharpDef.patch, 1.2 KB (added by thriwkin, 10 years ago) |
---|
-
SharpGenerator.cobra
966 966 sw.write('enum [_name]') 967 967 storageType = _storageType 968 968 if storageType and storageType is not .compiler.intType 969 # C annot say UInt64 because:970 # C# error: Type byte, sbyte, short, ushort, int, uint, long, or ulong expected969 # C# 4.0 Spec 14.1: "An enum declaration may explicitly declare an underlying type of 970 # byte, sbyte, short, ushort, int, uint, long or ulong. " 971 971 st = storageType to IntType 972 branch st.size 973 on 8, t = 'byte' 974 on 16, t = 'short' 975 on 32, t = 'int' 976 on 64, t = 'long' 977 else, throw FallThroughException(st) 978 if not st.isSigned, t = 'u' + t 972 if st.isSigned 973 branch st.size 974 on 8, t = 'sbyte' 975 on 16, t = 'short' 976 on 32, t = 'int' 977 on 64, t = 'long' 978 else, throw FallThroughException(st) 979 else 980 branch st.size 981 on 8, t = 'byte' 982 on 16, t = 'ushort' 983 on 32, t = 'uint' 984 on 64, t = 'ulong' 985 else, throw FallThroughException(st) 979 986 sw.write(' : [t]') 980 987 sw.write(' {\n') 981 988 sw.indent