Created
March 29, 2017 05:42
-
-
Save wcjohnson/6e048d3d911626e29096cce5f5ba0ce0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source code: | |
let o | |
now o = { | |
f() => | |
this | |
} | |
Transformed code: | |
let o; | |
o = { | |
f() { | |
return this; | |
} }; | |
o.f = o.f.bind(o); | |
AST: | |
001 Program@(loc: 1:0-6:0 start: 0 end: 36) | |
002 VariableDeclaration@(loc: 1:0-1:5 start: 0 end: 5) | |
003 VariableDeclarator@(loc: 1:4-1:5 start: 4 end: 5) | |
004 Identifier@(loc: 1:4-1:5 start: 4 end: 5) | |
005 ExpressionStatement@(loc: 2:0-5:1 start: 6 end: 35) | |
006 AssignmentExpression@(loc: 2:0-5:1 start: 6 end: 35) | |
007 Identifier@(loc: 2:4-2:5 start: 10 end: 11) | |
008 ObjectExpression@(loc: 2:8-5:1 start: 14 end: 35) | |
009 ObjectMethod@(loc: 3:2-4:8 start: 18 end: 33) | |
010 Identifier@(loc: 3:2-3:3 start: 18 end: 19) | |
011 BlockStatement@(loc: 3:6-4:8 start: 22 end: 33) | |
012 ReturnStatement@(loc: 4:8-4:8 start: 33 end: 33) | |
013 ThisExpression@(loc: 4:4-4:8 start: 29 end: 33) | |
014 ExpressionStatement@(loc: 2:8-5:1 start: 14 end: 35) | |
015 AssignmentExpression@(loc: 2:8-5:1 start: 14 end: 35) | |
016 MemberExpression@(loc: 2:8-5:1 start: 14 end: 35) | |
017 Identifier@(loc: 2:4-2:5 start: 10 end: 11) | |
018 Identifier@(loc: 3:2-3:3 start: 18 end: 19) | |
019 CallExpression@(loc: 2:8-5:1 start: 14 end: 35) | |
020 MemberExpression@(loc: 2:8-5:1 start: 14 end: 35) | |
021 MemberExpression@(loc: 2:8-5:1 start: 14 end: 35) | |
022 Identifier@(loc: 2:4-2:5 start: 10 end: 11) | |
023 Identifier@(loc: 3:2-3:3 start: 18 end: 19) | |
024 Identifier@(loc: 2:8-5:1 start: 14 end: 35) | |
025 Identifier@(loc: 2:4-2:5 start: 10 end: 11) | |
ERRORS: | |
ExpressionStatement #14 @ (loc: 2:8-5:1 start: 14 end: 35): Starts before prevSibling ends. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment