Diff
Modified: trunk/JSTests/ChakraCore/test/es6/globalParamCatchNewTargetSyntaxError.baseline-jsc (258278 => 258279)
--- trunk/JSTests/ChakraCore/test/es6/globalParamCatchNewTargetSyntaxError.baseline-jsc 2020-03-11 20:22:25 UTC (rev 258278)
+++ trunk/JSTests/ChakraCore/test/es6/globalParamCatchNewTargetSyntaxError.baseline-jsc 2020-03-11 20:26:06 UTC (rev 258279)
@@ -1,2 +1,2 @@
-Exception: SyntaxError: Unexpected identifier 'a'. Cannot declare a lexical variable twice: 'a'.
+Exception: SyntaxError: new.target is only valid inside functions.
at globalParamCatchNewTargetSyntaxError.js:7
Modified: trunk/JSTests/ChangeLog (258278 => 258279)
--- trunk/JSTests/ChangeLog 2020-03-11 20:22:25 UTC (rev 258278)
+++ trunk/JSTests/ChangeLog 2020-03-11 20:26:06 UTC (rev 258279)
@@ -1,3 +1,26 @@
+2020-03-11 Keith Miller <keith_mil...@apple.com>
+
+ Throws incorrectly a syntax error when declaring a top level catch variable the same as a parameter
+ https://bugs.webkit.org/show_bug.cgi?id=189914
+
+ Reviewed by Saam Barati.
+
+ * ChakraCore/test/es6/globalParamCatchNewTargetSyntaxError.baseline-jsc:
+ * stress/catch-destructuring-shadow-lexical-const-variable-global.js: Added.
+ (catch):
+ * stress/catch-destructuring-shadow-lexical-variable-class.js: Added.
+ (Foo):
+ (Bar):
+ (Baz):
+ * stress/catch-destructuring-shadow-lexical-variable-function.js: Added.
+ (foo):
+ (bar):
+ * stress/catch-destructuring-shadow-lexical-variable-global.js: Added.
+ (catch):
+ * stress/catch-destructuring-shadow-var-global.js: Added.
+ (catch):
+ * test262/expectations.yaml:
+
2020-03-10 Ross Kirsling <ross.kirsl...@sony.com>
Re-import test262 to acquire DST fix
Added: trunk/JSTests/stress/catch-destructuring-shadow-lexical-const-variable-global.js (0 => 258279)
--- trunk/JSTests/stress/catch-destructuring-shadow-lexical-const-variable-global.js (rev 0)
+++ trunk/JSTests/stress/catch-destructuring-shadow-lexical-const-variable-global.js 2020-03-11 20:26:06 UTC (rev 258279)
@@ -0,0 +1,21 @@
+let value = "string";
+const o = value;
+try {
+ throw { o: 1 };
+} catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+}
+if (o !== value)
+ throw new Error();
+
+try {
+ throw [ 1 ];
+} catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+}
+if (o !== value)
+ throw new Error();
Added: trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-class.js (0 => 258279)
--- trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-class.js (rev 0)
+++ trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-class.js 2020-03-11 20:26:06 UTC (rev 258279)
@@ -0,0 +1,80 @@
+class Foo {
+ constructor(o, value) {
+ try {
+ throw { o: 1 };
+ } catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ try {
+ throw [ 1 ];
+ } catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ }
+}
+new Foo("string", "string");
+
+
+class Bar {
+ constructor(value) {
+ let o = value;
+ try {
+ throw { o: 1 };
+ } catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ try {
+ throw [ 1 ];
+ } catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ }
+}
+new Bar("string");
+
+class Baz {
+ constructor(value) {
+ const o = value;
+ try {
+ throw { o: 1 };
+ } catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ try {
+ throw [ 1 ];
+ } catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ }
+}
+new Baz("string");
Added: trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-function.js (0 => 258279)
--- trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-function.js (rev 0)
+++ trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-function.js 2020-03-11 20:26:06 UTC (rev 258279)
@@ -0,0 +1,69 @@
+function foo(o, value) {
+ try {
+ throw { o: 1 };
+ } catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ try {
+ throw [ 1 ];
+ } catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+}
+foo("string", "string");
+
+function bar(value) {
+ let o = value;
+ try {
+ throw { o: 1 };
+ } catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ try {
+ throw [ 1 ];
+ } catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+}
+bar("string");
+
+function bar(value) {
+ const o = value;
+ try {
+ throw { o: 1 };
+ } catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+
+ try {
+ throw [ 1 ];
+ } catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+ }
+ if (o !== value)
+ throw new Error();
+}
Added: trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-global.js (0 => 258279)
--- trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-global.js (rev 0)
+++ trunk/JSTests/stress/catch-destructuring-shadow-lexical-variable-global.js 2020-03-11 20:26:06 UTC (rev 258279)
@@ -0,0 +1,21 @@
+let value = "string";
+let o = value;
+try {
+ throw { o: 1 };
+} catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+}
+if (o !== value)
+ throw new Error();
+
+try {
+ throw [ 1 ];
+} catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+}
+if (o !== value)
+ throw new Error();
Added: trunk/JSTests/stress/catch-destructuring-shadow-var-global.js (0 => 258279)
--- trunk/JSTests/stress/catch-destructuring-shadow-var-global.js (rev 0)
+++ trunk/JSTests/stress/catch-destructuring-shadow-var-global.js 2020-03-11 20:26:06 UTC (rev 258279)
@@ -0,0 +1,21 @@
+let value = "string";
+var o = value;
+try {
+ throw { o: 1 };
+} catch({ o }){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+}
+if (o !== value)
+ throw new Error();
+
+try {
+ throw [ 1 ];
+} catch([ o ]){
+ if (o !== 1)
+ throw new Error();
+ o = 2;
+}
+if (o !== value)
+ throw new Error();
Modified: trunk/JSTests/test262/expectations.yaml (258278 => 258279)
--- trunk/JSTests/test262/expectations.yaml 2020-03-11 20:22:25 UTC (rev 258278)
+++ trunk/JSTests/test262/expectations.yaml 2020-03-11 20:26:06 UTC (rev 258279)
@@ -3643,9 +3643,6 @@
test/language/statements/try/early-catch-lex.js:
default: 'Test262: This statement should not be evaluated.'
strict mode: 'Test262: This statement should not be evaluated.'
-test/language/statements/try/scope-catch-param-lex-open.js:
- default: "SyntaxError: Unexpected identifier 'x'. Cannot declare a lexical variable twice: 'x'."
- strict mode: "SyntaxError: Unexpected identifier 'x'. Cannot declare a lexical variable twice: 'x'."
test/language/statements/while/let-array-with-newline.js:
default: 'Test262: This statement should not be evaluated.'
test/language/statements/with/let-array-with-newline.js:
Modified: trunk/Source/_javascript_Core/ChangeLog (258278 => 258279)
--- trunk/Source/_javascript_Core/ChangeLog 2020-03-11 20:22:25 UTC (rev 258278)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-03-11 20:26:06 UTC (rev 258279)
@@ -1,3 +1,16 @@
+2020-03-11 Keith Miller <keith_mil...@apple.com>
+
+ Throws incorrectly a syntax error when declaring a top level catch variable the same as a parameter
+ https://bugs.webkit.org/show_bug.cgi?id=189914
+
+ Reviewed by Saam Barati.
+
+ When we are parsing catch block parameters we should increment the statement depth so we don't think
+ we are trying to shadow top level lexical variables in the same statement depth.
+
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::parseTryStatement):
+
2020-03-10 Yusuke Suzuki <ysuz...@apple.com>
[JSC] Fix iso-subspace static_assert for JSJavaScriptCallFramePrototype
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (258278 => 258279)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2020-03-11 20:22:25 UTC (rev 258278)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2020-03-11 20:26:06 UTC (rev 258279)
@@ -1761,6 +1761,8 @@
failIfFalse(catchBlock, "Unable to parse 'catch' block");
} else {
handleProductionOrFail(OPENPAREN, "(", "start", "'catch' target");
+ DepthManager statementDepth(&m_statementDepth);
+ m_statementDepth++;
AutoPopScopeRef catchScope(this, pushScope());
catchScope->setIsLexicalScope();
catchScope->preventVarDeclarations();