Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Pass function name to the registry #666

Merged
merged 1 commit into from
Apr 11, 2019
Merged

Pass function name to the registry #666

merged 1 commit into from
Apr 11, 2019

Conversation

kuba--
Copy link
Contributor

@kuba-- kuba-- commented Apr 10, 2019

Signed-off-by: kuba-- kuba@sourced.tech
Partly fixes: #665

This PR passes a function name to the registry, so it can improve debugging and error messages.

@kuba-- kuba-- requested a review from a team April 10, 2019 12:21
@kuba-- kuba-- changed the title Pass functiona name to the registry Pass function name to the registry Apr 10, 2019
@src-d src-d deleted a comment from juanjux Apr 10, 2019
sql/functionregistry.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ajnavarro ajnavarro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to avoid name duplication, we can change RegisterFunction to just accepts a Function. Doing that we can remove all duplicate names on maps and on version and database registrations.

@erizocosmico
Copy link
Contributor

@ajnavarro the map provides an useful feature: ensuring function names are unique. If we transform it into a slice, we will lose that.

@ajnavarro
Copy link
Contributor

@erizocosmico we could handle that in RegisterFunctions, right? (throwing an error or panicking)

But it's just a suggestion to avoid in the future having some inconsistencies between the name used to register and the function name (now only used on errors).

If it's worth it to keep the map, LGTM.

@erizocosmico
Copy link
Contributor

Oh, you're right, we could panic on RegisterFunction

@kuba--
Copy link
Contributor Author

kuba-- commented Apr 10, 2019

How about this?

Signed-off-by: kuba-- <kuba@sourced.tech>
@ajnavarro
Copy link
Contributor

@erizocosmico PTAL

@ajnavarro ajnavarro merged commit d03de5f into src-d:master Apr 11, 2019
@kuba-- kuba-- deleted the fix-665/func-name branch April 11, 2019 09:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Mis-formatted error diagnostics for incorrect function use
4 participants