use of org.eclipse.xtext.generator.trace.ILocationData in project xtext-core by eclipse.
the class AbstractTraceRegionToString method collect.
protected int collect(final AbstractTraceRegion reg, final int nextID, final AbstractTraceRegionToString.File lFile, final Map<SourceRelativeURI, AbstractTraceRegionToString.File> rFiles, final List<AbstractTraceRegionToString.RegionHandle> result) {
int i = nextID;
List<AbstractTraceRegionToString.RegionHandle> childResult = result;
boolean _shouldInclude = this.shouldInclude(reg);
if (_shouldInclude) {
int _plusPlus = i++;
final AbstractTraceRegionToString.RegionHandle regHandle = new AbstractTraceRegionToString.RegionHandle(_plusPlus, reg);
result.add(regHandle);
childResult = regHandle.children;
this.add(lFile, reg.getMyRegion(), regHandle, null);
final Function1<ILocationData, Boolean> _function = (ILocationData it) -> {
return Boolean.valueOf(this.shouldInclude(reg, it));
};
final List<ILocationData> locs = IterableExtensions.<ILocationData>toList(IterableExtensions.<ILocationData>filter(reg.getAssociatedLocations(), _function));
for (int j = 0; (j < locs.size()); j++) {
{
final ILocationData loc = locs.get(j);
int _xifexpression = (int) 0;
int _size = locs.size();
boolean _greaterThan = (_size > 1);
if (_greaterThan) {
_xifexpression = (j + 1);
} else {
_xifexpression = (-1);
}
final AbstractTraceRegionToString.LocationHandle locHandle = new AbstractTraceRegionToString.LocationHandle(regHandle, _xifexpression, loc);
regHandle.locations.add(locHandle);
SourceRelativeURI _elvis = null;
SourceRelativeURI _srcRelativePath = loc.getSrcRelativePath();
if (_srcRelativePath != null) {
_elvis = _srcRelativePath;
} else {
SourceRelativeURI _associatedSrcRelativePath = reg.getAssociatedSrcRelativePath();
_elvis = _associatedSrcRelativePath;
}
final SourceRelativeURI path = _elvis;
this.add(rFiles, path, loc, regHandle, locHandle);
}
}
}
List<AbstractTraceRegion> _nestedRegions = reg.getNestedRegions();
for (final AbstractTraceRegion child : _nestedRegions) {
i = this.collect(child, i, lFile, rFiles, childResult);
}
return i;
}
use of org.eclipse.xtext.generator.trace.ILocationData in project xtext-core by eclipse.
the class GeneratorNodeProcessor method _doProcess.
protected void _doProcess(final TraceNode node, final GeneratorNodeProcessor.Context ctx) {
boolean __hasContent = this._hasContent(node, ctx);
if (__hasContent) {
final AbstractTraceRegion beforeRegion = ctx.currentRegion;
boolean _isUseForDebugging = node.isUseForDebugging();
ILocationData _sourceLocation = node.getSourceLocation();
final GeneratorNodeProcessor.CompletableTraceRegion newRegion = new GeneratorNodeProcessor.CompletableTraceRegion(_isUseForDebugging, _sourceLocation, beforeRegion);
final int offset = ctx.contentLength();
final int startLineNumber = ctx.currentLineNumber();
try {
ctx.currentRegion = newRegion;
this.doProcessChildren(node, ctx);
} finally {
if ((beforeRegion != null)) {
ctx.currentRegion = beforeRegion;
}
int _contentLength = ctx.contentLength();
int _minus = (_contentLength - offset);
newRegion.complete(offset, _minus, startLineNumber, ctx.currentLineNumber());
}
}
}
use of org.eclipse.xtext.generator.trace.ILocationData in project xtext-core by eclipse.
the class TracingSugar method location.
/**
* @return ILocationData covering the <code>fullTextRegion</code> of the given EObject.
*/
public ILocationData location(final EObject obj) {
final ITextRegion region = this.locationProvider.getFullTextRegion(obj);
final SourceRelativeURI uri = this.traceURIConverter.getURIForTrace(obj.eResource());
return new LocationData(((ITextRegionWithLineInformation) region), uri);
}
use of org.eclipse.xtext.generator.trace.ILocationData in project xtext-core by eclipse.
the class TracingSugar method location.
/**
* @param obj the EObject containing the feature
* @param feature the EStructuralFeature to trace
* @param idx the index of the value to trace, in case the feature contains a list, should be <code>-1</code> otherwise.
*
* @return ILocationData covering the <code>fullTextRegion</code> of the given feature in the given EObject.
*/
public ILocationData location(final EObject obj, final EStructuralFeature feature, final int idx) {
final ITextRegion region = this.locationProvider.getFullTextRegion(obj, feature, idx);
final SourceRelativeURI uri = this.traceURIConverter.getURIForTrace(obj.eResource());
return new LocationData(((ITextRegionWithLineInformation) region), uri);
}
Aggregations