-
Notifications
You must be signed in to change notification settings - Fork 861
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue #1095. Fix some potential NPEs in Parser.java.
- Loading branch information
1 parent
cb8d5f0
commit 1860d6e
Showing
3 changed files
with
59 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
load("testsrc/assert.js"); | ||
|
||
(function TestSuccessDestructuring() { | ||
// var | ||
var [a, b] = [1, 2]; | ||
assertEquals(1, a); | ||
assertEquals(2, b); | ||
|
||
// let | ||
let [c, d] = [3, 4]; | ||
assertEquals(3, c); | ||
assertEquals(4, d); | ||
|
||
// const | ||
const [e, f] = [5, 6]; | ||
assertEquals(5, e); | ||
assertEquals(6, f); | ||
})(); | ||
|
||
(function TestDuplicateNameDestructuring() { | ||
// var | ||
var [a, a] = [1, 2]; | ||
assertEquals(2, a); | ||
|
||
// let | ||
assertThrows("let [b, b] = [3, 4];", TypeError); | ||
|
||
// const | ||
assertThrows("const [c, c] = [5, 6];", TypeError); | ||
})(); | ||
|
||
"success"; |
14 changes: 14 additions & 0 deletions
14
testsrc/org/mozilla/javascript/tests/es6/DestructuringAssignmentTest.java
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,14 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.javascript.tests.es6; | ||
|
||
import org.mozilla.javascript.Context; | ||
import org.mozilla.javascript.drivers.LanguageVersion; | ||
import org.mozilla.javascript.drivers.RhinoTest; | ||
import org.mozilla.javascript.drivers.ScriptTestsBase; | ||
|
||
@RhinoTest("testsrc/jstests/es6/desctructuring-assignment.js") | ||
@LanguageVersion(Context.VERSION_ES6) | ||
public class DestructuringAssignmentTest extends ScriptTestsBase {} |