com.togethersoft.openapi.sci
Interface SciCodeBlock
- public interface SciCodeBlock
- extends SciScope
A block of source code.
For example, the body of an operation is represented by the SciCodeBlock object. It can be
obtained using the SciFunction.getBody method.
Since this interface is an inheritor of SciObject, it is possible to get a containing
SciScope for
this code block, using the getContainingScope method. This method returns either
SciFile, SciClass, or another SciCodeBlock.
For example, for the inner code block:
MyClass extends BigClass{
void myMethod{
for (i=0;i<10;i++) {
//this is the inner code block
}
}
}
The getContainingScope method will return SciCodeBlock for the body
of myMethod. And the same getContainingScope method for that code block
will return SciClass for MyClass class.
Once again, since this interface is an inheritor of SciObject, you can use the
SciObject.getText method to get a string with the text of this code block.
- Author:
- TogetherSoft
- Since: Together 3.0
- See Also: SciScope, SciClass, SciFile
| Methods inherited from interface com.togethersoft.openapi.sci.SciObject |
canCut, canDelete, canReplace, copy, cut, delete, getContainingFile, getContainingScope, getLanguage, getPositions, getText, getUserProperty, isReadOnly, replace, setUserProperty |
getOwner
public SciObject getOwner()
- Provides access object which this code block belongs to. For example, owners of code block are function (SciFunction) and compound statement (SciCompoundStatement).
Added in order to simplify bottom-up walking through objects in source code.- Since:
- Together 6.0
statements
public SciStatementEnumeration statements()
- Returns an enumeration of all statements taking place in this block of a source code.
- Returns: an enumeration of all statements taking place in this block of a source code