 Chromium Code Reviews
 Chromium Code Reviews Issue 2185223002:
  Fix not throwing error when redefine eval or arguments in strict mode.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 2185223002:
  Fix not throwing error when redefine eval or arguments in strict mode.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| OLD | NEW | 
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright | 
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. | 
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above | 
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following | 
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided | 
| (...skipping 6532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6543 "var q, x; ({ q } = { x = 10 } = {});", | 6543 "var q, x; ({ q } = { x = 10 } = {});", | 
| 6544 "var x; [{ x = 10 } = {}]", | 6544 "var x; [{ x = 10 } = {}]", | 
| 6545 "var x; (true ? { x = true } = {} : { x = false } = {})", | 6545 "var x; (true ? { x = true } = {} : { x = false } = {})", | 
| 6546 "var q, x; (q, { x = 10 } = {});", | 6546 "var q, x; (q, { x = 10 } = {});", | 
| 6547 "var { x = 10 } = { x = 20 } = {};", | 6547 "var { x = 10 } = { x = 20 } = {};", | 
| 6548 "var { x = 10 } = (o = { x = 20 } = {});", | 6548 "var { x = 10 } = (o = { x = 20 } = {});", | 
| 6549 "var x; (({ x = 10 } = { x = 20 } = {}) => x)({})", | 6549 "var x; (({ x = 10 } = { x = 20 } = {}) => x)({})", | 
| 6550 NULL, | 6550 NULL, | 
| 6551 }; | 6551 }; | 
| 6552 RunParserSyncTest(empty_context_data, ambiguity_data, kSuccess); | 6552 RunParserSyncTest(empty_context_data, ambiguity_data, kSuccess); | 
| 6553 | |
| 6554 // v8:5201 | |
| 6555 { | |
| 6556 const char* context_data[][2] = { | |
| 6557 {"var {", "} = {};"}, | |
| 6558 {"(() => { function f({", " = false } = {}) {} })()"}, | |
| 6559 {NULL, NULL} | |
| 6560 }; | |
| 6561 | |
| 6562 const char* data[] = { | |
| 6563 "eval", | |
| 
adamk
2016/08/09 17:00:51
I think this test case belongs with the other dest
 | |
| 6564 NULL, | |
| 6565 }; | |
| 6566 | |
| 6567 RunParserSyncTest(context_data, data, kSuccess); | |
| 6568 } | |
| 6553 } | 6569 } | 
| 6554 | 6570 | 
| 6555 | 6571 | 
| 6556 TEST(DestructuringAssignmentNegativeTests) { | 6572 TEST(DestructuringAssignmentNegativeTests) { | 
| 6557 const char* context_data[][2] = { | 6573 const char* context_data[][2] = { | 
| 6558 {"'use strict'; let x, y, z; (", " = {});"}, | 6574 {"'use strict'; let x, y, z; (", " = {});"}, | 
| 6559 {"var x, y, z; (", " = {});"}, | 6575 {"var x, y, z; (", " = {});"}, | 
| 6560 {"'use strict'; let x, y, z; for (x in ", " = {});"}, | 6576 {"'use strict'; let x, y, z; for (x in ", " = {});"}, | 
| 6561 {"'use strict'; let x, y, z; for (x of ", " = {});"}, | 6577 {"'use strict'; let x, y, z; for (x of ", " = {});"}, | 
| 6562 {"var x, y, z; for (x in ", " = {});"}, | 6578 {"var x, y, z; for (x in ", " = {});"}, | 
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6708 "[ (arguments) = 0 ]", | 6724 "[ (arguments) = 0 ]", | 
| 6709 "[ ...(eval) ]", | 6725 "[ ...(eval) ]", | 
| 6710 "[ ...(arguments) ]", | 6726 "[ ...(arguments) ]", | 
| 6711 "[ ...(eval = 0) ]", | 6727 "[ ...(eval = 0) ]", | 
| 6712 "[ ...(arguments = 0) ]", | 6728 "[ ...(arguments = 0) ]", | 
| 6713 "[ ...(eval) = 0 ]", | 6729 "[ ...(eval) = 0 ]", | 
| 6714 "[ ...(arguments) = 0 ]", | 6730 "[ ...(arguments) = 0 ]", | 
| 6715 | 6731 | 
| 6716 NULL}; | 6732 NULL}; | 
| 6717 RunParserSyncTest(strict_context_data, strict_data, kError); | 6733 RunParserSyncTest(strict_context_data, strict_data, kError); | 
| 6734 | |
| 6735 // v8:5201 | |
| 6736 { | |
| 6737 // clang-format off | |
| 6738 const char* context_data[][2] = { | |
| 6739 {"'use strict'; var {", "} = {};"}, | |
| 6740 {"(() => { 'use strict'; function a({", " = false } = {}) {} })()"}, | |
| 6741 {NULL, NULL} | |
| 6742 }; | |
| 6743 | |
| 6744 const char* data[] = { | |
| 6745 "eval", | |
| 6746 "arguments", | |
| 6747 NULL | |
| 6748 }; | |
| 6749 | |
| 6750 // clang-format on | |
| 6751 RunParserSyncTest(context_data, data, kError); | |
| 6752 } | |
| 6718 } | 6753 } | 
| 6719 | 6754 | 
| 6720 | 6755 | 
| 6721 TEST(DestructuringDisallowPatternsInForVarIn) { | 6756 TEST(DestructuringDisallowPatternsInForVarIn) { | 
| 6722 const char* context_data[][2] = { | 6757 const char* context_data[][2] = { | 
| 6723 {"", ""}, {"function f() {", "}"}, {NULL, NULL}}; | 6758 {"", ""}, {"function f() {", "}"}, {NULL, NULL}}; | 
| 6724 // clang-format off | 6759 // clang-format off | 
| 6725 const char* error_data[] = { | 6760 const char* error_data[] = { | 
| 6726 "for (let x = {} in null);", | 6761 "for (let x = {} in null);", | 
| 6727 "for (let x = {} of null);", | 6762 "for (let x = {} of null);", | 
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7984 "(a,);", | 8019 "(a,);", | 
| 7985 "(a,b,c,);", | 8020 "(a,b,c,);", | 
| 7986 NULL | 8021 NULL | 
| 7987 }; | 8022 }; | 
| 7988 // clang-format on | 8023 // clang-format on | 
| 7989 | 8024 | 
| 7990 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 8025 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 
| 7991 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 8026 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 
| 7992 arraysize(always_flags)); | 8027 arraysize(always_flags)); | 
| 7993 } | 8028 } | 
| OLD | NEW |