| ... | ... | @@ -119,10 +119,21 @@ pub const MemLocRequirement = enum { |
| 119 | 119 | forward1, |
| 120 | 120 | }; |
| 121 | 121 | |
| 122 | pub const EvalToError = enum { |
| 123 | /// The builtin cannot possibly evaluate to an error. |
| 124 | never, |
| 125 | /// The builtin will always evaluate to an error. |
| 126 | always, |
| 127 | /// The builtin may or may not evaluate to an error depending on the parameters. |
| 128 | maybe, |
| 129 | }; |
| 130 | |
| 122 | 131 | tag: Tag, |
| 123 | 132 | |
| 124 | 133 | /// Info about the builtin call's ability to take advantage of a result location pointer. |
| 125 | 134 | needs_mem_loc: MemLocRequirement = .never, |
| 135 | /// Info about the builtin call's possibility of returning an error. |
| 136 | eval_to_error: EvalToError = .never, |
| 126 | 137 | /// `true` if the builtin call can be the left-hand side of an expression (assigned to). |
| 127 | 138 | allows_lvalue: bool = false, |
| 128 | 139 | /// The number of parameters to this builtin function. `null` means variable number |
| ... | ... | @@ -158,6 +169,7 @@ pub const list = list: { |
| 158 | 169 | .{ |
| 159 | 170 | .tag = .as, |
| 160 | 171 | .needs_mem_loc = .forward1, |
| 172 | .eval_to_error = .maybe, |
| 161 | 173 | .param_count = 2, |
| 162 | 174 | }, |
| 163 | 175 | }, |
| ... | ... | @@ -258,6 +270,7 @@ pub const list = list: { |
| 258 | 270 | .{ |
| 259 | 271 | .tag = .call, |
| 260 | 272 | .needs_mem_loc = .always, |
| 273 | .eval_to_error = .maybe, |
| 261 | 274 | .param_count = 3, |
| 262 | 275 | }, |
| 263 | 276 | }, |
| ... | ... | @@ -391,6 +404,7 @@ pub const list = list: { |
| 391 | 404 | "@errSetCast", |
| 392 | 405 | .{ |
| 393 | 406 | .tag = .err_set_cast, |
| 407 | .eval_to_error = .always, |
| 394 | 408 | .param_count = 2, |
| 395 | 409 | }, |
| 396 | 410 | }, |
| ... | ... | @@ -420,6 +434,7 @@ pub const list = list: { |
| 420 | 434 | .{ |
| 421 | 435 | .tag = .field, |
| 422 | 436 | .needs_mem_loc = .always, |
| 437 | .eval_to_error = .maybe, |
| 423 | 438 | .param_count = 2, |
| 424 | 439 | .allows_lvalue = true, |
| 425 | 440 | }, |
| ... | ... | @@ -512,6 +527,7 @@ pub const list = list: { |
| 512 | 527 | "@intToError", |
| 513 | 528 | .{ |
| 514 | 529 | .tag = .int_to_error, |
| 530 | .eval_to_error = .always, |
| 515 | 531 | .param_count = 1, |
| 516 | 532 | }, |
| 517 | 533 | }, |