Class CompilationUnit
Defined in: </jobs/genie.orion/orion-client-stable/workspace/bundles/org.eclipse.orion.client.javascript/web/javascript/compilationUnit.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
CompilationUnit(sourceblocks, metadata, editorContext)
Creates a new CompilationUint instance.
|
Method Attributes | Method Name and Description |
---|---|
Returns the computed list of dependencies
|
|
Returns an EditorContext-like object that can resolve promises for
getText and getFileMetadata |
|
Returns the source of this compilation unit
|
|
validOffset(offset)
Returns if the given offset is valid compared to the blocks of code
that make up this unit
|
Class Detail
CompilationUnit(sourceblocks, metadata, editorContext)
Creates a new CompilationUint instance. These instances should not be cached as they do
not respond to model change events.
- Parameters:
-
{Array.
} sourceblocks - The blocks of source to combine into one unit
- {Object} metadata
- The metadata describing the file this unit represents
- {Object} editorContext
- Optional editor context for the source file. Delegated to for setText and to get line information
- Since:
- 8.0
- Returns:
- {CompilationUnit} The new CompiationUnit instance
Method Detail
{Array.}
getDependencies()
Returns the computed list of dependencies
- Since:
- 9.0
- Returns:
- {Array.
} Returns the array of dependencies, or an empty array, never null
{Object}
getEditorContext()
Returns an EditorContext-like object that can resolve promises for
getText
and getFileMetadata
- Returns:
- {Object} The EditorContext object to use when parsing
{String}
getSource()
Returns the source of this compilation unit
- Returns:
- {String} The source of the compilation unit
{Boolean}
validOffset(offset)
Returns if the given offset is valid compared to the blocks of code
that make up this unit
- Parameters:
- {Number} offset
- The offset to check
- Returns:
- {Boolean} If the given offset is within any of the backing code blocks