Line |
Branch |
Exec |
Source |
1 |
|
|
#include "generator.h" |
2 |
|
|
#include "sema/builtin.h" |
3 |
|
|
#include "vm/tree.h" |
4 |
|
|
|
5 |
|
|
namespace lython { |
6 |
|
|
|
7 |
|
|
ConstantValue Generator::__next__(struct TreeEvaluator& vm2) { |
8 |
|
|
// |
9 |
|
|
// TODO we need to detech when we reach |
10 |
|
|
// vm.exec(bo) |
11 |
|
|
|
12 |
|
|
/* |
13 |
|
|
int depth = 0; |
14 |
|
|
TreeEvaluator vm(scope); |
15 |
|
|
|
16 |
|
|
for (StmtNode* stmt: generator->body) { |
17 |
|
|
vm.exec(stmt, depth + 1); |
18 |
|
|
|
19 |
|
|
if (vm.has_exceptions()) { |
20 |
|
|
break; |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
if (vm.yielding) { |
24 |
|
|
break; |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
// We are returning |
28 |
|
|
if (vm.return_value != nullptr) { |
29 |
|
|
break; |
30 |
|
|
} |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
vm.raise<StopIteration>(); |
34 |
|
|
*/ |
35 |
|
✗ |
return ConstantValue::none(); |
36 |
|
|
} |
37 |
|
|
} // namespace lython |
38 |
|
|
|