Boo
  1. Boo
  2. BOO-463

Support for Int16/UInt16 literals (e.g. Int16.MaxValue)

    Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.7
    • Component/s: Compiler, Emitter
    • Labels:
      None
    • Environment:
      Windows 2000/SP4, .NET 1.1 SP1
    • Number of attachments :
      0

      Description

      I noticed while playing with the "booish" tool that
      """
      i as short
      print i.MaxValue
      """
      didn't work, failing with the following error: "ERROR: Language feature still not implemented: 'Literal: Int16'."

      After some investigation, I discovered that short/ushort/Int16/UInt16 was not implemented as a case in Boo.Lang.Compiler/Steps/EmitAssembly.cs.

      I added the following two cases to my copy of EmitAssembly.cs:

      case TypeCode.Int16:
      {
      _il.Emit(OpCodes.Ldc_I4, (int)(short)value);
      break;
      }

      case TypeCode.UInt16:
      {
      _il.Emit(OpCodes.Ldc_I4, (int)(ushort)value);
      break;
      }

      These cases seemed to do the trick, as I can now use shorts in booish and access their static methods. I'm not sure why this was left out, but I wanted to thank all of people involved in this project for working to make Boo a very useful tool!

      Finally, I apologize for not submitting a proper diff

        Activity

        Hide
        Rodrigo B. de Oliveira added a comment -

        thanks!

        Show
        Rodrigo B. de Oliveira added a comment - thanks!

          People

          • Assignee:
            Unassigned
            Reporter:
            Joshua W. Biagio
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: