use of org.eclipse.n4js.ide.tests.helper.server.xt.XtMethodPattern.Match in project n4js by eclipse.
the class XtIdeTest method succs.
/**
* This xpect method can evaluate the direct successors of a code element. The successors can be limited when
* specifying the edge type.
*
* <pre>
* // Xpect succs type '{@link ControlFlowType#values()}' at '<LOCATION>' --> <SUCCESSORS>
* </pre>
*
* The type is optional. If given, the result is filtered accordingly. The type parameter does not work on self
* loops.
*
* SUCCESSORS is a comma separated list.
*/
// NOTE: This annotation is used only to enable validation and navigation of .xt files.
@Xpect
public void succs(XtMethodData data) {
Match match = PATTERN_SUCCS.match(data, eobjProvider);
String type = match.getText("type");
IEObjectCoveringRegion ocrAt = match.getEObjectWithOffset("at");
List<String> succTexts = xtFlowgraphs.getSuccs(type, ocrAt);
assertEqualIterables(data.expectation, succTexts);
}
use of org.eclipse.n4js.ide.tests.helper.server.xt.XtMethodPattern.Match in project n4js by eclipse.
the class XtIdeTest method preds.
/**
* This xpect method can evaluate the direct predecessors of a code element. The predecessors can be limited when
* specifying the edge type.
*
* <pre>
* // Xpect preds type '{@link ControlFlowType#values()}' at '<LOCATION>' --> <PREDECESSORS>
* </pre>
*
* The type is optional. If given, the result is filtered accordingly. The type parameter does not work on self
* loops.
*
* PREDECESSORS is a comma separated list.
*/
// NOTE: This annotation is used only to enable validation and navigation of .xt files.
@Xpect
public void preds(XtMethodData data) {
Match match = PATTERN_PREDS.match(data, eobjProvider);
String type = match.getText("type");
IEObjectCoveringRegion ocrAt = match.getEObjectWithOffset("at");
List<String> predTexts = xtFlowgraphs.getPreds(type, ocrAt);
assertEqualIterables(data.expectation, predTexts);
}
use of org.eclipse.n4js.ide.tests.helper.server.xt.XtMethodPattern.Match in project n4js by eclipse.
the class XtIdeTest method allBranches.
/**
* This xpect method can evaluate all branches from a given start code element. If no start code element is
* specified, the first code element of the containing function.
*
* <pre>
* // Xpect allBranches from '<LOCATION>' direction '<{@link TraverseDirection#values()}>' -->
* // <BRANCHES>
* </pre>
*
* The direction is optional.
*
* BRANCHES is a comma separated list.
*/
// NOTE: This annotation is used only to enable validation and navigation of .xt files.
@Xpect
public void allBranches(XtMethodData data) {
Match match = PATTERN_ALLBRANCHES.match(data, eobjProvider);
String direction = match.getText("direction");
IEObjectCoveringRegion ocrReference = match.ocrReference;
IEObjectCoveringRegion ocrFrom = match.getEObjectWithOffset("from");
List<String> branchStrings = xtFlowgraphs.getAllBranches(ocrFrom, direction, ocrReference);
assertEqualIterables(data.expectation, branchStrings);
}
use of org.eclipse.n4js.ide.tests.helper.server.xt.XtMethodPattern.Match in project n4js by eclipse.
the class XtIdeTest method allPaths.
/**
* This xpect method can evaluate all paths from a given start code element. If no start code element is specified,
* the first code element of the containing function.
*
* <pre>
* // Xpect allPaths from '<LOCATION>' direction '<{@link TraverseDirection#values()}>' --> <PATHS>
* </pre>
*
* The direction is optional.
*
* PATHS is a comma separated list.
*/
// NOTE: This annotation is used only to enable validation and navigation of .xt files.
@Xpect
public void allPaths(XtMethodData data) {
Match match = PATTERN_ALLPATHS.match(data, eobjProvider);
String direction = match.getText("direction");
IEObjectCoveringRegion ocrReference = match.ocrReference;
IEObjectCoveringRegion ocrFrom = match.getEObjectWithOffset("from");
List<String> pathStrings = xtFlowgraphs.getAllPaths(ocrFrom, direction, ocrReference);
assertEqualIterables(data.expectation, pathStrings);
}
use of org.eclipse.n4js.ide.tests.helper.server.xt.XtMethodPattern.Match in project n4js by eclipse.
the class XtIdeTest method commonPreds.
/**
* This xpect method can evaluate all common predecessors of two {@link ControlFlowElement}s.
*
* <pre>
* // Xpect cfContainer of '<LOCATION A>' and '<LOCATION B>' --> <COMMON PREDECESSORS>
* </pre>
*
* COMMON PREDECESSORS is a comma separated list.
*/
// NOTE: This annotation is used only to enable validation and navigation of .xt files.
@Xpect
public void commonPreds(XtMethodData data) {
Match match = PATTERN_COMMONPREDS.match(data, eobjProvider);
IEObjectCoveringRegion ocrA = match.getEObjectWithOffset("of");
IEObjectCoveringRegion ocrB = match.getEObjectWithOffset("and");
List<String> commonPredStrs = xtFlowgraphs.getCommonPreds(ocrA, ocrB);
assertEqualIterables(data.expectation, commonPredStrs);
}