Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

gleam / compiler-core / src / ast / visit.rs
64 kB 2294 lines
1//! AST traversal routines, referenced from [`syn::visit`](https://docs.rs/syn/latest/syn/visit/index.html) 2//! 3//! Each method of the [`Visit`] trait can be overridden to customize the 4//! behaviour when visiting the corresponding type of AST node. By default, 5//! every method recursively visits the substructure of the node by using the 6//! right visitor method. 7//! 8//! # Example 9//! 10//! Suppose we would like to collect all function names in a module, 11//! we can do the following: 12//! 13//! ```no_run 14//! use gleam_core::ast::{TypedFunction, visit::{self, Visit}}; 15//! 16//! struct FnCollector<'ast> { 17//! functions: Vec<&'ast TypedFunction> 18//! } 19//! 20//! impl<'ast> Visit<'ast> for FnCollector<'ast> { 21//! fn visit_typed_function(&mut self, fun: &'ast TypedFunction) { 22//! self.functions.push(fun); 23//! 24//! // Use the default behaviour to visit any nested functions 25//! visit::visit_typed_function(self, fun); 26//! } 27//! } 28//! 29//! fn print_all_module_functions() { 30//! let module = todo!("module"); 31//! let mut fn_collector = FnCollector { functions: vec![] }; 32//! 33//! // This will walk the AST and collect all functions 34//! fn_collector.visit_typed_module(module); 35//! 36//! // Print the collected functions 37//! println!("{:#?}", fn_collector.functions); 38//! } 39//! ``` 40 41use crate::{ 42 analyse::Inferred, 43 ast::{ 44 BitArraySize, RecordBeingUpdated, TypeAstConstructorName, TypedBitArraySize, 45 TypedConstantBitArraySegment, TypedDefinitions, TypedImport, TypedTailPattern, 46 TypedTypeAlias, typed::InvalidExpression, 47 }, 48 exhaustiveness::CompiledCase, 49 parse::LiteralFloatValue, 50 type_::{ 51 FieldMap, ModuleValueConstructor, PatternConstructor, TypedCallArg, ValueConstructor, 52 error::VariableOrigin, 53 }, 54}; 55use std::sync::Arc; 56 57use ecow::EcoString; 58use num_bigint::BigInt; 59use vec1::Vec1; 60 61use crate::type_::Type; 62 63use super::{ 64 AssignName, BinOp, BitArrayOption, CallArg, Pattern, PipelineAssignmentKind, RecordUpdateArg, 65 SrcSpan, Statement, TodoKind, TypeAst, TypedArg, TypedAssert, TypedAssignment, TypedClause, 66 TypedClauseGuard, TypedConstant, TypedCustomType, TypedExpr, TypedExprBitArraySegment, 67 TypedFunction, TypedModule, TypedModuleConstant, TypedPattern, TypedPatternBitArraySegment, 68 TypedPipelineAssignment, TypedStatement, TypedUse, untyped::FunctionLiteralKind, 69}; 70 71pub trait Visit<'ast> { 72 fn visit_typed_module(&mut self, module: &'ast TypedModule) { 73 visit_typed_module(self, module); 74 } 75 76 fn visit_typed_function(&mut self, fun: &'ast TypedFunction) { 77 visit_typed_function(self, fun); 78 } 79 80 fn visit_typed_module_constant(&mut self, constant: &'ast TypedModuleConstant) { 81 visit_typed_module_constant(self, constant); 82 } 83 84 fn visit_typed_custom_type(&mut self, custom_type: &'ast TypedCustomType) { 85 visit_typed_custom_type(self, custom_type); 86 } 87 88 fn visit_typed_type_alias(&mut self, type_alias: &'ast TypedTypeAlias) { 89 visit_typed_type_alias(self, type_alias) 90 } 91 92 fn visit_typed_import(&mut self, import: &'ast TypedImport) { 93 visit_typed_import(self, import) 94 } 95 96 fn visit_typed_expr(&mut self, expr: &'ast TypedExpr) { 97 visit_typed_expr(self, expr); 98 } 99 100 fn visit_typed_expr_echo( 101 &mut self, 102 location: &'ast SrcSpan, 103 type_: &'ast Arc<Type>, 104 expression: &'ast Option<Box<TypedExpr>>, 105 message: &'ast Option<Box<TypedExpr>>, 106 ) { 107 visit_typed_expr_echo(self, location, type_, expression, message); 108 } 109 110 fn visit_typed_expr_int( 111 &mut self, 112 location: &'ast SrcSpan, 113 type_: &'ast Arc<Type>, 114 value: &'ast EcoString, 115 ) { 116 visit_typed_expr_int(self, location, type_, value); 117 } 118 119 fn visit_typed_expr_float( 120 &mut self, 121 location: &'ast SrcSpan, 122 type_: &'ast Arc<Type>, 123 value: &'ast EcoString, 124 ) { 125 visit_typed_expr_float(self, location, type_, value); 126 } 127 128 fn visit_typed_expr_string( 129 &mut self, 130 location: &'ast SrcSpan, 131 type_: &'ast Arc<Type>, 132 value: &'ast EcoString, 133 ) { 134 visit_typed_expr_string(self, location, type_, value); 135 } 136 137 fn visit_typed_expr_block( 138 &mut self, 139 location: &'ast SrcSpan, 140 statements: &'ast [TypedStatement], 141 ) { 142 visit_typed_expr_block(self, location, statements); 143 } 144 145 fn visit_typed_expr_pipeline( 146 &mut self, 147 location: &'ast SrcSpan, 148 first_value: &'ast TypedPipelineAssignment, 149 assignments: &'ast [(TypedPipelineAssignment, PipelineAssignmentKind)], 150 finally: &'ast TypedExpr, 151 finally_kind: &'ast PipelineAssignmentKind, 152 ) { 153 visit_typed_expr_pipeline( 154 self, 155 location, 156 first_value, 157 assignments, 158 finally, 159 finally_kind, 160 ); 161 } 162 163 fn visit_typed_expr_var( 164 &mut self, 165 location: &'ast SrcSpan, 166 constructor: &'ast ValueConstructor, 167 name: &'ast EcoString, 168 ) { 169 visit_typed_expr_var(self, location, constructor, name); 170 } 171 172 fn visit_typed_expr_fn( 173 &mut self, 174 location: &'ast SrcSpan, 175 type_: &'ast Arc<Type>, 176 kind: &'ast FunctionLiteralKind, 177 arguments: &'ast [TypedArg], 178 body: &'ast Vec1<TypedStatement>, 179 return_annotation: &'ast Option<TypeAst>, 180 ) { 181 visit_typed_expr_fn( 182 self, 183 location, 184 type_, 185 kind, 186 arguments, 187 body, 188 return_annotation, 189 ); 190 } 191 192 fn visit_typed_expr_list( 193 &mut self, 194 location: &'ast SrcSpan, 195 type_: &'ast Arc<Type>, 196 elements: &'ast [TypedExpr], 197 tail: &'ast Option<Box<TypedExpr>>, 198 ) { 199 visit_typed_expr_list(self, location, type_, elements, tail); 200 } 201 202 fn visit_typed_expr_call( 203 &mut self, 204 location: &'ast SrcSpan, 205 type_: &'ast Arc<Type>, 206 fun: &'ast TypedExpr, 207 arguments: &'ast [TypedCallArg], 208 open_parenthesis: &'ast Option<u32>, 209 ) { 210 visit_typed_expr_call(self, location, type_, fun, arguments, open_parenthesis); 211 } 212 213 fn visit_typed_expr_bin_op( 214 &mut self, 215 location: &'ast SrcSpan, 216 type_: &'ast Arc<Type>, 217 operator: &'ast BinOp, 218 operator_start: &'ast u32, 219 left: &'ast TypedExpr, 220 right: &'ast TypedExpr, 221 ) { 222 visit_typed_expr_bin_op(self, location, type_, operator, operator_start, left, right); 223 } 224 225 fn visit_typed_expr_case( 226 &mut self, 227 location: &'ast SrcSpan, 228 type_: &'ast Arc<Type>, 229 subjects: &'ast [TypedExpr], 230 clauses: &'ast [TypedClause], 231 compiled_case: &'ast CompiledCase, 232 ) { 233 visit_typed_expr_case(self, location, type_, subjects, clauses, compiled_case); 234 } 235 236 #[allow(clippy::too_many_arguments)] 237 fn visit_typed_expr_record_access( 238 &mut self, 239 location: &'ast SrcSpan, 240 field_start: &'ast u32, 241 type_: &'ast Arc<Type>, 242 label: &'ast EcoString, 243 index: &'ast u64, 244 record: &'ast TypedExpr, 245 documentation: &'ast Option<EcoString>, 246 ) { 247 visit_typed_expr_record_access( 248 self, 249 location, 250 field_start, 251 type_, 252 label, 253 index, 254 record, 255 documentation, 256 ); 257 } 258 259 #[allow(clippy::too_many_arguments)] 260 fn visit_typed_expr_module_select( 261 &mut self, 262 location: &'ast SrcSpan, 263 field_start: &'ast u32, 264 type_: &'ast Arc<Type>, 265 label: &'ast EcoString, 266 module_name: &'ast EcoString, 267 module_alias: &'ast EcoString, 268 constructor: &'ast ModuleValueConstructor, 269 ) { 270 visit_typed_expr_module_select( 271 self, 272 location, 273 field_start, 274 type_, 275 label, 276 module_name, 277 module_alias, 278 constructor, 279 ); 280 } 281 282 fn visit_typed_expr_tuple( 283 &mut self, 284 location: &'ast SrcSpan, 285 type_: &'ast Arc<Type>, 286 elements: &'ast [TypedExpr], 287 ) { 288 visit_typed_expr_tuple(self, location, type_, elements); 289 } 290 291 fn visit_typed_expr_tuple_index( 292 &mut self, 293 location: &'ast SrcSpan, 294 type_: &'ast Arc<Type>, 295 index: &'ast u64, 296 tuple: &'ast TypedExpr, 297 ) { 298 visit_typed_expr_tuple_index(self, location, type_, index, tuple); 299 } 300 301 fn visit_typed_expr_todo( 302 &mut self, 303 location: &'ast SrcSpan, 304 message: &'ast Option<Box<TypedExpr>>, 305 kind: &'ast TodoKind, 306 type_: &'ast Arc<Type>, 307 ) { 308 visit_typed_expr_todo(self, location, message, kind, type_); 309 } 310 311 fn visit_typed_expr_panic( 312 &mut self, 313 location: &'ast SrcSpan, 314 message: &'ast Option<Box<TypedExpr>>, 315 type_: &'ast Arc<Type>, 316 ) { 317 visit_typed_expr_panic(self, location, message, type_); 318 } 319 320 fn visit_typed_expr_bit_array( 321 &mut self, 322 location: &'ast SrcSpan, 323 type_: &'ast Arc<Type>, 324 segments: &'ast [TypedExprBitArraySegment], 325 ) { 326 visit_typed_expr_bit_array(self, location, type_, segments); 327 } 328 329 #[allow(clippy::too_many_arguments)] 330 fn visit_typed_expr_record_update( 331 &mut self, 332 location: &'ast SrcSpan, 333 spread_start: &'ast u32, 334 type_: &'ast Arc<Type>, 335 updated_record: &'ast TypedExpr, 336 updated_record_assigned_name: &'ast Option<EcoString>, 337 constructor: &'ast TypedExpr, 338 arguments: &'ast [TypedCallArg], 339 ) { 340 visit_typed_expr_record_update( 341 self, 342 location, 343 spread_start, 344 type_, 345 updated_record, 346 updated_record_assigned_name, 347 constructor, 348 arguments, 349 ); 350 } 351 352 fn visit_typed_expr_negate_bool(&mut self, location: &'ast SrcSpan, value: &'ast TypedExpr) { 353 visit_typed_expr_negate_bool(self, location, value); 354 } 355 356 fn visit_typed_expr_negate_int(&mut self, location: &'ast SrcSpan, value: &'ast TypedExpr) { 357 visit_typed_expr_negate_int(self, location, value) 358 } 359 360 fn visit_typed_expr_invalid( 361 &mut self, 362 location: &'ast SrcSpan, 363 type_: &'ast Arc<Type>, 364 extra_information: &'ast Option<InvalidExpression>, 365 ) { 366 visit_typed_expr_invalid(self, location, type_, extra_information); 367 } 368 369 fn visit_typed_statement(&mut self, statement: &'ast TypedStatement) { 370 visit_typed_statement(self, statement); 371 } 372 373 fn visit_typed_assignment(&mut self, assignment: &'ast TypedAssignment) { 374 visit_typed_assignment(self, assignment); 375 } 376 377 fn visit_typed_use(&mut self, use_: &'ast TypedUse) { 378 visit_typed_use(self, use_); 379 } 380 381 fn visit_typed_assert(&mut self, assert: &'ast TypedAssert) { 382 visit_typed_assert(self, assert); 383 } 384 385 fn visit_typed_pipeline_assignment(&mut self, assignment: &'ast TypedPipelineAssignment) { 386 visit_typed_pipeline_assignment(self, assignment); 387 } 388 389 fn visit_typed_call_arg(&mut self, arg: &'ast TypedCallArg) { 390 visit_typed_call_arg(self, arg); 391 } 392 393 fn visit_typed_clause(&mut self, clause: &'ast TypedClause) { 394 visit_typed_clause(self, clause); 395 } 396 397 fn visit_typed_clause_guard(&mut self, guard: &'ast TypedClauseGuard) { 398 visit_typed_clause_guard(self, guard); 399 } 400 401 fn visit_typed_clause_guard_bin_op( 402 &mut self, 403 left: &'ast TypedClauseGuard, 404 right: &'ast TypedClauseGuard, 405 operator: &'ast BinOp, 406 operator_start: &'ast u32, 407 location: &'ast SrcSpan, 408 ) { 409 visit_typed_clause_guard_bin_op(self, left, right, operator, operator_start, location); 410 } 411 412 fn visit_typed_clause_guard_var( 413 &mut self, 414 location: &'ast SrcSpan, 415 name: &'ast EcoString, 416 type_: &'ast Arc<Type>, 417 definition_location: &'ast SrcSpan, 418 origin: &'ast VariableOrigin, 419 ) { 420 visit_typed_clause_guard_var(self, location, name, type_, definition_location, origin); 421 } 422 423 fn visit_typed_clause_guard_tuple_index( 424 &mut self, 425 location: &'ast SrcSpan, 426 index: &'ast u64, 427 type_: &'ast Arc<Type>, 428 tuple: &'ast TypedClauseGuard, 429 ) { 430 visit_typed_clause_guard_tuple_index(self, location, index, type_, tuple) 431 } 432 433 fn visit_typed_clause_guard_field_access( 434 &mut self, 435 label_location: &'ast SrcSpan, 436 index: &'ast Option<u64>, 437 label: &'ast EcoString, 438 type_: &'ast Arc<Type>, 439 container: &'ast TypedClauseGuard, 440 ) { 441 visit_typed_clause_guard_field_access(self, label_location, index, label, type_, container) 442 } 443 444 #[allow(clippy::too_many_arguments)] 445 fn visit_typed_clause_guard_module_select( 446 &mut self, 447 location: &'ast SrcSpan, 448 field_start: &'ast u32, 449 definition_location: &'ast SrcSpan, 450 type_: &'ast Arc<Type>, 451 label: &'ast EcoString, 452 module_name: &'ast EcoString, 453 module_alias: &'ast EcoString, 454 literal: &'ast TypedConstant, 455 ) { 456 visit_typed_clause_guard_module_select( 457 self, 458 location, 459 field_start, 460 definition_location, 461 type_, 462 label, 463 module_name, 464 module_alias, 465 literal, 466 ) 467 } 468 469 fn visit_typed_expr_bit_array_segment(&mut self, segment: &'ast TypedExprBitArraySegment) { 470 visit_typed_expr_bit_array_segment(self, segment); 471 } 472 473 fn visit_typed_bit_array_option(&mut self, option: &'ast BitArrayOption<TypedExpr>) { 474 visit_typed_bit_array_option(self, option); 475 } 476 477 fn visit_typed_pattern(&mut self, pattern: &'ast TypedPattern) { 478 visit_typed_pattern(self, pattern); 479 } 480 481 fn visit_typed_pattern_int(&mut self, location: &'ast SrcSpan, value: &'ast EcoString) { 482 visit_typed_pattern_int(self, location, value); 483 } 484 485 fn visit_typed_pattern_float(&mut self, location: &'ast SrcSpan, value: &'ast EcoString) { 486 visit_typed_pattern_float(self, location, value); 487 } 488 489 fn visit_typed_pattern_string(&mut self, location: &'ast SrcSpan, value: &'ast EcoString) { 490 visit_typed_pattern_string(self, location, value); 491 } 492 493 fn visit_typed_pattern_variable( 494 &mut self, 495 location: &'ast SrcSpan, 496 name: &'ast EcoString, 497 type_: &'ast Arc<Type>, 498 origin: &'ast VariableOrigin, 499 ) { 500 visit_typed_pattern_variable(self, location, name, type_, origin); 501 } 502 503 fn visit_typed_pattern_bit_array_size(&mut self, size: &'ast TypedBitArraySize) { 504 visit_typed_pattern_bit_array_size(self, size); 505 } 506 507 fn visit_typed_bit_array_size_int(&mut self, location: &'ast SrcSpan, value: &'ast EcoString) { 508 visit_typed_bit_array_size_int(self, location, value) 509 } 510 511 fn visit_typed_bit_array_size_variable( 512 &mut self, 513 location: &'ast SrcSpan, 514 name: &'ast EcoString, 515 constructor: &'ast Option<Box<ValueConstructor>>, 516 type_: &'ast Arc<Type>, 517 ) { 518 visit_typed_bit_array_size_variable(self, location, name, constructor, type_) 519 } 520 521 fn visit_typed_pattern_assign( 522 &mut self, 523 location: &'ast SrcSpan, 524 name: &'ast EcoString, 525 pattern: &'ast TypedPattern, 526 ) { 527 visit_typed_pattern_assign(self, location, name, pattern); 528 } 529 530 fn visit_typed_pattern_discard( 531 &mut self, 532 location: &'ast SrcSpan, 533 name: &'ast EcoString, 534 type_: &'ast Arc<Type>, 535 ) { 536 visit_typed_pattern_discard(self, location, name, type_) 537 } 538 539 fn visit_typed_pattern_list( 540 &mut self, 541 location: &'ast SrcSpan, 542 elements: &'ast Vec<TypedPattern>, 543 tail: &'ast Option<Box<TypedTailPattern>>, 544 type_: &'ast Arc<Type>, 545 ) { 546 visit_typed_pattern_list(self, location, elements, tail, type_); 547 } 548 549 #[allow(clippy::too_many_arguments)] 550 fn visit_typed_pattern_constructor( 551 &mut self, 552 location: &'ast SrcSpan, 553 name_location: &'ast SrcSpan, 554 name: &'ast EcoString, 555 arguments: &'ast Vec<CallArg<TypedPattern>>, 556 module: &'ast Option<(EcoString, SrcSpan)>, 557 constructor: &'ast Inferred<PatternConstructor>, 558 spread: &'ast Option<SrcSpan>, 559 type_: &'ast Arc<Type>, 560 ) { 561 visit_typed_pattern_constructor( 562 self, 563 location, 564 name_location, 565 name, 566 arguments, 567 module, 568 constructor, 569 spread, 570 type_, 571 ); 572 } 573 574 fn visit_typed_pattern_call_arg(&mut self, arg: &'ast CallArg<TypedPattern>) { 575 visit_typed_pattern_call_arg(self, arg); 576 } 577 578 fn visit_typed_pattern_tuple( 579 &mut self, 580 location: &'ast SrcSpan, 581 elements: &'ast Vec<TypedPattern>, 582 ) { 583 visit_typed_pattern_tuple(self, location, elements); 584 } 585 586 fn visit_typed_pattern_bit_array( 587 &mut self, 588 location: &'ast SrcSpan, 589 segments: &'ast [TypedPatternBitArraySegment], 590 ) { 591 visit_typed_pattern_bit_array(self, location, segments); 592 } 593 594 fn visit_typed_pattern_bit_array_option(&mut self, option: &'ast BitArrayOption<TypedPattern>) { 595 visit_typed_pattern_bit_array_option(self, option); 596 } 597 598 fn visit_typed_pattern_string_prefix( 599 &mut self, 600 location: &'ast SrcSpan, 601 left_location: &'ast SrcSpan, 602 left_side_assignment: &'ast Option<(EcoString, SrcSpan)>, 603 right_location: &'ast SrcSpan, 604 left_side_string: &'ast EcoString, 605 right_side_assignment: &'ast AssignName, 606 ) { 607 visit_typed_pattern_string_prefix( 608 self, 609 location, 610 left_location, 611 left_side_assignment, 612 right_location, 613 left_side_string, 614 right_side_assignment, 615 ); 616 } 617 618 fn visit_typed_pattern_invalid(&mut self, location: &'ast SrcSpan, type_: &'ast Arc<Type>) { 619 visit_typed_pattern_invalid(self, location, type_); 620 } 621 622 fn visit_type_ast( 623 &mut self, 624 node: &'ast TypeAst, 625 // The type inferred for this annotation. 626 // It might not always be possible to infer one in presence of type 627 // errors, so this is optional! 628 inferred_type: Option<Arc<Type>>, 629 ) { 630 visit_type_ast(self, node, inferred_type); 631 } 632 633 fn visit_type_ast_constructor( 634 &mut self, 635 location: &'ast SrcSpan, 636 name: &'ast TypeAstConstructorName, 637 arguments: &'ast [TypeAst], 638 inferred_arguments_types: Option<Vec<Arc<Type>>>, 639 ) { 640 visit_type_ast_constructor(self, location, name, arguments, inferred_arguments_types); 641 } 642 643 fn visit_type_ast_fn( 644 &mut self, 645 location: &'ast SrcSpan, 646 arguments: &'ast [TypeAst], 647 arguments_types: Option<Vec<Arc<Type>>>, 648 return_: &'ast TypeAst, 649 return_type: Option<Arc<Type>>, 650 ) { 651 visit_type_ast_fn( 652 self, 653 location, 654 arguments, 655 arguments_types, 656 return_, 657 return_type, 658 ); 659 } 660 661 fn visit_type_ast_var(&mut self, location: &'ast SrcSpan, name: &'ast EcoString) { 662 visit_type_ast_var(self, location, name); 663 } 664 665 fn visit_type_ast_tuple( 666 &mut self, 667 location: &'ast SrcSpan, 668 elements: &'ast [TypeAst], 669 elements_types: Option<&Vec<Arc<Type>>>, 670 ) { 671 visit_type_ast_tuple(self, location, elements, elements_types); 672 } 673 674 fn visit_type_ast_hole( 675 &mut self, 676 location: &'ast SrcSpan, 677 name: &'ast EcoString, 678 type_: Option<Arc<Type>>, 679 ) { 680 visit_type_ast_hole(self, location, name, type_); 681 } 682 683 fn visit_typed_constant(&mut self, constant: &'ast TypedConstant) { 684 visit_typed_constant(self, constant); 685 } 686 687 fn visit_typed_constant_todo( 688 &mut self, 689 location: &'ast SrcSpan, 690 type_: &'ast Arc<Type>, 691 message: &'ast Option<Box<TypedConstant>>, 692 ) { 693 visit_typed_constant_todo(self, location, type_, message); 694 } 695 696 fn visit_typed_constant_int( 697 &mut self, 698 location: &'ast SrcSpan, 699 value: &'ast EcoString, 700 int_value: &'ast BigInt, 701 ) { 702 visit_typed_constant_int(self, location, value, int_value); 703 } 704 705 fn visit_typed_constant_float( 706 &mut self, 707 location: &'ast SrcSpan, 708 value: &'ast EcoString, 709 float_value: &'ast LiteralFloatValue, 710 ) { 711 visit_typed_constant_float(self, location, value, float_value); 712 } 713 714 fn visit_typed_constant_string(&mut self, location: &'ast SrcSpan, value: &'ast EcoString) { 715 visit_typed_constant_string(self, location, value); 716 } 717 718 fn visit_typed_constant_tuple( 719 &mut self, 720 location: &'ast SrcSpan, 721 elements: &'ast Vec<TypedConstant>, 722 type_: &'ast Arc<Type>, 723 ) { 724 visit_typed_constant_tuple(self, location, elements, type_); 725 } 726 727 fn visit_typed_constant_list( 728 &mut self, 729 location: &'ast SrcSpan, 730 elements: &'ast Vec<TypedConstant>, 731 type_: &'ast Arc<Type>, 732 tail: &'ast Option<Box<TypedConstant>>, 733 ) { 734 visit_typed_constant_list(self, location, elements, type_, tail); 735 } 736 737 #[allow(clippy::too_many_arguments)] 738 fn visit_typed_constant_record( 739 &mut self, 740 location: &'ast SrcSpan, 741 module: &'ast Option<(EcoString, SrcSpan)>, 742 name: &'ast EcoString, 743 arguments: &'ast Option<Vec<CallArg<TypedConstant>>>, 744 type_: &'ast Arc<Type>, 745 field_map: &'ast Inferred<FieldMap>, 746 record_constructor: &'ast Option<Box<ValueConstructor>>, 747 ) { 748 visit_typed_constant_record( 749 self, 750 location, 751 module, 752 name, 753 arguments, 754 type_, 755 field_map, 756 record_constructor, 757 ) 758 } 759 760 #[allow(clippy::too_many_arguments)] 761 fn visit_typed_constant_record_update( 762 &mut self, 763 location: &'ast SrcSpan, 764 constructor_location: &'ast SrcSpan, 765 module: &'ast Option<(EcoString, SrcSpan)>, 766 name: &'ast EcoString, 767 record: &'ast RecordBeingUpdated<TypedConstant>, 768 arguments: &'ast [RecordUpdateArg<TypedConstant>], 769 type_: &'ast Arc<Type>, 770 field_map: &'ast Inferred<FieldMap>, 771 ) { 772 visit_typed_constant_record_update( 773 self, 774 location, 775 constructor_location, 776 module, 777 name, 778 record, 779 arguments, 780 type_, 781 field_map, 782 ) 783 } 784 785 fn visit_typed_constant_bit_array( 786 &mut self, 787 location: &'ast SrcSpan, 788 segments: &'ast [TypedConstantBitArraySegment], 789 ) { 790 visit_typed_constant_bit_array(self, location, segments); 791 } 792 793 fn visit_typed_constant_var( 794 &mut self, 795 location: &'ast SrcSpan, 796 module: &'ast Option<(EcoString, SrcSpan)>, 797 name: &'ast EcoString, 798 constructor: &'ast Option<Box<ValueConstructor>>, 799 type_: &'ast Arc<Type>, 800 ) { 801 visit_typed_constant_var(self, location, module, name, constructor, type_); 802 } 803 804 fn visit_typed_constant_string_concatenation( 805 &mut self, 806 location: &'ast SrcSpan, 807 left: &'ast TypedConstant, 808 right: &'ast TypedConstant, 809 ) { 810 visit_typed_constant_string_concatenation(self, location, left, right); 811 } 812 813 fn visit_typed_constant_invalid( 814 &mut self, 815 location: &'ast SrcSpan, 816 type_: &'ast Arc<Type>, 817 extra_information: &'ast Option<InvalidExpression>, 818 ) { 819 visit_typed_constant_invalid(self, location, type_, extra_information); 820 } 821} 822 823fn visit_typed_constant_invalid<'a, V: Visit<'a> + ?Sized>( 824 _v: &mut V, 825 _location: &'a SrcSpan, 826 _type_: &'a Type, 827 _extra_information: &'a Option<InvalidExpression>, 828) { 829 // No further traversal needed for constant invalid expressions 830} 831 832fn visit_typed_constant_string_concatenation<'a, V: Visit<'a> + ?Sized>( 833 v: &mut V, 834 _location: &'a SrcSpan, 835 left: &'a TypedConstant, 836 right: &'a TypedConstant, 837) { 838 v.visit_typed_constant(left); 839 v.visit_typed_constant(right); 840} 841 842pub fn visit_typed_constant_var<'a, V: Visit<'a> + ?Sized>( 843 _v: &mut V, 844 _location: &'a SrcSpan, 845 _module: &'a Option<(EcoString, SrcSpan)>, 846 _name: &'a EcoString, 847 _constructor: &'a Option<Box<ValueConstructor>>, 848 _type_: &'a Arc<Type>, 849) { 850 // No further traversal needed for constant vars 851} 852 853fn visit_typed_constant_bit_array<'a, V: Visit<'a> + ?Sized>( 854 _v: &mut V, 855 _location: &'a SrcSpan, 856 _segments: &'a [TypedConstantBitArraySegment], 857) { 858 // TODO 859} 860 861#[allow(clippy::too_many_arguments)] 862pub fn visit_typed_constant_record<'a, V: Visit<'a> + ?Sized>( 863 v: &mut V, 864 _location: &'a SrcSpan, 865 _module: &'a Option<(EcoString, SrcSpan)>, 866 _name: &'a EcoString, 867 arguments: &'a Option<Vec<CallArg<TypedConstant>>>, 868 _type_: &'a Arc<Type>, 869 _field_map: &'a Inferred<FieldMap>, 870 _record_constructor: &'a Option<Box<ValueConstructor>>, 871) { 872 for argument in arguments.iter().flatten() { 873 v.visit_typed_constant(&argument.value) 874 } 875} 876 877#[allow(clippy::too_many_arguments)] 878pub fn visit_typed_constant_record_update<'a, V: Visit<'a> + ?Sized>( 879 v: &mut V, 880 _location: &'a SrcSpan, 881 _constructor_location: &'a SrcSpan, 882 _module: &'a Option<(EcoString, SrcSpan)>, 883 _name: &'a EcoString, 884 record: &'a RecordBeingUpdated<TypedConstant>, 885 arguments: &'a [RecordUpdateArg<TypedConstant>], 886 _type_: &'a Arc<Type>, 887 _field_map: &'a Inferred<FieldMap>, 888) { 889 v.visit_typed_constant(&record.base); 890 for argument in arguments { 891 v.visit_typed_constant(&argument.value); 892 } 893} 894 895fn visit_typed_constant_list<'a, V: Visit<'a> + ?Sized>( 896 v: &mut V, 897 _location: &'a SrcSpan, 898 elements: &'a Vec<TypedConstant>, 899 _type_: &'a Arc<Type>, 900 tail: &'a Option<Box<TypedConstant>>, 901) { 902 for element in elements { 903 v.visit_typed_constant(element) 904 } 905 if let Some(tail) = tail { 906 v.visit_typed_constant(tail); 907 } 908} 909 910fn visit_typed_constant_tuple<'a, V: Visit<'a> + ?Sized>( 911 v: &mut V, 912 _location: &'a SrcSpan, 913 elements: &'a Vec<TypedConstant>, 914 _type_: &'a Arc<Type>, 915) { 916 for element in elements { 917 v.visit_typed_constant(element) 918 } 919} 920 921fn visit_typed_constant_string<'a, V: Visit<'a> + ?Sized>( 922 _v: &mut V, 923 _location: &'a SrcSpan, 924 _value: &'a EcoString, 925) { 926 // No further traversal needed for constant strings 927} 928 929fn visit_typed_constant_float<'a, V: Visit<'a> + ?Sized>( 930 _v: &mut V, 931 _location: &'a SrcSpan, 932 _value: &'a EcoString, 933 _float_value: &'a LiteralFloatValue, 934) { 935 // No further traversal needed for constant floats 936} 937 938fn visit_typed_constant_int<'a, V: Visit<'a> + ?Sized>( 939 _v: &mut V, 940 _location: &'a SrcSpan, 941 _value: &'a EcoString, 942 _int_value: &'a BigInt, 943) { 944 // No further traversal needed for constant ints 945} 946 947pub fn visit_typed_constant_todo<'a, V: Visit<'a> + ?Sized>( 948 _v: &mut V, 949 _location: &'a SrcSpan, 950 _type_: &'a Arc<Type>, 951 _message: &'a Option<Box<TypedConstant>>, 952) { 953 // No further traversal needed for constant todos 954} 955 956pub fn visit_typed_module<'a, V>(v: &mut V, module: &'a TypedModule) 957where 958 V: Visit<'a> + ?Sized, 959{ 960 let TypedDefinitions { 961 imports, 962 constants, 963 custom_types, 964 type_aliases, 965 functions, 966 } = &module.definitions; 967 968 for import in imports { 969 v.visit_typed_import(import); 970 } 971 972 for constant in constants { 973 v.visit_typed_module_constant(constant); 974 } 975 976 for custom_type in custom_types { 977 v.visit_typed_custom_type(custom_type); 978 } 979 980 for type_alias in type_aliases { 981 v.visit_typed_type_alias(type_alias); 982 } 983 984 for function in functions { 985 v.visit_typed_function(function); 986 } 987} 988 989pub fn visit_typed_function<'a, V>(v: &mut V, fun: &'a TypedFunction) 990where 991 V: Visit<'a> + ?Sized, 992{ 993 for argument in fun.arguments.iter() { 994 if let Some(annotation) = &argument.annotation { 995 v.visit_type_ast(annotation, Some(argument.type_.clone())); 996 } 997 } 998 if let Some(annotation) = &fun.return_annotation { 999 v.visit_type_ast(annotation, Some(fun.return_type.clone())); 1000 } 1001 1002 for statement in &fun.body { 1003 v.visit_typed_statement(statement); 1004 } 1005} 1006 1007pub fn visit_type_ast<'a, V>(v: &mut V, node: &'a TypeAst, type_: Option<Arc<Type>>) 1008where 1009 V: Visit<'a> + ?Sized, 1010{ 1011 match node { 1012 TypeAst::Constructor(super::TypeAstConstructor { 1013 location, 1014 arguments, 1015 name, 1016 start_parentheses: _, 1017 }) => { 1018 v.visit_type_ast_constructor( 1019 location, 1020 name, 1021 arguments, 1022 type_.and_then(|type_| type_.constructor_types()), 1023 ); 1024 } 1025 TypeAst::Fn(super::TypeAstFn { 1026 location, 1027 arguments, 1028 return_, 1029 }) => { 1030 let (arguments_types, return_type) = match type_.and_then(|type_| type_.fn_types()) { 1031 Some((arguments_types, return_type)) => (Some(arguments_types), Some(return_type)), 1032 None => (None, None), 1033 }; 1034 1035 v.visit_type_ast_fn(location, arguments, arguments_types, return_, return_type); 1036 } 1037 TypeAst::Var(super::TypeAstVar { location, name }) => { 1038 v.visit_type_ast_var(location, name); 1039 } 1040 TypeAst::Tuple(super::TypeAstTuple { location, elements }) => { 1041 let elements_types = if let Some(Type::Tuple { elements }) = type_.as_deref() { 1042 Some(elements) 1043 } else { 1044 None 1045 }; 1046 v.visit_type_ast_tuple(location, elements, elements_types); 1047 } 1048 TypeAst::Hole(super::TypeAstHole { location, name }) => { 1049 v.visit_type_ast_hole(location, name, type_); 1050 } 1051 } 1052} 1053 1054pub fn visit_type_ast_constructor<'a, V>( 1055 v: &mut V, 1056 _location: &'a SrcSpan, 1057 _name: &'a TypeAstConstructorName, 1058 arguments: &'a [TypeAst], 1059 inferred_arguments_types: Option<Vec<Arc<Type>>>, 1060) where 1061 V: Visit<'a> + ?Sized, 1062{ 1063 for (i, argument) in arguments.iter().enumerate() { 1064 let argument_type = inferred_arguments_types 1065 .as_ref() 1066 .and_then(|types| types.get(i)); 1067 v.visit_type_ast(argument, argument_type.cloned()); 1068 } 1069} 1070 1071pub fn visit_type_ast_fn<'a, V>( 1072 v: &mut V, 1073 _location: &'a SrcSpan, 1074 arguments: &'a [TypeAst], 1075 arguments_types: Option<Vec<Arc<Type>>>, 1076 return_: &'a TypeAst, 1077 return_type: Option<Arc<Type>>, 1078) where 1079 V: Visit<'a> + ?Sized, 1080{ 1081 for (i, argument) in arguments.iter().enumerate() { 1082 v.visit_type_ast( 1083 argument, 1084 arguments_types 1085 .as_ref() 1086 .and_then(|types| types.get(i)) 1087 .cloned(), 1088 ); 1089 } 1090 v.visit_type_ast(return_, return_type.clone()); 1091} 1092 1093pub fn visit_type_ast_var<'a, V>(_v: &mut V, _location: &'a SrcSpan, _name: &'a EcoString) 1094where 1095 V: Visit<'a> + ?Sized, 1096{ 1097 // No further traversal needed for variables 1098} 1099 1100pub fn visit_type_ast_tuple<'a, V>( 1101 v: &mut V, 1102 _location: &'a SrcSpan, 1103 elements: &'a [TypeAst], 1104 elements_types: Option<&Vec<Arc<Type>>>, 1105) where 1106 V: Visit<'a> + ?Sized, 1107{ 1108 for (i, element) in elements.iter().enumerate() { 1109 let element_type = elements_types 1110 .as_ref() 1111 .and_then(|types| types.get(i)) 1112 .cloned(); 1113 v.visit_type_ast(element, element_type); 1114 } 1115} 1116 1117pub fn visit_type_ast_hole<'a, V>( 1118 _v: &mut V, 1119 _location: &'a SrcSpan, 1120 _name: &'a EcoString, 1121 _type_: Option<Arc<Type>>, 1122) where 1123 V: Visit<'a> + ?Sized, 1124{ 1125 // No further traversal needed for holes 1126} 1127 1128pub fn visit_typed_module_constant<'a, V>(v: &mut V, constant: &'a TypedModuleConstant) 1129where 1130 V: Visit<'a> + ?Sized, 1131{ 1132 if let Some(annotation) = &constant.annotation { 1133 v.visit_type_ast(annotation, Some(constant.type_.clone())); 1134 } 1135 v.visit_typed_constant(&constant.value); 1136} 1137 1138pub fn visit_typed_constant<'a, V: Visit<'a> + ?Sized>(v: &mut V, constant: &'a TypedConstant) { 1139 match constant { 1140 super::Constant::Todo { 1141 location, 1142 type_, 1143 message, 1144 } => v.visit_typed_constant_todo(location, type_, message), 1145 super::Constant::Int { 1146 location, 1147 value, 1148 int_value, 1149 } => v.visit_typed_constant_int(location, value, int_value), 1150 super::Constant::Float { 1151 location, 1152 value, 1153 float_value, 1154 } => v.visit_typed_constant_float(location, value, float_value), 1155 super::Constant::String { location, value } => { 1156 v.visit_typed_constant_string(location, value) 1157 } 1158 super::Constant::Tuple { 1159 location, 1160 elements, 1161 type_, 1162 } => v.visit_typed_constant_tuple(location, elements, type_), 1163 super::Constant::List { 1164 location, 1165 elements, 1166 type_, 1167 tail, 1168 } => v.visit_typed_constant_list(location, elements, type_, tail), 1169 super::Constant::Record { 1170 location, 1171 module, 1172 name, 1173 arguments, 1174 type_, 1175 field_map, 1176 record_constructor, 1177 } => v.visit_typed_constant_record( 1178 location, 1179 module, 1180 name, 1181 arguments, 1182 type_, 1183 field_map, 1184 record_constructor, 1185 ), 1186 super::Constant::RecordUpdate { 1187 location, 1188 constructor_location, 1189 module, 1190 name, 1191 record, 1192 arguments, 1193 type_, 1194 field_map, 1195 } => v.visit_typed_constant_record_update( 1196 location, 1197 constructor_location, 1198 module, 1199 name, 1200 record, 1201 arguments, 1202 type_, 1203 field_map, 1204 ), 1205 super::Constant::BitArray { location, segments } => { 1206 v.visit_typed_constant_bit_array(location, segments) 1207 } 1208 super::Constant::Var { 1209 location, 1210 module, 1211 name, 1212 constructor, 1213 type_, 1214 } => v.visit_typed_constant_var(location, module, name, constructor, type_), 1215 super::Constant::StringConcatenation { 1216 location, 1217 left, 1218 right, 1219 } => v.visit_typed_constant_string_concatenation(location, left, right), 1220 super::Constant::Invalid { 1221 location, 1222 type_, 1223 extra_information, 1224 } => v.visit_typed_constant_invalid(location, type_, extra_information), 1225 } 1226} 1227 1228pub fn visit_typed_custom_type<'a, V>(v: &mut V, custom_type: &'a TypedCustomType) 1229where 1230 V: Visit<'a> + ?Sized, 1231{ 1232 for record in &custom_type.constructors { 1233 for argument in &record.arguments { 1234 v.visit_type_ast(&argument.ast, Some(argument.type_.clone())); 1235 } 1236 } 1237} 1238 1239pub fn visit_typed_type_alias<'a, V>(v: &mut V, type_alias: &'a TypedTypeAlias) 1240where 1241 V: Visit<'a> + ?Sized, 1242{ 1243 v.visit_type_ast(&type_alias.type_ast, Some(type_alias.type_.clone())); 1244} 1245 1246pub fn visit_typed_import<'a, V>(_v: &mut V, _import: &'a TypedImport) 1247where 1248 V: Visit<'a> + ?Sized, 1249{ 1250} 1251 1252pub fn visit_typed_expr<'a, V>(v: &mut V, node: &'a TypedExpr) 1253where 1254 V: Visit<'a> + ?Sized, 1255{ 1256 match node { 1257 TypedExpr::Int { 1258 location, 1259 type_, 1260 value, 1261 int_value: _, 1262 } => v.visit_typed_expr_int(location, type_, value), 1263 TypedExpr::Float { 1264 location, 1265 type_, 1266 value, 1267 float_value: _, 1268 } => v.visit_typed_expr_float(location, type_, value), 1269 TypedExpr::String { 1270 location, 1271 type_, 1272 value, 1273 } => v.visit_typed_expr_string(location, type_, value), 1274 TypedExpr::Block { 1275 location, 1276 statements, 1277 } => v.visit_typed_expr_block(location, statements), 1278 TypedExpr::Pipeline { 1279 location, 1280 first_value, 1281 assignments, 1282 finally, 1283 finally_kind, 1284 } => v.visit_typed_expr_pipeline(location, first_value, assignments, finally, finally_kind), 1285 TypedExpr::Var { 1286 location, 1287 constructor, 1288 name, 1289 } => v.visit_typed_expr_var(location, constructor, name), 1290 TypedExpr::Fn { 1291 location, 1292 type_, 1293 kind, 1294 arguments, 1295 body, 1296 return_annotation, 1297 purity: _, 1298 } => v.visit_typed_expr_fn(location, type_, kind, arguments, body, return_annotation), 1299 TypedExpr::List { 1300 location, 1301 type_, 1302 elements, 1303 tail, 1304 } => v.visit_typed_expr_list(location, type_, elements, tail), 1305 TypedExpr::Call { 1306 location, 1307 type_, 1308 fun, 1309 arguments, 1310 open_parenthesis, 1311 } => v.visit_typed_expr_call(location, type_, fun, arguments, open_parenthesis), 1312 TypedExpr::BinOp { 1313 location, 1314 type_, 1315 operator, 1316 operator_start, 1317 left, 1318 right, 1319 } => v.visit_typed_expr_bin_op(location, type_, operator, operator_start, left, right), 1320 TypedExpr::Case { 1321 location, 1322 type_, 1323 subjects, 1324 clauses, 1325 compiled_case, 1326 } => v.visit_typed_expr_case(location, type_, subjects, clauses, compiled_case), 1327 TypedExpr::RecordAccess { 1328 location, 1329 field_start, 1330 type_, 1331 label, 1332 index, 1333 record, 1334 documentation, 1335 } => v.visit_typed_expr_record_access( 1336 location, 1337 field_start, 1338 type_, 1339 label, 1340 index, 1341 record, 1342 documentation, 1343 ), 1344 TypedExpr::ModuleSelect { 1345 location, 1346 field_start, 1347 type_, 1348 label, 1349 module_name, 1350 module_alias, 1351 constructor, 1352 } => v.visit_typed_expr_module_select( 1353 location, 1354 field_start, 1355 type_, 1356 label, 1357 module_name, 1358 module_alias, 1359 constructor, 1360 ), 1361 TypedExpr::Tuple { 1362 location, 1363 type_, 1364 elements, 1365 } => v.visit_typed_expr_tuple(location, type_, elements), 1366 TypedExpr::TupleIndex { 1367 location, 1368 type_, 1369 index, 1370 tuple, 1371 } => v.visit_typed_expr_tuple_index(location, type_, index, tuple), 1372 TypedExpr::Todo { 1373 location, 1374 message, 1375 kind, 1376 type_, 1377 } => v.visit_typed_expr_todo(location, message, kind, type_), 1378 TypedExpr::Panic { 1379 location, 1380 message, 1381 type_, 1382 } => v.visit_typed_expr_panic(location, message, type_), 1383 TypedExpr::BitArray { 1384 location, 1385 type_, 1386 segments, 1387 } => v.visit_typed_expr_bit_array(location, type_, segments), 1388 TypedExpr::RecordUpdate { 1389 location, 1390 spread_start, 1391 type_, 1392 updated_record, 1393 updated_record_assigned_name, 1394 constructor, 1395 arguments, 1396 } => v.visit_typed_expr_record_update( 1397 location, 1398 spread_start, 1399 type_, 1400 updated_record, 1401 updated_record_assigned_name, 1402 constructor, 1403 arguments, 1404 ), 1405 TypedExpr::NegateBool { location, value } => { 1406 v.visit_typed_expr_negate_bool(location, value) 1407 } 1408 TypedExpr::NegateInt { location, value } => v.visit_typed_expr_negate_int(location, value), 1409 TypedExpr::Invalid { 1410 location, 1411 type_, 1412 extra_information, 1413 } => v.visit_typed_expr_invalid(location, type_, extra_information), 1414 TypedExpr::Echo { 1415 location, 1416 expression, 1417 message, 1418 type_, 1419 } => v.visit_typed_expr_echo(location, type_, expression, message), 1420 TypedExpr::PositionalAccess { .. } => {} 1421 } 1422} 1423 1424pub fn visit_typed_expr_int<'a, V>( 1425 _v: &mut V, 1426 _location: &'a SrcSpan, 1427 _type_: &'a Arc<Type>, 1428 _value: &'a EcoString, 1429) where 1430 V: Visit<'a> + ?Sized, 1431{ 1432} 1433 1434pub fn visit_typed_expr_float<'a, V>( 1435 _v: &mut V, 1436 _location: &'a SrcSpan, 1437 _type_: &'a Arc<Type>, 1438 _value: &'a EcoString, 1439) where 1440 V: Visit<'a> + ?Sized, 1441{ 1442} 1443 1444pub fn visit_typed_expr_string<'a, V>( 1445 _v: &mut V, 1446 _location: &'a SrcSpan, 1447 _type_: &'a Arc<Type>, 1448 _value: &'a EcoString, 1449) where 1450 V: Visit<'a> + ?Sized, 1451{ 1452} 1453 1454pub fn visit_typed_expr_block<'a, V>( 1455 v: &mut V, 1456 _location: &'a SrcSpan, 1457 statements: &'a [TypedStatement], 1458) where 1459 V: Visit<'a> + ?Sized, 1460{ 1461 for statement in statements { 1462 v.visit_typed_statement(statement); 1463 } 1464} 1465 1466pub fn visit_typed_expr_pipeline<'a, V>( 1467 v: &mut V, 1468 _location: &'a SrcSpan, 1469 first_value: &'a TypedPipelineAssignment, 1470 assignments: &'a [(TypedPipelineAssignment, PipelineAssignmentKind)], 1471 finally: &'a TypedExpr, 1472 _finally_kind: &'a PipelineAssignmentKind, 1473) where 1474 V: Visit<'a> + ?Sized, 1475{ 1476 v.visit_typed_pipeline_assignment(first_value); 1477 for (assignment, _kind) in assignments { 1478 v.visit_typed_pipeline_assignment(assignment); 1479 } 1480 1481 v.visit_typed_expr(finally); 1482} 1483 1484pub fn visit_typed_pipeline_assignment<'a, V>(v: &mut V, assignment: &'a TypedPipelineAssignment) 1485where 1486 V: Visit<'a> + ?Sized, 1487{ 1488 v.visit_typed_expr(&assignment.value); 1489} 1490 1491pub fn visit_typed_expr_var<'a, V>( 1492 _v: &mut V, 1493 _location: &'a SrcSpan, 1494 _constructor: &'a ValueConstructor, 1495 _name: &'a EcoString, 1496) where 1497 V: Visit<'a> + ?Sized, 1498{ 1499 /* TODO */ 1500} 1501 1502pub fn visit_typed_expr_fn<'a, V>( 1503 v: &mut V, 1504 _location: &'a SrcSpan, 1505 type_: &'a Arc<Type>, 1506 _kind: &'a FunctionLiteralKind, 1507 arguments: &'a [TypedArg], 1508 body: &'a Vec1<TypedStatement>, 1509 return_annotation: &'a Option<TypeAst>, 1510) where 1511 V: Visit<'a> + ?Sized, 1512{ 1513 for argument in arguments { 1514 if let Some(annotation) = &argument.annotation { 1515 v.visit_type_ast(annotation, Some(argument.type_.clone())); 1516 } 1517 } 1518 if let Some(return_) = return_annotation { 1519 v.visit_type_ast( 1520 return_, 1521 type_.fn_types().map(|(_, return_)| return_.clone()), 1522 ); 1523 } 1524 1525 for statement in body { 1526 v.visit_typed_statement(statement); 1527 } 1528} 1529 1530pub fn visit_typed_expr_list<'a, V>( 1531 v: &mut V, 1532 _location: &'a SrcSpan, 1533 _type_: &'a Arc<Type>, 1534 elements: &'a [TypedExpr], 1535 tail: &'a Option<Box<TypedExpr>>, 1536) where 1537 V: Visit<'a> + ?Sized, 1538{ 1539 for element in elements { 1540 v.visit_typed_expr(element); 1541 } 1542 1543 if let Some(tail) = tail { 1544 v.visit_typed_expr(tail); 1545 } 1546} 1547 1548pub fn visit_typed_expr_call<'a, V>( 1549 v: &mut V, 1550 _location: &'a SrcSpan, 1551 _type_: &'a Arc<Type>, 1552 fun: &'a TypedExpr, 1553 arguments: &'a [TypedCallArg], 1554 _arguments_start: &'a Option<u32>, 1555) where 1556 V: Visit<'a> + ?Sized, 1557{ 1558 v.visit_typed_expr(fun); 1559 for argument in arguments { 1560 v.visit_typed_call_arg(argument); 1561 } 1562} 1563 1564pub fn visit_typed_expr_bin_op<'a, V>( 1565 v: &mut V, 1566 _location: &'a SrcSpan, 1567 _type_: &'a Arc<Type>, 1568 _operator: &'a BinOp, 1569 _operator_start: &'a u32, 1570 left: &'a TypedExpr, 1571 right: &'a TypedExpr, 1572) where 1573 V: Visit<'a> + ?Sized, 1574{ 1575 v.visit_typed_expr(left); 1576 v.visit_typed_expr(right); 1577} 1578 1579pub fn visit_typed_expr_case<'a, V>( 1580 v: &mut V, 1581 _location: &'a SrcSpan, 1582 _type_: &'a Arc<Type>, 1583 subjects: &'a [TypedExpr], 1584 clauses: &'a [TypedClause], 1585 _compiled_case: &'a CompiledCase, 1586) where 1587 V: Visit<'a> + ?Sized, 1588{ 1589 for subject in subjects { 1590 v.visit_typed_expr(subject); 1591 } 1592 1593 for clause in clauses { 1594 v.visit_typed_clause(clause); 1595 } 1596} 1597 1598#[allow(clippy::too_many_arguments)] 1599pub fn visit_typed_expr_record_access<'a, V>( 1600 v: &mut V, 1601 _location: &'a SrcSpan, 1602 _field_start: &'a u32, 1603 _type_: &'a Arc<Type>, 1604 _label: &'a EcoString, 1605 _index: &'a u64, 1606 record: &'a TypedExpr, 1607 _documentation: &'a Option<EcoString>, 1608) where 1609 V: Visit<'a> + ?Sized, 1610{ 1611 v.visit_typed_expr(record); 1612} 1613 1614#[allow(clippy::too_many_arguments)] 1615pub fn visit_typed_expr_module_select<'a, V>( 1616 _v: &mut V, 1617 _location: &'a SrcSpan, 1618 _field_start: &'a u32, 1619 _type_: &'a Arc<Type>, 1620 _label: &'a EcoString, 1621 _module_name: &'a EcoString, 1622 _module_alias: &'a EcoString, 1623 _constructor: &'a ModuleValueConstructor, 1624) where 1625 V: Visit<'a> + ?Sized, 1626{ 1627 /* TODO */ 1628} 1629 1630pub fn visit_typed_expr_tuple<'a, V>( 1631 v: &mut V, 1632 _location: &'a SrcSpan, 1633 _type_: &'a Arc<Type>, 1634 elements: &'a [TypedExpr], 1635) where 1636 V: Visit<'a> + ?Sized, 1637{ 1638 for element in elements { 1639 v.visit_typed_expr(element); 1640 } 1641} 1642 1643pub fn visit_typed_expr_tuple_index<'a, V>( 1644 v: &mut V, 1645 _location: &'a SrcSpan, 1646 _type_: &'a Arc<Type>, 1647 _index: &'a u64, 1648 tuple: &'a TypedExpr, 1649) where 1650 V: Visit<'a> + ?Sized, 1651{ 1652 v.visit_typed_expr(tuple); 1653} 1654 1655pub fn visit_typed_expr_todo<'a, V>( 1656 v: &mut V, 1657 _location: &'a SrcSpan, 1658 message: &'a Option<Box<TypedExpr>>, 1659 _kind: &'a TodoKind, 1660 _type_: &'a Arc<Type>, 1661) where 1662 V: Visit<'a> + ?Sized, 1663{ 1664 if let Some(message) = message { 1665 v.visit_typed_expr(message); 1666 } 1667} 1668 1669pub fn visit_typed_expr_echo<'a, V>( 1670 v: &mut V, 1671 _location: &'a SrcSpan, 1672 _type_: &'a Arc<Type>, 1673 expression: &'a Option<Box<TypedExpr>>, 1674 message: &'a Option<Box<TypedExpr>>, 1675) where 1676 V: Visit<'a> + ?Sized, 1677{ 1678 if let Some(expression) = expression { 1679 v.visit_typed_expr(expression) 1680 } 1681 if let Some(message) = message { 1682 v.visit_typed_expr(message) 1683 } 1684} 1685 1686pub fn visit_typed_expr_panic<'a, V>( 1687 v: &mut V, 1688 _location: &'a SrcSpan, 1689 message: &'a Option<Box<TypedExpr>>, 1690 _type_: &'a Arc<Type>, 1691) where 1692 V: Visit<'a> + ?Sized, 1693{ 1694 if let Some(message) = message { 1695 v.visit_typed_expr(message); 1696 } 1697} 1698 1699pub fn visit_typed_expr_bit_array<'a, V>( 1700 v: &mut V, 1701 _location: &'a SrcSpan, 1702 _type_: &'a Arc<Type>, 1703 segments: &'a [TypedExprBitArraySegment], 1704) where 1705 V: Visit<'a> + ?Sized, 1706{ 1707 for segment in segments { 1708 v.visit_typed_expr_bit_array_segment(segment); 1709 } 1710} 1711 1712#[allow(clippy::too_many_arguments)] 1713pub fn visit_typed_expr_record_update<'a, V>( 1714 v: &mut V, 1715 _location: &'a SrcSpan, 1716 _spread_start: &'a u32, 1717 _type_: &'a Arc<Type>, 1718 updated_record: &'a TypedExpr, 1719 _updated_record_assigned_name: &'a Option<EcoString>, 1720 constructor: &'a TypedExpr, 1721 arguments: &'a [TypedCallArg], 1722) where 1723 V: Visit<'a> + ?Sized, 1724{ 1725 v.visit_typed_expr(constructor); 1726 v.visit_typed_expr(updated_record); 1727 for argument in arguments { 1728 v.visit_typed_call_arg(argument); 1729 } 1730} 1731 1732pub fn visit_typed_expr_negate_bool<'a, V>(v: &mut V, _location: &'a SrcSpan, value: &'a TypedExpr) 1733where 1734 V: Visit<'a> + ?Sized, 1735{ 1736 v.visit_typed_expr(value); 1737} 1738 1739pub fn visit_typed_expr_negate_int<'a, V>(v: &mut V, _location: &'a SrcSpan, value: &'a TypedExpr) 1740where 1741 V: Visit<'a> + ?Sized, 1742{ 1743 v.visit_typed_expr(value); 1744} 1745 1746pub fn visit_typed_statement<'a, V>(v: &mut V, statement: &'a TypedStatement) 1747where 1748 V: Visit<'a> + ?Sized, 1749{ 1750 match statement { 1751 Statement::Expression(expression) => v.visit_typed_expr(expression), 1752 Statement::Assignment(assignment) => v.visit_typed_assignment(assignment), 1753 Statement::Use(use_) => v.visit_typed_use(use_), 1754 Statement::Assert(assert) => v.visit_typed_assert(assert), 1755 } 1756} 1757 1758pub fn visit_typed_assignment<'a, V>(v: &mut V, assignment: &'a TypedAssignment) 1759where 1760 V: Visit<'a> + ?Sized, 1761{ 1762 if let Some(annotation) = &assignment.annotation { 1763 v.visit_type_ast(annotation, Some(assignment.type_())); 1764 } 1765 v.visit_typed_expr(&assignment.value); 1766 v.visit_typed_pattern(&assignment.pattern); 1767} 1768 1769pub fn visit_typed_use<'a, V>(v: &mut V, use_: &'a TypedUse) 1770where 1771 V: Visit<'a> + ?Sized, 1772{ 1773 v.visit_typed_expr(&use_.call); 1774 // TODO: We should also visit the typed patterns!! 1775} 1776 1777pub fn visit_typed_assert<'a, V>(v: &mut V, assert: &'a TypedAssert) 1778where 1779 V: Visit<'a> + ?Sized, 1780{ 1781 v.visit_typed_expr(&assert.value); 1782 if let Some(message) = &assert.message { 1783 v.visit_typed_expr(message); 1784 } 1785} 1786 1787pub fn visit_typed_call_arg<'a, V>(v: &mut V, arg: &'a TypedCallArg) 1788where 1789 V: Visit<'a> + ?Sized, 1790{ 1791 v.visit_typed_expr(&arg.value); 1792} 1793 1794pub fn visit_typed_clause<'a, V>(v: &mut V, clause: &'a TypedClause) 1795where 1796 V: Visit<'a> + ?Sized, 1797{ 1798 for pattern in clause.pattern.iter() { 1799 v.visit_typed_pattern(pattern); 1800 } 1801 for patterns in clause.alternative_patterns.iter() { 1802 for pattern in patterns { 1803 v.visit_typed_pattern(pattern); 1804 } 1805 } 1806 if let Some(guard) = &clause.guard { 1807 v.visit_typed_clause_guard(guard); 1808 } 1809 v.visit_typed_expr(&clause.then); 1810} 1811 1812pub fn visit_typed_clause_guard<'a, V>(v: &mut V, guard: &'a TypedClauseGuard) 1813where 1814 V: Visit<'a> + ?Sized, 1815{ 1816 match guard { 1817 super::ClauseGuard::BinaryOperator { 1818 left, 1819 right, 1820 location, 1821 operator, 1822 operator_start, 1823 } => v.visit_typed_clause_guard_bin_op(left, right, operator, operator_start, location), 1824 super::ClauseGuard::Block { location: _, value } => v.visit_typed_clause_guard(value), 1825 super::ClauseGuard::Not { 1826 location: _, 1827 expression, 1828 } => v.visit_typed_clause_guard(expression), 1829 super::ClauseGuard::Var { 1830 location, 1831 type_, 1832 name, 1833 definition_location, 1834 origin, 1835 } => v.visit_typed_clause_guard_var(location, name, type_, definition_location, origin), 1836 super::ClauseGuard::TupleIndex { 1837 location, 1838 index, 1839 type_, 1840 tuple, 1841 } => v.visit_typed_clause_guard_tuple_index(location, index, type_, tuple), 1842 super::ClauseGuard::FieldAccess { 1843 label_location, 1844 index, 1845 label, 1846 type_, 1847 container, 1848 } => { 1849 v.visit_typed_clause_guard_field_access(label_location, index, label, type_, container) 1850 } 1851 super::ClauseGuard::ModuleSelect { 1852 location, 1853 field_start, 1854 definition_location, 1855 type_, 1856 label, 1857 module_name, 1858 module_alias, 1859 literal, 1860 } => v.visit_typed_clause_guard_module_select( 1861 location, 1862 field_start, 1863 definition_location, 1864 type_, 1865 label, 1866 module_name, 1867 module_alias, 1868 literal, 1869 ), 1870 super::ClauseGuard::Constant(constant) => v.visit_typed_constant(constant), 1871 super::ClauseGuard::Invalid { .. } => (), 1872 } 1873} 1874 1875pub fn visit_typed_clause_guard_bin_op<'a, V>( 1876 v: &mut V, 1877 left: &'a TypedClauseGuard, 1878 right: &'a TypedClauseGuard, 1879 _operator: &'a BinOp, 1880 _operator_start: &'a u32, 1881 _location: &'a SrcSpan, 1882) where 1883 V: Visit<'a> + ?Sized, 1884{ 1885 v.visit_typed_clause_guard(left); 1886 v.visit_typed_clause_guard(right); 1887} 1888 1889pub fn visit_typed_clause_guard_var<'a, V>( 1890 _v: &mut V, 1891 _location: &'a SrcSpan, 1892 _name: &'a EcoString, 1893 _type_: &'a Arc<Type>, 1894 _definition_location: &'a SrcSpan, 1895 _origin: &'a VariableOrigin, 1896) where 1897 V: Visit<'a> + ?Sized, 1898{ 1899} 1900 1901pub fn visit_typed_clause_guard_tuple_index<'a, V>( 1902 v: &mut V, 1903 _location: &'a SrcSpan, 1904 _index: &'a u64, 1905 _type_: &'a Arc<Type>, 1906 tuple: &'a TypedClauseGuard, 1907) where 1908 V: Visit<'a> + ?Sized, 1909{ 1910 v.visit_typed_clause_guard(tuple); 1911} 1912 1913pub fn visit_typed_clause_guard_field_access<'a, V>( 1914 v: &mut V, 1915 _label_location: &'a SrcSpan, 1916 _index: &'a Option<u64>, 1917 _label: &'a EcoString, 1918 _type_: &'a Arc<Type>, 1919 container: &'a TypedClauseGuard, 1920) where 1921 V: Visit<'a> + ?Sized, 1922{ 1923 v.visit_typed_clause_guard(container); 1924} 1925 1926#[allow(clippy::too_many_arguments)] 1927pub fn visit_typed_clause_guard_module_select<'a, V>( 1928 _v: &mut V, 1929 _location: &'a SrcSpan, 1930 _field_start: &'a u32, 1931 _definition_location: &'a SrcSpan, 1932 _type_: &'a Arc<Type>, 1933 _label: &'a EcoString, 1934 _module_name: &'a EcoString, 1935 _module_alias: &'a EcoString, 1936 _literal: &'a TypedConstant, 1937) where 1938 V: Visit<'a> + ?Sized, 1939{ 1940} 1941 1942pub fn visit_typed_expr_bit_array_segment<'a, V>(v: &mut V, segment: &'a TypedExprBitArraySegment) 1943where 1944 V: Visit<'a> + ?Sized, 1945{ 1946 v.visit_typed_expr(&segment.value); 1947 for option in &segment.options { 1948 v.visit_typed_bit_array_option(option); 1949 } 1950} 1951 1952pub fn visit_typed_bit_array_option<'a, V>(v: &mut V, option: &'a BitArrayOption<TypedExpr>) 1953where 1954 V: Visit<'a> + ?Sized, 1955{ 1956 match option { 1957 BitArrayOption::Bytes { location: _ } => { /* TODO */ } 1958 BitArrayOption::Int { location: _ } => { /* TODO */ } 1959 BitArrayOption::Float { location: _ } => { /* TODO */ } 1960 BitArrayOption::Bits { location: _ } => { /* TODO */ } 1961 BitArrayOption::Utf8 { location: _ } => { /* TODO */ } 1962 BitArrayOption::Utf16 { location: _ } => { /* TODO */ } 1963 BitArrayOption::Utf32 { location: _ } => { /* TODO */ } 1964 BitArrayOption::Utf8Codepoint { location: _ } => { /* TODO */ } 1965 BitArrayOption::Utf16Codepoint { location: _ } => { /* TODO */ } 1966 BitArrayOption::Utf32Codepoint { location: _ } => { /* TODO */ } 1967 BitArrayOption::Signed { location: _ } => { /* TODO */ } 1968 BitArrayOption::Unsigned { location: _ } => { /* TODO */ } 1969 BitArrayOption::Big { location: _ } => { /* TODO */ } 1970 BitArrayOption::Little { location: _ } => { /* TODO */ } 1971 BitArrayOption::Native { location: _ } => { /* TODO */ } 1972 BitArrayOption::Size { 1973 location: _, 1974 value, 1975 short_form: _, 1976 } => { 1977 v.visit_typed_expr(value); 1978 } 1979 BitArrayOption::Unit { 1980 location: _, 1981 value: _, 1982 } => { /* TODO */ } 1983 } 1984} 1985 1986pub fn visit_typed_pattern<'a, V>(v: &mut V, pattern: &'a TypedPattern) 1987where 1988 V: Visit<'a> + ?Sized, 1989{ 1990 match pattern { 1991 Pattern::Int { 1992 location, 1993 value, 1994 int_value: _, 1995 } => v.visit_typed_pattern_int(location, value), 1996 Pattern::Float { 1997 location, 1998 value, 1999 float_value: _, 2000 } => v.visit_typed_pattern_float(location, value), 2001 Pattern::String { location, value } => v.visit_typed_pattern_string(location, value), 2002 Pattern::Variable { 2003 location, 2004 name, 2005 type_, 2006 origin, 2007 } => v.visit_typed_pattern_variable(location, name, type_, origin), 2008 Pattern::BitArraySize(size) => v.visit_typed_pattern_bit_array_size(size), 2009 Pattern::Assign { 2010 location, 2011 name, 2012 pattern, 2013 } => v.visit_typed_pattern_assign(location, name, pattern), 2014 Pattern::Discard { 2015 location, 2016 name, 2017 type_, 2018 } => v.visit_typed_pattern_discard(location, name, type_), 2019 Pattern::List { 2020 location, 2021 elements, 2022 tail, 2023 type_, 2024 } => v.visit_typed_pattern_list(location, elements, tail, type_), 2025 Pattern::Constructor { 2026 location, 2027 name_location, 2028 name, 2029 arguments, 2030 module, 2031 constructor, 2032 spread, 2033 type_, 2034 } => v.visit_typed_pattern_constructor( 2035 location, 2036 name_location, 2037 name, 2038 arguments, 2039 module, 2040 constructor, 2041 spread, 2042 type_, 2043 ), 2044 Pattern::Tuple { location, elements } => v.visit_typed_pattern_tuple(location, elements), 2045 Pattern::BitArray { location, segments } => { 2046 v.visit_typed_pattern_bit_array(location, segments) 2047 } 2048 Pattern::StringPrefix { 2049 location, 2050 left_location, 2051 left_side_assignment, 2052 right_location, 2053 left_side_string, 2054 right_side_assignment, 2055 } => v.visit_typed_pattern_string_prefix( 2056 location, 2057 left_location, 2058 left_side_assignment, 2059 right_location, 2060 left_side_string, 2061 right_side_assignment, 2062 ), 2063 Pattern::Invalid { location, type_ } => v.visit_typed_pattern_invalid(location, type_), 2064 } 2065} 2066 2067fn visit_typed_pattern_int<'a, V>(_v: &mut V, _location: &'a SrcSpan, _value: &'a EcoString) 2068where 2069 V: Visit<'a> + ?Sized, 2070{ 2071} 2072 2073pub fn visit_typed_pattern_float<'a, V>(_v: &mut V, _location: &'a SrcSpan, _value: &'a EcoString) 2074where 2075 V: Visit<'a> + ?Sized, 2076{ 2077} 2078 2079pub fn visit_typed_pattern_string<'a, V>(_v: &mut V, _location: &'a SrcSpan, _value: &'a EcoString) 2080where 2081 V: Visit<'a> + ?Sized, 2082{ 2083} 2084 2085pub fn visit_typed_pattern_variable<'a, V>( 2086 _v: &mut V, 2087 _location: &'a SrcSpan, 2088 _name: &'a EcoString, 2089 _type_: &'a Arc<Type>, 2090 _origin: &'a VariableOrigin, 2091) where 2092 V: Visit<'a> + ?Sized, 2093{ 2094} 2095 2096pub fn visit_typed_pattern_bit_array_size<'a, V>(v: &mut V, size: &'a TypedBitArraySize) 2097where 2098 V: Visit<'a> + ?Sized, 2099{ 2100 match size { 2101 BitArraySize::Int { 2102 location, 2103 value, 2104 int_value: _, 2105 } => v.visit_typed_bit_array_size_int(location, value), 2106 BitArraySize::Variable { 2107 location, 2108 name, 2109 constructor, 2110 type_, 2111 } => v.visit_typed_bit_array_size_variable(location, name, constructor, type_), 2112 BitArraySize::BinaryOperator { left, right, .. } => { 2113 v.visit_typed_pattern_bit_array_size(left); 2114 v.visit_typed_pattern_bit_array_size(right); 2115 } 2116 BitArraySize::Block { inner, .. } => v.visit_typed_pattern_bit_array_size(inner), 2117 } 2118} 2119 2120pub fn visit_typed_bit_array_size_int<'a, V>( 2121 _v: &mut V, 2122 _location: &'a SrcSpan, 2123 _value: &'a EcoString, 2124) where 2125 V: Visit<'a> + ?Sized, 2126{ 2127} 2128 2129pub fn visit_typed_bit_array_size_variable<'a, V>( 2130 _v: &mut V, 2131 _location: &'a SrcSpan, 2132 _name: &'a EcoString, 2133 _constructor: &'a Option<Box<ValueConstructor>>, 2134 _type_: &'a Arc<Type>, 2135) where 2136 V: Visit<'a> + ?Sized, 2137{ 2138} 2139 2140pub fn visit_typed_pattern_assign<'a, V>( 2141 v: &mut V, 2142 _location: &'a SrcSpan, 2143 _name: &'a EcoString, 2144 pattern: &'a TypedPattern, 2145) where 2146 V: Visit<'a> + ?Sized, 2147{ 2148 v.visit_typed_pattern(pattern); 2149} 2150 2151pub fn visit_typed_pattern_discard<'a, V>( 2152 _v: &mut V, 2153 _location: &'a SrcSpan, 2154 _name: &'a EcoString, 2155 _type_: &'a Arc<Type>, 2156) where 2157 V: Visit<'a> + ?Sized, 2158{ 2159} 2160 2161pub fn visit_typed_pattern_list<'a, V>( 2162 v: &mut V, 2163 _location: &'a SrcSpan, 2164 elements: &'a Vec<TypedPattern>, 2165 tail: &'a Option<Box<TypedTailPattern>>, 2166 _type_: &'a Arc<Type>, 2167) where 2168 V: Visit<'a> + ?Sized, 2169{ 2170 for element in elements { 2171 v.visit_typed_pattern(element); 2172 } 2173 if let Some(tail) = tail { 2174 v.visit_typed_pattern(&tail.pattern); 2175 } 2176} 2177 2178#[allow(clippy::too_many_arguments)] 2179pub fn visit_typed_pattern_constructor<'a, V>( 2180 v: &mut V, 2181 _location: &'a SrcSpan, 2182 _name_location: &'a SrcSpan, 2183 _name: &'a EcoString, 2184 arguments: &'a Vec<CallArg<TypedPattern>>, 2185 _module: &'a Option<(EcoString, SrcSpan)>, 2186 _constructor: &'a Inferred<PatternConstructor>, 2187 _spread: &'a Option<SrcSpan>, 2188 _type_: &'a Arc<Type>, 2189) where 2190 V: Visit<'a> + ?Sized, 2191{ 2192 for argument in arguments { 2193 v.visit_typed_pattern_call_arg(argument); 2194 } 2195} 2196 2197pub fn visit_typed_pattern_call_arg<'a, V>(v: &mut V, argument: &'a CallArg<TypedPattern>) 2198where 2199 V: Visit<'a> + ?Sized, 2200{ 2201 v.visit_typed_pattern(&argument.value) 2202} 2203 2204pub fn visit_typed_pattern_tuple<'a, V>( 2205 v: &mut V, 2206 _location: &'a SrcSpan, 2207 elements: &'a Vec<TypedPattern>, 2208) where 2209 V: Visit<'a> + ?Sized, 2210{ 2211 for element in elements { 2212 v.visit_typed_pattern(element); 2213 } 2214} 2215 2216pub fn visit_typed_pattern_bit_array<'a, V>( 2217 v: &mut V, 2218 _location: &'a SrcSpan, 2219 segments: &'a [TypedPatternBitArraySegment], 2220) where 2221 V: Visit<'a> + ?Sized, 2222{ 2223 for segment in segments { 2224 v.visit_typed_pattern(&segment.value); 2225 for option in segment.options.iter() { 2226 v.visit_typed_pattern_bit_array_option(option); 2227 } 2228 } 2229} 2230 2231pub fn visit_typed_pattern_bit_array_option<'a, V>( 2232 v: &mut V, 2233 option: &'a BitArrayOption<TypedPattern>, 2234) where 2235 V: Visit<'a> + ?Sized, 2236{ 2237 match option { 2238 BitArrayOption::Bytes { location: _ } => { /* TODO */ } 2239 BitArrayOption::Int { location: _ } => { /* TODO */ } 2240 BitArrayOption::Float { location: _ } => { /* TODO */ } 2241 BitArrayOption::Bits { location: _ } => { /* TODO */ } 2242 BitArrayOption::Utf8 { location: _ } => { /* TODO */ } 2243 BitArrayOption::Utf16 { location: _ } => { /* TODO */ } 2244 BitArrayOption::Utf32 { location: _ } => { /* TODO */ } 2245 BitArrayOption::Utf8Codepoint { location: _ } => { /* TODO */ } 2246 BitArrayOption::Utf16Codepoint { location: _ } => { /* TODO */ } 2247 BitArrayOption::Utf32Codepoint { location: _ } => { /* TODO */ } 2248 BitArrayOption::Signed { location: _ } => { /* TODO */ } 2249 BitArrayOption::Unsigned { location: _ } => { /* TODO */ } 2250 BitArrayOption::Big { location: _ } => { /* TODO */ } 2251 BitArrayOption::Little { location: _ } => { /* TODO */ } 2252 BitArrayOption::Native { location: _ } => { /* TODO */ } 2253 BitArrayOption::Size { 2254 location: _, 2255 value, 2256 short_form: _, 2257 } => { 2258 v.visit_typed_pattern(value); 2259 } 2260 BitArrayOption::Unit { 2261 location: _, 2262 value: _, 2263 } => { /* TODO */ } 2264 } 2265} 2266 2267pub fn visit_typed_pattern_string_prefix<'a, V>( 2268 _v: &mut V, 2269 _location: &'a SrcSpan, 2270 _left_location: &'a SrcSpan, 2271 _left_side_assignment: &'a Option<(EcoString, SrcSpan)>, 2272 _right_location: &'a SrcSpan, 2273 _left_side_string: &'a EcoString, 2274 _right_side_assignment: &'a AssignName, 2275) where 2276 V: Visit<'a> + ?Sized, 2277{ 2278} 2279 2280pub fn visit_typed_pattern_invalid<'a, V>(_v: &mut V, _location: &'a SrcSpan, _type_: &'a Arc<Type>) 2281where 2282 V: Visit<'a> + ?Sized, 2283{ 2284} 2285 2286pub fn visit_typed_expr_invalid<'a, V>( 2287 _v: &mut V, 2288 _location: &'a SrcSpan, 2289 _type_: &'a Arc<Type>, 2290 _extra_information: &'a Option<InvalidExpression>, 2291) where 2292 V: Visit<'a> + ?Sized, 2293{ 2294}