Skip to content

Instantly share code, notes, and snippets.

@aslushnikov
Created April 7, 2015 21:14
Show Gist options
  • Save aslushnikov/d79ac72fa2cbc5607d9f to your computer and use it in GitHub Desktop.
Save aslushnikov/d79ac72fa2cbc5607d9f to your computer and use it in GitHub Desktop.
V8 AST example 3
if (1 < 2) { 1} else { 2}
{
"type": "FunctionLiteral",
"position": 0,
"declarations": [],
"body": [
{
"type": "IfStatement",
"position": 0,
"condition": {
"type": "CompareOperation",
"position": 6,
"left": {
"type": "Literal",
"position": 4
},
"right": {
"type": "Literal",
"position": 8
}
},
"then_statement": {
"type": "Block",
"position": -1,
"statements": [
{
"type": "ExpressionStatement",
"position": 13,
"expression": {
"type": "Literal",
"position": 13
}
}
]
},
"else_statement": {
"type": "Block",
"position": -1,
"statements": [
{
"type": "ExpressionStatement",
"position": 23,
"expression": {
"type": "Literal",
"position": 23
}
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment