Class: AdLint::Cc1::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/cc1/scope.rb

Overview

:nodoc:

Direct Known Subclasses

GlobalScope

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#depthObject (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

Returns:

  • (Boolean)


58
59
60
# File 'lib/adlint/cc1/scope.rb', line 58

def eql?(rhs)
  @depth == rhs.depth
end

#global?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/adlint/cc1/scope.rb', line 42

def global?
  @depth == 0
end

#hashObject



62
63
64
# File 'lib/adlint/cc1/scope.rb', line 62

def hash
  @depth.hash
end

#inner_scopeObject



50
51
52
# File 'lib/adlint/cc1/scope.rb', line 50

def inner_scope
  Scope.new(@depth + 1)
end

#local?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/adlint/cc1/scope.rb', line 46

def local?
  @depth > 0
end

#outer_scopeObject



54
55
56
# File 'lib/adlint/cc1/scope.rb', line 54

def outer_scope
  Scope.new(@depth - 1)
end