Changeset 1762
- Timestamp:
- 11/12/08 06:03:30 (8 weeks ago)
- Location:
- cobra/trunk
- Files:
-
- 1 added
- 3 modified
-
Developer/IntermediateReleaseNotes.text (modified) (1 diff)
-
Source/BinaryOpExpr.cobra (modified) (1 diff)
-
Source/Compiler.cobra (modified) (1 diff)
-
Tests/220-delegates-etc/120-events/400-augmented-assignment-error.cobra (added)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Developer/IntermediateReleaseNotes.text
r1761 r1762 145 145 For convenience, the extension methods .toPrintString and .toTechString have been added to System.Object. 146 146 147 * Added improved error checking and/or error messages for `throw`, `raise` and `use`. 147 * Added improved error checking and/or error messages for `throw`, `raise` and `use`. Also, better error messages for C# syntax += and -= applied to events and delegates. 148 148 149 149 * Added various library methods from .NET to the primitive types such as decimal, int, char, bool, etc. These are documented on @link(http://cobra-language.com/trac/cobra/wiki/PrimitiveTypeMembers, the wiki). These include mathematical methods so you can say `x.round`, `x.round(decimals)`, `a.min(b)`, `x.sin`, `x.truncate`, etc. -
cobra/trunk/Source/BinaryOpExpr.cobra
r1731 r1762 392 392 base._bindImp 393 393 # TODO: does NumericPromoExpr cover everything we need? 394 # C# and other languages use += and -= on delegates and events, but Cobra does not. 395 if .left.type inherits MethodSig 396 # TODO: error 397 pass 398 else if .left.type.isDescendantOf(.compiler.delegateType) 399 # TODO: distinguish between events and delegates 400 leftSource = .left.toCobraSource 401 rightSource = .right.toCobraSource 402 if not .right inherits RefExpr, rightSource = 'ref ' + rightSource 403 branch .op 404 on 'PLUS_EQUALS', .throwError('Cannot use "+=". Use "listen [leftSource], [rightSource]" for events and "[leftSource] = Delegate.combine([leftSource], [rightSource])" for delegates.') 405 on 'MINUS_EQUALS', .throwError('Cannot use "-=". Use "ignore [leftSource], [rightSource]" for events and "[leftSource] = Delegate.remove([rightSource])" for delegates.') 406 else, .throwError('Cannot use the operator "[.token.text]" on events or delegates.') 394 407 395 408 -
cobra/trunk/Source/Compiler.cobra
r1760 r1762 1178 1178 return _libraryClass('System.Exception') 1179 1179 1180 def delegateType as Class 1181 return _libraryClass('System.Delegate') 1182 1180 1183 def attributeType as Box 1181 1184 return _libraryBox('System.Attribute')
