18 using System.Collections.Generic;
22 using ErrorManagement;
40 private List<SwitchLabel> labelSection;
45 private Block caseBlock;
56 get {
return this.caseBlock; }
64 get {
return this.labelSection; }
72 get {
return this.labelSection.Count; }
89 this.labelSection = labels;
90 this.caseBlock =
new Block(stats, location);
95 #region IsDefaultCase()
103 for (
int i = 0; i < this.labelSection.Count; i++)
105 if (this.labelSection[i].SwitchSectionType ==
SectionType.Default)
123 return v.Visit(
this, o);
Encapsulates a Case statement of our programming languages.
Encapsulates a block of statements.
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
Abstract class represents a programming language statement.
bool IsDefaultCase()
Checks if the switch section has a default case.
Block SwitchBlock
Gets the code block of Case statement.
List< SwitchLabel > LabelSection
Gets the type of the Case statement (case or default)
int LabelCount
Gets the number of labels associated to the switch section.
Location location
Location: Encapsulates in one object the line, column and filename
SectionType
Indicates if it is a case statement or a default case.
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
SwitchSection(List< SwitchLabel > labels, List< Statement > stats, Location location)
Constructor of SwitchSection