Changeset 1731

Show
Ignore:
Timestamp:
11/04/08 21:11:21 (2 months ago)
Author:
Chuck.Esterbrook
Message:

Code cleanup.

Location:
cobra/trunk/Source
Files:
4 modified

Legend:

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

    r1730 r1731  
    590590                        .compiler.curCodeMember.usesBase  # use of base implies override if the containing member is not already marked new 
    591591                else if _left inherits ThisLit 
    592                         if _left.isVisible 
     592                        if not _left.isImplicit 
    593593                                .compiler.warning(this, 'An explicit "this" literal is unnecessary for accessing members of the current object. You can remove "this".') 
    594                         else if .isVisible and .dotRight.name.startsWith('_') 
     594                        else if not .isImplicit and .dotRight.name.startsWith('_') 
    595595                                .compiler.warning(this, 'An explicit dot (".") is unnecessary for accessing underscored members of the current object. You can remove ".".') 
    596596                if not _type 
  • cobra/trunk/Source/CobraParser.cobra

    r1729 r1731  
    26712671                        finally 
    26722672                                .opStack.pop 
    2673                         return BinaryOpExpr.make(token to !, 'DOT', ThisLit(token, isVisible=false), expr) 
     2673                        return BinaryOpExpr.make(token to !, 'DOT', ThisLit(token, isImplicit=true), expr) 
    26742674                else if peek=='NIL' 
    26752675                        return NilLiteral(.grab) 
  • cobra/trunk/Source/Expr.cobra

    r1730 r1731  
    4848        var _contextType as IType? 
    4949        var _isParened as bool 
    50         var _isVisible as bool 
    5150        var _argumentLabel = ArgumentLabel.None 
    5251 
    5352        def init(token as IToken) 
    5453                base.init(token) 
    55                 _isVisible = true 
    5654 
    5755        def addRefFields is override 
     
    6260                """ 
    6361                Indicates the label for an argument such as 'out' or 'inout'. 
    64                 """ 
    65  
    66         pro isVisible from var 
    67                 """ 
    68                 Indicates if the expression is visible in the source code. 
    69                 Defaults to true. 
    70                  
    71                 An expression may not be if it was generated by means other than parsing, 
    72                 usually during _bindImp for the purpose of a _transformTo call. 
    73                 It's not always imperative to set this to false--only in cases where it's needed. 
    74                 Those cases are typically warnings centered around coding style ("favor succinct forms"). 
    7562                """ 
    7663 
     
    885872                        if _definition 
    886873                                if _definition inherits AbstractMethod or _definition inherits MemberOverload 
    887                                         _transformTo(DotExpr(.token, 'DOT', ThisLit(.token, isVisible=false), MemberExpr(.token), isVisible=false).bindAll) 
     874                                        _transformTo(DotExpr(.token, 'DOT', ThisLit(.token, isImplicit=true), MemberExpr(.token), isImplicit=true).bindAll) 
    888875                                else 
    889876                                        _type = _definition.typeForIdentifier 
     
    14651452                                # _foo(x) --> ._foo(x) 
    14661453                                newCall = CallExpr(.token, .name, .args, true) 
    1467                                 dotted = DotExpr(.token, 'DOT', ThisLit(.token, isVisible=false), newCall, isVisible=false).bindImp 
     1454                                dotted = DotExpr(.token, 'DOT', ThisLit(.token, isImplicit=true), newCall, isImplicit=true).bindImp 
    14681455                                _type = dotted.type to IType 
    14691456                                _transformTo(dotted) 
  • cobra/trunk/Source/Members.cobra

    r1730 r1731  
    828828                                                                expr = IdentifierExpr(token, decl) to Expr 
    829829                                                        else 
    830                                                                 expr = DotExpr(token, 'DOT', ThisLit(token, isVisible=false), MemberExpr(token, decl.name), isVisible=false) to Expr 
     830                                                                expr = DotExpr(token, 'DOT', ThisLit(token, isImplicit=true), MemberExpr(token, decl.name), isImplicit=true) to Expr 
    831831                                                        stmts.add(AssertStmt(token, IsNotNilExpr(token, expr), nil)) 
    832832                                if stmts.count