Changeset 1607

Show
Ignore:
Timestamp:
08/28/08 15:11:33 (3 months ago)
Author:
Chuck.Esterbrook
Message:

Code cleanup.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/Members.cobra

    r1606 r1607  
    229229 
    230230        def bindImp as dynamic 
    231                 if not .parentBox.isConstructed 
    232                         return base.bindImp 
    233                 else 
    234                         # TODO: shouldn't even get this message in the first place. investigate. 
    235                         return .bindImpResult 
     231                assert not .parentBox.isConstructed 
     232                return base.bindImp 
    236233                         
    237234        def _bindImp is override 
    238235                base._bindImp 
    239236                assert .didBindInt  # class members should have always received a bindInt first 
    240 # TODO:         assert not .parentBox.isConstructed  # not expecting to bindImp on a constructed type 
    241                 for attrib in _attribs 
    242                         attrib.bindImp 
    243                 if _testMethod 
    244                         _testMethod.bindImp 
     237                assert not .parentBox.isConstructed  # not expecting to bindImp on a constructed type 
     238                for attrib in _attribs, attrib.bindImp 
     239                if _testMethod, _testMethod.bindImp 
    245240 
    246241        def usesBase 
     
    250245                # using base implies override, but only if the method sig in the base class is the same 
    251246                # (otherwise it's just an overload) 
    252                 parentBox = _parentBox 
    253                 if parentBox inherits Class 
     247                if (parentBox = .parentBox) inherits Class 
    254248                        assert parentBox.baseClass 
    255249                        # Why not use .matchingBaseMember? Because currently that's only method-to-method. Does not work for properties. 
     
    548542                """ 
    549543                t = .type 
    550                 if t 
    551                         return t 
    552                 else 
    553                         throw FallThroughException('_type is nil. this=[this]') 
     544                if t, return t 
     545                else, throw FallThroughException('_type is nil. this=[this]') 
    554546 
    555547        def constructedFor(box as Box, gpToType as Dictionary<of GenericParam, IType>) as BoxMember  # CC: as same 
    556                 # TODO: require .type (or assert) 
     548                assert .type 
    557549                newMember = base.constructedFor(box, gpToType) to BoxVar  # CC: this = base. ... 
    558550                assert newMember._type 
     
    687679        def findLocal(name as String) as AbstractLocalVar? 
    688680                # TODO: should this use a dictionary lookup? 
    689                 for local in _locals 
    690                         if local.name==name 
    691                                 return local 
    692                 for param in _params 
    693                         if param.name==name 
    694                                 return param 
     681                for local in _locals, if local.name==name, return local 
     682                for param in _params, if param.name==name, return param 
    695683                return nil 
    696684 
     
    698686                name = name.toLower 
    699687                # TODO: should this use a dictionary lookup? 
    700                 for local in _locals 
    701                         if local.name.toLower==name 
    702                                 return local 
    703                 for param in _params 
    704                         if param.name.toLower==name 
    705                                 return param 
     688                for local in _locals, if local.name.toLower==name, return local 
     689                for param in _params, if param.name.toLower==name,      return param 
    706690                return nil 
    707691 
     
    851835                if _matchingBaseMember, return 
    852836                if not .canHaveMatchingBaseMember, return 
    853                 parentBox = .parentBox 
    854                 if parentBox inherits Class 
     837                if (parentBox = .parentBox) inherits Class 
    855838                        if parentBox.baseClass 
    856839                                baseMember = parentBox.baseClass.memberForName(_name) 
     
    12431226                _returnTypeNode = returnTypeNode 
    12441227                _implementsTypeNode = implementsTypeNode 
    1245                 # TODO: feels kind of hacky: 
    12461228                if 'virtual' in _isNames and _implementsTypeNode 
    12471229                        _isNames.remove('virtual')