Created
September 11, 2019 17:54
-
-
Save nomeyer/0e070ecb976937d76958e9ba9960231b to your computer and use it in GitHub Desktop.
Anonymised Abstract Syntax Tree example
This file contains 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
const lines = [ | |
'I am a string', | |
'I am not a string', | |
'Lies', | |
'You got me', | |
]; | |
function printLines(callback: () => void) { | |
lines.forEach((line, i) => console.log(`Line ${i}: ${line}`)); | |
callback(); | |
} |
This file contains 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
{ | |
"type": "FunctionDeclaration", | |
"start": 88, | |
"end": 212, | |
"loc": { | |
"start": { | |
"line": 8, | |
"column": 0 | |
}, | |
"end": { | |
"line": 11, | |
"column": 1 | |
} | |
}, | |
"id": { | |
"type": "Identifier", | |
"start": 97, | |
"end": 107, | |
"loc": { | |
"start": { | |
"line": 8, | |
"column": 9 | |
}, | |
"end": { | |
"line": 8, | |
"column": 19 | |
}, | |
"identifierName": "eab75b094e80638be4554d3bb0c8782ad8bc628f" | |
}, | |
"name": "eab75b094e80638be4554d3bb0c8782ad8bc628f" | |
}, | |
"generator": false, | |
"async": false, | |
"params": [ | |
{ | |
"type": "Identifier", | |
"start": 108, | |
"end": 128, | |
"loc": { | |
"start": { | |
"line": 8, | |
"column": 20 | |
}, | |
"end": { | |
"line": 8, | |
"column": 40 | |
}, | |
"identifierName": "b4d5b37bf7a986c138ede89e0806f366b5cb1830" | |
}, | |
"name": "b4d5b37bf7a986c138ede89e0806f366b5cb1830", | |
"typeAnnotation": { | |
"type": "TSTypeAnnotation", | |
"start": 116, | |
"end": 128, | |
"loc": { | |
"start": { | |
"line": 8, | |
"column": 28 | |
}, | |
"end": { | |
"line": 8, | |
"column": 40 | |
} | |
}, | |
"typeAnnotation": { | |
"type": "TSFunctionType", | |
"start": 118, | |
"end": 128, | |
"loc": { | |
"start": { | |
"line": 8, | |
"column": 30 | |
}, | |
"end": { | |
"line": 8, | |
"column": 40 | |
} | |
}, | |
"parameters": [], | |
"typeAnnotation": { | |
"type": "TSTypeAnnotation", | |
"start": 121, | |
"end": 128, | |
"loc": { | |
"start": { | |
"line": 8, | |
"column": 33 | |
}, | |
"end": { | |
"line": 8, | |
"column": 40 | |
} | |
}, | |
"typeAnnotation": { | |
"type": "TSVoidKeyword", | |
"start": 124, | |
"end": 128, | |
"loc": { | |
"start": { | |
"line": 8, | |
"column": 36 | |
}, | |
"end": { | |
"line": 8, | |
"column": 40 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
], | |
"body": { | |
"type": "BlockStatement", | |
"start": 130, | |
"end": 212, | |
"loc": { | |
"start": { | |
"line": 8, | |
"column": 42 | |
}, | |
"end": { | |
"line": 11, | |
"column": 1 | |
} | |
}, | |
"body": [ | |
{ | |
"type": "ExpressionStatement", | |
"start": 134, | |
"end": 196, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 2 | |
}, | |
"end": { | |
"line": 9, | |
"column": 64 | |
} | |
}, | |
"expression": { | |
"type": "CallExpression", | |
"start": 134, | |
"end": 195, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 2 | |
}, | |
"end": { | |
"line": 9, | |
"column": 63 | |
} | |
}, | |
"callee": { | |
"type": "MemberExpression", | |
"start": 134, | |
"end": 147, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 2 | |
}, | |
"end": { | |
"line": 9, | |
"column": 15 | |
} | |
}, | |
"object": { | |
"type": "Identifier", | |
"start": 134, | |
"end": 139, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 2 | |
}, | |
"end": { | |
"line": 9, | |
"column": 7 | |
}, | |
"identifierName": "8525aaa8359e52b9251c3d249c0cad272acd6251" | |
}, | |
"name": "8525aaa8359e52b9251c3d249c0cad272acd6251" | |
}, | |
"property": { | |
"type": "Identifier", | |
"start": 140, | |
"end": 147, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 8 | |
}, | |
"end": { | |
"line": 9, | |
"column": 15 | |
}, | |
"identifierName": "edc5ee22beb2b82f4da41914d8d41cca9c53020f" | |
}, | |
"name": "edc5ee22beb2b82f4da41914d8d41cca9c53020f" | |
}, | |
"computed": false | |
}, | |
"arguments": [ | |
{ | |
"type": "ArrowFunctionExpression", | |
"start": 148, | |
"end": 194, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 16 | |
}, | |
"end": { | |
"line": 9, | |
"column": 62 | |
} | |
}, | |
"id": null, | |
"generator": false, | |
"async": false, | |
"params": [ | |
{ | |
"type": "Identifier", | |
"start": 149, | |
"end": 153, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 17 | |
}, | |
"end": { | |
"line": 9, | |
"column": 21 | |
}, | |
"identifierName": "264f39cab871e4cfd65b3a002f7255888bb5ed97" | |
}, | |
"name": "264f39cab871e4cfd65b3a002f7255888bb5ed97" | |
}, | |
{ | |
"type": "Identifier", | |
"start": 155, | |
"end": 156, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 23 | |
}, | |
"end": { | |
"line": 9, | |
"column": 24 | |
}, | |
"identifierName": "042dc4512fa3d391c5170cf3aa61e6a638f84342" | |
}, | |
"name": "042dc4512fa3d391c5170cf3aa61e6a638f84342" | |
} | |
], | |
"body": { | |
"type": "CallExpression", | |
"start": 161, | |
"end": 194, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 29 | |
}, | |
"end": { | |
"line": 9, | |
"column": 62 | |
} | |
}, | |
"callee": { | |
"type": "MemberExpression", | |
"start": 161, | |
"end": 172, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 29 | |
}, | |
"end": { | |
"line": 9, | |
"column": 40 | |
} | |
}, | |
"object": { | |
"type": "Identifier", | |
"start": 161, | |
"end": 168, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 29 | |
}, | |
"end": { | |
"line": 9, | |
"column": 36 | |
}, | |
"identifierName": "e2346381bb8eb382eb8b3877a9d3838996c5ca2d" | |
}, | |
"name": "e2346381bb8eb382eb8b3877a9d3838996c5ca2d" | |
}, | |
"property": { | |
"type": "Identifier", | |
"start": 169, | |
"end": 172, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 37 | |
}, | |
"end": { | |
"line": 9, | |
"column": 40 | |
}, | |
"identifierName": "7babc233de26ab19ead1b9c278128d5c434910ee" | |
}, | |
"name": "7babc233de26ab19ead1b9c278128d5c434910ee" | |
}, | |
"computed": false | |
}, | |
"arguments": [ | |
{ | |
"type": "TemplateLiteral", | |
"start": 173, | |
"end": 193, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 41 | |
}, | |
"end": { | |
"line": 9, | |
"column": 61 | |
} | |
}, | |
"expressions": [ | |
{ | |
"type": "Identifier", | |
"start": 181, | |
"end": 182, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 49 | |
}, | |
"end": { | |
"line": 9, | |
"column": 50 | |
}, | |
"identifierName": "042dc4512fa3d391c5170cf3aa61e6a638f84342" | |
}, | |
"name": "042dc4512fa3d391c5170cf3aa61e6a638f84342" | |
}, | |
{ | |
"type": "Identifier", | |
"start": 187, | |
"end": 191, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 55 | |
}, | |
"end": { | |
"line": 9, | |
"column": 59 | |
}, | |
"identifierName": "264f39cab871e4cfd65b3a002f7255888bb5ed97" | |
}, | |
"name": "264f39cab871e4cfd65b3a002f7255888bb5ed97" | |
} | |
], | |
"quasis": [ | |
{ | |
"type": "TemplateElement", | |
"start": 174, | |
"end": 179, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 42 | |
}, | |
"end": { | |
"line": 9, | |
"column": 47 | |
} | |
}, | |
"value": "f1a5b8929ea454f44e7d470d0c2b59d040b4a5f0", | |
"tail": false | |
}, | |
{ | |
"type": "TemplateElement", | |
"start": 183, | |
"end": 185, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 51 | |
}, | |
"end": { | |
"line": 9, | |
"column": 53 | |
} | |
}, | |
"value": "2334a9f235c7e28bbfce7b8a455691070dd3e203", | |
"tail": false | |
}, | |
{ | |
"type": "TemplateElement", | |
"start": 192, | |
"end": 192, | |
"loc": { | |
"start": { | |
"line": 9, | |
"column": 60 | |
}, | |
"end": { | |
"line": 9, | |
"column": 60 | |
} | |
}, | |
"value": "bb11830d6a9912de5cba701c214e0430ceb7f250", | |
"tail": true | |
} | |
] | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "ExpressionStatement", | |
"start": 199, | |
"end": 210, | |
"loc": { | |
"start": { | |
"line": 10, | |
"column": 2 | |
}, | |
"end": { | |
"line": 10, | |
"column": 13 | |
} | |
}, | |
"expression": { | |
"type": "CallExpression", | |
"start": 199, | |
"end": 209, | |
"loc": { | |
"start": { | |
"line": 10, | |
"column": 2 | |
}, | |
"end": { | |
"line": 10, | |
"column": 12 | |
} | |
}, | |
"callee": { | |
"type": "Identifier", | |
"start": 199, | |
"end": 207, | |
"loc": { | |
"start": { | |
"line": 10, | |
"column": 2 | |
}, | |
"end": { | |
"line": 10, | |
"column": 10 | |
}, | |
"identifierName": "b4d5b37bf7a986c138ede89e0806f366b5cb1830" | |
}, | |
"name": "b4d5b37bf7a986c138ede89e0806f366b5cb1830" | |
}, | |
"arguments": [] | |
} | |
} | |
], | |
"directives": [] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment