Changeset 1608
- Timestamp:
- 09/03/08 14:50:52 (4 months ago)
- Location:
- cobra/trunk
- Files:
-
- 5 modified
-
Developer/IntermediateReleaseNotes.text (modified) (1 diff)
-
Source/Boxes.cobra (modified) (1 diff)
-
Source/CobraParser.cobra (modified) (1 diff)
-
Source/Members.cobra (modified) (2 diffs)
-
Tests/320-misc-two/800-attributes/100-attributes.cobra (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Developer/IntermediateReleaseNotes.text
r1597 r1608 71 71 * Added new Visitor class to the Cobra standard library. Subclasses can easily implement the visitor pattern and the classes being visited require no additional modification. See the doc string of `Visitor` in CobraLang.cobra for details. 72 72 73 * Added support for attributes on class/object variables (also know as "fields"). 74 73 75 * Cobra now prints '[1, 2, 3]' for a list of integers rather than 'System.Collections.Generic.List`1[System.Int32]'. It still uses the standard List<of> class. 74 76 -
cobra/trunk/Source/Boxes.cobra
r1606 r1608 1045 1045 if fieldInfo.isStatic 1046 1046 isNames.add('shared') 1047 varr = BoxVar(TokenFix.empty, this, Utils.cobraNameForSharpMemberName(fieldInfo.name), _memberTypeResultProxy(fieldInfo, fieldInfo.fieldType), isNames, nil, '')1047 varr = BoxVar(TokenFix.empty, this, Utils.cobraNameForSharpMemberName(fieldInfo.name), _memberTypeResultProxy(fieldInfo, fieldInfo.fieldType), isNames, nil, nil, '') 1048 1048 varr.binaryName = fieldInfo.name 1049 1049 .addDecl(varr) -
cobra/trunk/Source/CobraParser.cobra
r1605 r1608 1166 1166 docString = .docString 1167 1167 .dedent 1168 return BoxVar(tok, .curBox, identifier, type, isNames, initExpr, docString)1168 return BoxVar(tok, .curBox, identifier, type, isNames, initExpr, attribs, docString) 1169 1169 1170 1170 def declareInvariant -
cobra/trunk/Source/Members.cobra
r1607 r1608 464 464 var _isAssignedTo as bool 465 465 466 def init(token as IToken, box as Box, name as String, typeNode as ITypeProxy?, isNames as List<of String>, initExpr as Expr?, docString as String)467 base.init(token, box, name, isNames, AttributeList(), docString)466 def init(token as IToken, box as Box, name as String, typeNode as ITypeProxy?, isNames as List<of String>, initExpr as Expr?, attribs as AttributeList?, docString as String) 467 base.init(token, box, name, isNames, attribs ? AttributeList(), docString) 468 468 _typeNode = typeNode 469 469 _initExpr = initExpr … … 591 591 def writeSharpDef(sw as SharpWriter) is override 592 592 base.writeSharpDef(sw) 593 .writeSharpAttribs(sw) 593 594 .writeSharpIsNames(sw) 594 595 sw.write(_type.sharpRef) -
cobra/trunk/Tests/320-misc-two/800-attributes/100-attributes.cobra
r1177 r1608 59 59 60 60 def getHashCode as int is override 61 return $sharp('_x << 8 | _y')61 return _x << 8 | _y 62 62 63 63 … … 90 90 checkCount = 0 91 91 for member in t.getMembers 92 if v 93 print member 92 if v, print member 94 93 name = member.name 95 94 if name.startsWith('Attrib') or name.startsWith('Item') 96 95 attribs = List<of FooAttribute>() 97 96 for attrib in member.getCustomAttributes(true) 98 if v 99 print ' ', attrib 97 if v, print ' ', attrib 100 98 if attrib inherits FooAttribute 101 99 attribs.add(attrib) … … 217 215 # has Foo(x=3) 218 216 # pass 217 218 # var 219 var attribVar2a_0_0_2_3 as int 220 has Foo, Bar(x=2, y=3)
