Changeset 1912
- Timestamp:
- 01/17/09 22:55:30 (3 years ago)
- Location:
- cobra/trunk
- Files:
-
- 3 modified
-
Developer/IntermediateReleaseNotes.text (modified) (1 diff)
-
Source/Expr.cobra (modified) (1 diff)
-
Tests/120-classes/320-construct-prop-set.cobra (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Developer/IntermediateReleaseNotes.text
r1908 r1912 310 310 311 311 * Fixed: The compile does not correctly read nilable types from libraries, resulting in false compilation errors. ticket:136 312 313 * Fixed: Passing a method reference as a named property to an initalizer causes a false compilation error. -
cobra/trunk/Source/Expr.cobra
r1900 r1912 1706 1706 propsToSet.add(arg) 1707 1707 if firstPropArg == -1, firstPropArg = i 1708 propertyName = (arg.left to IdentifierExpr).name 1709 argType = _expr.memberForName(propertyName).resultType 1708 1710 arg = arg.right 1709 1711 else 1710 1712 argsForInitCall.add(if(arg inherits NilLiteral, arg, IdentifierExpr(token.copy('ID', 'arg[i]')))) 1711 paramsForDecl.add(Param(box.token.copy('ID', 'arg[i]'), arg.type)) 1713 argType = arg.type to ! 1714 paramsForDecl.add(Param(box.token.copy('ID', 'arg[i]'), argType)) 1712 1715 i += 1 1713 1716 name = '_ch_ext_init_[.serialNum]' # ch = class helper, ext = extended, init = initializer -
cobra/trunk/Tests/120-classes/320-construct-prop-set.cobra
r1709 r1912 1 1 class X 2 2 3 def main is shared 4 s = Stuff(a=1, b=2) 5 assert s.a == 1 6 assert s.b == 2 3 shared 4 5 var _counter = 0 6 7 get counter from var 8 9 def incCounter 10 _counter += 1 7 11 8 s = Stuff('a', b='b') 9 assert s.a == 'a' 10 assert s.b == 'b' 11 12 letters = 'aoeu' 13 s = Stuff(letters, b='b') 14 assert s.a == letters 15 assert s.b == 'b' 16 17 s = Stuff(nil, b='b') 18 assert s.a is nil 19 assert s.b == 'b' 20 21 t = Thing(nil, data=5) # test passing nil to a strongly typed arg 22 assert t.data == 5 23 24 s = Stuff(style=StyleType(Hype)) # test enum construction nested inside a prop set 12 def main 13 s = Stuff(a=1, b=2) 14 assert s.a == 1 15 assert s.b == 2 16 17 s = Stuff('a', b='b') 18 assert s.a == 'a' 19 assert s.b == 'b' 20 21 letters = 'aoeu' 22 s = Stuff(letters, b='b') 23 assert s.a == letters 24 assert s.b == 'b' 25 26 s = Stuff(nil, b='b') 27 assert s.a is nil 28 assert s.b == 'b' 29 30 s = Stuff(doSomething = ref .incCounter) # pass a method reference 31 assert .counter == 0 32 ds = s.doSomething 33 ds() 34 assert .counter == 1 35 36 t = Thing(nil, data=5) # test passing nil to a strongly typed arg 37 assert t.data == 5 38 39 s = Stuff(style=StyleType(Hype)) # test enum construction nested inside a prop set 25 40 26 41 … … 50 65 51 66 67 sig DoSomethingSig 68 69 pro doSomething from var as DoSomethingSig? 70 71 52 72 class Thing 53 73



