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

项目:xtext-extras    文件:EarlyExitValidator.java   
@Check
public void checkDeadCode(XBasicForLoopExpression loop) {
    XExpression predicate = loop.getExpression();
    if (!earlyExitComputer.isEarlyExit(predicate)) {
        Optional<BooleanResult> result = getBooleanResult(predicate);
        if (result.isPresent()) {
            BooleanResult booleanResult = result.get();
            markConstantBooleanCondition(predicate, booleanResult, false);
            if (booleanResult.isCompileTimeConstant() && !booleanResult.getValue().or(Boolean.TRUE)) {
                markAsDeadCode(loop.getEachExpression());
                return;
            }
        }
        if (earlyExitComputer.isEarlyExit(loop.getEachExpression())) {
            markAsDeadCode(loop.getUpdateExpressions());
        }
    } else {
        if (!markAsDeadCode(loop.getUpdateExpressions())) {
            markAsDeadCode(loop.getEachExpression());
        }
    }
}
项目:xtext-extras    文件:XbaseTypeComputer.java   
protected void _computeTypes(final XBasicForLoopExpression object, final ITypeComputationState state) {
    for(XExpression initExpression : object.getInitExpressions()) {
        ITypeComputationState expressionState = state.withoutExpectation();
        expressionState.computeTypes(initExpression);
        addLocalToCurrentScope(initExpression, state);
    }
    state.withinScope(object);
    XExpression expression = object.getExpression();
    if (expression != null) {
        LightweightTypeReference booleanType = getRawTypeForName(Boolean.TYPE, state);
        ITypeComputationState conditionExpectation = state.withExpectation(booleanType);
        conditionExpectation.computeTypes(expression);
    }

    XExpression eachExpression = object.getEachExpression();
    ITypeComputationState stateWithoutExpectation = state.withoutExpectation();
    ITypeComputationState eachExpressionState = reassignCheckedType(expression, eachExpression, stateWithoutExpectation);
    eachExpressionState.computeTypes(eachExpression);

    for (XExpression updateExpression : object.getUpdateExpressions()) {
        eachExpressionState.computeTypes(updateExpression);
    }

    LightweightTypeReference primitiveVoid = getPrimitiveVoid(state);
    state.acceptActualType(primitiveVoid);
}
项目:xtext-extras    文件:XbaseInterpreter.java   
protected Object _doEvaluate(XBasicForLoopExpression forLoop, IEvaluationContext context, CancelIndicator indicator) {
    IEvaluationContext forkedContext = context.fork();
    for (XExpression initExpression : forLoop.getInitExpressions()) {
        internalEvaluate(initExpression, forkedContext, indicator);
    }
    XExpression expression = forLoop.getExpression();
    Object condition = expression == null ? Boolean.TRUE : internalEvaluate(expression, forkedContext, indicator);
    while (Boolean.TRUE.equals(condition)) {
        internalEvaluate(forLoop.getEachExpression(), forkedContext, indicator);
        for (XExpression updateExpression : forLoop.getUpdateExpressions()) {
            internalEvaluate(updateExpression, forkedContext, indicator);
        }
        condition = expression == null ? Boolean.TRUE : internalEvaluate(expression, forkedContext, indicator);
    }
    return null;
}
项目:xtext-extras    文件:XbaseCompiler.java   
protected void _toJavaStatement(XBasicForLoopExpression expr, ITreeAppendable b, boolean isReferenced) {
    if (canCompileToJavaBasicForStatement(expr, b)) {
        toJavaBasicForStatement(expr, b, isReferenced);
    } else {
        toJavaWhileStatement(expr, b, isReferenced);
    }
}
项目: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    文件:XbaseIdeContentProposalProvider.java   
protected void completeXBasicForLoopInit(final EObject model, final ContentAssistContext context, final IIdeContentProposalAcceptor acceptor) {
  final ICompositeNode node = NodeModelUtils.getNode(model);
  int _offset = node.getOffset();
  int _offset_1 = context.getOffset();
  boolean _greaterEqualsThan = (_offset >= _offset_1);
  if (_greaterEqualsThan) {
    this.createLocalVariableAndImplicitProposals(model, IExpressionScope.Anchor.BEFORE, context, acceptor);
    return;
  }
  if ((model instanceof XBasicForLoopExpression)) {
    final EList<XExpression> children = ((XBasicForLoopExpression)model).getInitExpressions();
    for (int i = (children.size() - 1); (i >= 0); i--) {
      {
        final XExpression child = children.get(i);
        final ICompositeNode childNode = NodeModelUtils.getNode(child);
        int _endOffset = childNode.getEndOffset();
        int _offset_2 = context.getOffset();
        boolean _lessEqualsThan = (_endOffset <= _offset_2);
        if (_lessEqualsThan) {
          this.createLocalVariableAndImplicitProposals(child, IExpressionScope.Anchor.AFTER, context, acceptor);
          return;
        }
      }
    }
  }
  this.createLocalVariableAndImplicitProposals(model, IExpressionScope.Anchor.BEFORE, context, acceptor);
}
项目:xtext-extras    文件:XbaseExpectedTypeProviderTest.java   
@Test public void testBasicForLoopExpression_0() throws Exception {
    XBasicForLoopExpression loop = (XBasicForLoopExpression) expression("for(var i = 0; i < 10; i = i + 1) {}");
    for (XExpression initExpression : loop.getInitExpressions()) {
        assertExpected(null, initExpression);   
    }
    assertExpected("boolean", loop.getExpression());
    for (XExpression updateExpression : loop.getUpdateExpressions()) {
        assertExpected(null, updateExpression); 
    }
}
项目:xtext-extras    文件:XbaseExpectedTypeProviderTest.java   
@Test public void testBasicForLoopExpression_1() throws Exception {
    XBasicForLoopExpression loop = (XBasicForLoopExpression) expression("for(null; null; null) {}");
    for (XExpression initExpression : loop.getInitExpressions()) {
        assertExpected(null, initExpression);   
    }
    assertExpected("boolean", loop.getExpression());
    for (XExpression updateExpression : loop.getUpdateExpressions()) {
        assertExpected(null, updateExpression); 
    }
}
项目:xtext-extras    文件:XbaseExpectedTypeProviderTest.java   
@Test public void testBasicForLoopExpression_2() throws Exception {
    XBasicForLoopExpression loop = (XBasicForLoopExpression) expression("for(;;) {}");
    for (XExpression initExpression : loop.getInitExpressions()) {
        assertExpected(null, initExpression);   
    }
    assertExpected(null, loop.getExpression());
    for (XExpression updateExpression : loop.getUpdateExpressions()) {
        assertExpected(null, updateExpression); 
    }
}
项目:xtext-extras    文件:AbstractXbaseSemanticSequencer.java   
@Deprecated
protected void sequence_XBasicForLoopExpression(EObject context, XBasicForLoopExpression semanticObject) {
    sequence_XBasicForLoopExpression(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    文件: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   
/**
 * @param isReferenced unused in this context but necessary for dispatch signature 
 */
protected void toJavaBasicForStatement(XBasicForLoopExpression expr, ITreeAppendable b, boolean isReferenced) {
    ITreeAppendable loopAppendable = b.trace(expr);
    loopAppendable.openPseudoScope();
    loopAppendable.newLine().append("for (");

    EList<XExpression> initExpressions = expr.getInitExpressions();
    XExpression firstInitExpression = IterableExtensions.head(initExpressions);
    if (firstInitExpression instanceof XVariableDeclaration) {
        XVariableDeclaration variableDeclaration = (XVariableDeclaration) firstInitExpression;
        LightweightTypeReference type = appendVariableTypeAndName(variableDeclaration, loopAppendable);
        loopAppendable.append(" = ");
        if (variableDeclaration.getRight() != null) {
            compileAsJavaExpression(variableDeclaration.getRight(), loopAppendable, type);
        } else {
            appendDefaultLiteral(loopAppendable, type);
        }
    } else {
        for (int i = 0; i < initExpressions.size(); i++) {
            if (i != 0) {
                loopAppendable.append(", ");
            }
            XExpression initExpression = initExpressions.get(i);
            compileAsJavaExpression(initExpression, loopAppendable, getLightweightType(initExpression));
        }
    }

    loopAppendable.append(";");

    XExpression expression = expr.getExpression();
    if (expression != null) {
        loopAppendable.append(" ");
        internalToJavaExpression(expression, loopAppendable);
    }
    loopAppendable.append(";");

    EList<XExpression> updateExpressions = expr.getUpdateExpressions();
    for (int i = 0; i < updateExpressions.size(); i++) {
        if (i != 0) {
            loopAppendable.append(",");
        }
        loopAppendable.append(" ");
        XExpression updateExpression = updateExpressions.get(i);
        internalToJavaExpression(updateExpression, loopAppendable);
    }
    loopAppendable.append(") {").increaseIndentation();

    XExpression eachExpression = expr.getEachExpression();
    internalToJavaStatement(eachExpression, loopAppendable, false);

    loopAppendable.decreaseIndentation().newLine().append("}");
    loopAppendable.closeScope();
}
项目:xtext-extras    文件:XbaseCompiler.java   
protected void toJavaWhileStatement(XBasicForLoopExpression expr, ITreeAppendable b, boolean isReferenced) {
    ITreeAppendable loopAppendable = b.trace(expr);

    boolean needBraces = !bracesAreAddedByOuterStructure(expr);
    if (needBraces) {
        loopAppendable.newLine().increaseIndentation().append("{");
        loopAppendable.openPseudoScope();
    }

    EList<XExpression> initExpressions = expr.getInitExpressions();
    for (int i = 0; i < initExpressions.size(); i++) {
        XExpression initExpression = initExpressions.get(i);
        if (i < initExpressions.size() - 1) {
            internalToJavaStatement(initExpression, loopAppendable, false);
        } else {
            internalToJavaStatement(initExpression, loopAppendable, isReferenced);
            if (isReferenced) {
                loopAppendable.newLine().append(getVarName(expr, loopAppendable)).append(" = (");
                internalToConvertedExpression(initExpression, loopAppendable, getLightweightType(expr));
                loopAppendable.append(");");
            }
        }
    }

    final String varName = loopAppendable.declareSyntheticVariable(expr, "_while");

    XExpression expression = expr.getExpression();
    if (expression != null) {
        internalToJavaStatement(expression, loopAppendable, true);
        loopAppendable.newLine().append("boolean ").append(varName).append(" = ");
        internalToJavaExpression(expression, loopAppendable);
        loopAppendable.append(";");
    } else {
        loopAppendable.newLine().append("boolean ").append(varName).append(" = true;");
    }
    loopAppendable.newLine();
    loopAppendable.append("while (");
    loopAppendable.append(varName);
    loopAppendable.append(") {").increaseIndentation();
    loopAppendable.openPseudoScope();

    XExpression eachExpression = expr.getEachExpression();
    internalToJavaStatement(eachExpression, loopAppendable, false);

    EList<XExpression> updateExpressions = expr.getUpdateExpressions();
    if (!updateExpressions.isEmpty()) {
        for (XExpression updateExpression : updateExpressions) {
            internalToJavaStatement(updateExpression, loopAppendable, false);
        }
    }

    if (!isEarlyExit(eachExpression)) {
        if (expression != null) {
            internalToJavaStatement(expression, loopAppendable, true);
            loopAppendable.newLine().append(varName).append(" = ");
            internalToJavaExpression(expression, loopAppendable);
            loopAppendable.append(";");
        } else {
            loopAppendable.newLine().append(varName).append(" = true;");
        }
    }

    loopAppendable.closeScope();
    loopAppendable.decreaseIndentation().newLine().append("}");

    if (needBraces) {
        loopAppendable.closeScope();
        loopAppendable.decreaseIndentation().newLine().append("}");
    }
}
项目: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    文件:AbstractXbaseSemanticSequencer.java   
/**
 * Contexts:
 *     XExpression returns XBasicForLoopExpression
 *     XAssignment returns XBasicForLoopExpression
 *     XAssignment.XBinaryOperation_1_1_0_0_0 returns XBasicForLoopExpression
 *     XOrExpression returns XBasicForLoopExpression
 *     XOrExpression.XBinaryOperation_1_0_0_0 returns XBasicForLoopExpression
 *     XAndExpression returns XBasicForLoopExpression
 *     XAndExpression.XBinaryOperation_1_0_0_0 returns XBasicForLoopExpression
 *     XEqualityExpression returns XBasicForLoopExpression
 *     XEqualityExpression.XBinaryOperation_1_0_0_0 returns XBasicForLoopExpression
 *     XRelationalExpression returns XBasicForLoopExpression
 *     XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XBasicForLoopExpression
 *     XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XBasicForLoopExpression
 *     XOtherOperatorExpression returns XBasicForLoopExpression
 *     XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XBasicForLoopExpression
 *     XAdditiveExpression returns XBasicForLoopExpression
 *     XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XBasicForLoopExpression
 *     XMultiplicativeExpression returns XBasicForLoopExpression
 *     XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XBasicForLoopExpression
 *     XUnaryOperation returns XBasicForLoopExpression
 *     XCastedExpression returns XBasicForLoopExpression
 *     XCastedExpression.XCastedExpression_1_0_0_0 returns XBasicForLoopExpression
 *     XPostfixOperation returns XBasicForLoopExpression
 *     XPostfixOperation.XPostfixOperation_1_0_0 returns XBasicForLoopExpression
 *     XMemberFeatureCall returns XBasicForLoopExpression
 *     XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XBasicForLoopExpression
 *     XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XBasicForLoopExpression
 *     XPrimaryExpression returns XBasicForLoopExpression
 *     XParenthesizedExpression returns XBasicForLoopExpression
 *     XBasicForLoopExpression returns XBasicForLoopExpression
 *     XExpressionOrVarDeclaration returns XBasicForLoopExpression
 *
 * Constraint:
 *     (
 *         (initExpressions+=XExpressionOrVarDeclaration initExpressions+=XExpressionOrVarDeclaration*)? 
 *         expression=XExpression? 
 *         (updateExpressions+=XExpression updateExpressions+=XExpression*)? 
 *         eachExpression=XExpression
 *     )
 */
protected void sequence_XBasicForLoopExpression(ISerializationContext context, XBasicForLoopExpression semanticObject) {
    genericSequencer.createSequence(context, semanticObject);
}
项目:dsl-devkit    文件:AbstractCheckSemanticSequencer.java   
/**
 * Constraint:
 *     (
 *         (initExpressions+=XExpressionOrVarDeclaration initExpressions+=XExpressionOrVarDeclaration*)? 
 *         expression=XExpression? 
 *         (updateExpressions+=XExpression updateExpressions+=XExpression*)? 
 *         eachExpression=XExpression
 *     )
 */
protected void sequence_XBasicForLoopExpression(EObject context, XBasicForLoopExpression semanticObject) {
    genericSequencer.createSequence(context, semanticObject);
}
项目:dsl-devkit    文件:AbstractCheckCfgSemanticSequencer.java   
/**
 * Constraint:
 *     (
 *         (initExpressions+=XExpressionOrVarDeclaration initExpressions+=XExpressionOrVarDeclaration*)? 
 *         expression=XExpression? 
 *         (updateExpressions+=XExpression updateExpressions+=XExpression*)? 
 *         eachExpression=XExpression
 *     )
 */
protected void sequence_XBasicForLoopExpression(EObject context, XBasicForLoopExpression semanticObject) {
    genericSequencer.createSequence(context, semanticObject);
}