Java Code Examples for com.oracle.truffle.api.source.Source#createSection()
The following examples show how to use
com.oracle.truffle.api.source.Source#createSection() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HashemStatementNode.java From mr-hashemi with Universal Permissive License v1.0 | 5 votes |
@Override @TruffleBoundary public final SourceSection getSourceSection() { if (sourceCharIndex == NO_SOURCE) { // AST node without source return null; } RootNode rootNode = getRootNode(); if (rootNode == null) { // not yet adopted yet return null; } SourceSection rootSourceSection = rootNode.getSourceSection(); if (rootSourceSection == null) { return null; } Source source = rootSourceSection.getSource(); if (sourceCharIndex == UNAVAILABLE_SOURCE) { if (hasRootTag && !rootSourceSection.isAvailable()) { return rootSourceSection; } else { return source.createUnavailableSection(); } } else { return source.createSection(sourceCharIndex, sourceLength); } }
Example 2
Source File: ExecuteContextNode.java From trufflesqueak with MIT License | 5 votes |
@Override public SourceSection getSourceSection() { if (section == null) { final Source source = code.getSource(); section = source.createSection(1, 1, source.getLength()); } return section; }
Example 3
Source File: AbstractBytecodeNode.java From trufflesqueak with MIT License | 5 votes |
@Override public final SourceSection getSourceSection() { CompilerAsserts.neverPartOfCompilation(); if (sourceSection == null) { final Source source = code.getSource(); if (CompiledCodeObject.SOURCE_UNAVAILABLE_CONTENTS.equals(source.getCharacters())) { sourceSection = source.createUnavailableSection(); } else { final int lineNumber = SqueakBytecodeDecoder.findLineNumber(code, index); sourceSection = source.createSection(lineNumber); } } return sourceSection; }