@Override public int getStartColumn(Object impl) { SourceSection section = (SourceSection) impl; return section.getStartColumn(); }
@Override public int getStartColumn(Object impl) { SourceSection section = (SourceSection) impl; return section.getStartColumn(); }
@Override public void breakpointResolved(Breakpoint brkp, SourceSection section) { resolvedIndexPtr[0] = section.getCharIndex() + 1; if (TRACE) { trace("BREAKPOINT resolved to " + section.getStartLine() + ":" + section.getStartColumn()); } } }).build());
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (!sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartColumn(); for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherStart)) { return true; } } return false; }
@Override public void breakpointResolved(Breakpoint brkp, SourceSection section) { resolvedIndexPtr[0] = section.getCharIndex() + 1; if (TRACE) { trace("BREAKPOINT resolved to " + section.getStartLine() + ":" + section.getStartColumn()); } } }).build());
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { if (!sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartColumn(); for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherStart)) { return true; } } return false; }
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { int otherStart = sourceSection.getStartColumn(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndColumn(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherEnd, otherEnd)) { return true; } } return false; }
@Override public String getDescription() { return sourceSection.getSource().getURI() + " " + sourceSection.getStartLine() + ":" + sourceSection.getStartColumn(); }
b.append(" [").append(getStartLine()); if (hasColumns()) { b.append(':').append(getStartColumn());
@Override boolean isIncluded(Set<Class<?>> providedTags, Node instrumentedNode, SourceSection sourceSection) { int otherStart = sourceSection.getStartColumn(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndColumn(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherEnd, otherEnd)) { return true; } } return false; }
SourceSection adjustLocation(Source source, TruffleInstrument.Env env, SuspendAnchor suspendAnchor) { if (sourceSection != null) { return sourceSection; } if (key == null) { return null; } boolean hasColumn = column > 0; SourceSection location = SuspendableLocationFinder.findNearest(source, sourceElements, line, column, suspendAnchor, env); if (location != null) { switch (suspendAnchor) { case BEFORE: line = location.getStartLine(); if (hasColumn) { column = location.getStartColumn(); } break; case AFTER: line = location.getEndLine(); if (hasColumn) { column = location.getEndColumn(); } break; default: throw new IllegalArgumentException("Unknown suspend anchor: " + suspendAnchor); } } return location; }
static boolean isColumnIn(SourceSection sourceSection, IndexRange[] ranges) { if (!sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartColumn(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndColumn(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherEnd)) { return true; } } return false; }
static boolean isColumnIn(SourceSection sourceSection, IndexRange[] ranges) { if (!sourceSection.isAvailable()) { return false; } int otherStart = sourceSection.getStartColumn(); int otherEnd; if (sourceSection.getSource() == null) { otherEnd = otherStart; } else { otherEnd = sourceSection.getEndColumn(); } for (IndexRange indexRange : ranges) { if (indexRange.contains(otherStart, otherEnd)) { return true; } } return false; }
@Override SourceSection adjustLocation(Source source, TruffleInstrument.Env env, SuspendAnchor suspendAnchor) { if (sourceSection != null) { return sourceSection; } if (key == null) { return null; } boolean hasColumn = column > 0; SourceSection location = SuspendableLocationFinder.findNearest(source, sourceElements, line, column, suspendAnchor, env); if (location != null) { switch (suspendAnchor) { case BEFORE: line = location.getStartLine(); if (hasColumn) { column = location.getStartColumn(); } break; case AFTER: line = location.getEndLine(); if (hasColumn) { column = location.getEndColumn(); } break; default: throw new IllegalArgumentException("Unknown suspend anchor: " + suspendAnchor); } } return location; }
return rSource.createSection(section.getCharIndex(), section.getCharLength()); } else if (section.hasColumns()) { return rSource.createSection(section.getStartLine(), section.getStartColumn(), section.getEndLine(), section.getEndColumn()); } else if (section.hasLines()) {
static JSONObject sourceSectionToJSON(SourceSection sourceSection) { JSONObject sourceSectionJson = new JSONObject(); if (sourceSection != null) { Source source = sourceSection.getSource(); if (source != null) { if (source.getLanguage() != null) { sourceSectionJson.put("language", source.getLanguage().toString()); } String path = source.getPath(); if (path != null) { sourceSectionJson.put("path", path); } } sourceSectionJson.put("source_name", sourceSection.getSource().getName()); sourceSectionJson.put("start_line", sourceSection.getStartLine()); sourceSectionJson.put("end_line", sourceSection.getEndLine()); sourceSectionJson.put("start_column", sourceSection.getStartColumn()); sourceSectionJson.put("end_column", sourceSection.getEndColumn()); } return sourceSectionJson; }