-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rust): Scope functions inside
impl
blocks
- Loading branch information
Showing
9 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
tests/langs/snapshots/r#mod__langs__base.rs_impl-fn.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
source: tests/langs/mod.rs | ||
expression: inscope_parts | ||
--- | ||
- n: 75 | ||
l: " fn new() -> Self {\n" | ||
m: " ^^^^^^^^^^^^^^^^^^^^" | ||
- n: 76 | ||
l: " TestStruct {\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 77 | ||
l: " instance_var: String::from(\"hello\"),\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 78 | ||
l: " }\n" | ||
m: ^^^^^^^^^^^ | ||
- n: 79 | ||
l: " }\n" | ||
m: "^^^^^ " | ||
- n: 86 | ||
l: " fn static_decorator<F>(func: F) -> impl Fn()\n" | ||
m: " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" | ||
- n: 87 | ||
l: " where\n" | ||
m: ^^^^^^^^^^^ | ||
- n: 88 | ||
l: " F: Fn(),\n" | ||
m: ^^^^^^^^^^^^^^^^^^ | ||
- n: 89 | ||
l: " {\n" | ||
m: ^^^^^^^ | ||
- n: 90 | ||
l: " // Decorator for static methods.\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 91 | ||
l: " move || {\n" | ||
m: ^^^^^^^^^^^^^^^^^^^ | ||
- n: 92 | ||
l: " println!(\"Static method decorator called\");\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 93 | ||
l: " func();\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 94 | ||
l: " }\n" | ||
m: ^^^^^^^^^^^ | ||
- n: 95 | ||
l: " }\n" | ||
m: "^^^^^ " | ||
- n: 98 | ||
l: " fn instance_method(&mut self) {\n" | ||
m: " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" | ||
- n: 99 | ||
l: " // Instance method.\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 100 | ||
l: " self.instance_var = \"Instance variable\".to_string();\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 101 | ||
l: " println!(\"Instance variable is {}\", self.instance_var);\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 102 | ||
l: " }\n" | ||
m: "^^^^^ " | ||
- n: 104 | ||
l: " fn static_method() {\n" | ||
m: " ^^^^^^^^^^^^^^^^^^^^^^" | ||
- n: 105 | ||
l: " // Static method.\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 106 | ||
l: " println!(\"Inside static method\");\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 107 | ||
l: " }\n" | ||
m: "^^^^^ " | ||
- n: 118 | ||
l: " fn match_statement(x: TestEnum) {\n" | ||
m: " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" | ||
- n: 119 | ||
l: " // Function demonstrating match statement.\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 120 | ||
l: " match x {\n" | ||
m: ^^^^^^^^^^^^^^^^^^^ | ||
- n: 121 | ||
l: " TestEnum::VariantOne => println!(\"One\"),\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 122 | ||
l: " TestEnum::VariantTwo => println!(\"Two\"),\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 123 | ||
l: " TestEnum::VariantOther => println!(\"Other\"),\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 124 | ||
l: " }\n" | ||
m: ^^^^^^^^^^^ | ||
- n: 125 | ||
l: " }\n" | ||
m: "^^^^^ " | ||
- n: 313 | ||
l: " fn convert(&self) -> U {\n" | ||
m: " ^^^^^^^^^^^^^^^^^^^^^^^^^^" | ||
- n: 314 | ||
l: " U::from(self.as_ref().to_owned())\n" | ||
m: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- n: 315 | ||
l: " }\n" | ||
m: "^^^^^ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters