| ... | ... | @@ -338,9 +338,22 @@ struct ConstArgTuple { |
| 338 | 338 | }; |
| 339 | 339 | |
| 340 | 340 | enum ConstValSpecial { |
| 341 | // The value is only available at runtime. However there may be runtime hints |
| 342 | // narrowing the possible values down via the `data.rh_*` fields. |
| 341 | 343 | ConstValSpecialRuntime, |
| 344 | // The value is comptime-known and resolved. The `data.x_*` fields can be |
| 345 | // accessed. |
| 342 | 346 | ConstValSpecialStatic, |
| 347 | // The value is comptime-known to be `undefined`. |
| 343 | 348 | ConstValSpecialUndef, |
| 349 | // The value is comptime-known, but not yet resolved. The lazy value system |
| 350 | // helps avoid dependency loops by providing answers to certain questions |
| 351 | // about values without forcing them to be resolved. For example, the |
| 352 | // equation `@sizeOf(Foo) == 0` can be resolved without forcing the struct |
| 353 | // layout of `Foo` because we can know whether `Foo` is zero bits without |
| 354 | // performing field layout. |
| 355 | // A `ZigValue` can be converted from Lazy to Static/Undef by calling the |
| 356 | // appropriate resolve function. |
| 344 | 357 | ConstValSpecialLazy, |
| 345 | 358 | }; |
| 346 | 359 | |
| ... | ... | @@ -484,6 +497,8 @@ struct LazyValueErrUnionType { |
| 484 | 497 | |
| 485 | 498 | struct ZigValue { |
| 486 | 499 | ZigType *type; |
| 500 | // This field determines how the value is stored. It must be checked |
| 501 | // before accessing the `data` union. |
| 487 | 502 | ConstValSpecial special; |
| 488 | 503 | uint32_t llvm_align; |
| 489 | 504 | ConstParent parent; |