-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
Pkg: parse-functionPriority: HighAfter critical issues are fixed, these should be dealt with before any further issues.After critical issues are fixed, these should be dealt with before any further issues.Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.It's clear what the subject of the issue is about, and what the resolution should be.Status: AvailableNo one has claimed for resolving this issue. Generally applied to bugs and enhancement issues.No one has claimed for resolving this issue. Generally applied to bugs and enhancement issues.Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.Inconsistencies or issues which will cause an issue or problem for users or implementors.
Description
Support plan
- which support plan is this issue covered by? (e.g. Community, Sponsor, or
Enterprise): Community - is this issue currently blocking your project? (yes/no): No
- is this issue affecting a production system? (yes/no): No
Context
- node version: v12.19.0
- module version: 5.6.10
- environment (e.g. node, browser, native): node
- used with (i.e. popular names of modules): typescript
- any other relevant information:
What are you trying to achieve or the steps to reproduce?
This seems to only occur under these specific curcumstances
- Must be a class method
- Must be async
- Must contain a nested arrow function
If any of the above are not true, the issue does not occur.
Demo: https://repl.it/join/yibjtdqc-neaox
Code:
const parseFunction = require("parse-function");
class TestClass {
async TestFunction() {
() => true;
}
}
const app = parseFunction();
app.parse(TestClass.prototype.TestFunction)
What was the result you got?
SyntaxError: Unexpected token, expected "=>" (1:18)
What result did you expect?
The function to parse correctly.
Workaround
Use a function declaration within the class method instead of an arrow function:
const parseFunction = require("parse-function");
class TestClass {
async TestFunction() {
function nested() { return true; }
}
}
const app = parseFunction();
app.parse(TestClass.prototype.TestFunction)
tunnckoCore
Metadata
Metadata
Assignees
Labels
Pkg: parse-functionPriority: HighAfter critical issues are fixed, these should be dealt with before any further issues.After critical issues are fixed, these should be dealt with before any further issues.Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.It's clear what the subject of the issue is about, and what the resolution should be.Status: AvailableNo one has claimed for resolving this issue. Generally applied to bugs and enhancement issues.No one has claimed for resolving this issue. Generally applied to bugs and enhancement issues.Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.Inconsistencies or issues which will cause an issue or problem for users or implementors.