diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2020-04-15 13:17:02 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2020-04-28 04:22:31 -0400 |
| commit | 966fd878a020263af0a7a190cd981a75bfeec45d (patch) | |
| tree | 484cded40f9ee67b46b3b13d586692d0a196b443 /docs | |
| parent | 84bb86395d970fc8658e2b91cf37b755fed38a50 (diff) | |
more example
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/guide/type.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/guide/type.md b/docs/guide/type.md index 10ce53a5..b5f5b59e 100644 --- a/docs/guide/type.md +++ b/docs/guide/type.md @@ -293,6 +293,23 @@ _coming soon..._ _coming soon..._ +# Modify a function type + +Here's a snippet to take an existing function, and set the confidence of all the parameter types to 100%: + +```py` +old = current_function.function_type +new_parameters = [] +for v, p in zip(current_function.parameter_vars, old.parameters): + new_type = v + new_type.confidence = 256 #max-confidence + new_parameters.append(FunctionParameter(new_type, p.name, p.location)) + +current_function.function_type = types.Type.function(old.return_value, new_parameters, \ +old.calling_convention, old.has_variable_arguments, old.stack_adjustment) +``` + + # Type Library |
