Skip to content

Commit

Permalink
feat(experimental): function bind
Browse files Browse the repository at this point in the history
  • Loading branch information
h13i32maru committed Nov 20, 2016
1 parent aa59b40 commit 5b7a7d0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Parser/ESParser.js
Expand Up @@ -63,6 +63,7 @@ export default class ESParser {
if (experimental.classProperties) option.plugins.push('classProperties');
if (experimental.objectRestSpread) option.plugins.push('objectRestSpread');
if (experimental.doExpressions) option.plugins.push('doExpressions');
if (experimental.functionBind) option.plugins.push('functionBind');
}

return option;
Expand Down
1 change: 1 addition & 0 deletions src/Typedef/typedef.js
Expand Up @@ -32,6 +32,7 @@
* @property {boolean} experimentalProposal.classProperties
* @property {boolean} experimentalProposal.objectRestSpread
* @property {boolean} experimentalProposal.doExpressions
* @property {boolean} experimentalProposal.functionBind
* @see https://esdoc.org/config.html
*/

Expand Down
6 changes: 6 additions & 0 deletions test/fixture/syntax/FunctionBind.js
@@ -0,0 +1,6 @@
function foo(){}
export default class Foo {
method() {
this::foo();
}
}
5 changes: 4 additions & 1 deletion test/src/ParserTest/ESParserTest.js
Expand Up @@ -8,5 +8,8 @@ describe('ESParser', ()=>{
assert(ast.program.sourceType === 'module');
});

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

0 comments on commit 5b7a7d0

Please sign in to comment.