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