1
0

GAME1が動くようになった

This commit is contained in:
otya128
2015-08-20 20:11:33 +09:00
parent 886be04289
commit 8e0a4e0ae4
8 changed files with 275 additions and 30 deletions

View File

@@ -33,6 +33,7 @@ class DataTable
{
Value[] data;
int[wstring] label;
//dataIndexは関数ごとに別じゃないといけない
int dataIndex;
void addData(Value data)
{
@@ -714,6 +715,7 @@ class Compiler
{
globalLabel[label.label] = code.length;
}
s.data.addLabel(label.label);
}
break;
case NodeType.Goto:
@@ -791,6 +793,7 @@ class Compiler
case NodeType.CallFunctionStatement:
{
auto func = cast(CallFunctionStatement)i;
writeln(func.name);
auto bfun = otya.smilebasic.builtinfunctions.BuiltinFunction.builtinFunctions.get(func.name, null);
if(bfun)
{
@@ -835,6 +838,9 @@ class Compiler
case NodeType.Read:
compileRead(cast(Read)i, s);
break;
case NodeType.Restore:
genCode(new RestoreCodeS((cast(Constant)(cast(Restore)i).label).value.stringValue));
break;
case NodeType.On:
compileOn(cast(On)i, s);
break;
@@ -907,6 +913,11 @@ class Compiler
code[i] = new OnGoto(addresses);
}
}
if(c.type == CodeType.RestoreCodeS)
{
auto restore = cast(RestoreCodeS)c;
code[i] = new RestoreCode(s.data.label[restore.label], s.data);
}
}
return new VM(code, globalIndex + 1, global, functions, s.data);
}