src/som/compiler/JsonTreeTranslator.java
private JsonObject returnType(final JsonObject node) {
    if (!VmSettings.USE_TYPE_CHECKING) { // simply return null if type checking not used
      return null;
    }
    // Check that the signature has a return type
    JsonObject signatureNode = node.get("signature").getAsJsonObject();
    if (signatureNode.get("returntype").isJsonNull()) {
      // Report an error if a type is expected
      if (VmSettings.MUST_BE_FULLY_TYPED) {
        error(nodeType(node) + " is missing a type annotation", node);
        throw new RuntimeException();
      }
      // Otherwise it is unknown
      return null; // SomStructuralType.UNKNOWN;
    } else {
      // Return the AST of the return type
      return signatureNode.get("returntype").getAsJsonObject();

    }
  }
/**
   * Gets the return type of an AST node with a signature.
   *
   * @param node - class or method definition
   * @return The AST of the return type expression. Null if the type is unknown (possibly by
   *         being undefined).
   */
Gets the return type of an AST node with a signature.
@param node - class or method definition
@return The AST of the return type expression. Null if the type is unknown (possibly by
being undefined).
Gets the return type of an AST node with a signature . @param node - class or method definition @return The AST of the return type expression . Null if the type is unknown ( possibly by being undefined ) .
private JsonObject returnType(final JsonObject node) {
    if (!VmSettings.USE_TYPE_CHECKING) { 
      return null;
    }
    JsonObject signatureNode = node.get("signature").getAsJsonObject();
    if (signatureNode.get("returntype").isJsonNull()) {
      if (VmSettings.MUST_BE_FULLY_TYPED) {
        error(nodeType(node) + " is missing a type annotation", node);
        throw new RuntimeException();
      }
      return null; 
    } else {
      return signatureNode.get("returntype").getAsJsonObject();
    }
  }
private JsonObject returnType ( final JsonObject node ) { if ( ! VmSettings . USE_TYPE_CHECKING ) { return null ; } JsonObject signatureNode = node . get ( "signature" ) . getAsJsonObject ( ) ; if ( signatureNode . get ( "returntype" ) . isJsonNull ( ) ) { if ( VmSettings . MUST_BE_FULLY_TYPED ) { error ( nodeType ( node ) + " is missing a type annotation" , node ) ; throw new RuntimeException ( ) ; } return null ; } else { return signatureNode . get ( "returntype" ) . getAsJsonObject ( ) ; } }
Gets the return type of an AST node with a signature.
Gets the return type of an AST node with a signature .
// simply return null if type checking not used // Check that the signature has a return type // Report an error if a type is expected // Otherwise it is unknown // SomStructuralType.UNKNOWN; // Return the AST of the return type