Пример #1
0
 @Override
 public IType getExpressionType() {
   switch (getKind()) {
     case lk_this:
       {
         IScope scope = CPPVisitor.getContainingScope(this);
         IType type = CPPVisitor.getImpliedObjectType(scope);
         if (type == null) {
           return new ProblemType(ISemanticProblem.TYPE_UNRESOLVED_NAME);
         }
         return new CPPPointerType(type);
       }
     case lk_true:
     case lk_false:
       return CPPBasicType.BOOLEAN;
     case lk_char_constant:
       return new CPPBasicType(getCharType(), 0, this);
     case lk_float_constant:
       return classifyTypeOfFloatLiteral();
     case lk_integer_constant:
       return classifyTypeOfIntLiteral();
     case lk_string_literal:
       IType type = new CPPBasicType(getCharType(), 0, this);
       type = new CPPQualifierType(type, true, false);
       return new CPPArrayType(type, getStringLiteralSize());
   }
   return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
 }