Changeset 1740

Show
Ignore:
Timestamp:
11/07/08 16:16:30 (2 months ago)
Author:
Chuck.Esterbrook
Message:

Fixed: Errors about unknown properties in Foo(a=1, b=2) give the wrong line number.

Location:
cobra/trunk
Files:
1 added
1 modified

Legend:

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

    r1736 r1740  
    679679                                else 
    680680                                        .throwError('Argument [i+1] of method "[_name]" expects type [param.type.name], but the call is supplying type [arg.type.name].') 
    681         # end of _bindImp helpers 
    682681                 
    683682        def toCobraSource as String is override 
     
    15101509                                        if not arg.left inherits IdentifierExpr 
    15111510                                                .recordError('General purpose assignments are not allowed as arguments. Assignment syntax can only be used for keyword arguments.') 
    1512                                         # TODO: check property name 
     1511                                        if not expr.receiverType.isDynamicOrPassThrough 
     1512                                                propertyName = (arg.left to IdentifierExpr).name 
     1513                                                if expr.memberForName(propertyName) is nil 
     1514                                                        suggs = .expr.suggestionsForBadMemberName(propertyName) 
     1515                                                        isBoxAccess = expr inherits IdentifierExpr and (expr to IdentifierExpr).definition inherits Box  # like "Console.writeLine" where the receiver is a literal class or struct reference 
     1516                                                        whoseTypeIs = if(isBoxAccess, '', ' whose type is "[expr.receiverType.name]"') 
     1517                                                        .recordError('Cannot find a definition for "[propertyName]" in "[expr.toCobraSource]"[whoseTypeIs].[_suggestionsMessage(suggs)]') 
    15131518                                        arg.right.bindImp  # 'x=y' has special treatment in arguments 
    15141519                                else