Uploaded image for project: 'Swift'
  1. Swift
  2. SR-11580

FloatLiteralExprSyntax and IntegerLiteralExprSyntax should have computed properties that return their integer/float value

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: SwiftSyntax
    • Labels:

      Description

      Often, when dealing with FloatLiteralExprSyntax or IntegerLiteralExprSyntax, you want to get the value they represent. SwiftSyntax should provide computed properties that return these. 

      The catch with it is, that we need to support all kinds of literals that are supported in Swift. In addition to the obvious ones this includes:

      • Literals with underscores
      • Hexadecimal int literals
      • Octal int literals
      • Binary int literals
      • Exponential float literals (e.g. 5e+2)
      • Hexadecimal float literals with possible exponents (e.g. 0x5.fp+2)

      https://github.com/apple/swift-syntax/pull/148 started implementing these but gave up on the less obvious literals.

        Attachments

          Activity

            People

            Assignee:
            vermont42 Josh Adams
            Reporter:
            ahoppen Alex Hoppen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: