stephen-swensen / nl-compiler

A compiler for NL, a statically typed programming language targeting .NET
1 stars 0 forks source link

Literal fields like Int32.MaxValue need to have their values emitted directly as constants #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Literal fields like Int32.MaxValue will need to have their values emitted 
directly as constants; "fields" like these cannot be accessed through CIL. Note 
that SRE-wise, these are implemented as MdFieldInfo, they have the Literal 
FieldAttribute flag, and FieldHandle throws an exception (not sure what 
combination of those need to check)

Original issue reported on code.google.com by stephen....@gmail.com on 18 Dec 2011 at 4:18

GoogleCodeExporter commented 9 years ago
http://weblogs.asp.net/whaggard/archive/2003/02/20/2708.aspx says of FieldInfo

        // IsLiteral determines if its value is written at 
        //   compile time and not changeable
        // IsInitOnly determine if the field can be set 
        //   in the body of the constructor
        // for C# a field which is readonly keyword would have both true 
        //   but a const field would have only IsLiteral equal to true

Original comment by stephen....@gmail.com on 29 Dec 2011 at 5:07

GoogleCodeExporter commented 9 years ago
made a lot of progress, including enums, strings, non value types (NULL), and 
some other consts. but blocked on issue 33 (expand constants support)

Original comment by stephen....@gmail.com on 29 Dec 2011 at 8:18

GoogleCodeExporter commented 9 years ago
everything completed except for native and unative types (we are not addressing 
those in blocking issue 33 right now).

Original comment by stephen....@gmail.com on 30 Dec 2011 at 3:30

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 30 Dec 2011 at 3:30