Ignore:
Timestamp:
Mar 2, 2020, 4:59:27 PM (21 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
dfa4360
Parents:
37cdd97
Message:

First draft implementation of generators, still missing error checking, testing and clean-up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/coroutine/suspend_then.cfa

    r37cdd97 r427854b  
    1818
    1919void then() {
    20         sout | "Then!";
     20
    2121}
    2222
     
    2626        int fn1, fn2;                                                           // retained between resumes
    2727        fn = 0;  fn1 = fn;                                                      // 1st case
    28         suspend_then(then);                                                     // restart last resume
     28        suspend { sout | "Then!"; }                                             // restart last resume
    2929        fn = 1;  fn2 = fn1;  fn1 = fn;                                  // 2nd case
    30         suspend_then(then);                                                     // restart last resume
     30        suspend { sout | "Then!"; }                                             // restart last resume
    3131        for () {
    3232                fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;                  // general case
    33                 suspend_then(then);                                             // restart last resume
     33                suspend { sout | "Then!"; }                                     // restart last resume
    3434        } // for
    3535}
Note: See TracChangeset for help on using the changeset viewer.