本文整理汇总了Java中org.eclipse.xtext.xbase.XIfExpression.getThen方法的典型用法代码示例。如果您正苦于以下问题:Java XIfExpression.getThen方法的具体用法?Java XIfExpression.getThen怎么用?Java XIfExpression.getThen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.XIfExpression
的用法示例。
在下文中一共展示了XIfExpression.getThen方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReassignedType_01
import org.eclipse.xtext.xbase.XIfExpression; //导入方法依赖的package包/类
@Test
public void testReassignedType_01() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{ var it = new Object() if (it instanceof String) {} }");
XExpression _expression = this.expression(_builder, false);
XExpression _last = IterableExtensions.<XExpression>last(((XBlockExpression) _expression).getExpressions());
final XIfExpression ifExpr = ((XIfExpression) _last);
XExpression _then = ifExpr.getThen();
final XBlockExpression block = ((XBlockExpression) _then);
final IExpressionScope expressionScope = this._iBatchTypeResolver.resolveTypes(block).getExpressionScope(block, IExpressionScope.Anchor.BEFORE);
this.contains(expressionScope, "charAt");
this.contains(expressionScope, "it");
this.contains(expressionScope, "operator_lessThan");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例2: testReassignedType_02
import org.eclipse.xtext.xbase.XIfExpression; //导入方法依赖的package包/类
@Test
public void testReassignedType_02() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{ var it = new Object() if (it instanceof String) { it = new Object() } }");
XExpression _expression = this.expression(_builder, false);
XExpression _last = IterableExtensions.<XExpression>last(((XBlockExpression) _expression).getExpressions());
final XIfExpression ifExpr = ((XIfExpression) _last);
XExpression _then = ifExpr.getThen();
final XBlockExpression block = ((XBlockExpression) _then);
final IExpressionScope expressionScope = this._iBatchTypeResolver.resolveTypes(block).getExpressionScope(block, IExpressionScope.Anchor.BEFORE);
this.contains(expressionScope, "charAt");
this.contains(expressionScope, "it");
this.contains(expressionScope, "operator_lessThan");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例3: testReassignedType_03
import org.eclipse.xtext.xbase.XIfExpression; //导入方法依赖的package包/类
@Test
public void testReassignedType_03() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{ var it = new Object() if (it instanceof String) { it = new Object() } }");
XExpression _expression = this.expression(_builder, false);
XExpression _last = IterableExtensions.<XExpression>last(((XBlockExpression) _expression).getExpressions());
final XIfExpression ifExpr = ((XIfExpression) _last);
XExpression _then = ifExpr.getThen();
final XBlockExpression block = ((XBlockExpression) _then);
final XExpression assignment = IterableExtensions.<XExpression>head(block.getExpressions());
final IExpressionScope expressionScope = this._iBatchTypeResolver.resolveTypes(assignment).getExpressionScope(assignment, IExpressionScope.Anchor.AFTER);
this.containsNot(expressionScope, "charAt");
this.contains(expressionScope, "it");
this.containsNot(expressionScope, "operator_lessThan");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例4: testIf_3
import org.eclipse.xtext.xbase.XIfExpression; //导入方法依赖的package包/类
@Test public void testIf_3() throws Exception {
XIfExpression ie = (XIfExpression) expression("if (foo) bar else if (baz) if (apa) bpa else cpa");
XIfExpression nestedIf = (XIfExpression) ie.getElse();
XIfExpression secondNested = (XIfExpression) nestedIf.getThen();
XFeatureCall cpa = (XFeatureCall) secondNested.getElse();
assertEquals("cpa",cpa.getConcreteSyntaxFeatureName());
}
示例5: isVariableDeclarationRequired
import org.eclipse.xtext.xbase.XIfExpression; //导入方法依赖的package包/类
@Override
protected boolean isVariableDeclarationRequired(XExpression expr, ITreeAppendable b, boolean recursive) {
if (expr instanceof XAnnotation) {
return false;
}
if (expr instanceof XListLiteral) {
return false;
}
if (expr instanceof XSetLiteral) {
return false;
}
if (expr instanceof XCastedExpression) {
return false;
}
if (expr instanceof XInstanceOfExpression) {
return false;
}
if (expr instanceof XMemberFeatureCall && isVariableDeclarationRequired((XMemberFeatureCall) expr, b))
return true;
EObject container = expr.eContainer();
if ((container instanceof XVariableDeclaration)
|| (container instanceof XReturnExpression)
|| (container instanceof XThrowExpression)) {
return false;
}
if (container instanceof XIfExpression) {
XIfExpression ifExpression = (XIfExpression) container;
if (ifExpression.getThen() == expr || ifExpression.getElse() == expr) {
return false;
}
}
if (container instanceof XCasePart) {
XCasePart casePart = (XCasePart) container;
if (casePart.getThen() == expr) {
return false;
}
}
if (container instanceof XSwitchExpression) {
XSwitchExpression switchExpression = (XSwitchExpression) container;
if (switchExpression.getDefault() == expr) {
return false;
}
}
if (container instanceof XBlockExpression) {
List<XExpression> siblings = ((XBlockExpression) container).getExpressions();
if (siblings.get(siblings.size() - 1) == expr) {
return isVariableDeclarationRequired(getFeatureCall(expr), expr, b);
}
}
if (container instanceof XClosure) {
if (((XClosure) container).getExpression() == expr) {
return false;
}
}
if (expr instanceof XAssignment) {
XAssignment a = (XAssignment) expr;
for (XExpression arg : getActualArguments(a)) {
if (isVariableDeclarationRequired(arg, b, recursive)) {
return true;
}
}
}
return super.isVariableDeclarationRequired(expr, b, recursive);
}
示例6: getElse
import org.eclipse.xtext.xbase.XIfExpression; //导入方法依赖的package包/类
@Override
protected XExpression getElse(XIfExpression ifExpression) {
if (ifExpression.getElse() != null)
return ifExpression.getThen();
return super.getElse(ifExpression);
}
示例7: getThen
import org.eclipse.xtext.xbase.XIfExpression; //导入方法依赖的package包/类
/**
* Only for testing purpose.
* @nooverride This method is not intended to be re-implemented or extended by clients.
* @noreference This method is not intended to be referenced by clients.
*/
/* @Nullable */
protected XExpression getThen(XIfExpression ifExpression) {
return ifExpression.getThen();
}