コード例 #1
0
ファイル: Egl2MofStatement.java プロジェクト: eclipse/edt
 public boolean visit(org.eclipse.edt.compiler.core.ast.CloseStatement node) {
   ElementGenerator gen = getElementGenerator(node);
   if (gen != null) {
     CloseStatement stmt = (CloseStatement) gen.generate(node, eObjects);
     if (stmt != null) {
       stack.push(stmt);
       setElementInformation(node, stmt);
       commonIOVisit(node, stmt);
     }
   }
   return false;
 }
コード例 #2
0
ファイル: Egl2MofStatement.java プロジェクト: eclipse/edt
 @Override
 public boolean visit(org.eclipse.edt.compiler.core.ast.ReplaceStatement replaceStatement) {
   ElementGenerator gen = getElementGenerator(replaceStatement);
   if (gen != null) {
     ReplaceStatement stmt = (ReplaceStatement) gen.generate(replaceStatement, eObjects);
     if (stmt != null) {
       stack.push(stmt);
       setElementInformation(replaceStatement, stmt);
       commonIOVisit(replaceStatement, stmt);
     }
   }
   return false;
 }
コード例 #3
0
ファイル: Egl2MofStatement.java プロジェクト: eclipse/edt
  @Override
  public boolean visit(org.eclipse.edt.compiler.core.ast.CallStatement callStatement) {
    ElementGenerator gen = getElementGenerator(callStatement);
    if (gen != null) {
      CallStatement stmt = (CallStatement) gen.generate(callStatement, eObjects);
      if (stmt != null) {
        callStatement.getInvocationTarget().accept(this);
        stmt.setInvocationTarget((Expression) stack.pop());
        if (callStatement.hasArguments()) {
          for (Node node : (List<Node>) callStatement.getArguments()) {
            node.accept(this);
            stmt.getArguments().add((Expression) stack.pop());
          }
        }

        if (callStatement.getUsing() != null) {
          callStatement.getUsing().accept(this);
          stmt.setUsing((Expression) stack.pop());
        }

        if (callStatement.getCallSynchronizationValues() != null) {
          if (callStatement.getCallSynchronizationValues().getReturnTo() != null) {
            callStatement.getCallSynchronizationValues().getReturnTo().accept(this);
            stmt.setCallback((Expression) stack.pop());
          }
          if (callStatement.getCallSynchronizationValues().getOnException() != null) {
            callStatement.getCallSynchronizationValues().getOnException().accept(this);
            stmt.setErrorCallback((Expression) stack.pop());
          }
          if (callStatement.getCallSynchronizationValues().getReturns() != null) {
            callStatement.getCallSynchronizationValues().getReturns().accept(this);
            stmt.setReturns((LHSExpr) stack.pop());
          }
        }
        setElementInformation(callStatement, stmt);
        stack.push(stmt);
        if (callStatement.hasSettingsBlock()) {
          processSettings(stmt, callStatement.getSettingsBlock());
        }
      }
    }
    return false;
  }
コード例 #4
0
ファイル: Egl2MofStatement.java プロジェクト: eclipse/edt
  @Override
  public boolean visit(org.eclipse.edt.compiler.core.ast.ForEachStatement forEachStatement) {
    ElementGenerator gen = getElementGenerator(forEachStatement);
    if (gen != null) {
      ForEachStatement stmt = (ForEachStatement) gen.generate(forEachStatement, eObjects);
      if (stmt != null) {
        stack.push(stmt);
        setElementInformation(forEachStatement, stmt);

        if (forEachStatement.hasVariableDeclaration()) {
          DeclarationExpression decl = factory.createDeclarationExpression();
          Field field = factory.createField();
          field.setName(forEachStatement.getVariableDeclarationName().getCanonicalName());
          Type type = forEachStatement.getVariableDeclarationType().resolveType();
          field.setType((Type) mofTypeFor(type));
          field.setIsNullable(forEachStatement.isNullable());
          decl.getFields().add(field);
          eObjects.put(forEachStatement.getVariableDeclarationName().resolveMember(), field);
          stmt.setDeclarationExpression(decl);

          setElementInformation(forEachStatement.getVariableDeclarationName(), field);
          setElementInformation(forEachStatement.getVariableDeclarationName(), decl);
        }

        forEachStatement.getResultSet().accept(this);
        stmt.setDataSource((Expression) stack.pop());

        StatementBlock block = factory.createStatementBlock();
        stmt.setBody(block);
        for (Node nodeStmt : (List<Node>) forEachStatement.getStmts()) {
          nodeStmt.accept(this);
          Statement currStmt = (Statement) stack.pop();
          if (currStmt != null) {
            block.getStatements().add(currStmt);
          }
        }
      }
    }
    return false;
  }
コード例 #5
0
ファイル: Egl2MofStatement.java プロジェクト: eclipse/edt
  @Override
  public boolean visit(
      org.eclipse.edt.compiler.core.ast.GetByPositionStatement getByPositionStatement) {
    ElementGenerator gen = getElementGenerator(getByPositionStatement);
    if (gen != null) {
      GetByPositionStatement stmt =
          (GetByPositionStatement) gen.generate(getByPositionStatement, eObjects);
      if (stmt != null) {
        stack.push(stmt);
        setElementInformation(getByPositionStatement, stmt);
        commonIOVisit(getByPositionStatement, stmt);

        stmt.setDirective(getDirective(getByPositionStatement));

        if (getByPositionStatement.hasPosition()) {
          getByPositionStatement.getPosition().accept(this);
          stmt.setPosition((Expression) stack.pop());
        }
      }
    }
    return false;
  }
コード例 #6
0
ファイル: Egl2MofStatement.java プロジェクト: eclipse/edt
 private ElementGenerator getElementGenerator(Node node) {
   ElementGenerator generator = context.getCompiler().getElementGeneratorFor(node);
   if (generator != null) {
     generator.setCurrentPart(currentPart);
     generator.setCurrentBindingLevelPart(currentBindingLevelPart);
     generator.setCurrentFunction(currentFunction);
     generator.setContext(context);
     generator.setEnvironment(env);
     return generator;
   }
   return null;
 }