Softened on mission.setInstructions[Key](): passing no argument is now a warning, while passing explicit undefined is an error.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4100 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2011-01-20 14:38:32 +00:00
parent 968adda264
commit 4da54f3dc8
2 changed files with 8 additions and 6 deletions

View File

@ -714,7 +714,7 @@ console.__showErrorLocations = console.settings["show-error-locations"];
Object.defineProperty(console, "showErrorLocationsDuringConsoleEval",
{
get: function () { return console.settings["show-error-locations-during-console-eval"] ? true : false; },
set: function (value) { console.settings.showErrorLocationsDuringConsoleEval = !!value; },
set: function (value) { console.settings["show-error-locations-during-console-eval"] = !!value; },
enumerable: true
});

View File

@ -227,14 +227,16 @@ static JSBool MissionSetInstructionsInternal(OOJS_NATIVE_ARGS, BOOL isKey)
NSString *text = nil;
NSString *missionKey = nil;
if (argc < 1 || JSVAL_IS_VOID(OOJS_ARG(0)))
if (argc == 0)
{
jsval val = JSVAL_VOID;
OOJSReportBadArguments(context, @"Mission", isKey ? @"setInstructionsKey" : @"setInstructions", 1, &val, NULL, @"string or null");
OOJSReportWarning(context, @"Usage error: mission.%@() called with no arguments. Treating as Mission.%@(null). This call may fail in a future version of Oolite.", isKey ? @"setInstructionsKey" : @"setInstructions", isKey ? @"setInstructionsKey" : @"setInstructions");
}
else if (JSVAL_IS_VOID(OOJS_ARG(0)))
{
OOJSReportBadArguments(context, @"Mission", isKey ? @"setInstructionsKey" : @"setInstructions", 1, OOJS_ARGV, NULL, @"string or null");
return NO;
}
text = OOStringFromJSValue(context, OOJS_ARG(0));
else text = OOStringFromJSValue(context, OOJS_ARG(0));
if (argc > 1)
{