Browse Source

Use List<SwitchSection> and List<CatchClause> instead of ArrayLists.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@722 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
2e819f05f1
  1. 24
      src/Libraries/NRefactory/Project/Src/Parser/AST/General/Statements/SwitchStatement.cs
  2. 13
      src/Libraries/NRefactory/Project/Src/Parser/AST/General/Statements/TryCatchStatement.cs
  3. 8
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
  4. 8
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
  5. 14
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  6. 14
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

24
src/Libraries/NRefactory/Project/Src/Parser/AST/General/Statements/SwitchStatement.cs

@ -7,15 +7,14 @@ @@ -7,15 +7,14 @@
using System;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.Parser.AST
{
public class SwitchStatement : Statement
{
Expression switchExpression;
// List<SwitchSection> switchSections;
ArrayList switchSections;
List<SwitchSection> switchSections;
public Expression SwitchExpression {
get {
@ -26,16 +25,16 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -26,16 +25,16 @@ namespace ICSharpCode.NRefactory.Parser.AST
}
}
public ArrayList SwitchSections {
public List<SwitchSection> SwitchSections {
get {
return switchSections;
}
set {
switchSections = value == null ? new ArrayList(1) : value;
switchSections = value ?? new List<SwitchSection>(1);
}
}
public SwitchStatement(Expression switchExpression, ArrayList switchSections)
public SwitchStatement(Expression switchExpression, List<SwitchSection> switchSections)
{
this.SwitchExpression = switchExpression;
this.SwitchSections = switchSections;
@ -44,7 +43,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -44,7 +43,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
public SwitchStatement(Expression switchExpression)
{
this.SwitchExpression = switchExpression;
this.switchSections = new ArrayList(1);
this.switchSections = new List<SwitchSection>(1);
}
public override object AcceptVisitor(IASTVisitor visitor, object data)
@ -62,24 +61,23 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -62,24 +61,23 @@ namespace ICSharpCode.NRefactory.Parser.AST
public class SwitchSection : BlockStatement
{
// List<CaseLabel> switchLabels;
ArrayList switchLabels;
List<CaseLabel> switchLabels;
public ArrayList SwitchLabels {
public List<CaseLabel> SwitchLabels {
get {
return switchLabels;
}
set {
switchLabels = value == null ? new ArrayList(1) : value;
switchLabels = value ?? new List<CaseLabel>(1);
}
}
public SwitchSection()
{
switchLabels = new ArrayList(1);
switchLabels = new List<CaseLabel>(1);
}
public SwitchSection(ArrayList switchLabels)
public SwitchSection(List<CaseLabel> switchLabels)
{
SwitchLabels = switchLabels;
}

13
src/Libraries/NRefactory/Project/Src/Parser/AST/General/Statements/TryCatchStatement.cs

@ -7,15 +7,14 @@ @@ -7,15 +7,14 @@
using System;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.Parser.AST
{
public class TryCatchStatement : Statement
{
Statement statementBlock;
// List<CatchClause> catchClauses;
ArrayList catchClauses;
List<CatchClause> catchClauses;
Statement finallyBlock;
public Statement StatementBlock {
@ -27,12 +26,12 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -27,12 +26,12 @@ namespace ICSharpCode.NRefactory.Parser.AST
}
}
public ArrayList CatchClauses {
public List<CatchClause> CatchClauses {
get {
return catchClauses;
}
set {
catchClauses = value == null ? new ArrayList(1) : value;
catchClauses = value ?? new List<CatchClause>(1);
}
}
@ -45,14 +44,14 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -45,14 +44,14 @@ namespace ICSharpCode.NRefactory.Parser.AST
}
}
public TryCatchStatement(Statement statementBlock, ArrayList catchClauses, Statement finallyBlock)
public TryCatchStatement(Statement statementBlock, List<CatchClause> catchClauses, Statement finallyBlock)
{
this.StatementBlock = statementBlock;
this.CatchClauses = catchClauses;
this.FinallyBlock = finallyBlock;
}
public TryCatchStatement(Statement statementBlock, ArrayList catchClauses) : this(statementBlock, catchClauses, null)
public TryCatchStatement(Statement statementBlock, List<CatchClause> catchClauses) : this(statementBlock, catchClauses, null)
{
}

8
src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs

@ -3907,7 +3907,7 @@ out elseStatement); @@ -3907,7 +3907,7 @@ out elseStatement);
lexer.NextToken();
#line 1867 "cs.ATG"
ArrayList switchSections = new ArrayList(); SwitchSection switchSection;
List<SwitchSection> switchSections = new List<SwitchSection>(); SwitchSection switchSection;
Expect(20);
Expr(
#line 1868 "cs.ATG"
@ -4304,7 +4304,7 @@ out Statement tryStatement) { @@ -4304,7 +4304,7 @@ out Statement tryStatement) {
#line 1969 "cs.ATG"
Statement blockStmt = null, finallyStmt = null;
ArrayList catchClauses = null;
List<CatchClause> catchClauses = null;
Expect(113);
Block(
@ -4382,10 +4382,10 @@ out expr); @@ -4382,10 +4382,10 @@ out expr);
void CatchClauses(
#line 1984 "cs.ATG"
out ArrayList catchClauses) {
out List<CatchClause> catchClauses) {
#line 1986 "cs.ATG"
catchClauses = new ArrayList();
catchClauses = new List<CatchClause>();
Expect(55);

8
src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG

@ -1864,7 +1864,7 @@ EmbeddedStatement<out Statement statement> @@ -1864,7 +1864,7 @@ EmbeddedStatement<out Statement statement>
EmbeddedStatement<out embeddedStatement>
[ "else" EmbeddedStatement<out elseStatement> ]
(. statement = elseStatement != null ? (Statement)new IfElseStatement(expr, embeddedStatement, elseStatement) : (Statement)new IfElseStatement(expr, embeddedStatement); .)
| "switch" (. ArrayList switchSections = new ArrayList(); SwitchSection switchSection; .)
| "switch" (. List<SwitchSection> switchSections = new List<SwitchSection>(); SwitchSection switchSection; .)
"(" Expr<out expr> ")"
"{" { SwitchSection<out switchSection> (. switchSections.Add(switchSection); .) }
"}" (. statement = new SwitchStatement(expr, switchSections); .)
@ -1967,7 +1967,7 @@ SwitchLabel<out CaseLabel label> @@ -1967,7 +1967,7 @@ SwitchLabel<out CaseLabel label>
TryStatement<out Statement tryStatement>
(.
Statement blockStmt = null, finallyStmt = null;
ArrayList catchClauses = null;
List<CatchClause> catchClauses = null;
.)
=
"try" Block<out blockStmt>
@ -1981,9 +1981,9 @@ TryStatement<out Statement tryStatement> @@ -1981,9 +1981,9 @@ TryStatement<out Statement tryStatement>
.)
.
CatchClauses<out ArrayList catchClauses>
CatchClauses<out List<CatchClause> catchClauses>
(.
catchClauses = new ArrayList();
catchClauses = new List<CatchClause>();
.)
=
"catch" (. string identifier;

14
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

@ -5391,13 +5391,13 @@ out expr); @@ -5391,13 +5391,13 @@ out expr);
EndOfStmt();
#line 2560 "VBNET.ATG"
ArrayList selectSections = new ArrayList();
List<SwitchSection> selectSections = new List<SwitchSection>();
Statement block = null;
while (la.kind == 57) {
#line 2564 "VBNET.ATG"
ArrayList caseClauses = null;
List<CaseLabel> caseClauses = null;
lexer.NextToken();
CaseClauses(
#line 2565 "VBNET.ATG"
@ -5630,7 +5630,7 @@ localVariableDeclaration.Variables); @@ -5630,7 +5630,7 @@ localVariableDeclaration.Variables);
out Statement tryStatement) {
#line 2817 "VBNET.ATG"
Statement blockStmt = null, finallyStmt = null;ArrayList catchClauses = null;
Statement blockStmt = null, finallyStmt = null;List<CatchClause> catchClauses = null;
Expect(175);
EndOfStmt();
@ -5760,10 +5760,10 @@ out type); @@ -5760,10 +5760,10 @@ out type);
void CaseClauses(
#line 2746 "VBNET.ATG"
out ArrayList caseClauses) {
out List<CaseLabel> caseClauses) {
#line 2748 "VBNET.ATG"
caseClauses = new ArrayList();
caseClauses = new List<CaseLabel>();
CaseLabel caseClause = null;
CaseClause(
@ -5971,10 +5971,10 @@ out sexpr); @@ -5971,10 +5971,10 @@ out sexpr);
void CatchClauses(
#line 2830 "VBNET.ATG"
out ArrayList catchClauses) {
out List<CatchClause> catchClauses) {
#line 2832 "VBNET.ATG"
catchClauses = new ArrayList();
catchClauses = new List<CatchClause>();
TypeReference type = null;
Statement blockStmt = null;
Expression expr = null;

14
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -2557,11 +2557,11 @@ EmbeddedStatement<out Statement statement> @@ -2557,11 +2557,11 @@ EmbeddedStatement<out Statement statement>
)
| /* 10.8.2 */
"Select" [ "Case" ] Expr<out expr> EndOfStmt
(.ArrayList selectSections = new ArrayList();
(.List<SwitchSection> selectSections = new List<SwitchSection>();
Statement block = null;
.)
{
(.ArrayList caseClauses = null; .)
(.List<CaseLabel> caseClauses = null; .)
"Case" CaseClauses<out caseClauses> [ IF(IsNotStatementSeparator()) ":" ] EndOfStmt
(.
SwitchSection selectSection = new SwitchSection(caseClauses);
@ -2743,9 +2743,9 @@ ResumeStatement<out ResumeStatement resumeStatement> @@ -2743,9 +2743,9 @@ ResumeStatement<out ResumeStatement resumeStatement>
.
/* 18.8.2 */
CaseClauses<out ArrayList caseClauses>
CaseClauses<out List<CaseLabel> caseClauses>
(.
caseClauses = new ArrayList();
caseClauses = new List<CaseLabel>();
CaseLabel caseClause = null;
.) =
CaseClause<out caseClause> (. caseClauses.Add(caseClause); .)
@ -2814,7 +2814,7 @@ WithStatement<out Statement withStatement> @@ -2814,7 +2814,7 @@ WithStatement<out Statement withStatement>
/* 10.10.1 */
TryStatement<out Statement tryStatement>
(.
Statement blockStmt = null, finallyStmt = null;ArrayList catchClauses = null;
Statement blockStmt = null, finallyStmt = null;List<CatchClause> catchClauses = null;
.) =
"Try" EndOfStmt
Block<out blockStmt>
@ -2827,9 +2827,9 @@ TryStatement<out Statement tryStatement> @@ -2827,9 +2827,9 @@ TryStatement<out Statement tryStatement>
.
/* 10.10.1.2 */
CatchClauses<out ArrayList catchClauses>
CatchClauses<out List<CatchClause> catchClauses>
(.
catchClauses = new ArrayList();
catchClauses = new List<CatchClause>();
TypeReference type = null;
Statement blockStmt = null;
Expression expr = null;

Loading…
Cancel
Save