org.jruby.compiler.ir
Interface IRScope

All Known Implementing Classes:
IRClass, IRClosure, IRExecutionScope, IRMetaClass, IRMethod, IRModule, IRScopeImpl, IRScript

public interface IRScope

IRScope is the interface for all lexically scoped constructs: Script, Module, Class, Method, and Closure. It is important to understand that a single class (e.g. MyFoo) may be opened lexically in several locations in source code. Each one of these locations will have their own instance of an IRScope.


Method Summary
 void addInstr(Instr i)
          methods and closures
 Operand getContainer()
          Returns the containing parent scope
 IRScope getLexicalParent()
          Returns the lexical scope that contains this scope definition
 LocalVariable getLocalVariable(java.lang.String name)
          Get Local Variable from this scope
 java.lang.String getName()
           
 IRModule getNearestModule()
          Returns the nearest module/class from this scope which may be itself.
 Label getNewLabel()
          Get a new label using a generic prefix
 Label getNewLabel(java.lang.String lblPrefix)
          Get a new label using the provided label prefix
 Variable getNewTemporaryVariable()
          create a new temporary variable
 int getNextClosureId()
          Get the next available unique closure id for closures in this scope
 int getRenamedVariableSize()
          How many renamed variables are in this scope?
 StaticScope getStaticScope()
           
 int getTemporaryVariableSize()
          How many temporary variables are in this scope?
 void prepareForInterpretation()
           
 void recordMethodAlias(java.lang.String newName, java.lang.String oldName)
          Record that newName is a new method name for method with oldName This is for the 'alias' keyword which resolves method names in the static compile/parse-time context
 void runCompilerPass(CompilerPass opt)
          Run the passed in compiler pass on this scope!
 java.lang.String unaliasMethodName(java.lang.String name)
          Unalias 'name' and return new name
 

Method Detail

getContainer

Operand getContainer()
Returns the containing parent scope


getLexicalParent

IRScope getLexicalParent()
Returns the lexical scope that contains this scope definition


getNearestModule

IRModule getNearestModule()
Returns the nearest module/class from this scope which may be itself.


addInstr

void addInstr(Instr i)
methods and closures


recordMethodAlias

void recordMethodAlias(java.lang.String newName,
                       java.lang.String oldName)
Record that newName is a new method name for method with oldName This is for the 'alias' keyword which resolves method names in the static compile/parse-time context


unaliasMethodName

java.lang.String unaliasMethodName(java.lang.String name)
Unalias 'name' and return new name


getNextClosureId

int getNextClosureId()
Get the next available unique closure id for closures in this scope


getNewTemporaryVariable

Variable getNewTemporaryVariable()
create a new temporary variable


getStaticScope

StaticScope getStaticScope()

getTemporaryVariableSize

int getTemporaryVariableSize()
How many temporary variables are in this scope?


getRenamedVariableSize

int getRenamedVariableSize()
How many renamed variables are in this scope?


getLocalVariable

LocalVariable getLocalVariable(java.lang.String name)
Get Local Variable from this scope


getName

java.lang.String getName()

getNewLabel

Label getNewLabel(java.lang.String lblPrefix)
Get a new label using the provided label prefix


getNewLabel

Label getNewLabel()
Get a new label using a generic prefix


runCompilerPass

void runCompilerPass(CompilerPass opt)
Run the passed in compiler pass on this scope!


prepareForInterpretation

void prepareForInterpretation()


Copyright © 2002-2009 JRuby Team. All Rights Reserved.