Commit 506e54b
Method Declarations & Trailing Exprs & Constructors (#2337)
Method declarations and a bunch of other AST / HIR / THIR / Codegen
fixes.
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Enhance BAML compiler and VM with method declarations, trailing
expression handling, and improved constructor logic, including
comprehensive test updates.
>
> - **Behavior**:
> - Add support for method declarations in classes, including `self`
parameter handling in `parse_named_args_list.rs` and
`parse_type_expression_block.rs`.
> - Implement trailing expression handling in blocks, replacing
`produces_final_value()` with `trailing_expr` in `hir.rs` and `thir.rs`.
> - Update `compile_thir_to_bytecode()` in `codegen.rs` to handle method
bytecode generation.
> - Modify `Vm::len()` in `native.rs` to use `std.Array.len`.
> - **Parsing**:
> - Update `parse_expr.rs` and `parse_named_args_list.rs` to support new
syntax for method declarations and assignments.
> - Adjust `parse_type_expression_block.rs` to parse methods within
classes.
> - **Validation**:
> - Enhance `validate_expr_fns()` in `expr_fns.rs` to check for method
name uniqueness and argument validity.
> - **Testing**:
> - Add and update tests in `bytecode_tests.rs` and `vm.rs` to cover new
method declaration and execution scenarios.
> - Update bytecode and HIR test files to reflect changes in method
handling and trailing expressions.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for 7b80c60. You can
[customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->
---------
Co-authored-by: Luke Ramsden <hello@lukeramsden.com>
Co-authored-by: aaronvg <aaron@boundaryml.com>
Co-authored-by: hellovai <vbv@boundaryml.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Jesús Lapastora <jesus@boundaryml.com>
Co-authored-by: Samuel Lijin <sam@boundaryml.com>
Co-authored-by: Ayush Goyal <ayushg1214@gmail.com>
Co-authored-by: Chris Watts <chris@boundaryml.com>1 parent cfdd5ad commit 506e54b
File tree
50 files changed
+1132
-499
lines changed- engine
- baml-compiler/src
- hir
- thir
- baml-lib
- ast/src
- ast
- parser
- baml-core/src/validate/validation_pipeline/validations
- baml/tests
- bytecode_files
- loops
- hir_files
- loops
- validation_files
- expr
- loops
- baml-vm
- benches
- src
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
50 files changed
+1132
-499
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
133 | | - | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
137 | | - | |
| 138 | + | |
| 139 | + | |
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| |||
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
160 | | - | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| |||
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
271 | | - | |
| 273 | + | |
| 274 | + | |
272 | 275 | | |
273 | 276 | | |
274 | 277 | | |
| |||
284 | 287 | | |
285 | 288 | | |
286 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
287 | 299 | | |
288 | 300 | | |
289 | 301 | | |
| |||
308 | 320 | | |
309 | 321 | | |
310 | 322 | | |
311 | | - | |
| 323 | + | |
312 | 324 | | |
313 | 325 | | |
314 | 326 | | |
| |||
318 | 330 | | |
319 | 331 | | |
320 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
321 | 339 | | |
322 | 340 | | |
323 | 341 | | |
| |||
448 | 466 | | |
449 | 467 | | |
450 | 468 | | |
451 | | - | |
| 469 | + | |
452 | 470 | | |
453 | 471 | | |
454 | 472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
297 | 286 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | 287 | | |
318 | 288 | | |
319 | 289 | | |
320 | 290 | | |
321 | | - | |
| 291 | + | |
322 | 292 | | |
323 | 293 | | |
324 | 294 | | |
325 | 295 | | |
326 | 296 | | |
327 | 297 | | |
328 | | - | |
| 298 | + | |
329 | 299 | | |
330 | 300 | | |
331 | 301 | | |
| |||
349 | 319 | | |
350 | 320 | | |
351 | 321 | | |
352 | | - | |
| 322 | + | |
353 | 323 | | |
354 | 324 | | |
| 325 | + | |
355 | 326 | | |
356 | 327 | | |
357 | 328 | | |
| |||
373 | 344 | | |
374 | 345 | | |
375 | 346 | | |
376 | | - | |
| 347 | + | |
377 | 348 | | |
378 | 349 | | |
379 | 350 | | |
380 | 351 | | |
381 | 352 | | |
382 | 353 | | |
383 | 354 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
| 355 | + | |
| 356 | + | |
390 | 357 | | |
391 | 358 | | |
392 | 359 | | |
393 | 360 | | |
394 | | - | |
| 361 | + | |
395 | 362 | | |
396 | 363 | | |
397 | 364 | | |
398 | 365 | | |
399 | | - | |
| 366 | + | |
400 | 367 | | |
401 | 368 | | |
402 | 369 | | |
| |||
447 | 414 | | |
448 | 415 | | |
449 | 416 | | |
450 | | - | |
| 417 | + | |
451 | 418 | | |
452 | 419 | | |
453 | 420 | | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
476 | 429 | | |
477 | 430 | | |
478 | 431 | | |
| |||
481 | 434 | | |
482 | 435 | | |
483 | 436 | | |
484 | | - | |
485 | | - | |
| 437 | + | |
486 | 438 | | |
487 | 439 | | |
488 | 440 | | |
| |||
577 | 529 | | |
578 | 530 | | |
579 | 531 | | |
580 | | - | |
| 532 | + | |
581 | 533 | | |
582 | 534 | | |
583 | 535 | | |
| |||
688 | 640 | | |
689 | 641 | | |
690 | 642 | | |
| 643 | + | |
691 | 644 | | |
692 | 645 | | |
693 | 646 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
| |||
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
| 317 | + | |
315 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
316 | 322 | | |
317 | 323 | | |
318 | 324 | | |
| |||
333 | 339 | | |
334 | 340 | | |
335 | 341 | | |
336 | | - | |
| 342 | + | |
337 | 343 | | |
338 | 344 | | |
339 | 345 | | |
340 | 346 | | |
341 | | - | |
| 347 | + | |
342 | 348 | | |
343 | 349 | | |
344 | 350 | | |
| |||
359 | 365 | | |
360 | 366 | | |
361 | 367 | | |
362 | | - | |
| 368 | + | |
363 | 369 | | |
364 | 370 | | |
365 | 371 | | |
| |||
456 | 462 | | |
457 | 463 | | |
458 | 464 | | |
459 | | - | |
| 465 | + | |
460 | 466 | | |
461 | 467 | | |
462 | 468 | | |
| |||
545 | 551 | | |
546 | 552 | | |
547 | 553 | | |
548 | | - | |
| 554 | + | |
549 | 555 | | |
550 | 556 | | |
551 | 557 | | |
| |||
0 commit comments