mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 05:47:34 +00:00
LibJS: Remove ErrorType::FixmeAddAnErrorStringWithMessage
This commit is contained in:
parent
1fe6a422f1
commit
c3cb44ca8a
3 changed files with 14 additions and 11 deletions
|
@ -3213,7 +3213,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
|
|||
{
|
||||
for_each_lexically_declared_name([&](FlyString const& name) {
|
||||
if (global_environment.has_var_declaration(name) || global_environment.has_lexical_declaration(name)) {
|
||||
interpreter.vm().throw_exception<SyntaxError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Lexical variable top level already declared");
|
||||
interpreter.vm().throw_exception<SyntaxError>(global_object, ErrorType::TopLevelVariableAlreadyDeclared, name);
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
||||
|
@ -3222,7 +3222,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
|
|||
return IterationDecision::Break;
|
||||
|
||||
if (restricted_global)
|
||||
interpreter.vm().throw_exception<SyntaxError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Restricted global property");
|
||||
interpreter.vm().throw_exception<SyntaxError>(global_object, ErrorType::RestrictedGlobalProperty, name);
|
||||
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
@ -3232,7 +3232,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
|
|||
|
||||
for_each_var_declared_name([&](auto const& name) {
|
||||
if (global_environment.has_lexical_declaration(name)) {
|
||||
interpreter.vm().throw_exception<SyntaxError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Var declared variable top level also lexically declared");
|
||||
interpreter.vm().throw_exception<SyntaxError>(global_object, ErrorType::TopLevelVariableAlreadyDeclared, name);
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
||||
|
@ -3255,7 +3255,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
|
|||
return IterationDecision::Break;
|
||||
|
||||
if (!function_definable) {
|
||||
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Global function not definable");
|
||||
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::CannotDeclareGlobalFunction, function.name());
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
||||
|
@ -3278,7 +3278,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
|
|||
return IterationDecision::Break;
|
||||
|
||||
if (!var_definable) {
|
||||
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Global variable not definable");
|
||||
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::CannotDeclareGlobalVariable, name);
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
||||
|
@ -3305,7 +3305,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i
|
|||
return IterationDecision::Break;
|
||||
|
||||
if (!function_definable) {
|
||||
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Global function not definable");
|
||||
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::CannotDeclareGlobalFunction, function_name);
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
||||
|
|
|
@ -547,7 +547,7 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, GlobalObject& glo
|
|||
if (global_var_environment) {
|
||||
program.for_each_var_declared_name([&](auto const& name) {
|
||||
if (global_var_environment->has_lexical_declaration(name)) {
|
||||
vm.throw_exception<SyntaxError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Var already declared lexically");
|
||||
vm.throw_exception<SyntaxError>(global_object, ErrorType::TopLevelVariableAlreadyDeclared, name);
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
|
@ -559,7 +559,7 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, GlobalObject& glo
|
|||
if (!is<ObjectEnvironment>(*this_environment)) {
|
||||
program.for_each_var_declared_name([&](auto const& name) {
|
||||
if (MUST(this_environment->has_binding(name))) {
|
||||
vm.throw_exception<SyntaxError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Var already declared lexically");
|
||||
vm.throw_exception<SyntaxError>(global_object, ErrorType::TopLevelVariableAlreadyDeclared, name);
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
// FIXME: NOTE: Annex B.3.4 defines alternate semantics for the above step.
|
||||
|
@ -586,7 +586,7 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, GlobalObject& glo
|
|||
if (vm.exception())
|
||||
return IterationDecision::Break;
|
||||
if (!function_definable) {
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Cannot define global function");
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::CannotDeclareGlobalFunction, function.name());
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, GlobalObject& glo
|
|||
if (vm.exception())
|
||||
return IterationDecision::Break;
|
||||
if (!variable_definable) {
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::FixmeAddAnErrorStringWithMessage, "Cannot define global var");
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::CannotDeclareGlobalVariable, name);
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
M(BigIntInvalidValue, "Invalid value for BigInt: {}") \
|
||||
M(BindingNotInitialized, "Binding {} is not initialized") \
|
||||
M(CallStackSizeExceeded, "Call stack size limit exceeded") \
|
||||
M(CannotDeclareGlobalFunction, "Cannot declare global function of name '{}'") \
|
||||
M(CannotDeclareGlobalVariable, "Cannot declare global variable of name '{}'") \
|
||||
M(ClassConstructorWithoutNew, "Class constructor {} must be called with 'new'") \
|
||||
M(ClassExtendsValueNotAConstructorOrNull, "Class extends value {} is not a constructor or null") \
|
||||
M(ClassExtendsValueInvalidPrototype, "Class extends value has an invalid prototype {}") \
|
||||
|
@ -171,6 +173,7 @@
|
|||
M(RegExpObjectRepeatedFlag, "Repeated RegExp flag '{}'") \
|
||||
M(RestrictedFunctionPropertiesAccess, "Restricted function properties like 'callee', 'caller' and 'arguments' may " \
|
||||
"not be accessed in strict mode") \
|
||||
M(RestrictedGlobalProperty, "Cannot declare global property '{}'") \
|
||||
M(ShadowRealmEvaluateAbruptCompletion, "The evaluated script did not complete normally") \
|
||||
M(ShadowRealmWrappedValueNonFunctionObject, "Wrapped value must be primitive or a function object, got {}") \
|
||||
M(SpeciesConstructorDidNotCreate, "Species constructor did not create {}") \
|
||||
|
@ -209,6 +212,7 @@
|
|||
M(ThisHasNotBeenInitialized, "|this| has not been initialized") \
|
||||
M(ThisIsAlreadyInitialized, "|this| is already initialized") \
|
||||
M(ToObjectNullOrUndefined, "ToObject on null or undefined") \
|
||||
M(TopLevelVariableAlreadyDeclared, "Redeclaration of top level variable '{}'") \
|
||||
M(ToPrimitiveReturnedObject, "Can't convert {} to primitive with hint \"{}\", its @@toPrimitive method returned an object") \
|
||||
M(TypedArrayContentTypeMismatch, "Can't create {} from {}") \
|
||||
M(TypedArrayInvalidBufferLength, "Invalid buffer length for {}: must be a multiple of {}, got {}") \
|
||||
|
@ -227,7 +231,6 @@
|
|||
M(BadArgCountAtLeastOne, "{}() needs at least one argument") \
|
||||
M(BadArgCountMany, "{}() needs {} arguments") \
|
||||
M(FixmeAddAnErrorString, "FIXME: Add a string for this error.") \
|
||||
M(FixmeAddAnErrorStringWithMessage, "FIXME: Add a real string for this error '{}'") \
|
||||
M(NotEnoughMemoryToAllocate, "Not enough memory to allocate {} bytes")
|
||||
|
||||
namespace JS {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue