Changeset 2298
- Timestamp:
- 03/03/10 06:00:51 (2 years ago)
- Location:
- cobra/trunk
- Files:
-
- 2 modified
-
Source/Attributes.cobra (modified) (1 diff)
-
Tests/320-misc-two/800-attributes/100-attributes.cobra (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Source/Attributes.cobra
r2262 r2298 46 46 _expr.left.bindImp # Could cause a transformation. Handled in .replaceChild 47 47 name = _expr.dotRight.name 48 defi = _expr.left.definition.memberForName(name) 49 if defi is nil 48 if not name.endsWith('Attribute') 50 49 defi = _expr.left.definition.memberForName(name+'Attribute') 51 50 if defi is nil 52 _expr.throwCannotFindMemberError(_expr.left, '[name] or [name]Attribute') 51 defi = _expr.left.definition.memberForName(name) 52 if defi is nil 53 _expr.throwCannotFindMemberError(_expr.left, '[name]Attribute or [name]') 53 54 if defi inherits IType 54 _expr = PostCallExpr(_expr.right.token, TypeExpr(_expr.right.token, defi), _expr.dotRight.args , isForAttribute=true)55 _expr = PostCallExpr(_expr.right.token, TypeExpr(_expr.right.token, defi), _expr.dotRight.args) 55 56 else 56 57 .throwError('Expecting an attribute class instead of a [defi.englishName].') 57 58 else if _expr inherits PostCallExpr 58 59 name = _expr.name 59 if not name.endsWith('Attribute') and name.canBeUndottedMemberName and not .compiler.symbolForName(name, false)60 if not name.endsWith('Attribute') and name.canBeUndottedMemberName 60 61 if .compiler.symbolForName(name+'Attribute', false) 61 _expr = PostCallExpr(_expr.token, IdentifierExpr(_expr.token, name+'Attribute'), _expr.args, isForAttribute=true) 62 else 63 _expr.isForAttribute = true 62 _expr = PostCallExpr(_expr.token, IdentifierExpr(_expr.token, name+'Attribute'), _expr.args) 64 63 assert _expr inherits PostCallExpr 64 (_expr to PostCallExpr).isForAttribute = true 65 65 _expr.bindImp 66 66 -
cobra/trunk/Tests/320-misc-two/800-attributes/100-attributes.cobra
r2160 r2298 251 251 252 252 pass 253 254 255 class TestAttribute inherits Attribute 256 257 pass 258 259 260 class UseTestAttribute 261 262 def foo has Test # `Test` is also a namespace in Cobra.Lang, but the attribute "TestAttribute" takes precedence 263 pass



