mam-project-templates
Version:
my personal templating projects
1,511 lines (1,456 loc) • 443 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;
var harmonyTestFixture = {
'ES6 Unicode Code Point Escape Sequence': {
'"\\u{714E}\\u{8336}"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: '煎茶',
raw: '"\\u{714E}\\u{8336}"',
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 }
}
},
'"\\u{20BB7}\\u{91CE}\\u{5BB6}"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: '\ud842\udfb7\u91ce\u5bb6',
raw: '"\\u{20BB7}\\u{91CE}\\u{5BB6}"',
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
}
},
// ECMAScript 6th Syntax, 7.8.3 Numeric Literals
'ES6: Numeric Literal': {
'00': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '00',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
'0o0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0o0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'function test() {\'use strict\'; 0o0; }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'test',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '\'use strict\'',
range: [17, 29],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 29 }
}
},
range: [17, 30],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 30 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0o0',
range: [31, 34],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 34 }
}
},
range: [31, 35],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 35 }
}
}],
range: [16, 37],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 37 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 37],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 37 }
}
},
'0o2': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '0o2',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0o12': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 10,
raw: '0o12',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0O0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0O0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'function test() {\'use strict\'; 0O0; }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'test',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '\'use strict\'',
range: [17, 29],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 29 }
}
},
range: [17, 30],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 30 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0O0',
range: [31, 34],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 34 }
}
},
range: [31, 35],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 35 }
}
}],
range: [16, 37],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 37 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 37],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 37 }
}
},
'0O2': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '0O2',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0O12': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 10,
raw: '0O12',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0b0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0b0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0b1': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 1,
raw: '0b1',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0b10': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '0b10',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0B0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0B0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0B1': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 1,
raw: '0B1',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0B10': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '0B10',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}
},
// ECMAScript 6th Syntax, 11.1. 9 Template Literals
'ES6 Template Strings': {
'`42`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '42',
cooked: '42'
},
tail: true,
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}],
expressions: [],
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'raw`42`': {
type: 'ExpressionStatement',
expression: {
type: 'TaggedTemplateExpression',
tag: {
type: 'Identifier',
name: 'raw',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
quasi: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '42',
cooked: '42'
},
tail: true,
range: [3, 7],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 7 }
}
}],
expressions: [],
range: [3, 7],
loc: {
start: { line: 1, column: 3 },
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 }
}
},
'raw`hello ${name}`': {
type: 'ExpressionStatement',
expression: {
type: 'TaggedTemplateExpression',
tag: {
type: 'Identifier',
name: 'raw',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
quasi: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: 'hello ',
cooked: 'hello '
},
tail: false,
range: [3, 12],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 12 }
}
}, {
type: 'TemplateElement',
value: {
raw: '',
cooked: ''
},
tail: true,
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
}],
expressions: [{
type: 'Identifier',
name: 'name',
range: [12, 16],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 16 }
}
}],
range: [3, 18],
loc: {
start: { line: 1, column: 3 },
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 }
}
},
'`$`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '$',
cooked: '$'
},
tail: true,
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}],
expressions: [],
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'`\\n\\r\\b\\v\\t\\f\\\n\\\r\n`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '\\n\\r\\b\\v\\t\\f\\\n\\\r\n',
cooked: '\n\r\b\v\t\f'
},
tail: true,
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 19 }
}
}],
expressions: [],
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 19 }
}
},
'`\n\r\n`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '\n\r\n',
cooked: '\n\n'
},
tail: true,
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 5 }
}
}],
expressions: [],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 5 }
}
},
'`\\u{000042}\\u0042\\x42\\u0\\102\\A`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '\\u{000042}\\u0042\\x42\\u0\\102\\A',
cooked: 'BBBu0BA'
},
tail: true,
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
}],
expressions: [],
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
'new raw`42`': {
type: 'ExpressionStatement',
expression: {
type: 'NewExpression',
callee: {
type: 'TaggedTemplateExpression',
tag: {
type: 'Identifier',
name: 'raw',
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
quasi: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '42',
cooked: '42'
},
tail: true,
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
}],
expressions: [],
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
'arguments': [],
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 }
}
}
},
// ECMAScript 6th Syntax, 12.11 The switch statement
'ES6: Switch Case Declaration': {
'switch (answer) { case 42: let t = 42; break; }': {
type: 'SwitchStatement',
discriminant: {
type: 'Identifier',
name: 'answer',
range: [8, 14],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 14 }
}
},
cases: [{
type: 'SwitchCase',
test: {
type: 'Literal',
value: 42,
raw: '42',
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
consequent: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 't',
range: [31, 32],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 32 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [35, 37],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 37 }
}
},
range: [31, 37],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 37 }
}
}],
kind: 'let',
range: [27, 38],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 38 }
}
}, {
type: 'BreakStatement',
label: null,
range: [39, 45],
loc: {
start: { line: 1, column: 39 },
end: { line: 1, column: 45 }
}
}],
range: [18, 45],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 45 }
}
}],
range: [0, 47],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 47 }
}
}
},
// ECMAScript 6th Syntax, 13.2 Arrow Function Definitions
'ES6: Arrow Function': {
'() => "test"': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'Literal',
value: 'test',
raw: '"test"',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
rest: null,
generator: false,
expression: true,
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 }
}
},
'e => "test"': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 'test',
raw: '"test"',
range: [5, 11],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 11 }
}
},
rest: null,
generator: false,
expression: true,
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 }
}
},
'(e) => "test"': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 'test',
raw: '"test"',
range: [7, 13],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 13 }
}
},
rest: null,
generator: false,
expression: true,
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 }
}
},
'(a, b) => "test"': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}, {
type: 'Identifier',
name: 'b',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 'test',
raw: '"test"',
range: [10, 16],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 16 }
}
},
rest: null,
generator: false,
expression: true,
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 }
}
},
'e => { 42; }': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [7, 9],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 9 }
}
},
range: [7, 10],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 10 }
}
}],
range: [5, 12],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 12 }
}
},
rest: null,
generator: false,
expression: false,
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 }
}
},
'e => ({ property: 42 })': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'property',
range: [8, 16],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 16 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [8, 20],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 20 }
}
}],
range: [6, 22],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
// Not an object!
'e => { label: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: 'label',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
range: [14, 17],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 17 }
}
},
range: [7, 17],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 17 }
}
}],
range: [5, 18],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 18 }
}
},
rest: null,
generator: false,
expression: false,
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 }
}
},
'(a, b) => { 42; }': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}, {
type: 'Identifier',
name: 'b',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [12, 15],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 15 }
}
}],
range: [10, 17],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 17 }
}
},
rest: null,
generator: false,
expression: false,
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 }
}
},
'([a, , b]) => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
}, null, {
type: 'Identifier',
name: 'b',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
range: [1, 9],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 9 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
rest: null,
generator: false,
expression: true,
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 }
}
},
'([a.a]) => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'ArrayPattern',
elements: [{
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'a',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
},
property: {
type: 'Identifier',
name: 'a',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [2, 5],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 5 }
}
}],
range: [1, 6],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 6 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
},
rest: null,
generator: false,
expression: true,
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) => x * x': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [{
type: 'Literal',
value: 1,
raw: '1',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
}],
body: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
right: {
type: 'Identifier',
name: 'x',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
rest: null,
generator: false,
expression: true,
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 }
}
},
// not strict mode, using eval
'eval => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,