-
Notifications
You must be signed in to change notification settings - Fork 2
Description
There is no native API in the current version of ECMAScript (ECMAScript 2020) for accessing function parameters. There is only someFunction.length which is also imperfect. The alternative is to parse the string representation of the function. A regular expression is no longer sufficient though due to the new patterns and default values allowed in method declarations. Example:
class Foo {
method({size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}){ ... }
}Sadly there is no native parser in the language either. The closest is the SpiderMonkey specific extension Reflect.parse(...) which is not currently on the standards track. The 3rd party option is the acorn library. This would effectively double the size of the contracts library or more if used...
Extending the Babel or TypeScript compiler is out of scope as the desire is to keep this library standards compliant and not extend the language itself
This should be a deferred requirement...