| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 namespace blink { | 5 namespace blink { |
| 6 | 6 |
| 7 // Simple global constants. | 7 // Simple global constants. |
| 8 const char kHelloWorldConstant[] = "Hello world!"; | 8 const char kHelloWorldConstant[] = "Hello world!"; |
| 9 // Make sure a one-character constant doesn't get mangled. | 9 // Make sure a one-character constant doesn't get mangled. |
| 10 const float kE = 2.718281828; | 10 const float kE = 2.718281828; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Not a constant even though it has static storage duration. | 26 // Not a constant even though it has static storage duration. |
| 27 static const char* current_event_; | 27 static const char* current_event_; |
| 28 | 28 |
| 29 static int Function(); | 29 static int Function(); |
| 30 | 30 |
| 31 static void FunctionWithConstant() { | 31 static void FunctionWithConstant() { |
| 32 const int kFunctionConstant = 4; | 32 const int kFunctionConstant = 4; |
| 33 const int kFunctionConstantFromExpression = 4 + 6; | 33 const int kFunctionConstantFromExpression = 4 + 6; |
| 34 const int kFunctionConstantFromOtherConsts = | 34 const int kFunctionConstantFromOtherConsts = |
| 35 kFunctionConstant + kFunctionConstantFromExpression; | 35 kFunctionConstant + kFunctionConstantFromExpression; |
| 36 // These don't do the right thing right now, but names like this don't | 36 // These are constants but they are hacker_case, so we just leave them as |
| 37 // exist in blink (hopefully). | 37 // is since the author explicitly did this. |
| 38 const int kShould_be_renamed_to_a_const = 9 - 2; | 38 const int should_not_be_renamed_to_a_const = 9 - 2; |
| 39 const int kShould_also_be_renamed_to_a_const = | 39 const int should_not_also_be_renamed_to_a_const = |
| 40 kFunctionConstant + kFunctionConstantFromOtherConsts; | 40 kFunctionConstant + kFunctionConstantFromOtherConsts; |
| 41 const int not_compile_time_const = kFunctionConstant + Function(); | 41 const int not_compile_time_const = kFunctionConstant + Function(); |
| 42 } | 42 } |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // |constParam| should not be renamed to |kConstParam|. | 45 // |constParam| should not be renamed to |kConstParam|. |
| 46 void F(const bool const_param = true) { | 46 void F(const bool const_param = true) { |
| 47 // Constant in function body. | 47 // Constant in function body. |
| 48 static const char kStaticString[] = "abc"; | 48 static const char kStaticString[] = "abc"; |
| 49 // Constant-style naming, since it's initialized with a literal. | 49 // Constant-style naming, since it's initialized with a literal. |
| 50 const char* const kNonStaticStringConstant = "def"; | 50 const char* const kNonStaticStringConstant = "def"; |
| 51 // Not constant-style naming, since it's not initialized with a literal. | 51 // Not constant-style naming, since it's not initialized with a literal. |
| 52 const char* const non_static_string_unconstant = kNonStaticStringConstant; | 52 const char* const non_static_string_unconstant = kNonStaticStringConstant; |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace blink | 55 } // namespace blink |
| OLD | NEW |