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

Support Anonymous Function Assignments #158

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

YetAnotherClown
Copy link
Collaborator

Resolves #139

Supports Anonymous Function Assignments, such as the following

--- @within Class
class.foo = function(x: number): number end

--- @within Class
local freeFunction = function(x: number): number end

--- @within Class
bar = function(x: number): number end

When multiple variables or expressions are present, the Extractor will output the following Diagnostic:

error: Assignments cannot have more than one variable
  ┌─ test-input/failing/anonymous_function_assignment.lua:6:1
  │  
6 │ ╭ --- @within Class
7 │ │ --- Multiple variables should fail
  │ ╰──────────────────────────────────^ Assignments cannot have more than one variable
8 │   class.foo, class.bar = function(x: number): number end, function(y: string): string end
  │              --------- Additional variable here

@YetAnotherClown YetAnotherClown merged commit 2bd13c2 into master Nov 16, 2024
1 check passed
@YetAnotherClown YetAnotherClown deleted the anonymous-function-assignments branch November 16, 2024 03:01
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.

Module.abc = function() isn't recognized
1 participant