Module: Duby::AST::Scoped
- Included in:
- Block, BlockArgument, FunctionalCall, Local, LocalAssignment, LocalDeclaration, OptionalArgument, RequiredArgument, RescueClause, RestArgument
- Defined in:
- lib/duby/ast.rb
Instance Method Summary collapse
Instance Method Details
#containing_scope ⇒ Object
217 218 219 220 221 222 223 |
# File 'lib/duby/ast.rb', line 217 def containing_scope scope = self.scope.static_scope while scope.parent && scope.parent.include?(name) scope = scope.parent end scope end |
#scope ⇒ Object
206 207 208 209 210 211 212 213 214 215 |
# File 'lib/duby/ast.rb', line 206 def scope @scope ||= begin scope = parent raise "No parent for #{self.class.name} at #{line_number}" if scope.nil? until scope.class.include?(Scope) scope = scope.parent end scope end end |