示例#1
0
 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
 private IType[] getParameterTypes() {
   ICPPASTFunctionDeclarator lambdaDtor = fLambdaExpression.getDeclarator();
   if (lambdaDtor != null) {
     return CPPVisitor.createParameterTypes(lambdaDtor);
   }
   return IType.EMPTY_TYPE_ARRAY;
 }
示例#3
0
 private boolean isMutable() {
   ICPPASTFunctionDeclarator lambdaDtor = fLambdaExpression.getDeclarator();
   return lambdaDtor != null && lambdaDtor.isMutable();
 }