Changeset 1731
- Timestamp:
- 11/04/08 21:11:21 (2 months ago)
- Location:
- cobra/trunk/Source
- Files:
-
- 4 modified
-
BinaryOpExpr.cobra (modified) (1 diff)
-
CobraParser.cobra (modified) (1 diff)
-
Expr.cobra (modified) (4 diffs)
-
Members.cobra (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Source/BinaryOpExpr.cobra
r1730 r1731 590 590 .compiler.curCodeMember.usesBase # use of base implies override if the containing member is not already marked new 591 591 else if _left inherits ThisLit 592 if _left.isVisible592 if not _left.isImplicit 593 593 .compiler.warning(this, 'An explicit "this" literal is unnecessary for accessing members of the current object. You can remove "this".') 594 else if .isVisibleand .dotRight.name.startsWith('_')594 else if not .isImplicit and .dotRight.name.startsWith('_') 595 595 .compiler.warning(this, 'An explicit dot (".") is unnecessary for accessing underscored members of the current object. You can remove ".".') 596 596 if not _type -
cobra/trunk/Source/CobraParser.cobra
r1729 r1731 2671 2671 finally 2672 2672 .opStack.pop 2673 return BinaryOpExpr.make(token to !, 'DOT', ThisLit(token, is Visible=false), expr)2673 return BinaryOpExpr.make(token to !, 'DOT', ThisLit(token, isImplicit=true), expr) 2674 2674 else if peek=='NIL' 2675 2675 return NilLiteral(.grab) -
cobra/trunk/Source/Expr.cobra
r1730 r1731 48 48 var _contextType as IType? 49 49 var _isParened as bool 50 var _isVisible as bool51 50 var _argumentLabel = ArgumentLabel.None 52 51 53 52 def init(token as IToken) 54 53 base.init(token) 55 _isVisible = true56 54 57 55 def addRefFields is override … … 62 60 """ 63 61 Indicates the label for an argument such as 'out' or 'inout'. 64 """65 66 pro isVisible from var67 """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").75 62 """ 76 63 … … 885 872 if _definition 886 873 if _definition inherits AbstractMethod or _definition inherits MemberOverload 887 _transformTo(DotExpr(.token, 'DOT', ThisLit(.token, is Visible=false), MemberExpr(.token), isVisible=false).bindAll)874 _transformTo(DotExpr(.token, 'DOT', ThisLit(.token, isImplicit=true), MemberExpr(.token), isImplicit=true).bindAll) 888 875 else 889 876 _type = _definition.typeForIdentifier … … 1465 1452 # _foo(x) --> ._foo(x) 1466 1453 newCall = CallExpr(.token, .name, .args, true) 1467 dotted = DotExpr(.token, 'DOT', ThisLit(.token, is Visible=false), newCall, isVisible=false).bindImp1454 dotted = DotExpr(.token, 'DOT', ThisLit(.token, isImplicit=true), newCall, isImplicit=true).bindImp 1468 1455 _type = dotted.type to IType 1469 1456 _transformTo(dotted) -
cobra/trunk/Source/Members.cobra
r1730 r1731 828 828 expr = IdentifierExpr(token, decl) to Expr 829 829 else 830 expr = DotExpr(token, 'DOT', ThisLit(token, is Visible=false), MemberExpr(token, decl.name), isVisible=false) to Expr830 expr = DotExpr(token, 'DOT', ThisLit(token, isImplicit=true), MemberExpr(token, decl.name), isImplicit=true) to Expr 831 831 stmts.add(AssertStmt(token, IsNotNilExpr(token, expr), nil)) 832 832 if stmts.count
