1' 2' Visual Basic.Net Compiler 3' Copyright (C) 2004 - 2010 Rolf Bjarne Kvinge, RKvinge@novell.com 4' 5' This library is free software; you can redistribute it and/or 6' modify it under the terms of the GNU Lesser General Public 7' License as published by the Free Software Foundation; either 8' version 2.1 of the License, or (at your option) any later version. 9' 10' This library is distributed in the hope that it will be useful, 11' but WITHOUT ANY WARRANTY; without even the implied warranty of 12' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13' Lesser General Public License for more details. 14' 15' You should have received a copy of the GNU Lesser General Public 16' License along with this library; if not, write to the Free Software 17' Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18' 19 20''' <summary> 21''' This exception is thrown when an unexpected condition occurs in the compiler. 22''' </summary> 23Public Class InternalException 24 Inherits vbncException 25 26 Private Shared recursive As Boolean 27 Private m_Message As String 28 29 Public Overrides ReadOnly Property Message() As String 30 Get 31 Return m_Message 32 End Get 33 End Property 34 35 Sub New() 36 m_Message = "There has been an internal error in the compiler." 37 StopOnInternalException() 38 End Sub 39 40 <Diagnostics.DebuggerHidden()> _ 41 Sub New(ByVal Location As Span) 42 MyBase.new() 43 'If Location IsNot Nothing Then 44 m_Message = "There has been an internal error in the compiler caused by the line: " & Location.AsString 45 'Else 46 'm_Message = "There has been an internal error in the compiler." 47 'End If 48 StopOnInternalException() 49 End Sub 50 51 <Diagnostics.DebuggerHidden()> _ 52 Sub New(ByVal Obj As IBaseObject) 53 MyBase.new() 54 If Obj IsNot Nothing Then 55 m_Message = "There has been an internal error in the compiler caused by the line: " & Obj.Location.AsString 56 Else 57 m_Message = "There has been an internal error in the compiler." 58 End If 59 StopOnInternalException() 60 End Sub 61 62 <Diagnostics.DebuggerHidden()> _ 63 Sub New(ByVal Obj As ExpressionClassification) 64 MyBase.new() 65 If Obj IsNot Nothing Then 66 m_Message = "There has been an internal error in the compiler caused by the line: " & Obj.Parent.Location.ToString(Obj.Parent.Compiler) 67 Else 68 m_Message = "There has been an internal error in the compiler." 69 End If 70 StopOnInternalException() 71 End Sub 72 73 <Diagnostics.DebuggerHidden()> _ 74 Sub New(ByVal InnerException As Exception) 75 MyBase.New("", InnerException) 76 m_Message = "There has been an internal error in the compiler: " & InnerException.Message 77StopOnInternalException() 78 End Sub 79 80 <Diagnostics.DebuggerHidden()> _ 81 Sub New(ByVal Obj As BaseObject, ByVal strMsg As String) 82 MyBase.new() 83 m_Message = "There has been an internal error in the compiler: '" & strMsg & "'" 84 If Obj IsNot Nothing Then 85 m_Message &= " caused by the line: " & Obj.Location.AsString 86 End If 87StopOnInternalException() 88 End Sub 89 90 <Diagnostics.DebuggerHidden()> _ 91 Sub New(ByVal strMsg As String) 92 MyBase.new() 93 m_Message = "There has been an internal error in the compiler: " & strMsg 94 StopOnInternalException() 95 End Sub 96 97 <Diagnostics.DebuggerHidden()> _ 98 Sub StopOnInternalException() 99#If DEBUG Then 100 If recursive Then Return 101 recursive = True 102 Helper.StopIfDebugging(True) 103 recursive = False 104#End If 105 End Sub 106End Class 107