diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-11-10 14:06:53 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-11-10 14:06:53 +0100 |
commit | e01f4f86cef7bed3cb99b26f9f57d86f6eb5fe1a (patch) | |
tree | 4235a8451174d4724c5b5854ae7dcba6635a21ae /src | |
parent | 450ca4335e467ac29c1560b7397225a974aee3bf (diff) | |
download | vim-git-e01f4f86cef7bed3cb99b26f9f57d86f6eb5fe1a.tar.gz |
patch 7.4.912v7.4.912
Problem: Wrong indenting for C++ constructor.
Solution: Recognize ::. (Anhong)
Diffstat (limited to 'src')
-rw-r--r-- | src/misc1.c | 13 | ||||
-rw-r--r-- | src/testdir/test3.in | 7 | ||||
-rw-r--r-- | src/testdir/test3.ok | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 29 insertions, 0 deletions
diff --git a/src/misc1.c b/src/misc1.c index fa1e049d3..5190db4a1 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -6250,6 +6250,19 @@ cin_isfuncdecl(sp, first_lnum, min_lnum) { if (cin_iscomment(s)) /* ignore comments */ s = cin_skipcomment(s); + else if (*s == ':') + { + if (*(s + 1) == ':') + s += 2; + else + /* To avoid a mistake in the following situation: + * A::A(int a, int b) + * : a(0) // <--not a function decl + * , b(0) + * {... + */ + return FALSE; + } else ++s; } diff --git a/src/testdir/test3.in b/src/testdir/test3.in index f3d4f182f..c0a68d094 100644 --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -663,6 +663,13 @@ Constructor::Constructor(int a, { } +A::A(int a, int b) +: aa(a), +bb(b), +cc(c) +{ +} + class CAbc : public BaseClass1, protected BaseClass2 diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok index 477aacc1c..c4c01a3d4 100644 --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -651,6 +651,13 @@ Constructor::Constructor(int a, { } +A::A(int a, int b) + : aa(a), + bb(b), + cc(c) +{ +} + class CAbc : public BaseClass1, protected BaseClass2 diff --git a/src/version.c b/src/version.c index 734f84f3c..a0896f8d9 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 912, +/**/ 911, /**/ 910, |