本文整理汇总了Java中org.eclipse.xtext.xbase.XNullLiteral类的典型用法代码示例。如果您正苦于以下问题:Java XNullLiteral类的具体用法?Java XNullLiteral怎么用?Java XNullLiteral使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XNullLiteral类属于org.eclipse.xtext.xbase包,在下文中一共展示了XNullLiteral类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: internalToConvertedExpression
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
@Override
protected void internalToConvertedExpression(XExpression obj, ITreeAppendable appendable) {
if (obj instanceof XStringLiteral) {
_toJavaExpression((XStringLiteral) obj, appendable);
} else if (obj instanceof XNumberLiteral) {
_toJavaExpression((XNumberLiteral) obj, appendable);
} else if (obj instanceof XNullLiteral) {
_toJavaExpression((XNullLiteral) obj, appendable);
} else if (obj instanceof XBooleanLiteral) {
_toJavaExpression((XBooleanLiteral) obj, appendable);
} else if (obj instanceof XTypeLiteral) {
_toJavaExpression((XTypeLiteral) obj, appendable);
} else {
super.internalToConvertedExpression(obj, appendable);
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:LiteralsCompiler.java
示例2: doInternalToJavaStatement
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
@Override
protected void doInternalToJavaStatement(XExpression obj, ITreeAppendable appendable, boolean isReferenced) {
if (obj instanceof XStringLiteral) {
_toJavaStatement((XStringLiteral) obj, appendable, isReferenced);
} else if (obj instanceof XNumberLiteral) {
_toJavaStatement((XNumberLiteral) obj, appendable, isReferenced);
} else if (obj instanceof XNullLiteral) {
_toJavaStatement((XNullLiteral) obj, appendable, isReferenced);
} else if (obj instanceof XBooleanLiteral) {
_toJavaStatement((XBooleanLiteral) obj, appendable, isReferenced);
} else if (obj instanceof XTypeLiteral) {
_toJavaStatement((XTypeLiteral) obj, appendable, isReferenced);
} else {
super.doInternalToJavaStatement(obj, appendable, isReferenced);
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:LiteralsCompiler.java
示例3: appendImmutableCollectionExpression
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
protected void appendImmutableCollectionExpression(XCollectionLiteral literal,
ITreeAppendable b, String collectionsMethod, Class<?> guavaHelper, String guavaHelperMethod) {
LightweightTypeReference collectionElementType = getCollectionElementType(literal);
b.append(Collections.class);
b.append(".<").append(collectionElementType).append(">").append(collectionsMethod).append("(");
b.append(guavaHelper).append(".<").append(collectionElementType).append(">").append(guavaHelperMethod).append("(");
boolean isFirst = true;
for(XExpression element: literal.getElements()) {
if(!isFirst)
b.append(", ");
isFirst = false;
if(element instanceof XNullLiteral) {
b.append("(").append(collectionElementType).append(")");
}
internalToJavaExpression(element, b);
}
b.append("))");
return;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:XbaseCompiler.java
示例4: testChildrenAddEntryForParent
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
@Test
public void testChildrenAddEntryForParent() {
try {
this.resolver.setTypeComputer(this);
final XExpression expression = this.expression("{ null }");
this.resolver.initializeFrom(expression);
final PublicResolvedTypes resolution = new PublicResolvedTypes(this.resolver);
final AnyTypeReference any = resolution.getReferenceOwner().newAnyTypeReference();
IFeatureScopeSession _newSession = this.resolver.getBatchScopeProvider().newSession(expression.eResource());
new ExpressionBasedRootTypeComputationState(resolution, _newSession, expression, any).computeTypes();
Assert.assertEquals(any.toString(), resolution.getActualType(expression).toString());
EObject _head = IterableExtensions.<EObject>head(expression.eContents());
Assert.assertEquals(any.toString(), resolution.getActualType(((XNullLiteral) _head)).toString());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:TypeComputationStateTest.java
示例5: hasSideEffects
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
/**
* @return whether the expression itself (not its children) possibly causes a side-effect
*/
public boolean hasSideEffects(XExpression expr) {
if (expr instanceof XClosure
|| expr instanceof XStringLiteral
|| expr instanceof XTypeLiteral
|| expr instanceof XBooleanLiteral
|| expr instanceof XNumberLiteral
|| expr instanceof XNullLiteral
|| expr instanceof XAnnotation
)
return false;
if(expr instanceof XCollectionLiteral) {
for(XExpression element: ((XCollectionLiteral)expr).getElements()) {
if(hasSideEffects(element))
return true;
}
return false;
}
if (expr instanceof XAbstractFeatureCall) {
XAbstractFeatureCall featureCall = (XAbstractFeatureCall) expr;
return hasSideEffects(featureCall, true);
}
if (expr instanceof XConstructorCall) {
XConstructorCall constrCall = (XConstructorCall) expr;
return findPureAnnotation(constrCall.getConstructor()) == null;
}
return true;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:31,代码来源:XExpressionHelper.java
示例6: isVariableDeclarationRequired
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
@Override
protected boolean isVariableDeclarationRequired(XExpression expr, ITreeAppendable b, boolean recursive) {
if (expr instanceof XBooleanLiteral
|| expr instanceof XStringLiteral
|| expr instanceof XNumberLiteral
|| expr instanceof XTypeLiteral
|| expr instanceof XClosure
|| expr instanceof XNullLiteral)
return false;
return super.isVariableDeclarationRequired(expr,b, recursive);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:LiteralsCompiler.java
示例7: internalEvaluate
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
public EvaluationResult internalEvaluate(final XExpression it, final EvaluationContext context) {
if (it instanceof XBinaryOperation) {
return _internalEvaluate((XBinaryOperation)it, context);
} else if (it instanceof XUnaryOperation) {
return _internalEvaluate((XUnaryOperation)it, context);
} else if (it instanceof XAbstractFeatureCall) {
return _internalEvaluate((XAbstractFeatureCall)it, context);
} else if (it instanceof XBooleanLiteral) {
return _internalEvaluate((XBooleanLiteral)it, context);
} else if (it instanceof XCastedExpression) {
return _internalEvaluate((XCastedExpression)it, context);
} else if (it instanceof XNullLiteral) {
return _internalEvaluate((XNullLiteral)it, context);
} else if (it instanceof XNumberLiteral) {
return _internalEvaluate((XNumberLiteral)it, context);
} else if (it instanceof XStringLiteral) {
return _internalEvaluate((XStringLiteral)it, context);
} else if (it instanceof XTypeLiteral) {
return _internalEvaluate((XTypeLiteral)it, context);
} else if (it != null) {
return _internalEvaluate(it, context);
} else if (it == null) {
return _internalEvaluate((Void)null, context);
} else {
throw new IllegalArgumentException("Unhandled parameter types: " +
Arrays.<Object>asList(it, context).toString());
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:29,代码来源:ConstantConditionsInterpreter.java
示例8: computeTypes
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
@Override
public void computeTypes(final XExpression expression, final ITypeComputationState state) {
try {
Assert.assertTrue("state is instanceof ExpressionTypeComputationState", (state instanceof ExpressionTypeComputationState));
final LightweightTypeReference expectedType = IterableExtensions.head(state.getExpectations()).getExpectedType();
if ((expression instanceof XNullLiteral)) {
final ExpressionTypeComputationState casted = ((ExpressionTypeComputationState) state);
final ResolvedTypes resolution = this._reflectExtensions.<ResolvedTypes>get(casted, "resolvedTypes");
final ResolvedTypes parentResolution = this._reflectExtensions.<ResolvedTypes>get(this._reflectExtensions.<ExpressionTypeComputationState>get(casted, "parent"), "resolvedTypes");
EObject _eContainer = ((XNullLiteral)expression).eContainer();
Assert.assertNull(parentResolution.getActualType(((XExpression) _eContainer)));
state.acceptActualType(expectedType);
Assert.assertNull(parentResolution.getActualType(expression));
Assert.assertEquals(expectedType.getIdentifier(), resolution.getActualType(expression).getIdentifier());
EObject _eContainer_1 = ((XNullLiteral)expression).eContainer();
Assert.assertNull(parentResolution.getActualType(((XExpression) _eContainer_1)));
} else {
Assert.assertTrue((expression instanceof XBlockExpression));
EObject _head = IterableExtensions.<EObject>head(expression.eContents());
final XNullLiteral nullLiteral = ((XNullLiteral) _head);
state.computeTypes(nullLiteral);
final ResolvedTypes resolution_1 = this._reflectExtensions.<ResolvedTypes>get(state, "resolvedTypes");
Assert.assertEquals(expectedType.getIdentifier(), resolution_1.getActualType(nullLiteral).getIdentifier());
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:29,代码来源:TypeComputationStateTest.java
示例9: genericTestInitializeSafely
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
protected <T extends Object> void genericTestInitializeSafely(final Function3<? super EObject, ? super String, ? super Procedure1<? super T>, ? extends EObject> create) {
final XNullLiteral expr = XbaseFactory.eINSTANCE.createXNullLiteral();
final Wrapper<Boolean> initialized = new Wrapper<Boolean>(Boolean.valueOf(false));
final Procedure1<T> _function = (T it) -> {
initialized.set(Boolean.valueOf(true));
throw new RuntimeException();
};
final EObject element = create.apply(expr, "foo", _function);
Assert.assertTrue((initialized.get()).booleanValue());
Assert.assertNotNull(element);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:JvmTypesBuilderTest.java
示例10: sequence_XNullLiteral
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
@Deprecated
protected void sequence_XNullLiteral(EObject context, XNullLiteral semanticObject) {
sequence_XNullLiteral(createContext(context, semanticObject), semanticObject);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:5,代码来源:AbstractXbaseSemanticSequencer.java
示例11: computeTypes
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
@Override
public void computeTypes(XExpression expression, ITypeComputationState state) {
if (expression instanceof XAssignment) {
_computeTypes((XAssignment)expression, state);
} else if (expression instanceof XAbstractFeatureCall) {
_computeTypes((XAbstractFeatureCall)expression, state);
} else if (expression instanceof XDoWhileExpression) {
_computeTypes((XDoWhileExpression)expression, state);
} else if (expression instanceof XWhileExpression) {
_computeTypes((XWhileExpression)expression, state);
} else if (expression instanceof XBlockExpression) {
_computeTypes((XBlockExpression)expression, state);
} else if (expression instanceof XBooleanLiteral) {
_computeTypes((XBooleanLiteral)expression, state);
} else if (expression instanceof XCastedExpression) {
_computeTypes((XCastedExpression)expression, state);
} else if (expression instanceof XClosure) {
_computeTypes((XClosure)expression, state);
} else if (expression instanceof XConstructorCall) {
_computeTypes((XConstructorCall)expression, state);
} else if (expression instanceof XForLoopExpression) {
_computeTypes((XForLoopExpression)expression, state);
} else if (expression instanceof XBasicForLoopExpression) {
_computeTypes((XBasicForLoopExpression)expression, state);
} else if (expression instanceof XIfExpression) {
_computeTypes((XIfExpression)expression, state);
} else if (expression instanceof XInstanceOfExpression) {
_computeTypes((XInstanceOfExpression)expression, state);
} else if (expression instanceof XNumberLiteral) {
_computeTypes((XNumberLiteral)expression, state);
} else if (expression instanceof XNullLiteral) {
_computeTypes((XNullLiteral)expression, state);
} else if (expression instanceof XReturnExpression) {
_computeTypes((XReturnExpression)expression, state);
} else if (expression instanceof XStringLiteral) {
_computeTypes((XStringLiteral)expression, state);
} else if (expression instanceof XSwitchExpression) {
_computeTypes((XSwitchExpression)expression, state);
} else if (expression instanceof XThrowExpression) {
_computeTypes((XThrowExpression)expression, state);
} else if (expression instanceof XTryCatchFinallyExpression) {
_computeTypes((XTryCatchFinallyExpression)expression, state);
} else if (expression instanceof XTypeLiteral) {
_computeTypes((XTypeLiteral)expression, state);
} else if (expression instanceof XVariableDeclaration) {
_computeTypes((XVariableDeclaration)expression, state);
} else if (expression instanceof XListLiteral) {
_computeTypes((XListLiteral)expression, state);
} else if (expression instanceof XSetLiteral) {
_computeTypes((XSetLiteral)expression, state);
} else if (expression instanceof XSynchronizedExpression) {
_computeTypes((XSynchronizedExpression)expression, state);
} else {
throw new UnsupportedOperationException("Missing type computation for expression type: " + expression.eClass().getName() + " / " + state);
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:57,代码来源:XbaseTypeComputer.java
示例12: _computeTypes
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
/**
* @param object used for dispatching
*/
protected void _computeTypes(XNullLiteral object, ITypeComputationState state) {
state.acceptActualType(state.getReferenceOwner().newAnyTypeReference());
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:7,代码来源:XbaseTypeComputer.java
示例13: sequence_XExpression
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
/**
* This is for backwards compatibility < 2.3RC2 due to change in the naming strategy for sequencer methods
*/
@Deprecated
protected void sequence_XExpression(EObject context, XNullLiteral semanticObject) {
super.sequence_XNullLiteral(context, semanticObject);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:XbaseSemanticSequencer.java
示例14: _toJavaExpression
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
/**
* @param expr the expression. Used by the dispatch strategy.
*/
public void _toJavaExpression(XNullLiteral expr, ITreeAppendable b) {
b.append("null");
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:7,代码来源:LiteralsCompiler.java
示例15: _toJavaStatement
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
public void _toJavaStatement(XNullLiteral expr, ITreeAppendable b, boolean isReferenced) {
generateComment(expr, b, isReferenced);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:4,代码来源:LiteralsCompiler.java
示例16: doEvaluate
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
/**
* don't call this directly. Always call evaluate() internalEvaluate()
*/
protected Object doEvaluate(XExpression expression, IEvaluationContext context, CancelIndicator indicator) {
if (expression instanceof XAssignment) {
return _doEvaluate((XAssignment)expression, context, indicator);
} else if (expression instanceof XDoWhileExpression) {
return _doEvaluate((XDoWhileExpression)expression, context, indicator);
} else if (expression instanceof XMemberFeatureCall) {
return _doEvaluate((XMemberFeatureCall)expression, context, indicator);
} else if (expression instanceof XWhileExpression) {
return _doEvaluate((XWhileExpression)expression, context, indicator);
} else if (expression instanceof XFeatureCall) {
return _doEvaluate((XFeatureCall)expression, context, indicator);
} else if (expression instanceof XAbstractFeatureCall) {
return _doEvaluate((XAbstractFeatureCall)expression, context, indicator);
} else if (expression instanceof XBlockExpression) {
return _doEvaluate((XBlockExpression)expression, context, indicator);
} else if (expression instanceof XSynchronizedExpression) {
return _doEvaluate((XSynchronizedExpression)expression, context, indicator);
} else if (expression instanceof XBooleanLiteral) {
return _doEvaluate((XBooleanLiteral)expression, context, indicator);
} else if (expression instanceof XCastedExpression) {
return _doEvaluate((XCastedExpression)expression, context, indicator);
} else if (expression instanceof XClosure) {
return _doEvaluate((XClosure)expression, context, indicator);
} else if (expression instanceof XConstructorCall) {
return _doEvaluate((XConstructorCall)expression, context, indicator);
} else if (expression instanceof XForLoopExpression) {
return _doEvaluate((XForLoopExpression)expression, context, indicator);
} else if (expression instanceof XBasicForLoopExpression) {
return _doEvaluate((XBasicForLoopExpression)expression, context, indicator);
} else if (expression instanceof XIfExpression) {
return _doEvaluate((XIfExpression)expression, context, indicator);
} else if (expression instanceof XInstanceOfExpression) {
return _doEvaluate((XInstanceOfExpression)expression, context, indicator);
} else if (expression instanceof XNullLiteral) {
return _doEvaluate((XNullLiteral)expression, context, indicator);
} else if (expression instanceof XNumberLiteral) {
return _doEvaluate((XNumberLiteral)expression, context, indicator);
} else if (expression instanceof XReturnExpression) {
return _doEvaluate((XReturnExpression)expression, context, indicator);
} else if (expression instanceof XStringLiteral) {
return _doEvaluate((XStringLiteral)expression, context, indicator);
} else if (expression instanceof XSwitchExpression) {
return _doEvaluate((XSwitchExpression)expression, context, indicator);
} else if (expression instanceof XThrowExpression) {
return _doEvaluate((XThrowExpression)expression, context, indicator);
} else if (expression instanceof XTryCatchFinallyExpression) {
return _doEvaluate((XTryCatchFinallyExpression)expression, context, indicator);
} else if (expression instanceof XTypeLiteral) {
return _doEvaluate((XTypeLiteral)expression, context, indicator);
} else if (expression instanceof XVariableDeclaration) {
return _doEvaluate((XVariableDeclaration)expression, context, indicator);
} else if (expression instanceof XListLiteral) {
return _doEvaluate((XListLiteral)expression, context, indicator);
} else if (expression instanceof XSetLiteral) {
return _doEvaluate((XSetLiteral)expression, context, indicator);
} else {
throw new IllegalArgumentException("Unhandled parameter types: " +
Arrays.<Object>asList(expression, context, indicator).toString());
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:64,代码来源:XbaseInterpreter.java
示例17: _findImplicitReturns
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
protected void _findImplicitReturns(final XNullLiteral expression, final ImplicitReturnFinder.Acceptor acceptor) {
acceptor.accept(expression);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:4,代码来源:XbaseImplicitReturnFinder.java
示例18: findImplicitReturns
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
public void findImplicitReturns(final XExpression expression, final ImplicitReturnFinder.Acceptor acceptor) {
if (expression instanceof XAbstractFeatureCall) {
_findImplicitReturns((XAbstractFeatureCall)expression, acceptor);
return;
} else if (expression instanceof XBlockExpression) {
_findImplicitReturns((XBlockExpression)expression, acceptor);
return;
} else if (expression instanceof XBooleanLiteral) {
_findImplicitReturns((XBooleanLiteral)expression, acceptor);
return;
} else if (expression instanceof XCastedExpression) {
_findImplicitReturns((XCastedExpression)expression, acceptor);
return;
} else if (expression instanceof XClosure) {
_findImplicitReturns((XClosure)expression, acceptor);
return;
} else if (expression instanceof XCollectionLiteral) {
_findImplicitReturns((XCollectionLiteral)expression, acceptor);
return;
} else if (expression instanceof XConstructorCall) {
_findImplicitReturns((XConstructorCall)expression, acceptor);
return;
} else if (expression instanceof XIfExpression) {
_findImplicitReturns((XIfExpression)expression, acceptor);
return;
} else if (expression instanceof XInstanceOfExpression) {
_findImplicitReturns((XInstanceOfExpression)expression, acceptor);
return;
} else if (expression instanceof XNullLiteral) {
_findImplicitReturns((XNullLiteral)expression, acceptor);
return;
} else if (expression instanceof XNumberLiteral) {
_findImplicitReturns((XNumberLiteral)expression, acceptor);
return;
} else if (expression instanceof XStringLiteral) {
_findImplicitReturns((XStringLiteral)expression, acceptor);
return;
} else if (expression instanceof XSwitchExpression) {
_findImplicitReturns((XSwitchExpression)expression, acceptor);
return;
} else if (expression instanceof XSynchronizedExpression) {
_findImplicitReturns((XSynchronizedExpression)expression, acceptor);
return;
} else if (expression instanceof XTryCatchFinallyExpression) {
_findImplicitReturns((XTryCatchFinallyExpression)expression, acceptor);
return;
} else if (expression instanceof XTypeLiteral) {
_findImplicitReturns((XTypeLiteral)expression, acceptor);
return;
} else if (expression != null) {
_findImplicitReturns(expression, acceptor);
return;
} else if (expression == null) {
_findImplicitReturns((Void)null, acceptor);
return;
} else {
throw new IllegalArgumentException("Unhandled parameter types: " +
Arrays.<Object>asList(expression, acceptor).toString());
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:61,代码来源:XbaseImplicitReturnFinder.java
示例19: _internalEvaluate
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
protected EvaluationResult _internalEvaluate(final XNullLiteral it, final EvaluationContext context) {
return new EvaluationResult(null, true);
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:4,代码来源:ConstantConditionsInterpreter.java
示例20: _doEvaluate
import org.eclipse.xtext.xbase.XNullLiteral; //导入依赖的package包/类
/**
* @param literal unused in this context but required for dispatching
* @param context unused in this context but required for dispatching
* @param indicator unused in this context but required for dispatching
*/
protected Object _doEvaluate(XNullLiteral literal, IEvaluationContext context, CancelIndicator indicator) {
return null;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:9,代码来源:XbaseInterpreter.java
注:本文中的org.eclipse.xtext.xbase.XNullLiteral类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论