Changeset 1767
- Timestamp:
- 11/15/08 23:31:17 (8 weeks ago)
- Location:
- cobra/trunk
- Files:
-
- 1 added
- 6 modified
-
Developer/IntermediateReleaseNotes.text (modified) (1 diff)
-
Source/BackEndClr/SharpGenerator.cobra (modified) (2 diffs)
-
Source/BinaryOpExpr.cobra (modified) (1 diff)
-
Source/Expr.cobra (modified) (1 diff)
-
Source/Members.cobra (modified) (1 diff)
-
Source/Statements.cobra (modified) (1 diff)
-
Tests/220-delegates-etc/100-delegates/150-use-delegates-from-library.cobra (added)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Developer/IntermediateReleaseNotes.text
r1762 r1767 222 222 223 223 * Fixed: No warning for derived methods that are not marked "override" or "new" when the parameters differ by being nilable (String?) or not (String). ticket:59 224 225 * Fixed: Cannot properly invoke delegates whose delegate types come from binary libraries. -
cobra/trunk/Source/BackEndClr/SharpGenerator.cobra
r1766 r1767 2 2 Eventually this file will contain all C# code generation. 3 3 In the future, you can expect (or contribute!) alternate code generators such as IL, JVM and Objective-C. 4 5 There should be not use .throwError, or recording of warnings, etc. in this file. 6 All of that happens during .bindFoo phases. 4 7 """ 5 8 … … 3371 3374 .writeSharpArgs(sw) 3372 3375 sw.write(')') 3373 else if expr.type inherits MethodSig or (expr.type inherits NilableType and (expr.type to NilableType).theWrappedType inherits MethodSig) 3376 else if expr.type.isDescendantOf(.compiler.delegateType) 3377 isMethodSig = true 3378 else if expr.type inherits NilableType and (expr.type to NilableType).theWrappedType.isDescendantOf(.compiler.delegateType) 3374 3379 isMethodSig = true 3375 3380 else if expr.type.isSystemTypeClass or _type.isDynamic 3376 3381 isDynamic = true 3377 3382 else 3378 assert false, expr # TODO: .throwError3383 assert false, expr 3379 3384 else if expr inherits IndexExpr 3380 if expr.type inherits MethodSig3385 if expr.type.isDescendantOf(.compiler.delegateType) 3381 3386 isMethodSig = true 3382 3387 else if expr.type.isSystemTypeClass or _type.isDynamic 3383 3388 isDynamic = true 3384 3389 else 3385 assert false, expr # TODO: .throwError3390 assert false, expr 3386 3391 else 3387 assert false, expr # TODO: .throwError3392 assert false, expr 3388 3393 if isMethodSig 3389 expr.writeSharpDef(sw )3394 expr.writeSharpDef(sw, false) 3390 3395 sw.write('(') 3391 3396 .writeSharpArgs(sw) -
cobra/trunk/Source/BinaryOpExpr.cobra
r1766 r1767 384 384 pass 385 385 else if .left.type.isDescendantOf(.compiler.delegateType) 386 # TODO: distinguish between events and delegates387 386 leftSource = .left.toCobraSource 388 387 rightSource = .right.toCobraSource 389 388 if not .right inherits RefExpr, rightSource = 'ref ' + rightSource 390 389 branch .op 391 on 'PLUS_EQUALS', .throwError('Cannot use "+=". Use "listen [leftSource], [rightSource]" for events and "[leftSource] = Delegate.combine([leftSource], [rightSource])" for delegates.') 392 on 'MINUS_EQUALS', .throwError('Cannot use "-=". Use "ignore [leftSource], [rightSource]" for events and "[leftSource] = Delegate.remove([rightSource])" for delegates.') 393 else, .throwError('Cannot use the operator "[.token.text]" on events or delegates.') 394 390 on 'PLUS_EQUALS' 391 msg = 'Cannot use "+=". ' 392 if .left.definition inherits BoxEvent, msg += 'Use "listen [leftSource], [rightSource]" for events.' 393 else, msg += 'Use "[leftSource] = Delegate.combine([leftSource], [rightSource])" for delegates.' 394 on 'MINUS_EQUALS' 395 msg = 'Cannot use "-=". ' 396 if .left.definition inherits BoxEvent, msg += 'Use "ignore [leftSource], [rightSource]" for events.' 397 else, msg += 'Use "[leftSource] = Delegate.remove([rightSource])" for delegates.' 398 else 399 msg = 'Cannot use the operator "[.token.text]" on events or delegates.' 400 .throwError(msg) 395 401 396 402 class AugAssignBitwiseExpr -
cobra/trunk/Source/Expr.cobra
r1766 r1767 1570 1570 if exprType inherits NilableType 1571 1571 exprType = exprType.theWrappedType 1572 if exprType inherits MethodSig # TODO: probably still need to handle case of a method sig coming from a DLL1572 if exprType inherits MethodSig 1573 1573 _type = exprType.returnType 1574 else if exprType.isDescendantOf(.compiler.delegateType) 1575 member = exprType.memberForName('invoke') 1576 if member inherits Method 1577 _type = member.resultType 1578 else 1579 .throwError('Cannot find a single "invoke" method for "_eventType.name".') 1574 1580 else if expr.receiverType and expr.receiverType.isSystemTypeClass 1575 1581 _type = .compiler.dynamicType -
cobra/trunk/Source/Members.cobra
r1758 r1767 374 374 _handlerType = _handlerTypeProxy.realType 375 375 # TODO: error check that _handlerType is a delegate 376 # _handlerType.isDescendantOf(.compiler. libraryType('System.Delegate'))376 # _handlerType.isDescendantOf(.compiler.delegateType) 377 377 378 378 -
cobra/trunk/Source/Statements.cobra
r1763 r1767 915 915 assert expr.potentialType 916 916 _eventType = expr.potentialType 917 if _eventType.isDescendantOf(.compiler. libraryType('System.Delegate')) or _eventType inherits MethodSig917 if _eventType.isDescendantOf(.compiler.delegateType) 918 918 pass 919 919 else if _eventType.isDescendantOf(.compiler.exceptionType)
