Show
Ignore:
Timestamp:
08/06/08 02:23:08 (5 months ago)
Author:
Chuck.Esterbrook
Message:

Added support for a Cobra compiler directive to specify the type for number
credit:hopscc
ticket:21

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/Compiler.cobra

    r1542 r1569  
    516516                                else, throw FallThroughException(.options['number']) 
    517517                return _numberType to ! 
    518                  
     518 
     519        set numberTypeName as String 
     520                """ 
     521                Set `number` type from a string/name. 
     522                """ 
     523                require value in ['decimal', 'float', 'float32', 'float64'] 
     524                branch value 
     525                        on 'decimal', _numberType = .decimalType 
     526                        on 'float',   _numberType = .floatType 
     527                        on 'float32', _numberType = .floatType(32) 
     528                        on 'float64', _numberType = .floatType(64) 
     529                        else, throw FallThroughException(value) 
     530 
    519531        get passThroughType as PassThroughType 
    520532                if _passThroughType is nil