| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <type_traits> | 5 #include <type_traits> |
| 6 | 6 |
| 7 namespace not_blink { | 7 namespace not_blink { |
| 8 | 8 |
| 9 void function(int x) {} | 9 void function(int x) {} |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 const int kIsAConstToo = number; | 57 const int kIsAConstToo = number; |
| 58 // These are built from calls to functions which produces inconsistent | 58 // These are built from calls to functions which produces inconsistent |
| 59 // results so they should not be considered const to be safe. | 59 // results so they should not be considered const to be safe. |
| 60 const bool from_a_method = FunctionNotMarkedConstexpr(number); | 60 const bool from_a_method = FunctionNotMarkedConstexpr(number); |
| 61 const bool from_a_templated_method = | 61 const bool from_a_templated_method = |
| 62 TemplatedFunctionNotMarkedConstexpr(number); | 62 TemplatedFunctionNotMarkedConstexpr(number); |
| 63 // A complex statement of const things is const. | 63 // A complex statement of const things is const. |
| 64 const bool kComplexConst = number || (number + 1); | 64 const bool kComplexConst = number || (number + 1); |
| 65 // A complex statement with a non-const thing is not const. | 65 // A complex statement with a non-const thing is not const. |
| 66 const bool complex_not_const = number || (g_global_number + 1); | 66 const bool complex_not_const = number || (g_global_number + 1); |
| 67 // A const built from other consts is a const. |
| 68 const bool kConstFromAConst = kComplexConst || number; |
| 67 } | 69 } |
| 68 | 70 |
| 69 template <int number, typename... T> | 71 template <int number, typename... T> |
| 70 void F() { | 72 void F() { |
| 71 // These are const but hacker_case so we leave them alone. | 73 // These are const but hacker_case so we leave them alone. |
| 72 const int maybe_a_const = sizeof...(T); | 74 const int maybe_a_const = sizeof...(T); |
| 73 const int is_a_const = number; | 75 const int is_a_const = number; |
| 74 // These are const expressions so they get a k prefix. | 76 // These are const expressions so they get a k prefix. |
| 75 const int kMaybeAConstToo = sizeof...(T); | 77 const int kMaybeAConstToo = sizeof...(T); |
| 76 const int kIsAConstToo = number; | 78 const int kIsAConstToo = number; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // Need to rewrite |f| to |F| below (because this method name | 371 // Need to rewrite |f| to |F| below (because this method name |
| 370 // does get rewritten when processing blink::test_unnamed_arg::Class). | 372 // does get rewritten when processing blink::test_unnamed_arg::Class). |
| 371 // See also https://crbug.com/670434. | 373 // See also https://crbug.com/670434. |
| 372 output->F(123); | 374 output->F(123); |
| 373 } | 375 } |
| 374 }; | 376 }; |
| 375 | 377 |
| 376 } // namespace blink_methods_called_from_mojo_traits_are_not_rewritten | 378 } // namespace blink_methods_called_from_mojo_traits_are_not_rewritten |
| 377 | 379 |
| 378 } // namespace not_blink | 380 } // namespace not_blink |
| OLD | NEW |