OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 "' property is neither an array, nor does it have indexed properties."; | 134 "' property is neither an array, nor does it have indexed properties."; |
135 } | 135 } |
136 | 136 |
137 String ExceptionMessages::NotEnoughArguments(unsigned expected, | 137 String ExceptionMessages::NotEnoughArguments(unsigned expected, |
138 unsigned provided) { | 138 unsigned provided) { |
139 return String::Number(expected) + " argument" + (expected > 1 ? "s" : "") + | 139 return String::Number(expected) + " argument" + (expected > 1 ? "s" : "") + |
140 " required, but only " + String::Number(provided) + " present."; | 140 " required, but only " + String::Number(provided) + " present."; |
141 } | 141 } |
142 | 142 |
143 String ExceptionMessages::NotAFiniteNumber(double value, const char* name) { | 143 String ExceptionMessages::NotAFiniteNumber(double value, const char* name) { |
144 ASSERT(!std::isfinite(value)); | 144 DCHECK(!std::isfinite(value)); |
145 return String::Format("The %s is %s.", name, | 145 return String::Format("The %s is %s.", name, |
146 std::isinf(value) ? "infinite" : "not a number"); | 146 std::isinf(value) ? "infinite" : "not a number"); |
147 } | 147 } |
148 | 148 |
149 String ExceptionMessages::NotAFiniteNumber(const Decimal& value, | 149 String ExceptionMessages::NotAFiniteNumber(const Decimal& value, |
150 const char* name) { | 150 const char* name) { |
151 ASSERT(!value.IsFinite()); | 151 DCHECK(!value.IsFinite()); |
152 return String::Format("The %s is %s.", name, | 152 return String::Format("The %s is %s.", name, |
153 value.IsInfinity() ? "infinite" : "not a number"); | 153 value.IsInfinity() ? "infinite" : "not a number"); |
154 } | 154 } |
155 | 155 |
156 String ExceptionMessages::OrdinalNumber(int number) { | 156 String ExceptionMessages::OrdinalNumber(int number) { |
157 String suffix("th"); | 157 String suffix("th"); |
158 switch (number % 10) { | 158 switch (number % 10) { |
159 case 1: | 159 case 1: |
160 if (number % 100 != 11) | 160 if (number % 100 != 11) |
161 suffix = "st"; | 161 suffix = "st"; |
(...skipping 21 matching lines...) Expand all Loading... |
183 CORE_EXPORT String ExceptionMessages::FormatNumber<float>(float number) { | 183 CORE_EXPORT String ExceptionMessages::FormatNumber<float>(float number) { |
184 return FormatPotentiallyNonFiniteNumber(number); | 184 return FormatPotentiallyNonFiniteNumber(number); |
185 } | 185 } |
186 | 186 |
187 template <> | 187 template <> |
188 CORE_EXPORT String ExceptionMessages::FormatNumber<double>(double number) { | 188 CORE_EXPORT String ExceptionMessages::FormatNumber<double>(double number) { |
189 return FormatPotentiallyNonFiniteNumber(number); | 189 return FormatPotentiallyNonFiniteNumber(number); |
190 } | 190 } |
191 | 191 |
192 } // namespace blink | 192 } // namespace blink |
OLD | NEW |