Skip to content

Instantly share code, notes, and snippets.

@hegemonic
Created December 28, 2012 22:39
Show Gist options
  • Save hegemonic/4402668 to your computer and use it in GitHub Desktop.
Save hegemonic/4402668 to your computer and use it in GitHub Desktop.
issue with escodegen.attachComments and leading block comments
/**
* @class MyClass
*/
function MyClass() {}
{
"type": "Program",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "MyClass",
"range": [
35,
42
],
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 16
}
}
},
"params": [],
"defaults": [],
"body": {
"type": "BlockStatement",
"body": [],
"range": [
45,
47
],
"loc": {
"start": {
"line": 4,
"column": 19
},
"end": {
"line": 4,
"column": 21
}
}
},
"rest": null,
"generator": false,
"expression": false,
"range": [
26,
47
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 21
}
}
}
],
"range": [
26,
47
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 21
}
},
"comments": [
{
"type": "Block",
"value": "*\n * @class MyClass\n ",
"range": [
0,
25
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
}
}
],
"tokens": [
{
"type": "Keyword",
"value": "function",
"range": [
26,
34
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 8
}
}
},
{
"type": "Identifier",
"value": "MyClass",
"range": [
35,
42
],
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 16
}
}
},
{
"type": "Punctuator",
"value": "(",
"range": [
42,
43
],
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 17
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
43,
44
],
"loc": {
"start": {
"line": 4,
"column": 17
},
"end": {
"line": 4,
"column": 18
}
}
},
{
"type": "Punctuator",
"value": "{",
"range": [
45,
46
],
"loc": {
"start": {
"line": 4,
"column": 19
},
"end": {
"line": 4,
"column": 20
}
}
},
{
"type": "Punctuator",
"value": "}",
"range": [
46,
47
],
"loc": {
"start": {
"line": 4,
"column": 20
},
"end": {
"line": 4,
"column": 21
}
}
}
],
"leadingComments": [
{
"type": "Block",
"value": "*\n * @class MyClass\n ",
"range": {
"0": 0,
"1": 25
},
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
},
"extendedRange": [
0,
26
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment