code: JSType getRestrictedByTypeOfResult(JSType type, String value,
                                       boolean resultEqualsValue) {
      if (type == null) {
        if (resultEqualsValue) {
          JSType result = getNativeTypeForTypeOf(value);
          return result == null ? getNativeType(CHECKED_UNKNOWN_TYPE) : result;
        } else {
          return null;
        }
      }
      return type.visit(
          new RestrictByOneTypeOfResultVisitor(value, resultEqualsValue));
    }
docs: Returns a version of {@code type} that is restricted by some knowledge
  about the result of the {@code typeof} operation.
  <p>
  The behavior of the {@code typeof} operator can be summarized by the
  following table:
  <table>
  <tr><th>type</th><th>result</th></tr>
  <tr><td>{@code undefined}</td><td>"undefined"</td></tr>
  <tr><td>{@code null}</td><td>"object"</td></tr>
  <tr><td>{@code boolean}</td><td>"boolean"</td></tr>
  <tr><td>{@code number}</td><td>"number"</td></tr>
  <tr><td>{@code string}</td><td>"string"</td></tr>
  <tr><td>{@code Object} (which doesn't implement [[Call]])</td>
  <td>"object"</td></tr>
  <tr><td>{@code Object} (which implements [[Call]])</td>
  <td>"function"</td></tr>
  </table>
  @param type the type to restrict
  @param value A value known to be equal or not equal to the result of the
  {@code typeof} operation
  @param resultEqualsValue {@code true} if the {@code typeOf} result is known
  to equal {@code value}; {@code false} if it is known <em>not</em> to
  equal {@code value}
  @return the restricted type or null if no version of the type matches the
  restriction