Java 类org.eclipse.xtext.xbase.XSynchronizedExpression 实例源码

项目:xtext-extras    文件:XbaseTypeComputer.java   
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());
}
项目:xtext-extras    文件:XbaseCompiler.java   
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;
}
项目:xtext-extras    文件:XbaseCompiler.java   
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("}");
}
项目:xtext-extras    文件:XbaseCompiler.java   
@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);
    }
}
项目:xtext-extras    文件:DefaultEarlyExitComputer.java   
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());
}
项目:xtext-extras    文件:DefaultEarlyExitComputer.java   
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());
  }
}
项目:xtext-extras    文件:ImplicitReturnFinderTest.java   
@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);
  }
}
项目:dsl-devkit    文件:AbstractCheckSemanticSequencer.java   
/**
 * 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();
}
项目:dsl-devkit    文件:AbstractCheckCfgSemanticSequencer.java   
/**
 * 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();
}
项目:xtext-extras    文件:AbstractXbaseSemanticSequencer.java   
@Deprecated
protected void sequence_XSynchronizedExpression(EObject context, XSynchronizedExpression semanticObject) {
    sequence_XSynchronizedExpression(createContext(context, semanticObject), semanticObject);
}
项目:xtext-extras    文件:XbaseTypeComputer.java   
@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);
    }
}
项目:xtext-extras    文件:ExtendedEarlyExitComputer.java   
/**
 * 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;
}
项目:xtext-extras    文件:ExtendedEarlyExitComputer.java   
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;
}
项目:xtext-extras    文件:XbaseCompiler.java   
@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);
    }
}
项目:xtext-extras    文件:XbaseCompiler.java   
protected void _toJavaExpression(XSynchronizedExpression synchronizedExpression, ITreeAppendable b) {
    b.trace(synchronizedExpression, false).append(getVarName(synchronizedExpression, b));
}
项目:xtext-extras    文件:XbaseInterpreter.java   
/**
 * 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());
    }
}
项目:xtext-extras    文件:XbaseInterpreter.java   
protected Object _doEvaluate(XSynchronizedExpression expression, IEvaluationContext context, CancelIndicator indicator) {
    internalEvaluate(expression.getParam(), context, indicator);
    return internalEvaluate(expression.getExpression(), context, indicator);
}
项目:xtext-extras    文件:XbaseImplicitReturnFinder.java   
protected void _findImplicitReturns(final XSynchronizedExpression expression, final ImplicitReturnFinder.Acceptor acceptor) {
  this.findImplicitReturns(expression.getExpression(), acceptor);
}
项目:xtext-extras    文件:XbaseImplicitReturnFinder.java   
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());
  }
}
项目:xtext-extras    文件:AbstractXbaseSemanticSequencer.java   
/**
 * Contexts:
 *     XExpression returns XSynchronizedExpression
 *     XAssignment returns XSynchronizedExpression
 *     XAssignment.XBinaryOperation_1_1_0_0_0 returns XSynchronizedExpression
 *     XOrExpression returns XSynchronizedExpression
 *     XOrExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
 *     XAndExpression returns XSynchronizedExpression
 *     XAndExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
 *     XEqualityExpression returns XSynchronizedExpression
 *     XEqualityExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
 *     XRelationalExpression returns XSynchronizedExpression
 *     XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XSynchronizedExpression
 *     XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XSynchronizedExpression
 *     XOtherOperatorExpression returns XSynchronizedExpression
 *     XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
 *     XAdditiveExpression returns XSynchronizedExpression
 *     XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
 *     XMultiplicativeExpression returns XSynchronizedExpression
 *     XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression
 *     XUnaryOperation returns XSynchronizedExpression
 *     XCastedExpression returns XSynchronizedExpression
 *     XCastedExpression.XCastedExpression_1_0_0_0 returns XSynchronizedExpression
 *     XPostfixOperation returns XSynchronizedExpression
 *     XPostfixOperation.XPostfixOperation_1_0_0 returns XSynchronizedExpression
 *     XMemberFeatureCall returns XSynchronizedExpression
 *     XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XSynchronizedExpression
 *     XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XSynchronizedExpression
 *     XPrimaryExpression returns XSynchronizedExpression
 *     XParenthesizedExpression returns XSynchronizedExpression
 *     XExpressionOrVarDeclaration returns XSynchronizedExpression
 *     XSynchronizedExpression returns XSynchronizedExpression
 *
 * Constraint:
 *     (param=XExpression expression=XExpression)
 */
protected void sequence_XSynchronizedExpression(ISerializationContext 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));
    }
    SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
    feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getParamXExpressionParserRuleCall_1_0(), semanticObject.getParam());
    feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getExpressionXExpressionParserRuleCall_3_0(), semanticObject.getExpression());
    feeder.finish();
}