| 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 4810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4821 arraysize(always_flags)); | 4821 arraysize(always_flags)); |
| 4822 } | 4822 } |
| 4823 | 4823 |
| 4824 | 4824 |
| 4825 TEST(ParseRestParameters) { | 4825 TEST(ParseRestParameters) { |
| 4826 const char* context_data[][2] = {{"'use strict';(function(", | 4826 const char* context_data[][2] = {{"'use strict';(function(", |
| 4827 "){ return args;})(1, [], /regexp/, 'str'," | 4827 "){ return args;})(1, [], /regexp/, 'str'," |
| 4828 "function(){});"}, | 4828 "function(){});"}, |
| 4829 {"(function(", "){ return args;})(1, []," | 4829 {"(function(", "){ return args;})(1, []," |
| 4830 "/regexp/, 'str', function(){});"}, | 4830 "/regexp/, 'str', function(){});"}, |
| 4831 {"((", ") => args)(1, [], /regexp/, 'str'," |
| 4832 "function(){});"}, |
| 4831 {NULL, NULL}}; | 4833 {NULL, NULL}}; |
| 4832 | 4834 |
| 4833 const char* data[] = { | 4835 const char* data[] = { |
| 4834 "...args", | 4836 "...args", |
| 4835 "a, ...args", | 4837 "a, ...args", |
| 4836 "... args", | 4838 "... args", |
| 4837 "a, ... args", | 4839 "a, ... args", |
| 4838 "...\targs", | 4840 "...\targs", |
| 4839 "a, ...\targs", | 4841 "a, ...\targs", |
| 4840 "...\r\nargs", | 4842 "...\r\nargs", |
| 4841 "a, ...\r\nargs", | 4843 "a, ...\r\nargs", |
| 4842 "...\rargs", | 4844 "...\rargs", |
| 4843 "a, ...\rargs", | 4845 "a, ...\rargs", |
| 4844 "...\t\n\t\t\n args", | 4846 "...\t\n\t\t\n args", |
| 4845 "a, ... \n \n args", | 4847 "a, ... \n \n args", |
| 4846 NULL}; | 4848 NULL}; |
| 4847 static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters}; | 4849 static const ParserFlag always_flags[] = |
| 4850 {kAllowHarmonyRestParameters, kAllowHarmonyArrowFunctions}; |
| 4848 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | 4851 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
| 4849 arraysize(always_flags)); | 4852 arraysize(always_flags)); |
| 4850 } | 4853 } |
| 4851 | 4854 |
| 4852 | 4855 |
| 4853 TEST(ParseRestParametersErrors) { | 4856 TEST(ParseRestParametersErrors) { |
| 4854 const char* context_data[][2] = {{"'use strict';(function(", | 4857 const char* context_data[][2] = {{"'use strict';(function(", |
| 4855 "){ return args;}(1, [], /regexp/, 'str'," | 4858 "){ return args;}(1, [], /regexp/, 'str'," |
| 4856 "function(){});"}, | 4859 "function(){});"}, |
| 4857 {"(function(", "){ return args;}(1, []," | 4860 {"(function(", "){ return args;}(1, []," |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5575 "(a/*\n*/=> a)(1)", | 5578 "(a/*\n*/=> a)(1)", |
| 5576 "((a)\n=> a)(1)", | 5579 "((a)\n=> a)(1)", |
| 5577 "((a)/*\n*/=> a)(1)", | 5580 "((a)/*\n*/=> a)(1)", |
| 5578 "((a, b)\n=> a + b)(1, 2)", | 5581 "((a, b)\n=> a + b)(1, 2)", |
| 5579 "((a, b)/*\n*/=> a + b)(1, 2)", | 5582 "((a, b)/*\n*/=> a + b)(1, 2)", |
| 5580 NULL}; | 5583 NULL}; |
| 5581 static const ParserFlag always_flags[] = {kAllowHarmonyArrowFunctions}; | 5584 static const ParserFlag always_flags[] = {kAllowHarmonyArrowFunctions}; |
| 5582 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 5585 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
| 5583 arraysize(always_flags)); | 5586 arraysize(always_flags)); |
| 5584 } | 5587 } |
| OLD | NEW |