1
0

ELSEIFを実装

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

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
{