Skip to content
  • Sven/Sarah Barth's avatar
    Add support for IfThen() instrinsic that works like the if-statement in that... · ed94ca4b
    Sven/Sarah Barth authored
    Add support for IfThen() instrinsic that works like the if-statement in that it evaluates only the expression that is indeed executed.
    The result type of the intrinsic is determined by the Then-expression to provide a bit of control. There might however be some situations in which this fails, for this exceptions need to be added (e.g. a constant string needs to be converted to a normal string).
    
    compinnr.inc:
      + add new constant in_ifthen_x_y_z for the IfThen() intrinsic
    psystem.pas: 
      + create_intern_symbols: add symbol for IfThen() intrinsic
    pexpr.pas:
      * statement_syssym: parse parameters of IfThen() intrinsic and return corresponding inline node
    ninl.pas, tinlinenode:
      + new method handle_ifthen() which converts the inline node to an if-node which assigns the expressions to a temp node that is returned
      * pass_typecheck: handle in_ifthen_x_y_z using handle_ifthen()
      * pass_1: in_ifthen_x_y_z does not need a first pass as it's already converted after the typecheck pass
    
    + added tests
    
    git-svn-id: trunk@33036 -
    ed94ca4b