Search in sources :

Example 1 with RootTraceRegionForTesting

use of org.eclipse.xtend.core.tests.compiler.RootTraceRegionForTesting in project xtext-xtend by eclipse.

the class CompilerTraceTest method merge.

public AbstractTraceRegion merge(final List<AbstractTraceRegion> regions) {
    boolean _isEmpty = regions.isEmpty();
    boolean _not = (!_isEmpty);
    Assert.assertTrue(_not);
    int _size = regions.size();
    boolean _greaterThan = (_size > 1);
    if (_greaterThan) {
        ITextRegionWithLineInformation rootLocation = ITextRegionWithLineInformation.EMPTY_REGION;
        ITextRegionWithLineInformation associated = ITextRegionWithLineInformation.EMPTY_REGION;
        for (final AbstractTraceRegion child : regions) {
            {
                int _myOffset = child.getMyOffset();
                int _myLength = child.getMyLength();
                int _myLineNumber = child.getMyLineNumber();
                int _myEndLineNumber = child.getMyEndLineNumber();
                TextRegionWithLineInformation _textRegionWithLineInformation = new TextRegionWithLineInformation(_myOffset, _myLength, _myLineNumber, _myEndLineNumber);
                rootLocation = rootLocation.merge(_textRegionWithLineInformation);
                ILocationData childAssociation = child.getMergedAssociatedLocation();
                if ((childAssociation != null)) {
                    associated = associated.merge(childAssociation);
                }
            }
        }
        final RootTraceRegionForTesting root = new RootTraceRegionForTesting(rootLocation, associated);
        for (final AbstractTraceRegion child_1 : regions) {
            child_1.setParent(root);
        }
        return root;
    } else {
        return IterableExtensions.<AbstractTraceRegion>head(regions);
    }
}
Also used : ITextRegionWithLineInformation(org.eclipse.xtext.util.ITextRegionWithLineInformation) AbstractTraceRegion(org.eclipse.xtext.generator.trace.AbstractTraceRegion) RootTraceRegionForTesting(org.eclipse.xtend.core.tests.compiler.RootTraceRegionForTesting) ITextRegionWithLineInformation(org.eclipse.xtext.util.ITextRegionWithLineInformation) TextRegionWithLineInformation(org.eclipse.xtext.util.TextRegionWithLineInformation) ILocationData(org.eclipse.xtext.generator.trace.ILocationData)

Aggregations

RootTraceRegionForTesting (org.eclipse.xtend.core.tests.compiler.RootTraceRegionForTesting)1 AbstractTraceRegion (org.eclipse.xtext.generator.trace.AbstractTraceRegion)1 ILocationData (org.eclipse.xtext.generator.trace.ILocationData)1 ITextRegionWithLineInformation (org.eclipse.xtext.util.ITextRegionWithLineInformation)1 TextRegionWithLineInformation (org.eclipse.xtext.util.TextRegionWithLineInformation)1