+2012-01-27 Kentaro Hara <haraken@chromium.org>
+
+ The cpp parser of prepare-ChangeLog treats if(...) {} as a method
+ https://bugs.webkit.org/show_bug.cgi?id=77241
+
+ Reviewed by Ryosuke Niwa.
+
+ The cpp parser of prepare-ChangeLog is wrong, and an inner {} block
+ in a method in some namespace or class is treated as a method.
+ This patch fixes the bug.
+
+ class C {
+ void func()
+ {
+ if (1) { // This should not be treated as a method.
+ }
+ }
+ };
+
+ * Scripts/prepare-ChangeLog:
+ (get_function_line_ranges_for_cpp):
+ * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests-expected.txt:
+ * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/cpp_unittests.cpp:
+ (Class108):
+ (Class108::func35):
+
2012-01-27 Enrica Casucci <enrica@apple.com>
Followup to http://trac.webkit.org/changeset/106171.
if ($1 eq "{") {
$skip_til_brace_or_semicolon = 0;
- if ($namespace_start >= 0 and $namespace_start < $potential_start) {
- push @ranges, [ $namespace_start . "", $potential_start - 1, $name ];
- }
+ if (!$in_braces) {
+ if ($namespace_start >= 0 and $namespace_start < $potential_start) {
+ push @ranges, [ $namespace_start . "", $potential_start - 1, $name ];
+ }
- if ($potential_namespace) {
- push @namespaces, $potential_namespace;
- $potential_namespace = "";
- $name = $namespaces[-1];
- $namespace_start = $. + 1;
- next;
- }
+ if ($potential_namespace) {
+ push @namespaces, $potential_namespace;
+ $potential_namespace = "";
+ $name = $namespaces[-1];
+ $namespace_start = $. + 1;
+ next;
+ }
- # Promote potential name to real function name at the
- # start of the outer level set of braces (function body?).
- if (!$in_braces and $potential_start) {
- $start = $potential_start;
- $name = $potential_name;
- if (@namespaces && $name && (length($name) < 2 || substr($name,1,1) ne "[")) {
- $name = join ('::', @namespaces, $name);
+ # Promote potential name to real function name at the
+ # start of the outer level set of braces (function body?).
+ if ($potential_start) {
+ $start = $potential_start;
+ $name = $potential_name;
+ if (@namespaces && $name && (length($name) < 2 || substr($name,1,1) ne "[")) {
+ $name = join ('::', @namespaces, $name);
+ }
}
}