コード例 #1
0
ファイル: CPPClosureType.java プロジェクト: lucciano/cdt
 private IType getReturnType() {
   ICPPASTFunctionDeclarator lambdaDtor = fLambdaExpression.getDeclarator();
   if (lambdaDtor != null) {
     IASTTypeId trailingReturnType = lambdaDtor.getTrailingReturnType();
     if (trailingReturnType != null) {
       return CPPVisitor.createType(trailingReturnType);
     }
   }
   IASTCompoundStatement body = fLambdaExpression.getBody();
   if (body != null) {
     IASTStatement[] stmts = body.getStatements();
     if (stmts.length > 0) {
       // Gnu extension allows to deduce return type in complex compound statements
       IASTStatement stmt = stmts[stmts.length - 1];
       if (stmt instanceof IASTReturnStatement) {
         IASTReturnStatement rtstmt = (IASTReturnStatement) stmt;
         IASTExpression expr = rtstmt.getReturnValue();
         if (expr != null) {
           IType type = expr.getExpressionType();
           type = Conversions.lvalue_to_rvalue(type, false);
           if (type != null) {
             return type;
           }
         }
       }
     }
   }
   return CPPSemantics.VOID_TYPE;
 }
コード例 #2
0
 protected IASTStatement[] getNestedStatements(IASTCompoundStatement compoundStatement) {
   return compoundStatement.getStatements();
 }