Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: traverse method args in comptime #22229

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

felipensp
Copy link
Member

Fix #20926

fn register[T]() []string {
	mut args := []string{}
	$for method in T.methods {
		$for arg in method.args {
			$if arg.typ is f32 {
				args << 'f32: ${arg.name} ${typeof(arg.typ).name}'
			} $else $if arg.typ is voidptr {
				args << '&void: ${arg.name} ${typeof(arg.typ).name}'
			} $else {
			}
		}
	}
	return args
}

@felipensp felipensp marked this pull request as ready for review September 16, 2024 20:52
@medvednikov
Copy link
Member

medvednikov commented Sep 17, 2024

Great job! It should be called method.params though.

There's another args => params name change needed in comptime.

@spytheman spytheman merged commit 1187e13 into vlang:master Sep 17, 2024
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add .args to compile time method
3 participants