Merge from origin/emacs-29

46b8746b38 Fix warning-suppress for list type "warning type"
910ea5f1e5 Make object init more robust (bug#69571)
This commit is contained in:
Eli Zaretskii 2024-04-06 11:13:34 -04:00
commit 5f89da1423
3 changed files with 93 additions and 3 deletions

View file

@ -225,10 +225,14 @@ SUPPRESS-LIST is the list of kinds of warnings to suppress."
(?q "quit and do nothing"))))
(?y
(customize-save-variable 'warning-suppress-log-types
(cons (list type) warning-suppress-log-types)))
(if (consp type)
(cons type warning-suppress-log-types)
(cons (list type) warning-suppress-log-types))))
(?n
(customize-save-variable 'warning-suppress-types
(cons (list type) warning-suppress-types)))
(if (consp type)
(cons type warning-suppress-types)
(cons (list type) warning-suppress-types))))
(_ (message "Exiting"))))
;;;###autoload

View file

@ -500,7 +500,15 @@ compilation and evaluation time conflicts."
;; Also, deal with the possible end of line obscured by a
;; trailing comment.
(goto-char (c-point 'iopl))
(looking-at "^[^//]*new[^//]*;$")))
(when (looking-at-p ".*new.*")
(if (re-search-forward ";" (pos-eol) t 1)
;; If the ';' is inside a comment, the statement hasn't
;; likely ended, so we should accept as object init.
;; Example:
;; var x = new // This should return true ;
;; var x = new(); // This should return false ;
(nth 4 (syntax-ppss (point)))
t))))
;; Line should not already be terminated
(save-excursion
(goto-char (c-point 'eopl))

View file

@ -16,4 +16,82 @@ public class Foo {
} // [2]
}
}
public class Foo {
void Bar () {
var x = new X();
for (;;) {
x();
} // [2]
}
}
public class Foo {
void Bar () {
var x = new X()
{
var b = 3;
};
for (;;) {
x();
} // [2]
}
}
public class Foo {
void Bar () {
var x = new X() // Hello
{
var b = 3;
};
for (;;) {
x();
} // [2]
}
}
public class Foo {
void Bar () {
var x = new X() // Hello ;
{
var b = 3;
};
for (;;) {
x();
} // [2]
}
}
public class Foo {
void Bar () {
var x = new X // Hello ;
{
var b = 3;
};
for (;;) {
x();
} // [2]
}
}
public class Foo {
void Bar () {
var x = new X(); // Hello ;
for (;;) {
x();
} // [2]
}
}
public class Foo
{
void Bar ()
{
var x = new X(); // Hello ;
for (;;)
{
x();
} // [2]
}
}
=-=-=