Skip to content

Commit 5b7a7d0

Browse files
committed
feat(experimental): function bind
1 parent aa59b40 commit 5b7a7d0

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

src/Parser/ESParser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export default class ESParser {
6363
if (experimental.classProperties) option.plugins.push('classProperties');
6464
if (experimental.objectRestSpread) option.plugins.push('objectRestSpread');
6565
if (experimental.doExpressions) option.plugins.push('doExpressions');
66+
if (experimental.functionBind) option.plugins.push('functionBind');
6667
}
6768

6869
return option;

src/Typedef/typedef.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* @property {boolean} experimentalProposal.classProperties
3333
* @property {boolean} experimentalProposal.objectRestSpread
3434
* @property {boolean} experimentalProposal.doExpressions
35+
* @property {boolean} experimentalProposal.functionBind
3536
* @see https://esdoc.org/config.html
3637
*/
3738

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function foo(){}
2+
export default class Foo {
3+
method() {
4+
this::foo();
5+
}
6+
}

test/src/ParserTest/ESParserTest.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ describe('ESParser', ()=>{
88
assert(ast.program.sourceType === 'module');
99
});
1010

11-
// todo: enhance test patterns.
11+
it('can parse "function bind"', ()=>{
12+
const ast = ESParser.parse({experimentalProposal: {functionBind: true}}, './test/fixture/syntax/FunctionBind.js');
13+
assert(ast.program.sourceType === 'module');
14+
});
1215
});

0 commit comments

Comments
 (0)