DIRECTOR: LINGO: Reimplement scummvmAssertError

This commit is contained in:
djsrv 2021-06-19 02:21:35 -04:00 committed by D.J. Servilla
parent 35c103de10
commit 884db621b4
5 changed files with 983 additions and 936 deletions

View File

@ -44,6 +44,7 @@ struct RepeatWithToNode;
struct NextRepeatNode;
struct ExitRepeatNode;
struct ExitNode;
struct AssertErrorNode;
struct IntNode;
struct FloatNode;
struct SymbolNode;
@ -91,6 +92,7 @@ enum NodeType {
kNextRepeatNode,
kExitRepeatNode,
kExitNode,
kAssertErrorNode,
kIntNode,
kFloatNode,
kSymbolNode,
@ -132,6 +134,7 @@ public:
virtual void visitNextRepeatNode(NextRepeatNode *node) = 0;
virtual void visitExitRepeatNode(ExitRepeatNode *node) = 0;
virtual void visitExitNode(ExitNode *node) = 0;
virtual void visitAssertErrorNode(AssertErrorNode *node) = 0;
virtual void visitIntNode(IntNode *node) = 0;
virtual void visitFloatNode(FloatNode *node) = 0;
virtual void visitSymbolNode(SymbolNode *node) = 0;
@ -473,6 +476,20 @@ struct ExitNode : StmtNode {
}
};
/* AssertErrorNode */
struct AssertErrorNode : StmtNode {
Node *stmt;
AssertErrorNode(Node *stmtIn) : StmtNode(kAssertErrorNode), stmt(stmtIn) {}
virtual ~AssertErrorNode() {
delete stmt;
}
virtual void accept(NodeVisitor *visitor) {
visitor->visitAssertErrorNode(this);
}
};
/* IntNode */
struct IntNode : ExprNode {

View File

@ -723,6 +723,14 @@ void LingoCompiler::visitExitNode(ExitNode *node) {
code1(LC::c_procret);
}
/* AssertErrorNode */
void LingoCompiler::visitAssertErrorNode(AssertErrorNode *node) {
code1(LC::c_asserterror);
compile(node->stmt);
code1(LC::c_asserterrordone);
}
/* IntNode */
void LingoCompiler::visitIntNode(IntNode *node) {

View File

@ -95,6 +95,7 @@ public:
virtual void visitNextRepeatNode(NextRepeatNode *node);
virtual void visitExitRepeatNode(ExitRepeatNode *node);
virtual void visitExitNode(ExitNode *node);
virtual void visitAssertErrorNode(AssertErrorNode *node);
virtual void visitIntNode(IntNode *node);
virtual void visitFloatNode(FloatNode *node);
virtual void visitSymbolNode(SymbolNode *node);

File diff suppressed because it is too large Load Diff

View File

@ -377,6 +377,7 @@ proc: ID cmdargs '\n' { $$ = new CmdNode($ID, $cmdargs); }
| tNEXT tREPEAT '\n' { $$ = new NextRepeatNode(); }
| tEXIT tREPEAT '\n' { $$ = new ExitRepeatNode(); }
| tEXIT '\n' { $$ = new ExitNode(); }
| tASSERTERROR stmtoneliner { $$ = new AssertErrorNode($stmtoneliner); }
;
cmdargs: /* empty */ {