com.aptana.ide.editor.js.runtime
Interface IScope

All Superinterfaces:
IDocumentationContainer, IObject, IRange
All Known Implementing Classes:
JSScope

public interface IScope
extends IObject

Author:
Kevin Lindsey

Method Summary
 IFunction getEnclosingFunction()
          Gets the enclosing function of this object, or null if global
 java.lang.String[] getLocalVariableNames()
          Get all variable names that exist on this scope only (does not follow scope chain)
 IScope getOwningScope(java.lang.String variableName)
          Returns the IScope object that holds the specified variable name
 IScope getParentScope()
          Returns the parent scope of this object.
 Property getVariable(java.lang.String variableName)
          Get the Property object for the associated variable name
 java.lang.String[] getVariableNames()
          Return all variable names in this scope and in all parent scopes.
 Reference getVariableReference(java.lang.String variableName)
          Get a reference object that points to the specified property name
 IObject getVariableValue(java.lang.String variableName, int fileIndex, int offset)
          Get the named variable.
 boolean hasVariable(java.lang.String variableName)
          Determine if the specified variable name is in the current scope chain
 void putVariableValue(java.lang.String variableName, IObject value, int fileIndex)
          Set the named variable to the specified value.
 void setEnclosingFunction(IFunction enclosingFunction)
          Sets the enclosing function of this object, or null if global
 void setParentScope(IScope parentScope)
          Sets the parent scope of this object
 void unputVariableName(java.lang.String variableName)
          Remove a reference to the specified variable name.
 
Methods inherited from interface com.aptana.ide.editor.js.runtime.IObject
canPut, deletePropertyName, getClassName, getInstance, getLocalProperty, getLocalPropertyCount, getLocalPropertyNames, getProperty, getPropertyNames, getPropertyNames, getPropertyValue, getPrototype, hasLocalProperty, hasProperty, putLocalProperty, putPropertyValue, putPropertyValue, setPrototype, unputPropertyName
 
Methods inherited from interface com.aptana.ide.lexer.IRange
containsOffset, getEndingOffset, getLength, getStartingOffset, isEmpty
 
Methods inherited from interface com.aptana.ide.metadata.IDocumentationContainer
getDocumentation, hasDocumentation, setDocumentation
 

Method Detail

getVariable

Property getVariable(java.lang.String variableName)
Get the Property object for the associated variable name

Parameters:
variableName - The name of the Property to return
Returns:
The Property object associated with the specified name

getVariableValue

IObject getVariableValue(java.lang.String variableName,
                         int fileIndex,
                         int offset)
Get the named variable. If necessary, the current scope chain will be traversed until either the scope is null or the identifier is located. This implements [[Scope]] from the ECMA specification

Parameters:
variableName - The name of the variable to lookup in the current scope
fileIndex - The file index
offset - The file offset
Returns:
The value of the specified variable name

hasVariable

boolean hasVariable(java.lang.String variableName)
Determine if the specified variable name is in the current scope chain

Parameters:
variableName - The name of the variable to look up
Returns:
Returns true if the variable exists in this scope object or in any of its ancestor scope objects

getVariableNames

java.lang.String[] getVariableNames()
Return all variable names in this scope and in all parent scopes.

Returns:
An array of variable names

getLocalVariableNames

java.lang.String[] getLocalVariableNames()
Get all variable names that exist on this scope only (does not follow scope chain)

Returns:
An array of variable names

getVariableReference

Reference getVariableReference(java.lang.String variableName)
Get a reference object that points to the specified property name

Parameters:
variableName - The name of the property to refer to
Returns:
Returns a reference object that points to the specified property name

putVariableValue

void putVariableValue(java.lang.String variableName,
                      IObject value,
                      int fileIndex)
Set the named variable to the specified value. The scope chain will be traversed to locate

Parameters:
variableName - The name of the variable to set
value - The value of the variable
fileIndex - The file index

unputVariableName

void unputVariableName(java.lang.String variableName)
Remove a reference to the specified variable name. If the variable no longer has references, it will be removed from this scope

Parameters:
variableName - The name of the variable to unput

getOwningScope

IScope getOwningScope(java.lang.String variableName)
Returns the IScope object that holds the specified variable name

Parameters:
variableName - The name of the variable to look up
Returns:
Returns the IScope object that contains the specified variable name

getParentScope

IScope getParentScope()
Returns the parent scope of this object.

Returns:
This object's parent scope

setParentScope

void setParentScope(IScope parentScope)
Sets the parent scope of this object

Parameters:
parentScope - The new parent scope

getEnclosingFunction

IFunction getEnclosingFunction()
Gets the enclosing function of this object, or null if global

Returns:
JSFunction

setEnclosingFunction

void setEnclosingFunction(IFunction enclosingFunction)
Sets the enclosing function of this object, or null if global

Parameters:
enclosingFunction -