Beispiel #1
0
void StatementBlock::parseCheckReturn() {
   const QoreTypeInfo* returnTypeInfo = getReturnTypeInfo();
   if (returnTypeInfo->hasType() && !returnTypeInfo->parseAccepts(nothingTypeInfo)) {
      // make sure the last statement is a return statement if the block has a return type
      if (statement_list.empty() || !(*statement_list.last())->hasFinalReturn()) {
	 QoreStringNode* desc = new QoreStringNode("this code block has declared return type ");
	 returnTypeInfo->getThisType(*desc);
	 desc->concat(" but does not have a return statement as the last statement in the block");
	 qore_program_private::makeParseException(getProgram(), loc, "MISSING-RETURN", desc);
      }
   }
}
Beispiel #2
0
void clang::api_notes::ObjCMethodInfo::mergePropInfoIntoGetter(
      const ObjCPropertyInfo &pInfo) {
  // Set the return type of the getter or check that the value we have is
  // consistent with the property.
  // TODO: Can we provide proper error handling here?
  if (auto pNullability = pInfo.getNullability()) {
    if (!NullabilityAudited) {
      addReturnTypeInfo(*pNullability);
      assert(NumAdjustedNullable == 1);
    } else {
      assert(getReturnTypeInfo() == *pNullability);
    }
  }
}