Ignore:
Timestamp:
Jan 19, 2021, 8:44:29 PM (3 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
dafbde8
Parents:
2f47ea4
Message:

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/containers/result.cfa

    r2f47ea4 rfd54fef  
    1818
    1919
    20 forall(otype T, otype E)
     20forall(T, E)
    2121void ?{}(result(T, E) & this) {
    2222        this.has_value = false;
     
    2424}
    2525
    26 forall(otype T, otype E)
     26forall(T, E)
    2727void ?{}(result(T, E) & this, one_t, T value) {
    2828        this.has_value = true;
     
    3030}
    3131
    32 forall(otype T, otype E)
     32forall(T, E)
    3333void ?{}(result(T, E) & this, zero_t, E error) {
    3434        this.has_value = false;
     
    3636}
    3737
    38 forall(otype T, otype E)
     38forall(T, E)
    3939void ?{}(result(T, E) & this, result(T, E) other) {
    4040        this.has_value = other.has_value;
     
    4646}
    4747
    48 forall(otype T, otype E)
     48forall(T, E)
    4949result(T, E) ?=?(result(T, E) & this, result(T, E) that) {
    5050        if (this.has_value && that.has_value) {
     
    6363}
    6464
    65 forall(otype T, otype E)
     65forall(T, E)
    6666void ^?{}(result(T, E) & this) {
    6767        if (this.has_value) {
     
    7272}
    7373
    74 forall(otype T, otype E)
     74forall(T, E)
    7575bool ?!=?(result(T, E) this, zero_t) {
    7676        return this.has_value;
    7777}
    7878
    79 forall(otype T, otype E)
     79forall(T, E)
    8080result(T, E) result_value(T value) {
    8181        return (result(T, E)){1, value};
    8282}
    8383
    84 forall(otype T, otype E)
     84forall(T, E)
    8585result(T, E) result_error(E error) {
    8686        return (result(T, E)){0, error};
    8787}
    8888
    89 forall(otype T, otype E)
     89forall(T, E)
    9090bool has_value(result(T, E) * this) {
    9191        return this->has_value;
    9292}
    9393
    94 forall(otype T, otype E)
     94forall(T, E)
    9595T get(result(T, E) * this) {
    9696        assertf(this->has_value, "attempt to get from result without value");
     
    9898}
    9999
    100 forall(otype T, otype E)
     100forall(T, E)
    101101E get_error(result(T, E) * this) {
    102102        assertf(!this->has_value, "attempt to get from result without error");
     
    104104}
    105105
    106 forall(otype T, otype E)
     106forall(T, E)
    107107void set(result(T, E) * this, T value) {
    108108        if (this->has_value) {
     
    115115}
    116116
    117 forall(otype T, otype E)
     117forall(T, E)
    118118void set_error(result(T, E) * this, E error) {
    119119        if (this->has_value) {
Note: See TracChangeset for help on using the changeset viewer.