Bugfixing

git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@109 ea6a568a-9f4f-0410-981a-c910a81bb256
actorid
nkorslund 16 years ago
parent 21c2bb116e
commit e991753f1d

@ -943,6 +943,8 @@ class FunctionCallExpr : Expression
bool isVararg;
bool fResolved; // True if fname is already resolved
// Read a function parameter list (a,b,v1=c,v2=d,...). The function
// expects that you have already removed the initial left paren '('
// token.
@ -1044,6 +1046,7 @@ class FunctionCallExpr : Expression
getParamsConsole(toks, params, named);
else
getParams(toks, params, named);
fResolved = console;
}
/* Might be used for D-like implicit function calling, eg. someFunc;
@ -1068,7 +1071,9 @@ class FunctionCallExpr : Expression
void resolve(Scope sc)
{
// Resolve the function lookup first
fname.resolve(sc);
if(!fResolved)
fname.resolve(sc);
assert(fname.type !is null);
// Is the 'function' really a type name?
if(fname.type.isMeta)
@ -1154,8 +1159,15 @@ class FunctionCallExpr : Expression
// Non-vararg case. Non-vararg functions must cover at least all
// the non-optional function parameters.
// Make the coverage list of all the parameters.
int parNum = fd.params.length;
// Sanity check on the parameter number
if(params.length > parNum)
fail(format("Too many parameters to function %s(): expected %s, got %s",
name, parNum, params.length), fname.loc);
// Make the coverage list of all the parameters.
coverage = new Expression[parNum];
// Mark all the parameters which are present

@ -377,7 +377,11 @@ abstract class Scope
}
// Add an import to this scope
void registerImport(ImportHolder s) { importList ~= s; }
void registerImport(ImportHolder s)
{
//writefln("Registering import %s in scope %s", s, this);
importList ~= s;
}
// More user-friendly version for API-defined
// imports. Eg. global.registerImport(myclass) -> makes myclass

@ -749,7 +749,7 @@ class MemberExpr : Expression
fail(name.str ~ " is not a member of " ~ ownerType.toString,
loc);
else
fail("Undefined identifier "~name.str, name.loc);
fail("Unknown identifier "~name.str, name.loc);
}
}

@ -107,7 +107,7 @@ class Console
obj = Function.getIntMO();
// Next set up the function and the scope
fn.name.str = "console";
fn.name.str = "__console";
fn.owner = obj.cls;
sc = new FuncScope(obj.cls.sc, &fn);

@ -36,14 +36,14 @@ toggle()
{
if(isBattle)
{
print("Switching to normal music");
io.print("Switching to normal music");
battle.pause();
jukebox.resume();
isBattle = false;
}
else
{
print("Switching to battle music");
io.print("Switching to battle music");
jukebox.pause();
battle.resume();
isBattle = true;
@ -56,14 +56,14 @@ toggleMute()
{
jukebox.updateVolume(0);
battle.updateVolume(0);
print("Muted");
io.print("Muted");
isMuted = true;
}
else
{
updateVolume();
isMuted = false;
print("Mute off");
io.print("Mute off");
}
}

Loading…
Cancel
Save