Ignore:
Timestamp:
Aug 11, 2017, 10:10:26 AM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
fd344aa
Parents:
8499c707
Message:

Fix concurrency library, tests, and keywords for references

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/coroutine.c

    r8499c707 r83a071f9  
    2525}
    2626
    27 void main( Fibonacci * this ) {
     27void main( Fibonacci & this ) {
    2828        int fn1, fn2;                                   // retained between resumes
    29         this->fn = 0;                                   // case 0
    30         fn1 = this->fn;
     29        this.fn = 0;                                    // case 0
     30        fn1 = this.fn;
    3131        suspend();                                              // return to last resume
    3232
    33         this->fn = 1;                                   // case 1
     33        this.fn = 1;                                    // case 1
    3434        fn2 = fn1;
    35         fn1 = this->fn;
     35        fn1 = this.fn;
    3636        suspend();                                              // return to last resume
    3737
    3838        for ( ;; ) {                                    // general case
    39                 this->fn = fn1 + fn2;
     39                this.fn = fn1 + fn2;
    4040                fn2 = fn1;
    41                 fn1 = this->fn;
     41                fn1 = this.fn;
    4242                suspend();                                      // return to last resume
    4343        } // for
    4444}
    4545
    46 int next( Fibonacci * this ) {
     46int next( Fibonacci & this ) {
    4747        resume( this );                                 // transfer to last suspend
    48         return this->fn;
     48        return this.fn;
    4949}
    5050
     
    5252        Fibonacci f1, f2;
    5353        for ( int i = 1; i <= 10; i += 1 ) {
    54                 sout | next( &f1 ) | ' ' | next( &f2 ) | endl;
     54                sout | next( f1 ) | ' ' | next( f2 ) | endl;
    5555        } // for
    5656}
Note: See TracChangeset for help on using the changeset viewer.