Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle member expressions in patterns (resolves #2750)
- Loading branch information
1 parent
09802b9
commit 42a80a1
Showing
10 changed files
with
167 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
description: 'handles member expressions in patterns (#2750)' | ||
}; |
23 changes: 23 additions & 0 deletions
23
test/form/samples/pattern-member-expressions/_expected/amd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define(function () { 'use strict'; | ||
|
||
const array = [false]; | ||
const obj1 = {value: false}; | ||
const obj2 = {value: false}; | ||
|
||
([array[0]] = [true]); | ||
({a: obj1.value} = {a: true}); | ||
({[globalVar1]: obj2[globalVar2]} = {[globalVar3]: true}); | ||
|
||
if (array[0]) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj1.value) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj2.value) { | ||
console.log('retained'); | ||
} | ||
|
||
}); |
21 changes: 21 additions & 0 deletions
21
test/form/samples/pattern-member-expressions/_expected/cjs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const array = [false]; | ||
const obj1 = {value: false}; | ||
const obj2 = {value: false}; | ||
|
||
([array[0]] = [true]); | ||
({a: obj1.value} = {a: true}); | ||
({[globalVar1]: obj2[globalVar2]} = {[globalVar3]: true}); | ||
|
||
if (array[0]) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj1.value) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj2.value) { | ||
console.log('retained'); | ||
} |
19 changes: 19 additions & 0 deletions
19
test/form/samples/pattern-member-expressions/_expected/es.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const array = [false]; | ||
const obj1 = {value: false}; | ||
const obj2 = {value: false}; | ||
|
||
([array[0]] = [true]); | ||
({a: obj1.value} = {a: true}); | ||
({[globalVar1]: obj2[globalVar2]} = {[globalVar3]: true}); | ||
|
||
if (array[0]) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj1.value) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj2.value) { | ||
console.log('retained'); | ||
} |
24 changes: 24 additions & 0 deletions
24
test/form/samples/pattern-member-expressions/_expected/iife.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
const array = [false]; | ||
const obj1 = {value: false}; | ||
const obj2 = {value: false}; | ||
|
||
([array[0]] = [true]); | ||
({a: obj1.value} = {a: true}); | ||
({[globalVar1]: obj2[globalVar2]} = {[globalVar3]: true}); | ||
|
||
if (array[0]) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj1.value) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj2.value) { | ||
console.log('retained'); | ||
} | ||
|
||
}()); |
28 changes: 28 additions & 0 deletions
28
test/form/samples/pattern-member-expressions/_expected/system.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
const array = [false]; | ||
const obj1 = {value: false}; | ||
const obj2 = {value: false}; | ||
|
||
([array[0]] = [true]); | ||
({a: obj1.value} = {a: true}); | ||
({[globalVar1]: obj2[globalVar2]} = {[globalVar3]: true}); | ||
|
||
if (array[0]) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj1.value) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj2.value) { | ||
console.log('retained'); | ||
} | ||
|
||
} | ||
}; | ||
}); |
26 changes: 26 additions & 0 deletions
26
test/form/samples/pattern-member-expressions/_expected/umd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(function (factory) { | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
factory(); | ||
}(function () { 'use strict'; | ||
|
||
const array = [false]; | ||
const obj1 = {value: false}; | ||
const obj2 = {value: false}; | ||
|
||
([array[0]] = [true]); | ||
({a: obj1.value} = {a: true}); | ||
({[globalVar1]: obj2[globalVar2]} = {[globalVar3]: true}); | ||
|
||
if (array[0]) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj1.value) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj2.value) { | ||
console.log('retained'); | ||
} | ||
|
||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const array = [false]; | ||
const obj1 = {value: false}; | ||
const obj2 = {value: false}; | ||
|
||
([array[0]] = [true]); | ||
({a: obj1.value} = {a: true}); | ||
({[globalVar1]: obj2[globalVar2]} = {[globalVar3]: true}); | ||
|
||
if (array[0]) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj1.value) { | ||
console.log('retained'); | ||
} | ||
|
||
if (obj2.value) { | ||
console.log('retained'); | ||
} |