Changeset 1598
- Timestamp:
- 08/28/08 06:40:46 (3 months ago)
- Location:
- cobra/trunk
- Files:
-
- 3 modified
-
Source/Expr.cobra (modified) (2 diffs)
-
Source/SharpGenerator.cobra (modified) (3 diffs)
-
Tests/120-classes/320-construct-prop-set.cobra (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Source/Expr.cobra
r1591 r1598 1479 1479 """ 1480 1480 box = .compiler.curBox 1481 token = box.token.copy 1481 1482 paramsForDecl = List<of Param>() 1482 1483 argsForInitCall = List<of Expr>() # args to pass to `Foo(arg0, arg1)` … … 1490 1491 arg = arg.right 1491 1492 else 1492 argsForInitCall.add( arg)1493 argsForInitCall.add(IdentifierExpr(token.copy('ID', 'arg[i]'))) 1493 1494 paramsForDecl.add(Param(box.token.copy('ID', 'arg[i]'), arg.type)) 1494 1495 i += 1 1495 1496 name = '_ch_ext_init_[.serialNum]' # ch = class helper, ext = extended, init = initializer 1496 token = box.token.copy 1497 m = Method(token.copy('ID', name), box, name, paramsForDecl, _type, nil, ['shared'], AttributeList(), '') 1497 m = Method(token.copy('ID', name), box, name, paramsForDecl, _type, nil, ['shared', 'private'], AttributeList(), '') 1498 1498 m.locals.add(LocalVar(token.copy('ID', 'obj'), .type)) 1499 1499 -
cobra/trunk/Source/SharpGenerator.cobra
r1591 r1598 426 426 427 427 def writeSharpDef(sw as SharpWriter, parens as bool) is override 428 if parens, sw.write('(')429 428 if _helperMethod 430 429 sw.write(_helperMethod.name + '(') … … 438 437 sw.write(')') 439 438 else 439 if parens, sw.write('(') 440 440 expr = _expr 441 441 isMethodSig = false … … 496 496 .writeSharpArgs(sw, ', ') 497 497 sw.write(')') 498 if parens, sw.write(')')498 if parens, sw.write(')') 499 499 500 500 def writeSharpArgs(sw as SharpWriter) -
cobra/trunk/Tests/120-classes/320-construct-prop-set.cobra
r1591 r1598 5 5 assert s.a == 1 6 6 assert s.b == 2 7 7 8 s = Stuff('a', b='b') 8 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 9 15 assert s.b == 'b' 10 16
