1 | // |
---|
2 | // ErrorExpression.cs |
---|
3 | // |
---|
4 | // Author: |
---|
5 | // Mike Krüger <mkrueger@xamarin.com> |
---|
6 | // |
---|
7 | // Copyright (c) 2011 Xamarin Inc. |
---|
8 | // |
---|
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: |
---|
15 | // |
---|
16 | // The above copyright notice and this permission notice shall be included in |
---|
17 | // all copies or substantial portions of the Software. |
---|
18 | // |
---|
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 |
---|
25 | // THE SOFTWARE. |
---|
26 | using System; |
---|
27 | |
---|
28 | namespace ICSharpCode.NRefactory.CSharp |
---|
29 | { |
---|
30 | [Obsolete("This class is obsolete. Remove all referencing code.")] |
---|
31 | public class EmptyExpression : AstNode |
---|
32 | { |
---|
33 | #region implemented abstract members of AstNode |
---|
34 | |
---|
35 | public override void AcceptVisitor(IAstVisitor visitor) |
---|
36 | { |
---|
37 | throw new NotImplementedException(); |
---|
38 | } |
---|
39 | |
---|
40 | public override T AcceptVisitor<T>(IAstVisitor<T> visitor) |
---|
41 | { |
---|
42 | throw new NotImplementedException(); |
---|
43 | } |
---|
44 | |
---|
45 | public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
---|
46 | { |
---|
47 | throw new NotImplementedException(); |
---|
48 | } |
---|
49 | |
---|
50 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match) |
---|
51 | { |
---|
52 | throw new NotImplementedException(); |
---|
53 | } |
---|
54 | |
---|
55 | public override NodeType NodeType { |
---|
56 | get { |
---|
57 | throw new NotImplementedException(); |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | #endregion |
---|
62 | |
---|
63 | |
---|
64 | } |
---|
65 | |
---|
66 | public class ErrorExpression : Expression |
---|
67 | { |
---|
68 | TextLocation location; |
---|
69 | |
---|
70 | public override TextLocation StartLocation { |
---|
71 | get { |
---|
72 | return location; |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | public override TextLocation EndLocation { |
---|
77 | get { |
---|
78 | return location; |
---|
79 | } |
---|
80 | } |
---|
81 | |
---|
82 | public string Error { |
---|
83 | get; |
---|
84 | private set; |
---|
85 | } |
---|
86 | |
---|
87 | public ErrorExpression () |
---|
88 | { |
---|
89 | } |
---|
90 | |
---|
91 | public ErrorExpression (TextLocation location) |
---|
92 | { |
---|
93 | this.location = location; |
---|
94 | } |
---|
95 | |
---|
96 | public ErrorExpression (string error) |
---|
97 | { |
---|
98 | this.Error = error; |
---|
99 | } |
---|
100 | |
---|
101 | public ErrorExpression (string error, TextLocation location) |
---|
102 | { |
---|
103 | this.location = location; |
---|
104 | this.Error = error; |
---|
105 | } |
---|
106 | |
---|
107 | public override void AcceptVisitor (IAstVisitor visitor) |
---|
108 | { |
---|
109 | visitor.VisitErrorNode(this); |
---|
110 | } |
---|
111 | |
---|
112 | public override T AcceptVisitor<T> (IAstVisitor<T> visitor) |
---|
113 | { |
---|
114 | return visitor.VisitErrorNode(this); |
---|
115 | } |
---|
116 | |
---|
117 | public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data) |
---|
118 | { |
---|
119 | return visitor.VisitErrorNode(this, data); |
---|
120 | } |
---|
121 | |
---|
122 | protected internal override bool DoMatch (AstNode other, PatternMatching.Match match) |
---|
123 | { |
---|
124 | var o = other as ErrorExpression; |
---|
125 | return o != null; |
---|
126 | } |
---|
127 | } |
---|
128 | } |
---|
129 | |
---|