Skip to content

Commit 4483af9

Browse files
authored
Group and rename_visit functions which receive a FunctionCall (pyccel#1844)
1 parent 9464954 commit 4483af9

File tree

4 files changed

+336
-181
lines changed

4 files changed

+336
-181
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
1717
- #1787 : Ensure `STC` is installed with Pyccel.
1818
- #1656 : Ensure `gFTL` is installed with Pyccel.
1919
- #1830 : Add a `pyccel.lambdify.lambdify` function to accelerate SymPy expressions.
20+
- #1844 : Add line numbers and code to errors from built-in function calls.
2021
- \[INTERNALS\] Added `container_rank` property to `ast.datatypes.PyccelType` objects.
2122
- \[DEVELOPER\] Added an improved traceback to the developer-mode errors for errors in function calls.
2223

@@ -61,6 +62,7 @@ All notable changes to this project will be documented in this file.
6162
- \[INTERNALS\] Rename `pyccel.ast.internals.PyccelInternalFunction` to `pyccel.ast.internals.PyccelFunction`.
6263
- \[INTERNALS\] All internal classes which can be generated from `FunctionCall`s must inherit from `PyccelFunction`.
6364
- \[INTERNALS\] `PyccelFunction` objects which do not represent objects in memory have the type `SymbolicType`.
65+
- \[INTERNALS\] Rename `_visit` functions called from a `FunctionCall` which don't match the documented naming pattern to `_build` functions.
6466

6567
### Deprecated
6668

developer_docs/semantic_stage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ Built-in functions do not need importing.
111111
Instead they are recognised via the function [`pyccel.ast.utilities.builtin_function`](../pyccel/ast/utilities.py) which uses the dictionary [`pyccel.ast.builtins.builtin_functions_dict`](../pyccel/ast/builtins.py) to identify supported functions.
112112
Functions from supported libraries are saved in an object of type [`pyccel.ast.core.PyccelFunctionDef`](../pyccel/ast/core.py) when they are imported.
113113
These functions are handled one of two ways.
114-
If there is special treatment which requires functions from the `SemanticParser` then a `_visit_X` function should be created.
114+
If there is special treatment which requires functions from the `SemanticParser` (e.g. handling inhomogeneous tuples or adding new imports) then a `_build_X` function should be created.
115+
Differently than the `_visit_X` functions, a `_build_X` function does not take an object of type `X` as argument, but rather a `FunctionCall` to the class `X`. In other words it does not visit `X`, but rather the call `X()`. If `X` represents a method of a class then `_build_X` takes a `DottedName` instead of a `FunctionCall`.
115116
The `SemanticParser._visit_FunctionCall` function will call this visitation function internally if it exists.
116117
Otherwise the object will be created in the `SemanticParser._handle_function` function and its type will be determined by its constructor.
117118

0 commit comments

Comments
 (0)