Changeset 1713

Show
Ignore:
Timestamp:
10/29/08 01:21:51 (2 months ago)
Author:
Chuck.Esterbrook
Message:

Minor improvs.
Make BoxVar? use Expr.canBeAssignedTo rather that Expr.isKindOf for consistency with AssignExpr?.bindImp's behavior.
Also change the error message to be identical; again for consistency.
Add a test case.

Location:
cobra/trunk
Files:
1 added
2 modified

Legend:

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

    r1712 r1713  
    397397        def addRefFields is override 
    398398                base.addRefFields 
    399                 if _type 
    400                         .addField('type', _type) 
    401                 else 
    402                         .addField('typeNode', _typeNode) 
     399                if _type, .addField('type', _type) 
     400                else, .addField('typeNode', _typeNode) 
    403401 
    404402        def addSubFields is override 
     
    434432                                                node.doNotPopIfInheritsStack 
    435433                                                count -= 1 
    436                                                 if count == 0 
    437                                                         break                                            
     434                                                if count == 0, break                                             
    438435                        return true 
    439436                else 
     
    449446                        if _type is nil 
    450447                                _type = _initExpr.type 
    451                         else if not _initExpr.isKindOf(_type to !) 
    452                                 .throwError('The expression type of [_initExpr.type.name] does not match the variable type of [_type.name].') 
     448                        else if not _initExpr.canBeAssignedTo(_type to !) 
     449                                .throwError('Incompatible types. Cannot assign value of type [_initExpr.type.name] on the right to [_type.name] on the left.') 
    453450 
    454451        get resultType as IType is override 
  • cobra/trunk/Source/Vars.cobra

    r1645 r1713  
    114114                                                node.doNotPopIfInheritsStack 
    115115                                                count -= 1 
    116                                                 if count == 0 
    117                                                         break 
     116                                                if count == 0, break 
    118117                        return true 
    119118                else