OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
6 | 6 |
7 var $errorToString; | 7 var $errorToString; |
8 var $getStackTraceLine; | 8 var $getStackTraceLine; |
9 var $internalErrorSymbol; | 9 var $internalErrorSymbol; |
10 var $messageGetPositionInLine; | 10 var $messageGetPositionInLine; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 if (IS_STRING(constructorName) && constructorName !== "") { | 165 if (IS_STRING(constructorName) && constructorName !== "") { |
166 return "#<" + constructorName + ">"; | 166 return "#<" + constructorName + ">"; |
167 } | 167 } |
168 } | 168 } |
169 } | 169 } |
170 return ToStringCheckErrorObject(obj); | 170 return ToStringCheckErrorObject(obj); |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 function MakeGenericError(constructor, type, arg0, arg1, arg2) { | 174 function MakeGenericError(constructor, type, arg0, arg1, arg2) { |
175 if (IS_UNDEFINED(arg0) && IS_STRING(type)) arg0 = []; | |
176 var error = new constructor(FormatMessage(type, arg0, arg1, arg2)); | 175 var error = new constructor(FormatMessage(type, arg0, arg1, arg2)); |
177 error[$internalErrorSymbol] = true; | 176 error[$internalErrorSymbol] = true; |
178 return error; | 177 return error; |
179 } | 178 } |
180 | 179 |
181 | 180 |
182 /** | 181 /** |
183 * Set up the Script function and constructor. | 182 * Set up the Script function and constructor. |
184 */ | 183 */ |
185 %FunctionSetInstanceClassName(Script, 'Script'); | 184 %FunctionSetInstanceClassName(Script, 'Script'); |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 | 1006 |
1008 $errorToString = ErrorToString; | 1007 $errorToString = ErrorToString; |
1009 $messageGetPositionInLine = GetPositionInLine; | 1008 $messageGetPositionInLine = GetPositionInLine; |
1010 $messageGetLineNumber = GetLineNumber; | 1009 $messageGetLineNumber = GetLineNumber; |
1011 $messageGetSourceLine = GetSourceLine; | 1010 $messageGetSourceLine = GetSourceLine; |
1012 | 1011 |
1013 MakeError = function(type, arg0, arg1, arg2) { | 1012 MakeError = function(type, arg0, arg1, arg2) { |
1014 return MakeGenericError(GlobalError, type, arg0, arg1, arg2); | 1013 return MakeGenericError(GlobalError, type, arg0, arg1, arg2); |
1015 } | 1014 } |
1016 | 1015 |
1017 MakeEvalError = function(type, arg0, arg1, arg2) { | |
1018 return MakeGenericError(GlobalEvalError, type, arg0, arg1, arg2); | |
1019 } | |
1020 | |
1021 MakeRangeError = function(type, arg0, arg1, arg2) { | 1016 MakeRangeError = function(type, arg0, arg1, arg2) { |
1022 return MakeGenericError(GlobalRangeError, type, arg0, arg1, arg2); | 1017 return MakeGenericError(GlobalRangeError, type, arg0, arg1, arg2); |
1023 } | 1018 } |
1024 | 1019 |
1025 MakeReferenceError = function(type, arg0, arg1, arg2) { | |
1026 return MakeGenericError(GlobalReferenceError, type, arg0, arg1, arg2); | |
1027 } | |
1028 | |
1029 MakeSyntaxError = function(type, arg0, arg1, arg2) { | 1020 MakeSyntaxError = function(type, arg0, arg1, arg2) { |
1030 return MakeGenericError(GlobalSyntaxError, type, arg0, arg1, arg2); | 1021 return MakeGenericError(GlobalSyntaxError, type, arg0, arg1, arg2); |
1031 } | 1022 } |
1032 | 1023 |
1033 MakeTypeError = function(type, arg0, arg1, arg2) { | 1024 MakeTypeError = function(type, arg0, arg1, arg2) { |
1034 return MakeGenericError(GlobalTypeError, type, arg0, arg1, arg2); | 1025 return MakeGenericError(GlobalTypeError, type, arg0, arg1, arg2); |
1035 } | 1026 } |
1036 | 1027 |
1037 MakeURIError = function() { | 1028 MakeURIError = function() { |
1038 return MakeGenericError(GlobalURIError, kURIMalformed); | 1029 return MakeGenericError(GlobalURIError, kURIMalformed); |
(...skipping 21 matching lines...) Expand all Loading... |
1060 to.Error = GlobalError; | 1051 to.Error = GlobalError; |
1061 to.EvalError = GlobalEvalError; | 1052 to.EvalError = GlobalEvalError; |
1062 to.RangeError = GlobalRangeError; | 1053 to.RangeError = GlobalRangeError; |
1063 to.ReferenceError = GlobalReferenceError; | 1054 to.ReferenceError = GlobalReferenceError; |
1064 to.SyntaxError = GlobalSyntaxError; | 1055 to.SyntaxError = GlobalSyntaxError; |
1065 to.TypeError = GlobalTypeError; | 1056 to.TypeError = GlobalTypeError; |
1066 to.URIError = GlobalURIError; | 1057 to.URIError = GlobalURIError; |
1067 to.GetStackTraceLine = GetStackTraceLine; | 1058 to.GetStackTraceLine = GetStackTraceLine; |
1068 to.NoSideEffectToString = NoSideEffectToString; | 1059 to.NoSideEffectToString = NoSideEffectToString; |
1069 to.ToDetailString = ToDetailString; | 1060 to.ToDetailString = ToDetailString; |
| 1061 to.MakeError = MakeGenericError; |
1070 }); | 1062 }); |
1071 | 1063 |
1072 }); | 1064 }); |
OLD | NEW |