Browse Source

Added some bounds checking.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
54b6c5714f
  1. 12
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

12
ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

@ -23,7 +23,6 @@ @@ -23,7 +23,6 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Linq;
using System.Collections.Generic;
@ -920,6 +919,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -920,6 +919,7 @@ namespace ICSharpCode.NRefactory.CSharp
parent.AddChild (ConvertAttributeSection (attr), AttributedNode.AttributeRole);
}
}
public void AddAttributeSection (AstNode parent, Attributes attrs)
{
AddAttributeSection (parent, attrs, AttributedNode.AttributeRole);
@ -1002,7 +1002,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1002,7 +1002,7 @@ namespace ICSharpCode.NRefactory.CSharp
newMethod.AddChild (new CSharpTokenNode (Convert (location [0]), 1), MethodDeclaration.Roles.LPar);
AddParameter (newMethod, m.ParameterInfo);
if (location != null)
if (location != null && location.Count > 1)
newMethod.AddChild (new CSharpTokenNode (Convert (location [1]), 1), MethodDeclaration.Roles.RPar);
AddConstraints (newMethod, m.CurrentTypeParameters);
@ -1851,7 +1851,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1851,7 +1851,6 @@ namespace ICSharpCode.NRefactory.CSharp
return result;
}
public override object Visit (Checked checkedStatement)
{
var result = new CheckedStatement ();
@ -2079,7 +2078,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2079,7 +2078,7 @@ namespace ICSharpCode.NRefactory.CSharp
public override object Visit (LocalVariableReference localVariableReference)
{
return Identifier.Create (localVariableReference.Name, Convert (localVariableReference.Location));;
return Identifier.Create (localVariableReference.Name, Convert (localVariableReference.Location));
}
public override object Visit (MemberAccess memberAccess)
@ -2147,7 +2146,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2147,7 +2146,6 @@ namespace ICSharpCode.NRefactory.CSharp
return booleanExpression.Expr.Accept (this);
}
public override object Visit (Mono.CSharp.ParenthesizedExpression parenthesizedExpression)
{
var result = new ParenthesizedExpression ();
@ -2458,7 +2456,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2458,7 +2456,7 @@ namespace ICSharpCode.NRefactory.CSharp
if (p.Name != null)
parameterDeclarationExpression.AddChild (Identifier.Create (p.Name, Convert (p.Location)), ParameterDeclaration.Roles.Identifier);
if (p.HasDefaultValue) {
if (location != null)
if (location != null && location.Count > 1)
parameterDeclarationExpression.AddChild (new CSharpTokenNode (Convert (location [1]), 1), ParameterDeclaration.Roles.Assign);
parameterDeclarationExpression.AddChild ((Expression)p.DefaultValue.Accept (this), ParameterDeclaration.Roles.Expression);
}
@ -2774,7 +2772,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2774,7 +2772,6 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
public override object Visit (NewInitialize newInitializeExpression)
{
var result = new ObjectCreateExpression ();
@ -2797,7 +2794,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2797,7 +2794,6 @@ namespace ICSharpCode.NRefactory.CSharp
return result;
}
public override object Visit (ArrayCreation arrayCreationExpression)
{
var result = new ArrayCreateExpression ();

Loading…
Cancel
Save