ELSEIFを実装

This commit is contained in:
otya128 committed 2016-09-02 16:12:23 +09:00
1 parent 57de8e07d3
commit 7cb0b26880
5 files changed
+140 -6

No files matched your search

+8 -1
View File
@@ -247,21 +247,28 @@ class Goto : Statement
}
class If : Statement
{
import std.typecons;
Expression condition;
Statements then;
Statements else_;
this(Expression condition, Statements t, Statements e, SourceLocation loc)
Tuple!(Statements, Expression)[] elseif;
this(Expression condition, Statements t, Statements e, Tuple!(Statements, Expression)[] elif, SourceLocation loc)
{
super.location = loc;
this.type = NodeType.If;
this.condition = condition;
this.then = t;
this.else_ = e;
this.elseif = elif;
}
bool hasElse()
{
return !(else_ is null) && else_.statements.length != 0;
}
bool hasElseif()
{
return !(elseif is null) && elseif.length != 0;
}
}
class For : Statement
{