From e84e7fadf30df6ae3dd0e1894e4f9bebdcd2416c Mon Sep 17 00:00:00 2001 From: Giuseppe Ottaviano Date: Wed, 9 Mar 2016 14:35:35 -0800 Subject: [PATCH] Port easy instances to folly::dynamic::array Summary:The vast majority of `folly::dynamic` array initializations are single-line and with no nested arrays, so we can fix them with a syntactic codemod. This also fixes a couple of singletons. For empty arrays: ``` codemod '((?:folly::)?)(dynamic\s+\w+\s*=\s*)({\s*})' '\1\2\1dynamic::array' ``` For non-empty ones: ``` codemod '((?:folly::)?)(dynamic\s+\w+\s*=\s*)(?:{\s*([^{}]+?)\s*})' '\1\2\1dynamic::array(\3)' ``` Reviewed By: igorsugak Differential Revision: D3030338 fb-gh-sync-id: 3e56704a6c6294d6f6270e42a1776d991a7938df shipit-source-id: 3e56704a6c6294d6f6270e42a1776d991a7938df --- folly/gen/test/BaseTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/gen/test/BaseTest.cpp b/folly/gen/test/BaseTest.cpp index f9ff355f..b8dc807a 100644 --- a/folly/gen/test/BaseTest.cpp +++ b/folly/gen/test/BaseTest.cpp @@ -998,7 +998,7 @@ TEST(Gen, CopyCount) { // test dynamics with various layers of nested arrays. TEST(Gen, Dynamic) { - dynamic array1 = {1, 2}; + dynamic array1 = dynamic::array(1, 2); EXPECT_EQ(dynamic(3), from(array1) | sum); dynamic array2 = {{1}, {1, 2}}; EXPECT_EQ(dynamic(4), from(array2) | rconcat | sum); -- 2.34.1