Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Test that inferring anonymous function information is done correctly |
michael@0 | 6 | * from arrow expressions. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | function test() { |
michael@0 | 10 | let { Parser, ParserHelpers, SyntaxTreeVisitor } = |
michael@0 | 11 | Cu.import("resource:///modules/devtools/Parser.jsm", {}); |
michael@0 | 12 | |
michael@0 | 13 | function verify(source, predicate, details) { |
michael@0 | 14 | let { name, chain } = details; |
michael@0 | 15 | let [[sline, scol], [eline, ecol]] = details.loc; |
michael@0 | 16 | let ast = Parser.reflectionAPI.parse(source); |
michael@0 | 17 | let node = SyntaxTreeVisitor.filter(ast, predicate).pop(); |
michael@0 | 18 | let info = ParserHelpers.inferFunctionExpressionInfo(node); |
michael@0 | 19 | |
michael@0 | 20 | is(info.name, name, |
michael@0 | 21 | "The function expression assignment property name is correct."); |
michael@0 | 22 | is(chain ? info.chain.toSource() : info.chain, chain ? chain.toSource() : chain, |
michael@0 | 23 | "The function expression assignment property chain is correct."); |
michael@0 | 24 | is(info.loc.start.toSource(), { line: sline, column: scol }.toSource(), |
michael@0 | 25 | "The start location was correct for the identifier in: '" + source + "'."); |
michael@0 | 26 | is(info.loc.end.toSource(), { line: eline, column: ecol }.toSource(), |
michael@0 | 27 | "The end location was correct for the identifier in: '" + source + "'."); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | // VariableDeclarator |
michael@0 | 31 | |
michael@0 | 32 | verify("var foo=()=>{}", e => e.type == "ArrowExpression", { |
michael@0 | 33 | name: "foo", |
michael@0 | 34 | chain: null, |
michael@0 | 35 | loc: [[1, 4], [1, 7]] |
michael@0 | 36 | }); |
michael@0 | 37 | verify("\nvar\nfoo\n=\n(\n)\n=>\n{\n}\n", e => e.type == "ArrowExpression", { |
michael@0 | 38 | name: "foo", |
michael@0 | 39 | chain: null, |
michael@0 | 40 | loc: [[3, 0], [3, 3]] |
michael@0 | 41 | }); |
michael@0 | 42 | |
michael@0 | 43 | // AssignmentExpression |
michael@0 | 44 | |
michael@0 | 45 | verify("foo=()=>{}", e => e.type == "ArrowExpression", |
michael@0 | 46 | { name: "foo", chain: [], loc: [[1, 0], [1, 3]] }); |
michael@0 | 47 | |
michael@0 | 48 | verify("\nfoo\n=\n(\n)\n=>\n{\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 49 | { name: "foo", chain: [], loc: [[2, 0], [2, 3]] }); |
michael@0 | 50 | |
michael@0 | 51 | verify("foo.bar=()=>{}", e => e.type == "ArrowExpression", |
michael@0 | 52 | { name: "bar", chain: ["foo"], loc: [[1, 0], [1, 7]] }); |
michael@0 | 53 | |
michael@0 | 54 | verify("\nfoo.bar\n=\n(\n)\n=>\n{\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 55 | { name: "bar", chain: ["foo"], loc: [[2, 0], [2, 7]] }); |
michael@0 | 56 | |
michael@0 | 57 | verify("this.foo=()=>{}", e => e.type == "ArrowExpression", |
michael@0 | 58 | { name: "foo", chain: ["this"], loc: [[1, 0], [1, 8]] }); |
michael@0 | 59 | |
michael@0 | 60 | verify("\nthis.foo\n=\n(\n)\n=>\n{\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 61 | { name: "foo", chain: ["this"], loc: [[2, 0], [2, 8]] }); |
michael@0 | 62 | |
michael@0 | 63 | verify("this.foo.bar=()=>{}", e => e.type == "ArrowExpression", |
michael@0 | 64 | { name: "bar", chain: ["this", "foo"], loc: [[1, 0], [1, 12]] }); |
michael@0 | 65 | |
michael@0 | 66 | verify("\nthis.foo.bar\n=\n(\n)\n=>\n{\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 67 | { name: "bar", chain: ["this", "foo"], loc: [[2, 0], [2, 12]] }); |
michael@0 | 68 | |
michael@0 | 69 | verify("foo.this.bar=()=>{}", e => e.type == "ArrowExpression", |
michael@0 | 70 | { name: "bar", chain: ["foo", "this"], loc: [[1, 0], [1, 12]] }); |
michael@0 | 71 | |
michael@0 | 72 | verify("\nfoo.this.bar\n=\n(\n)\n=>\n{\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 73 | { name: "bar", chain: ["foo", "this"], loc: [[2, 0], [2, 12]] }); |
michael@0 | 74 | |
michael@0 | 75 | // ObjectExpression |
michael@0 | 76 | |
michael@0 | 77 | verify("({foo:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 78 | { name: "foo", chain: [], loc: [[1, 2], [1, 5]] }); |
michael@0 | 79 | |
michael@0 | 80 | verify("(\n{\nfoo\n:\n(\n)\n=>\n{\n}\n}\n)", e => e.type == "ArrowExpression", |
michael@0 | 81 | { name: "foo", chain: [], loc: [[3, 0], [3, 3]] }); |
michael@0 | 82 | |
michael@0 | 83 | verify("({foo:{bar:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 84 | { name: "bar", chain: ["foo"], loc: [[1, 7], [1, 10]] }); |
michael@0 | 85 | |
michael@0 | 86 | verify("(\n{\nfoo\n:\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n}\n)", e => e.type == "ArrowExpression", |
michael@0 | 87 | { name: "bar", chain: ["foo"], loc: [[6, 0], [6, 3]] }); |
michael@0 | 88 | |
michael@0 | 89 | // AssignmentExpression + ObjectExpression |
michael@0 | 90 | |
michael@0 | 91 | verify("foo={bar:()=>{}}", e => e.type == "ArrowExpression", |
michael@0 | 92 | { name: "bar", chain: ["foo"], loc: [[1, 5], [1, 8]] }); |
michael@0 | 93 | |
michael@0 | 94 | verify("\nfoo\n=\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 95 | { name: "bar", chain: ["foo"], loc: [[5, 0], [5, 3]] }); |
michael@0 | 96 | |
michael@0 | 97 | verify("foo={bar:{baz:()=>{}}}", e => e.type == "ArrowExpression", |
michael@0 | 98 | { name: "baz", chain: ["foo", "bar"], loc: [[1, 10], [1, 13]] }); |
michael@0 | 99 | |
michael@0 | 100 | verify("\nfoo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 101 | { name: "baz", chain: ["foo", "bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 102 | |
michael@0 | 103 | verify("nested.foo={bar:()=>{}}", e => e.type == "ArrowExpression", |
michael@0 | 104 | { name: "bar", chain: ["nested", "foo"], loc: [[1, 12], [1, 15]] }); |
michael@0 | 105 | |
michael@0 | 106 | verify("\nnested.foo\n=\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 107 | { name: "bar", chain: ["nested", "foo"], loc: [[5, 0], [5, 3]] }); |
michael@0 | 108 | |
michael@0 | 109 | verify("nested.foo={bar:{baz:()=>{}}}", e => e.type == "ArrowExpression", |
michael@0 | 110 | { name: "baz", chain: ["nested", "foo", "bar"], loc: [[1, 17], [1, 20]] }); |
michael@0 | 111 | |
michael@0 | 112 | verify("\nnested.foo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 113 | { name: "baz", chain: ["nested", "foo", "bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 114 | |
michael@0 | 115 | verify("this.foo={bar:()=>{}}", e => e.type == "ArrowExpression", |
michael@0 | 116 | { name: "bar", chain: ["this", "foo"], loc: [[1, 10], [1, 13]] }); |
michael@0 | 117 | |
michael@0 | 118 | verify("\nthis.foo\n=\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 119 | { name: "bar", chain: ["this", "foo"], loc: [[5, 0], [5, 3]] }); |
michael@0 | 120 | |
michael@0 | 121 | verify("this.foo={bar:{baz:()=>{}}}", e => e.type == "ArrowExpression", |
michael@0 | 122 | { name: "baz", chain: ["this", "foo", "bar"], loc: [[1, 15], [1, 18]] }); |
michael@0 | 123 | |
michael@0 | 124 | verify("\nthis.foo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 125 | { name: "baz", chain: ["this", "foo", "bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 126 | |
michael@0 | 127 | verify("this.nested.foo={bar:()=>{}}", e => e.type == "ArrowExpression", |
michael@0 | 128 | { name: "bar", chain: ["this", "nested", "foo"], loc: [[1, 17], [1, 20]] }); |
michael@0 | 129 | |
michael@0 | 130 | verify("\nthis.nested.foo\n=\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 131 | { name: "bar", chain: ["this", "nested", "foo"], loc: [[5, 0], [5, 3]] }); |
michael@0 | 132 | |
michael@0 | 133 | verify("this.nested.foo={bar:{baz:()=>{}}}", e => e.type == "ArrowExpression", |
michael@0 | 134 | { name: "baz", chain: ["this", "nested", "foo", "bar"], loc: [[1, 22], [1, 25]] }); |
michael@0 | 135 | |
michael@0 | 136 | verify("\nthis.nested.foo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 137 | { name: "baz", chain: ["this", "nested", "foo", "bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 138 | |
michael@0 | 139 | verify("nested.this.foo={bar:()=>{}}", e => e.type == "ArrowExpression", |
michael@0 | 140 | { name: "bar", chain: ["nested", "this", "foo"], loc: [[1, 17], [1, 20]] }); |
michael@0 | 141 | |
michael@0 | 142 | verify("\nnested.this.foo\n=\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 143 | { name: "bar", chain: ["nested", "this", "foo"], loc: [[5, 0], [5, 3]] }); |
michael@0 | 144 | |
michael@0 | 145 | verify("nested.this.foo={bar:{baz:()=>{}}}", e => e.type == "ArrowExpression", |
michael@0 | 146 | { name: "baz", chain: ["nested", "this", "foo", "bar"], loc: [[1, 22], [1, 25]] }); |
michael@0 | 147 | |
michael@0 | 148 | verify("\nnested.this.foo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 149 | { name: "baz", chain: ["nested", "this", "foo", "bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 150 | |
michael@0 | 151 | // VariableDeclarator + AssignmentExpression + ObjectExpression |
michael@0 | 152 | |
michael@0 | 153 | verify("let foo={bar:()=>{}}", e => e.type == "ArrowExpression", |
michael@0 | 154 | { name: "bar", chain: ["foo"], loc: [[1, 9], [1, 12]] }); |
michael@0 | 155 | |
michael@0 | 156 | verify("\nlet\nfoo\n=\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 157 | { name: "bar", chain: ["foo"], loc: [[6, 0], [6, 3]] }); |
michael@0 | 158 | |
michael@0 | 159 | verify("let foo={bar:{baz:()=>{}}}", e => e.type == "ArrowExpression", |
michael@0 | 160 | { name: "baz", chain: ["foo", "bar"], loc: [[1, 14], [1, 17]] }); |
michael@0 | 161 | |
michael@0 | 162 | verify("\nlet\nfoo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n", e => e.type == "ArrowExpression", |
michael@0 | 163 | { name: "baz", chain: ["foo", "bar"], loc: [[9, 0], [9, 3]] }); |
michael@0 | 164 | |
michael@0 | 165 | // New/CallExpression + AssignmentExpression + ObjectExpression |
michael@0 | 166 | |
michael@0 | 167 | verify("foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 168 | { name: "bar", chain: [], loc: [[1, 5], [1, 8]] }); |
michael@0 | 169 | |
michael@0 | 170 | verify("\nfoo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 171 | { name: "bar", chain: [], loc: [[5, 0], [5, 3]] }); |
michael@0 | 172 | |
michael@0 | 173 | verify("foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 174 | { name: "baz", chain: ["bar"], loc: [[1, 10], [1, 13]] }); |
michael@0 | 175 | |
michael@0 | 176 | verify("\nfoo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 177 | { name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 178 | |
michael@0 | 179 | verify("nested.foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 180 | { name: "bar", chain: [], loc: [[1, 12], [1, 15]] }); |
michael@0 | 181 | |
michael@0 | 182 | verify("\nnested.foo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 183 | { name: "bar", chain: [], loc: [[5, 0], [5, 3]] }); |
michael@0 | 184 | |
michael@0 | 185 | verify("nested.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 186 | { name: "baz", chain: ["bar"], loc: [[1, 17], [1, 20]] }); |
michael@0 | 187 | |
michael@0 | 188 | verify("\nnested.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 189 | { name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 190 | |
michael@0 | 191 | verify("this.foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 192 | { name: "bar", chain: [], loc: [[1, 10], [1, 13]] }); |
michael@0 | 193 | |
michael@0 | 194 | verify("\nthis.foo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 195 | { name: "bar", chain: [], loc: [[5, 0], [5, 3]] }); |
michael@0 | 196 | |
michael@0 | 197 | verify("this.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 198 | { name: "baz", chain: ["bar"], loc: [[1, 15], [1, 18]] }); |
michael@0 | 199 | |
michael@0 | 200 | verify("\nthis.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 201 | { name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 202 | |
michael@0 | 203 | verify("this.nested.foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 204 | { name: "bar", chain: [], loc: [[1, 17], [1, 20]] }); |
michael@0 | 205 | |
michael@0 | 206 | verify("\nthis.nested.foo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 207 | { name: "bar", chain: [], loc: [[5, 0], [5, 3]] }); |
michael@0 | 208 | |
michael@0 | 209 | verify("this.nested.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 210 | { name: "baz", chain: ["bar"], loc: [[1, 22], [1, 25]] }); |
michael@0 | 211 | |
michael@0 | 212 | verify("\nthis.nested.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 213 | { name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 214 | |
michael@0 | 215 | verify("nested.this.foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 216 | { name: "bar", chain: [], loc: [[1, 17], [1, 20]] }); |
michael@0 | 217 | |
michael@0 | 218 | verify("\nnested.this.foo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 219 | { name: "bar", chain: [], loc: [[5, 0], [5, 3]] }); |
michael@0 | 220 | |
michael@0 | 221 | verify("nested.this.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 222 | { name: "baz", chain: ["bar"], loc: [[1, 22], [1, 25]] }); |
michael@0 | 223 | |
michael@0 | 224 | verify("\nnested.this.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 225 | { name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] }); |
michael@0 | 226 | |
michael@0 | 227 | // New/CallExpression + VariableDeclarator + AssignmentExpression + ObjectExpression |
michael@0 | 228 | |
michael@0 | 229 | verify("let target=foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 230 | { name: "bar", chain: ["target"], loc: [[1, 16], [1, 19]] }); |
michael@0 | 231 | |
michael@0 | 232 | verify("\nlet\ntarget=\nfoo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 233 | { name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] }); |
michael@0 | 234 | |
michael@0 | 235 | verify("let target=foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 236 | { name: "baz", chain: ["target", "bar"], loc: [[1, 21], [1, 24]] }); |
michael@0 | 237 | |
michael@0 | 238 | verify("\nlet\ntarget=\nfoo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 239 | { name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] }); |
michael@0 | 240 | |
michael@0 | 241 | verify("let target=nested.foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 242 | { name: "bar", chain: ["target"], loc: [[1, 23], [1, 26]] }); |
michael@0 | 243 | |
michael@0 | 244 | verify("\nlet\ntarget=\nnested.foo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 245 | { name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] }); |
michael@0 | 246 | |
michael@0 | 247 | verify("let target=nested.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 248 | { name: "baz", chain: ["target", "bar"], loc: [[1, 28], [1, 31]] }); |
michael@0 | 249 | |
michael@0 | 250 | verify("\nlet\ntarget=\nnested.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 251 | { name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] }); |
michael@0 | 252 | |
michael@0 | 253 | verify("let target=this.foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 254 | { name: "bar", chain: ["target"], loc: [[1, 21], [1, 24]] }); |
michael@0 | 255 | |
michael@0 | 256 | verify("\nlet\ntarget=\nthis.foo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 257 | { name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] }); |
michael@0 | 258 | |
michael@0 | 259 | verify("let target=this.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 260 | { name: "baz", chain: ["target", "bar"], loc: [[1, 26], [1, 29]] }); |
michael@0 | 261 | |
michael@0 | 262 | verify("\nlet\ntarget=\nthis.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 263 | { name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] }); |
michael@0 | 264 | |
michael@0 | 265 | verify("let target=this.nested.foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 266 | { name: "bar", chain: ["target"], loc: [[1, 28], [1, 31]] }); |
michael@0 | 267 | |
michael@0 | 268 | verify("\nlet\ntarget=\nthis.nested.foo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 269 | { name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] }); |
michael@0 | 270 | |
michael@0 | 271 | verify("let target=this.nested.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 272 | { name: "baz", chain: ["target", "bar"], loc: [[1, 33], [1, 36]] }); |
michael@0 | 273 | |
michael@0 | 274 | verify("\nlet\ntarget=\nthis.nested.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 275 | { name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] }); |
michael@0 | 276 | |
michael@0 | 277 | verify("let target=nested.this.foo({bar:()=>{}})", e => e.type == "ArrowExpression", |
michael@0 | 278 | { name: "bar", chain: ["target"], loc: [[1, 28], [1, 31]] }); |
michael@0 | 279 | |
michael@0 | 280 | verify("\nlet\ntarget=\nnested.this.foo\n(\n{\nbar\n:\n(\n)\n=>\n{\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 281 | { name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] }); |
michael@0 | 282 | |
michael@0 | 283 | verify("let target=nested.this.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowExpression", |
michael@0 | 284 | { name: "baz", chain: ["target", "bar"], loc: [[1, 33], [1, 36]] }); |
michael@0 | 285 | |
michael@0 | 286 | verify("\nlet\ntarget=\nnested.this.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)\n=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowExpression", |
michael@0 | 287 | { name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] }); |
michael@0 | 288 | |
michael@0 | 289 | finish(); |
michael@0 | 290 | } |