5
// Mike Krüger <mike@icsharpcode.net>
7
// Copyright (c) 2011 Mike Krüger <mike@icsharpcode.net>
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the "Software"), to deal
11
// in the Software without restriction, including without limitation the rights
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
// copies of the Software, and to permit persons to whom the Software is
14
// furnished to do so, subject to the following conditions:
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
namespace ICSharpCode.NRefactory.TypeSystem
32
/// Enum that describes the type of an error.
42
/// Descibes an error during parsing.
47
readonly ErrorType errorType;
48
readonly string message;
49
readonly DomRegion region;
52
/// The type of the error.
54
public ErrorType ErrorType { get { return errorType; } }
57
/// The error description.
59
public string Message { get { return message; } }
62
/// The region of the error.
64
public DomRegion Region { get { return region; } }
67
/// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.Error"/> class.
69
/// <param name='errorType'>
72
/// <param name='message'>
73
/// The description of the error.
75
/// <param name='region'>
76
/// The region of the error.
78
public Error (ErrorType errorType, string message, DomRegion region)
80
this.errorType = errorType;
81
this.message = message;
86
/// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.Error"/> class.
88
/// <param name='errorType'>
91
/// <param name='message'>
92
/// The description of the error.
94
/// <param name='location'>
95
/// The location of the error.
97
public Error (ErrorType errorType, string message, TextLocation location)
99
this.errorType = errorType;
100
this.message = message;
101
this.region = new DomRegion (location, location);
105
/// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.Error"/> class.
107
/// <param name='errorType'>
110
/// <param name='message'>
111
/// The description of the error.
113
/// <param name='line'>
114
/// The line of the error.
116
/// <param name='col'>
117
/// The column of the error.
119
public Error (ErrorType errorType, string message, int line, int col) : this (errorType, message, new TextLocation (line, col))
124
/// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.Error"/> class.
126
/// <param name='errorType'>
129
/// <param name='message'>
130
/// The description of the error.
132
public Error (ErrorType errorType, string message)
134
this.errorType = errorType;
135
this.message = message;
136
this.region = DomRegion.Empty;