d2-ui
Version:
1,464 lines (1,423 loc) • 682 kB
JavaScript
/*
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2011 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2011 Arpad Borsos <arpad.borsos@googlemail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var testFixture = {
'Primary Expression': {
'this\n': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'ThisExpression',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 0 }
}
}],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 0 }
},
tokens: [{
type: 'Keyword',
value: 'this',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}]
},
'null\n': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: null,
raw: 'null',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 0 }
}
}],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 0 }
},
tokens: [{
type: 'Null',
value: 'null',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}]
},
'\n 42\n\n': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
},
range: [5, 9],
loc: {
start: { line: 2, column: 4 },
end: { line: 4, column: 0 }
}
}],
range: [5, 9],
loc: {
start: { line: 2, column: 4 },
end: { line: 4, column: 0 }
},
tokens: [{
type: 'Numeric',
value: '42',
range: [5, 7],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
}]
},
'(1 + 2 ) * 3': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Literal',
value: 1,
raw: '1',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'Literal',
value: 2,
raw: '2',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [1, 6],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'Literal',
value: 3,
raw: '3',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
}
},
'Grouping Operator': {
'(1) + (2 ) + 3': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Literal',
value: 1,
raw: '1',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'Literal',
value: 2,
raw: '2',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
right: {
type: 'Literal',
value: 3,
raw: '3',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'4 + 5 << (6)': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<<',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Literal',
value: 4,
raw: '4',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 5,
raw: '5',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Literal',
value: 6,
raw: '6',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
}
},
'Array Initializer': {
'x = []': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
}],
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
},
tokens: [{
type: 'Identifier',
value: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}, {
type: 'Punctuator',
value: '=',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
}, {
type: 'Punctuator',
value: '[',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: ']',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}]
},
'x = [ ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x = [ 42 ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 42,
raw: '42',
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
}],
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
'x = [ 42, ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 42,
raw: '42',
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
}],
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'x = [ ,, 42 ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [
null,
null,
{
type: 'Literal',
value: 42,
raw: '42',
range: [9, 11],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 11 }
}
}],
range: [4, 13],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'x = [ 1, 2, 3, ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 1,
raw: '1',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'Literal',
value: 2,
raw: '2',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}, {
type: 'Literal',
value: 3,
raw: '3',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
}],
range: [4, 16],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'x = [ 1, 2,, 3, ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 1,
raw: '1',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'Literal',
value: 2,
raw: '2',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}, null, {
type: 'Literal',
value: 3,
raw: '3',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'日本語 = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: '日本語',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'T\u203F = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'T\u203F',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'T\u200C = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'T\u200C',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'T\u200D = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'T\u200D',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'\u2163\u2161 = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: '\u2163\u2161',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'\u2163\u2161\u200A=\u2009[]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: '\u2163\u2161',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
}
},
'Object Initializer': {
'x = {}': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [],
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x = { }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x = { answer: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'answer',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
kind: 'init',
range: [6, 16],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 16 }
}
}],
range: [4, 18],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'x = { if: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'if',
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
kind: 'init',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
}],
range: [4, 14],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'x = { true: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'true',
range: [6, 10],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 10 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
kind: 'init',
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
}],
range: [4, 16],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'x = { false: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'false',
range: [6, 11],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 11 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
kind: 'init',
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'x = { null: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'null',
range: [6, 10],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 10 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
kind: 'init',
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
}],
range: [4, 16],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'x = { "answer": 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: 'answer',
raw: '"answer"',
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
},
kind: 'init',
range: [6, 18],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 18 }
}
}],
range: [4, 20],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'x = { x: 1, x: 2 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [
{
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
value: {
type: 'Literal',
value: 1,
raw: '1',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
kind: 'init',
range: [6, 10],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 10 }
}
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
value: {
type: 'Literal',
value: 2,
raw: '2',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
},
kind: 'init',
range: [12, 16],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 16 }
}
}
],
range: [4, 18],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'x = { get width() { return m_width } }': {
type: 'ExpressionStatement',
expression: {