diff --git a/fixtures/issue65-op.js b/fixtures/issue65-op.js new file mode 100644 index 0000000..a6ddd61 --- /dev/null +++ b/fixtures/issue65-op.js @@ -0,0 +1 @@ +var a = 0 + 1; diff --git a/fixtures/issue65-op.js.native b/fixtures/issue65-op.js.native new file mode 100644 index 0000000..38263fe --- /dev/null +++ b/fixtures/issue65-op.js.native @@ -0,0 +1,141 @@ +{ + comments: [], + end: 15, + loc: { + end: { + column: 0, + line: 2, + }, + start: { + column: 0, + line: 1, + }, + }, + program: { + body: [ + { + declarations: [ + { + end: 13, + id: { + end: 5, + loc: { + end: { + column: 5, + line: 1, + }, + identifierName: "a", + start: { + column: 4, + line: 1, + }, + }, + name: "a", + start: 4, + type: "Identifier", + }, + init: { + end: 13, + left: { + end: 9, + extra: { + raw: "0", + rawValue: 0, + }, + loc: { + end: { + column: 9, + line: 1, + }, + start: { + column: 8, + line: 1, + }, + }, + start: 8, + type: "NumericLiteral", + value: 0, + }, + loc: { + end: { + column: 13, + line: 1, + }, + start: { + column: 8, + line: 1, + }, + }, + operator: "+", + right: { + end: 13, + extra: { + raw: "1", + rawValue: 1, + }, + loc: { + end: { + column: 13, + line: 1, + }, + start: { + column: 12, + line: 1, + }, + }, + start: 12, + type: "NumericLiteral", + value: 1, + }, + start: 8, + type: "BinaryExpression", + }, + loc: { + end: { + column: 13, + line: 1, + }, + start: { + column: 4, + line: 1, + }, + }, + start: 4, + type: "VariableDeclarator", + }, + ], + end: 14, + kind: "var", + loc: { + end: { + column: 14, + line: 1, + }, + start: { + column: 0, + line: 1, + }, + }, + start: 0, + type: "VariableDeclaration", + }, + ], + directives: [], + end: 15, + loc: { + end: { + column: 0, + line: 2, + }, + start: { + column: 0, + line: 1, + }, + }, + sourceType: "module", + start: 0, + type: "Program", + }, + start: 0, + type: "File", +} \ No newline at end of file diff --git a/fixtures/issue65-op.js.sem.uast b/fixtures/issue65-op.js.sem.uast new file mode 100644 index 0000000..0155ba8 --- /dev/null +++ b/fixtures/issue65-op.js.sem.uast @@ -0,0 +1,134 @@ +{ '@type': "javascript:File", + '@role': [File], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 2, + col: 1, + }, + }, + comments: [], + program: { '@type': "javascript:Program", + '@role': [Module], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 2, + col: 1, + }, + }, + body: [ + { '@type': "javascript:VariableDeclaration", + '@role': [Declaration, Statement, Variable], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 14, + line: 1, + col: 15, + }, + }, + declarations: [ + { '@type': "javascript:VariableDeclarator", + '@role': [Declaration, Variable], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4, + line: 1, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + id: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4, + line: 1, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 5, + line: 1, + col: 6, + }, + }, + Name: "a", + }, + init: { '@type': "javascript:BinaryExpression", + '@role': [Add, Arithmetic, Binary, Expression, Initialization, Operator], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8, + line: 1, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + left: { '@type': "javascript:NumericLiteral", + '@token': 0, + '@role': [Binary, Expression, Left, Literal, Number], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8, + line: 1, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 9, + line: 1, + col: 10, + }, + }, + }, + operator: { '@type': "uast:Operator", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Expression, Operator], + }, + right: { '@type': "javascript:NumericLiteral", + '@token': 1, + '@role': [Binary, Expression, Literal, Number, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 12, + line: 1, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + }, + }, + }, + ], + kind: "var", + }, + ], + directives: [], + sourceType: "module", + }, +} \ No newline at end of file diff --git a/fixtures/issue65-op.js.uast b/fixtures/issue65-op.js.uast new file mode 100644 index 0000000..7761f13 --- /dev/null +++ b/fixtures/issue65-op.js.uast @@ -0,0 +1,135 @@ +{ '@type': "File", + '@role': [File], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 2, + col: 1, + }, + }, + comments: [], + program: { '@type': "Program", + '@role': [Module], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 15, + line: 2, + col: 1, + }, + }, + body: [ + { '@type': "VariableDeclaration", + '@role': [Declaration, Statement, Variable], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 14, + line: 1, + col: 15, + }, + }, + declarations: [ + { '@type': "VariableDeclarator", + '@role': [Declaration, Variable], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4, + line: 1, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + id: { '@type': "Identifier", + '@token': "a", + '@role': [Expression, Identifier], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 4, + line: 1, + col: 5, + }, + end: { '@type': "uast:Position", + offset: 5, + line: 1, + col: 6, + }, + }, + }, + init: { '@type': "BinaryExpression", + '@role': [Add, Arithmetic, Binary, Expression, Initialization, Operator], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8, + line: 1, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + left: { '@type': "NumericLiteral", + '@token': 0, + '@role': [Binary, Expression, Left, Literal, Number], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 8, + line: 1, + col: 9, + }, + end: { '@type': "uast:Position", + offset: 9, + line: 1, + col: 10, + }, + }, + }, + operator: { '@type': "uast:Operator", + '@token': "+", + '@role': [Add, Arithmetic, Binary, Expression, Operator], + }, + right: { '@type': "NumericLiteral", + '@token': 1, + '@role': [Binary, Expression, Literal, Number, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 12, + line: 1, + col: 13, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + }, + }, + }, + ], + kind: "var", + }, + ], + directives: [], + sourceType: "module", + }, +} \ No newline at end of file