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:
parent
968adda264
commit
4da54f3dc8
@ -714,7 +714,7 @@ console.__showErrorLocations = console.settings["show-error-locations"];
|
|||||||
Object.defineProperty(console, "showErrorLocationsDuringConsoleEval",
|
Object.defineProperty(console, "showErrorLocationsDuringConsoleEval",
|
||||||
{
|
{
|
||||||
get: function () { return console.settings["show-error-locations-during-console-eval"] ? true : false; },
|
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
|
enumerable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -227,14 +227,16 @@ static JSBool MissionSetInstructionsInternal(OOJS_NATIVE_ARGS, BOOL isKey)
|
|||||||
NSString *text = nil;
|
NSString *text = nil;
|
||||||
NSString *missionKey = nil;
|
NSString *missionKey = nil;
|
||||||
|
|
||||||
if (argc < 1 || JSVAL_IS_VOID(OOJS_ARG(0)))
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
jsval val = JSVAL_VOID;
|
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");
|
||||||
OOJSReportBadArguments(context, @"Mission", isKey ? @"setInstructionsKey" : @"setInstructions", 1, &val, NULL, @"string or null");
|
}
|
||||||
|
else if (JSVAL_IS_VOID(OOJS_ARG(0)))
|
||||||
|
{
|
||||||
|
OOJSReportBadArguments(context, @"Mission", isKey ? @"setInstructionsKey" : @"setInstructions", 1, OOJS_ARGV, NULL, @"string or null");
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
else text = OOStringFromJSValue(context, OOJS_ARG(0));
|
||||||
text = OOStringFromJSValue(context, OOJS_ARG(0));
|
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user