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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 static String invalidArity(const char* expected, unsigned provided); | 122 static String invalidArity(const char* expected, unsigned provided); |
123 | 123 |
124 // If > 0, the argument index that failed type check (1-indexed.) | 124 // If > 0, the argument index that failed type check (1-indexed.) |
125 // If == 0, a (non-argument) value (e.g., a setter) failed the same check. | 125 // If == 0, a (non-argument) value (e.g., a setter) failed the same check. |
126 static String notAnArrayTypeArgumentOrValue(int argumentIndex); | 126 static String notAnArrayTypeArgumentOrValue(int argumentIndex); |
127 static String notASequenceTypeProperty(const String& propertyName); | 127 static String notASequenceTypeProperty(const String& propertyName); |
128 static String notAFiniteNumber(double value, const char* name = "value provi
ded"); | 128 static String notAFiniteNumber(double value, const char* name = "value provi
ded"); |
129 static String notAFiniteNumber(const Decimal& value, const char* name = "val
ue provided"); | 129 static String notAFiniteNumber(const Decimal& value, const char* name = "val
ue provided"); |
130 | 130 |
131 static String notEnoughArguments(unsigned expected, unsigned providedleastNu
mMandatoryParams); | 131 static String notEnoughArguments(unsigned expected, unsigned provided); |
132 | 132 |
133 static String readOnly(const char* detail = 0); | 133 static String readOnly(const char* detail = 0); |
134 | 134 |
135 private: | 135 private: |
136 template <typename NumType> | 136 template <typename NumType> |
137 static String formatFiniteNumber(NumType number) | 137 static String formatFiniteNumber(NumType number) |
138 { | 138 { |
139 if (number > 1e20 || number < -1e20) | 139 if (number > 1e20 || number < -1e20) |
140 return String::format("%e", 1.0*number); | 140 return String::format("%e", 1.0*number); |
141 return String::number(number); | 141 return String::number(number); |
(...skipping 13 matching lines...) Expand all Loading... |
155 | 155 |
156 static String ordinalNumber(int number); | 156 static String ordinalNumber(int number); |
157 }; | 157 }; |
158 | 158 |
159 template <> String ExceptionMessages::formatNumber<float>(float number); | 159 template <> String ExceptionMessages::formatNumber<float>(float number); |
160 template <> String ExceptionMessages::formatNumber<double>(double number); | 160 template <> String ExceptionMessages::formatNumber<double>(double number); |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
163 | 163 |
164 #endif // ExceptionMessages_h | 164 #endif // ExceptionMessages_h |
OLD | NEW |