Show
Ignore:
Timestamp:
08/13/08 19:37:27 (5 months ago)
Author:
Chuck.Esterbrook
Message:

Fix a bug in the raise statement regarding overloaded init and default arguments.

Files:
1 modified

Legend:

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

    r1568 r1575  
    12511251 
    12521252        def _postCallForType(type as IType) as PostCallExpr              
    1253                 inits = type.memberForName('init') 
    1254                 if inits inherits Initializer 
    1255                         if inits.params.count <> 0 
    1256                                 .throwError('Missing argument for "raise" of type "[type.name]".') 
    1257                         else 
    1258                                 token = .token.copy('ID', type.name) 
    1259                                 return PostCallExpr(token, TypeExpr(token, type), List<of Expr>()).bindImp 
     1253                init = type.memberForName('init') 
     1254                good = false 
     1255                if init inherits Initializer 
     1256                        if init.params.count == 0 
     1257                                good = true 
     1258                else if init inherits MemberOverload 
     1259                        for member in init.members 
     1260                                if member.params.count == 0 
     1261                                        good = true 
     1262                                        break 
     1263                if good 
     1264                        token = .token.copy('ID', type.name) 
     1265                        return PostCallExpr(token, TypeExpr(token, type), List<of Expr>()).bindImp 
    12601266                else 
    12611267                        .throwError('Missing argument for "raise" of type "[type.name]".')