本文整理汇总了Java中org.eclipse.xtext.xbase.XSynchronizedExpression类的典型用法代码示例。如果您正苦于以下问题:Java XSynchronizedExpression类的具体用法?Java XSynchronizedExpression怎么用?Java XSynchronizedExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSynchronizedExpression类属于org.eclipse.xtext.xbase包,在下文中一共展示了XSynchronizedExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _computeTypes
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
protected void _computeTypes(XSynchronizedExpression expr, ITypeComputationState state) {
ITypeComputationState paramState = state.withExpectation(state.getReferenceOwner().newReferenceToObject());
ITypeComputationResult paramType = paramState.computeTypes(expr.getParam());
LightweightTypeReference actualParamType = paramType.getActualExpressionType();
if (actualParamType != null && (actualParamType.isPrimitive() || actualParamType.isAny())) {
state.addDiagnostic(new EObjectDiagnosticImpl(
Severity.ERROR,
IssueCodes.INCOMPATIBLE_TYPES,
actualParamType.getHumanReadableName() + " is not a valid type's argument for the synchronized expression.",
expr.getParam(),
null,
-1,
new String[] {
}));
}
state.computeTypes(expr.getExpression());
}
示例2: bracesAreAddedByOuterStructure
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
protected boolean bracesAreAddedByOuterStructure(XExpression expression) {
EObject container = expression.eContainer();
if (container instanceof XTryCatchFinallyExpression
|| container instanceof XIfExpression
|| container instanceof XClosure
|| container instanceof XSynchronizedExpression) {
return true;
}
if (container instanceof XBlockExpression) {
XBlockExpression blockExpression = (XBlockExpression) container;
EList<XExpression> expressions = blockExpression.getExpressions();
if (expressions.size() == 1 && expressions.get(0) == expression) {
return bracesAreAddedByOuterStructure(blockExpression);
}
}
if (!(container instanceof XExpression)) {
return true;
}
return false;
}
示例3: _toJavaStatement
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
protected void _toJavaStatement(final XSynchronizedExpression synchronizedExpression, final ITreeAppendable b, boolean isReferenced) {
if (isReferenced) {
declareSyntheticVariable(synchronizedExpression, b);
}
ITreeAppendable synchronizedAppendable = b.trace(synchronizedExpression, true);
XExpression param = synchronizedExpression.getParam();
if (!canCompileToJavaExpression(param, b))
internalToJavaStatement(param, synchronizedAppendable, isReferenced);
synchronizedAppendable.newLine().append("synchronized (");
internalToJavaExpression(param, synchronizedAppendable);
synchronizedAppendable.append(") {").increaseIndentation();
synchronizedAppendable.openPseudoScope();
XExpression expression = synchronizedExpression.getExpression();
internalToJavaStatement(expression, b, isReferenced);
if (isReferenced) {
b.newLine().append(getVarName(synchronizedExpression, synchronizedAppendable)).append(" = ");
internalToConvertedExpression(expression, b, getLightweightType(synchronizedExpression));
b.append(";");
}
synchronizedAppendable.closeScope();
synchronizedAppendable.decreaseIndentation().newLine().append("}");
}
示例4: internalToConvertedExpression
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
@Override
protected void internalToConvertedExpression(XExpression obj, ITreeAppendable appendable) {
if (obj instanceof XBlockExpression) {
_toJavaExpression((XBlockExpression) obj, appendable);
} else if (obj instanceof XCastedExpression) {
_toJavaExpression((XCastedExpression) obj, appendable);
} else if (obj instanceof XClosure) {
_toJavaExpression((XClosure) obj, appendable);
} else if (obj instanceof XAnnotation) {
_toJavaExpression((XAnnotation) obj, appendable);
} else if (obj instanceof XConstructorCall) {
_toJavaExpression((XConstructorCall) obj, appendable);
} else if (obj instanceof XIfExpression) {
_toJavaExpression((XIfExpression) obj, appendable);
} else if (obj instanceof XInstanceOfExpression) {
_toJavaExpression((XInstanceOfExpression) obj, appendable);
} else if (obj instanceof XSwitchExpression) {
_toJavaExpression((XSwitchExpression) obj, appendable);
} else if (obj instanceof XTryCatchFinallyExpression) {
_toJavaExpression((XTryCatchFinallyExpression) obj, appendable);
} else if (obj instanceof XListLiteral) {
_toJavaExpression((XListLiteral) obj, appendable);
} else if (obj instanceof XSetLiteral) {
_toJavaExpression((XSetLiteral) obj, appendable);
} else if (obj instanceof XSynchronizedExpression) {
_toJavaExpression((XSynchronizedExpression) obj, appendable);
} else if (obj instanceof XReturnExpression) {
_toJavaExpression((XReturnExpression) obj, appendable);
} else if (obj instanceof XThrowExpression) {
_toJavaExpression((XThrowExpression) obj, appendable);
} else {
super.internalToConvertedExpression(obj, appendable);
}
}
示例5: _exitPoints
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
protected Collection<IEarlyExitComputer.ExitPoint> _exitPoints(final XSynchronizedExpression expression) {
Collection<IEarlyExitComputer.ExitPoint> paramExitPoints = this.getExitPoints(expression.getParam());
boolean _isNotEmpty = this.isNotEmpty(paramExitPoints);
if (_isNotEmpty) {
return paramExitPoints;
}
return this.getExitPoints(expression.getExpression());
}
示例6: exitPoints
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
protected Collection<IEarlyExitComputer.ExitPoint> exitPoints(final XExpression expression) {
if (expression instanceof XDoWhileExpression) {
return _exitPoints((XDoWhileExpression)expression);
} else if (expression instanceof XWhileExpression) {
return _exitPoints((XWhileExpression)expression);
} else if (expression instanceof XAbstractFeatureCall) {
return _exitPoints((XAbstractFeatureCall)expression);
} else if (expression instanceof XBasicForLoopExpression) {
return _exitPoints((XBasicForLoopExpression)expression);
} else if (expression instanceof XBlockExpression) {
return _exitPoints((XBlockExpression)expression);
} else if (expression instanceof XConstructorCall) {
return _exitPoints((XConstructorCall)expression);
} else if (expression instanceof XForLoopExpression) {
return _exitPoints((XForLoopExpression)expression);
} else if (expression instanceof XIfExpression) {
return _exitPoints((XIfExpression)expression);
} else if (expression instanceof XReturnExpression) {
return _exitPoints((XReturnExpression)expression);
} else if (expression instanceof XSwitchExpression) {
return _exitPoints((XSwitchExpression)expression);
} else if (expression instanceof XSynchronizedExpression) {
return _exitPoints((XSynchronizedExpression)expression);
} else if (expression instanceof XThrowExpression) {
return _exitPoints((XThrowExpression)expression);
} else if (expression instanceof XTryCatchFinallyExpression) {
return _exitPoints((XTryCatchFinallyExpression)expression);
} else if (expression instanceof XVariableDeclaration) {
return _exitPoints((XVariableDeclaration)expression);
} else if (expression != null) {
return _exitPoints(expression);
} else {
throw new IllegalArgumentException("Unhandled parameter types: " +
Arrays.<Object>asList(expression).toString());
}
}
示例7: testSynchronized
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
@Test
public void testSynchronized() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("synchronized (this) {1}");
XExpression _expression = this.expression(_builder);
final XSynchronizedExpression block = ((XSynchronizedExpression) _expression);
XExpression _expression_1 = block.getExpression();
this.hasImplicitReturns(block, IterableExtensions.<XExpression>head(((XBlockExpression) _expression_1).getExpressions()));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例8: sequence_XSynchronizedExpression
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
/**
* Constraint:
* (param=XExpression expression=XExpression)
*/
protected void sequence_XSynchronizedExpression(EObject context, XSynchronizedExpression semanticObject) {
if(errorAcceptor != null) {
if(transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM));
if(transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION));
}
INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getParamXExpressionParserRuleCall_1_0(), semanticObject.getParam());
feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getExpressionXExpressionParserRuleCall_3_0(), semanticObject.getExpression());
feeder.finish();
}
示例9: sequence_XSynchronizedExpression
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
@Deprecated
protected void sequence_XSynchronizedExpression(EObject context, XSynchronizedExpression semanticObject) {
sequence_XSynchronizedExpression(createContext(context, semanticObject), semanticObject);
}
示例10: computeTypes
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的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);
}
}
示例11: isIntentionalEarlyExit
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
/**
* Returns <code>true</code> for expressions that seem to be early exit expressions, e.g.
* <pre>
* while(condition) {
* if (anotherCondition)
* return value
* changeResultOfFirstCondition
* }
* </pre>
*/
public boolean isIntentionalEarlyExit(/* @Nullable */ XExpression expression) {
if (expression == null) {
return true;
}
if (expression instanceof XBlockExpression) {
XBlockExpression block = (XBlockExpression) expression;
List<XExpression> children = block.getExpressions();
for(XExpression child: children) {
if (isIntentionalEarlyExit(child)) {
return true;
}
}
} else if (expression instanceof XIfExpression) {
return isIntentionalEarlyExit(((XIfExpression) expression).getThen())
|| isIntentionalEarlyExit(((XIfExpression) expression).getElse());
} else if (expression instanceof XSwitchExpression) {
XSwitchExpression switchExpression = (XSwitchExpression) expression;
for(XCasePart caseExpression: switchExpression.getCases()) {
if (isIntentionalEarlyExit(caseExpression.getThen())) {
return true;
}
}
if (isIntentionalEarlyExit(switchExpression.getDefault())) {
return true;
}
} else if (expression instanceof XTryCatchFinallyExpression) {
XTryCatchFinallyExpression tryCatchFinally = (XTryCatchFinallyExpression) expression;
if (isIntentionalEarlyExit(tryCatchFinally.getExpression())) {
for(XCatchClause catchClause: tryCatchFinally.getCatchClauses()) {
if (!isIntentionalEarlyExit(catchClause.getExpression()))
return false;
}
return true;
}
return false;
} else if (expression instanceof XAbstractWhileExpression) {
return isIntentionalEarlyExit(((XAbstractWhileExpression) expression).getBody());
} else if (expression instanceof XForLoopExpression) {
return isIntentionalEarlyExit(((XForLoopExpression) expression).getEachExpression());
} else if (expression instanceof XBasicForLoopExpression) {
return isIntentionalEarlyExit(((XBasicForLoopExpression) expression).getEachExpression());
} else if (expression instanceof XSynchronizedExpression) {
return isIntentionalEarlyExit(((XSynchronizedExpression) expression).getExpression());
}
return expression instanceof XReturnExpression || expression instanceof XThrowExpression;
}
示例12: isDefiniteEarlyExit
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
public boolean isDefiniteEarlyExit(XExpression expression) {
// TODO further improvements
if (expression instanceof XIfExpression) {
XIfExpression ifExpression = (XIfExpression) expression;
return isDefiniteEarlyExit(ifExpression.getThen()) && isDefiniteEarlyExit(ifExpression.getElse());
} else if (expression instanceof XSwitchExpression) {
XSwitchExpression switchExpression = (XSwitchExpression) expression;
if (isDefiniteEarlyExit(switchExpression.getDefault())) {
for(XCasePart caseExpression: switchExpression.getCases()) {
if (!isDefiniteEarlyExit(caseExpression.getThen())) {
return false;
}
}
return true;
}
return false;
} else if (expression instanceof XTryCatchFinallyExpression) {
XTryCatchFinallyExpression tryExpression = (XTryCatchFinallyExpression) expression;
if (isDefiniteEarlyExit(tryExpression.getFinallyExpression())) {
return true;
}
if (isDefiniteEarlyExit(tryExpression.getExpression())) {
for(XCatchClause catchClause: tryExpression.getCatchClauses()) {
if (!isDefiniteEarlyExit(catchClause.getExpression())) {
return false;
}
}
return true;
}
return false;
} else if (expression instanceof XBlockExpression) {
List<XExpression> expressions = ((XBlockExpression) expression).getExpressions();
for(int i = expressions.size() - 1; i >= 0; i--) {
if (isDefiniteEarlyExit(expressions.get(i))) {
return true;
}
}
} else if (expression instanceof XSynchronizedExpression) {
return isDefiniteEarlyExit(((XSynchronizedExpression) expression).getExpression());
}
return expression instanceof XReturnExpression || expression instanceof XThrowExpression;
}
示例13: doInternalToJavaStatement
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
@Override
protected void doInternalToJavaStatement(XExpression obj, ITreeAppendable appendable, boolean isReferenced) {
if (obj instanceof XBlockExpression) {
_toJavaStatement((XBlockExpression) obj, appendable, isReferenced);
} else if (obj instanceof XCastedExpression) {
_toJavaStatement((XCastedExpression) obj, appendable, isReferenced);
} else if (obj instanceof XClosure) {
_toJavaStatement((XClosure) obj, appendable, isReferenced);
} else if (obj instanceof XConstructorCall) {
_toJavaStatement((XConstructorCall) obj, appendable, isReferenced);
} else if (obj instanceof XDoWhileExpression) {
_toJavaStatement((XDoWhileExpression) obj, appendable, isReferenced);
} else if (obj instanceof XForLoopExpression) {
_toJavaStatement((XForLoopExpression) obj, appendable, isReferenced);
} else if (obj instanceof XBasicForLoopExpression) {
_toJavaStatement((XBasicForLoopExpression) obj, appendable, isReferenced);
} else if (obj instanceof XIfExpression) {
_toJavaStatement((XIfExpression) obj, appendable, isReferenced);
} else if (obj instanceof XInstanceOfExpression) {
_toJavaStatement((XInstanceOfExpression) obj, appendable, isReferenced);
} else if (obj instanceof XReturnExpression) {
_toJavaStatement((XReturnExpression) obj, appendable, isReferenced);
} else if (obj instanceof XSwitchExpression) {
_toJavaStatement((XSwitchExpression) obj, appendable, isReferenced);
} else if (obj instanceof XThrowExpression) {
_toJavaStatement((XThrowExpression) obj, appendable, isReferenced);
} else if (obj instanceof XTryCatchFinallyExpression) {
_toJavaStatement((XTryCatchFinallyExpression) obj, appendable, isReferenced);
} else if (obj instanceof XVariableDeclaration) {
_toJavaStatement((XVariableDeclaration) obj, appendable, isReferenced);
} else if (obj instanceof XWhileExpression) {
_toJavaStatement((XWhileExpression) obj, appendable, isReferenced);
} else if (obj instanceof XListLiteral) {
_toJavaStatement((XListLiteral) obj, appendable, isReferenced);
} else if (obj instanceof XSetLiteral) {
_toJavaStatement((XSetLiteral) obj, appendable, isReferenced);
} else if (obj instanceof XSynchronizedExpression) {
_toJavaStatement((XSynchronizedExpression) obj, appendable, isReferenced);
} else {
super.doInternalToJavaStatement(obj, appendable, isReferenced);
}
}
示例14: _toJavaExpression
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的package包/类
protected void _toJavaExpression(XSynchronizedExpression synchronizedExpression, ITreeAppendable b) {
b.trace(synchronizedExpression, false).append(getVarName(synchronizedExpression, b));
}
示例15: doEvaluate
import org.eclipse.xtext.xbase.XSynchronizedExpression; //导入依赖的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());
}
}