本文整理了Java中org.eclipse.xtext.xbase.XMemberFeatureCall.isNullSafe()
方法的一些代码示例,展示了XMemberFeatureCall.isNullSafe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMemberFeatureCall.isNullSafe()
方法的具体详情如下:
包路径:org.eclipse.xtext.xbase.XMemberFeatureCall
类名称:XMemberFeatureCall
方法名:isNullSafe
[英]Returns the value of the 'Null Safe' attribute.
If the meaning of the 'Null Safe' attribute isn't clear, there really should be more of a description here...
[中]返回“Null-Safe”属性的值。
如果“Null-Safe”属性的含义不清楚,这里真的应该有更多的描述。。。
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected boolean isVariableDeclarationRequired(XMemberFeatureCall expr, @SuppressWarnings("unused") ITreeAppendable b) {
return expr.isNullSafe();
}
代码示例来源:origin: io.sarl.lang/io.sarl.lang
/** Generate a feature call.
*
* @param expr the call expression.
*/
public void generate(XAbstractFeatureCall expr) {
if (expr.isTypeLiteral()) {
final JvmType type = (JvmType) expr.getFeature();
this.codeReceiver.append(type);
//} else if (getExpressionHelper().isShortCircuitOperation(expr)) {
// generateShortCircuitInvocation(expr);
} else {
if (expr instanceof XMemberFeatureCall && ((XMemberFeatureCall) expr).isNullSafe()) {
featureCalltoJavaExpression(expr, () -> expr);
} else {
featureCalltoJavaExpression(expr, null);
}
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected boolean isPotentialTypeLiteralImpl(XExpression featureCall, /* @Nullable */ IResolvedTypes resolvedTypes, boolean staticNotation) {
if (featureCall instanceof XMemberFeatureCall) {
XMemberFeatureCall casted = (XMemberFeatureCall) featureCall;
if (casted.isExplicitOperationCallOrBuilderSyntax() || casted.isNullSafe()) {
return false;
}
XExpression target = casted.getMemberCallTarget();
if (casted.isExplicitStatic() != staticNotation) {
return false;
}
return isPotentialTypeLiteralImpl(target, resolvedTypes, staticNotation);
}
if (featureCall instanceof XFeatureCall) {
XFeatureCall casted = (XFeatureCall) featureCall;
if (casted.isExplicitOperationCallOrBuilderSyntax()) {
return false;
}
if (resolvedTypes == null)
return true;
LightweightTypeReference knownType = resolvedTypes.getActualType(casted);
if (knownType == null || knownType.isUnknown()) {
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected Object _doEvaluate(final XMemberFeatureCall featureCall, final IEvaluationContext context, final CancelIndicator indicator) {
if (featureCall.isTypeLiteral()) {
JvmType type = (JvmType) featureCall.getFeature();
Object result = translateJvmTypeToResult(type, 0);
return result;
} else {
XExpression receiver = getActualReceiver(featureCall); //, featureCall.getFeature(), featureCall.getImplicitReceiver());
Object receiverObj = receiver==null?null:internalEvaluate(receiver, context, indicator);
if (featureCall.isNullSafe() && receiverObj==null) {
return getDefaultObjectValue(typeResolver.resolveTypes(featureCall).getActualType(featureCall));
}
return invokeFeature(featureCall.getFeature(), featureCall, receiverObj, context, indicator);
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
@Check
void checkNullSafeFeatureCallWithPrimitives(XMemberFeatureCall featureCall) {
if (featureCall.isNullSafe()) {
if (getActualType(featureCall.getMemberCallTarget()).isPrimitive()) {
error("Cannot use null-safe feature call on primitive receiver", featureCall,
Literals.XMEMBER_FEATURE_CALL__NULL_SAFE, NULL_SAFE_FEATURE_CALL_ON_PRIMITIVE);
return;
}
LightweightTypeReference type = getActualType(featureCall);
if (type.isPrimitive() && isValueExpectedRecursive(featureCall)) {
addIssue("Null-safe call of primitive-valued feature " + featureCall.getConcreteSyntaxFeatureName()
+ ", default value "+ getDefaultValue(type) +" will be used",
featureCall, NULL_SAFE_FEATURE_CALL_OF_PRIMITIVE_VALUED_FEATURE);
}
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
if (featureCall.isNullSafe())
acceptor.accept(memberFeatureCallElements.getNullSafeQuestionMarkFullStopKeyword_1_1_0_0_1_1_0());
else if (featureCall.isExplicitStatic())
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
return !((XMemberFeatureCall) featureCall).isNullSafe();
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
if (((XMemberFeatureCall) expr.eContainer()).isNullSafe()) {
if (expr instanceof XFeatureCall) {
JvmIdentifiableElement feature = ((XFeatureCall) expr).getFeature();
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
if (expr instanceof XMemberFeatureCall && ((XMemberFeatureCall) expr).isNullSafe()) {
compileNullSafeFeatureCall((XMemberFeatureCall) expr, b, isReferenced);
} else {
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
final XMemberFeatureCall it = ((XMemberFeatureCall)top);
boolean _matched = false;
boolean _isNullSafe = it.isNullSafe();
if (_isNullSafe) {
_matched=true;
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
final XMemberFeatureCall it = call;
boolean _matched = false;
boolean _isNullSafe = it.isNullSafe();
if (_isNullSafe) {
_matched=true;
内容来源于网络,如有侵权,请联系作者删除!