Class: AdLint::Cc1::Scope
- Inherits:
-
Object
- Object
- AdLint::Cc1::Scope
- Defined in:
- lib/adlint/cc1/scope.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
Instance Method Summary collapse
- #eql?(rhs) ⇒ Boolean
- #global? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(depth) ⇒ Scope
constructor
A new instance of Scope.
- #inner_scope ⇒ Object
- #local? ⇒ Boolean
- #outer_scope ⇒ Object
Constructor Details
#initialize(depth) ⇒ Scope
Returns a new instance of Scope.
36 37 38 |
# File 'lib/adlint/cc1/scope.rb', line 36 def initialize(depth) @depth = depth end |
Instance Attribute Details
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
40 41 42 |
# File 'lib/adlint/cc1/scope.rb', line 40 def depth @depth end |
Instance Method Details
#eql?(rhs) ⇒ Boolean
58 59 60 |
# File 'lib/adlint/cc1/scope.rb', line 58 def eql?(rhs) @depth == rhs.depth end |
#global? ⇒ Boolean
42 43 44 |
# File 'lib/adlint/cc1/scope.rb', line 42 def global? @depth == 0 end |
#hash ⇒ Object
62 63 64 |
# File 'lib/adlint/cc1/scope.rb', line 62 def hash @depth.hash end |
#inner_scope ⇒ Object
50 51 52 |
# File 'lib/adlint/cc1/scope.rb', line 50 def inner_scope Scope.new(@depth + 1) end |
#local? ⇒ Boolean
46 47 48 |
# File 'lib/adlint/cc1/scope.rb', line 46 def local? @depth > 0 end |