572 lines
25 KiB
Text
572 lines
25 KiB
Text
[
|
|
{"type":"CommentSingle","value":";; An example of some possible linters using Fennel's --plugin option."},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":";; The first two linters here can only function on static module"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"CommentSingle","value":";; use. For instance, this code can be checked because they use static"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"CommentSingle","value":";; field access on a local directly bound to a require call:"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":";; (local m (require :mymodule))"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"CommentSingle","value":";; (print m.field) ; fails if mymodule lacks a :field field"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"CommentSingle","value":";; (print (m.function 1 2 3)) ; fails unless mymodule.function takes 3 args"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":";; However, these cannot:"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":";; (local m (do (require :mymodule)) ; m is not directly bound"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"CommentSingle","value":";; (print (. m field)) ; not a static field reference"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"CommentSingle","value":";; (let [f m.function]"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"CommentSingle","value":";; (print (f 1 2 3)) ; intermediate local, not a static field call on m"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":";; Still, pretty neat, huh?"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"CommentSingle","value":";; This file is provided as an example and is not part of Fennel's public API."},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"KeywordDeclaration","value":"fn "},
|
|
{"type":"NameVariable","value":"save-require-meta"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"NameVariable","value":"from"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"to"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"scope"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralString","value":"\"When destructuring, save module name if local is bound to a `require' call.\nDoesn't do any linting on its own; just saves the data for other linters.\""},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"when "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"and "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"sym?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"to"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"not "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"multi-sym?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"to"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"list?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"from"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"sym?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameVariable","value":"from"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"1"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"= "},
|
|
{"type":"LiteralStringSymbol","value":":require"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"tostring "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameVariable","value":"from"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"1"},
|
|
{"type":"Punctuation","value":")))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"= "},
|
|
{"type":"LiteralStringSymbol","value":":string"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"type "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameVariable","value":"from"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"2"},
|
|
{"type":"Punctuation","value":"))))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"let "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"NameVariable","value":"meta"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameVariable","value":"scope.symmeta"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"tostring "},
|
|
{"type":"NameVariable","value":"to"},
|
|
{"type":"Punctuation","value":"))]"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"set "},
|
|
{"type":"NameVariable","value":"meta.required"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"tostring "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameVariable","value":"from"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"2"},
|
|
{"type":"Punctuation","value":"))))))"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"KeywordDeclaration","value":"fn "},
|
|
{"type":"NameVariable","value":"check-module-fields"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"NameVariable","value":"symbol"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"scope"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralString","value":"\"When referring to a field in a local that's a module, make sure it exists.\""},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"let "},
|
|
{"type":"Punctuation","value":"[["},
|
|
{"type":"NameVariable","value":"module-local"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"or "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"multi-sym?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"symbol"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"[])"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"NameVariable","value":"module-name"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"-?\u003e "},
|
|
{"type":"NameVariable","value":"scope.symmeta"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"tostring "},
|
|
{"type":"NameVariable","value":"module-local"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"LiteralStringSymbol","value":":required"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"NameBuiltin","value":"module "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"and "},
|
|
{"type":"NameVariable","value":"module-name"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"require "},
|
|
{"type":"NameVariable","value":"module-name"},
|
|
{"type":"Punctuation","value":"))]"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"assert-compile"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"or "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"= "},
|
|
{"type":"NameBuiltin","value":"module "},
|
|
{"type":"NameVariable","value":"nil"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"not= "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameBuiltin","value":"module "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"nil"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"string.format "},
|
|
{"type":"LiteralString","value":"\"Missing field %s in module %s\""},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"or "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":?"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"or "},
|
|
{"type":"NameVariable","value":"module-name"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":?"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"symbol"},
|
|
{"type":"Punctuation","value":")))"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"KeywordDeclaration","value":"fn "},
|
|
{"type":"NameVariable","value":"arity-check?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"NameVariable","value":"module"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"-?\u003e "},
|
|
{"type":"NameBuiltin","value":"module getmetatable "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"LiteralStringSymbol","value":":arity-check?"},
|
|
{"type":"Punctuation","value":")))"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"KeywordDeclaration","value":"fn "},
|
|
{"type":"NameVariable","value":"arity-check-call"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"[["},
|
|
{"type":"NameVariable","value":"f"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"\u0026"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"args"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"scope"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralString","value":"\"Perform static arity checks on static function calls in a module.\""},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"let "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"NameVariable","value":"arity"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Operator","value":"#"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"args"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"NameVariable","value":"last-arg"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameVariable","value":"args"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"arity"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"NameVariable","value":"f-local"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"or "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"multi-sym?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"f"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"[])"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"NameVariable","value":"module-name"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"-?\u003e "},
|
|
{"type":"NameVariable","value":"scope.symmeta"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"tostring "},
|
|
{"type":"NameVariable","value":"f-local"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"LiteralStringSymbol","value":":required"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"NameBuiltin","value":"module "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"and "},
|
|
{"type":"NameVariable","value":"module-name"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"require "},
|
|
{"type":"NameVariable","value":"module-name"},
|
|
{"type":"Punctuation","value":"))]"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"when "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"and "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"arity-check?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"module"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"_G.debug"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"_G.debug.getinfo"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"not "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"varg?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"last-arg"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"not "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"list?"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"last-arg"},
|
|
{"type":"Punctuation","value":")))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"assert-compile"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"= "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"type "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameBuiltin","value":"module "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":function"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"string.format "},
|
|
{"type":"LiteralString","value":"\"Missing function %s in module %s\""},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"or "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":?"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"module-name"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"f"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"match "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"_G.debug.getinfo"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameBuiltin","value":"module "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Keyword","value":": "},
|
|
{"type":"NameVariable","value":"nparams"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":what"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"Lua\""},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":isvararg"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"true"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"assert-compile"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"\u003c= "},
|
|
{"type":"NameVariable","value":"nparams"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Operator","value":"#"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"args"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":": "},
|
|
{"type":"LiteralString","value":"\"Called %s.%s with %s arguments, expected %s+\""},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralStringSymbol","value":":format"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"f-local"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"arity"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"nparams"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"f"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Keyword","value":": "},
|
|
{"type":"NameVariable","value":"nparams"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":what"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"Lua\""},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":isvararg"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"false"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"assert-compile"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"= "},
|
|
{"type":"NameVariable","value":"nparams"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Operator","value":"#"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"args"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":": "},
|
|
{"type":"LiteralString","value":"\"Called %s.%s with %s arguments, expected %s\""},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralStringSymbol","value":":format"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"f-local"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"field"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"arity"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"nparams"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"f"},
|
|
{"type":"Punctuation","value":")))))"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"KeywordDeclaration","value":"fn "},
|
|
{"type":"NameVariable","value":"check-unused"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"NameVariable","value":"ast"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"scope"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"each "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"NameVariable","value":"symname"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"pairs "},
|
|
{"type":"NameVariable","value":"scope.symmeta"},
|
|
{"type":"Punctuation","value":")]"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"assert-compile"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"or "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":". "},
|
|
{"type":"NameVariable","value":"scope.symmeta"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"symname"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":used"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"symname"},
|
|
{"type":"LiteralStringSymbol","value":":find"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"^_\""},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameBuiltin","value":"string.format "},
|
|
{"type":"LiteralString","value":"\"unused local %s\""},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Keyword","value":"or "},
|
|
{"type":"NameVariable","value":"symname"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralStringSymbol","value":":?"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"ast"},
|
|
{"type":"Punctuation","value":")))"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"LiteralStringSymbol","value":":destructure"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"save-require-meta"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralStringSymbol","value":":symbol-to-expression"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"check-module-fields"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralStringSymbol","value":":call"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"arity-check-call"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"CommentSingle","value":";; Note that this will only check unused args inside functions and let blocks,"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"CommentSingle","value":";; not top-level locals of a chunk."},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralStringSymbol","value":":fn"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"check-unused"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"LiteralStringSymbol","value":":do"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameVariable","value":"check-unused"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"TextWhitespace","value":"\n"}
|
|
]
|