Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make the error message and reported location for error BC30099 consis…

…tent with VBC.
  • Loading branch information...
commit 0089fde407ec3333b0bb2218f63fa907fea4cce0 1 parent b4c1be5
Lee Millward authored September 18, 2011
2  vbnc/vbnc/source/General/Messages.vb
@@ -674,7 +674,7 @@ Public Enum Messages
674 674
     <Message(MessageLevel.Error)> VBNC30098 = 30098
675 675
 
676 676
     ''' <summary>
677  
-    ''' VBNC = "This 'Exit Select' statement is not contained within a 'Select' statement."
  677
+    ''' VBNC = "'Exit Select' can only appear inside a 'Select' statement."
678 678
     ''' VB   = "'Exit Select' can only appear inside a 'Select' statement."
679 679
     ''' </summary>
680 680
     ''' <remarks></remarks>
4  vbnc/vbnc/source/Parser/Parser.vb
@@ -5173,17 +5173,19 @@ Public Class Parser
5173 5173
     ''' <remarks></remarks>
5174 5174
     Private Function ParseExitStatement(ByVal Parent As ParsedObject) As ExitStatement
5175 5175
         Dim m_ExitWhat As KS
  5176
+        Dim exitLocation As Span
5176 5177
 
5177 5178
         tm.AcceptIfNotInternalError(KS.Exit)
5178 5179
         If tm.CurrentToken.Equals(KS.Sub, KS.Function, KS.Property, KS.Do, KS.For, KS.Try, KS.While, KS.Select) Then
5179 5180
             m_ExitWhat = tm.CurrentToken.Keyword
  5181
+            exitLocation = tm.CurrentLocation
5180 5182
             tm.NextToken()
5181 5183
         Else
5182 5184
             Compiler.Report.ShowMessage(Messages.VBNC30240, tm.CurrentLocation)
5183 5185
             Return Nothing
5184 5186
         End If
5185 5187
 
5186  
-        Return New ExitStatement(Parent, m_ExitWhat)
  5188
+        Return New ExitStatement(Parent, m_ExitWhat, exitLocation)
5187 5189
     End Function
5188 5190
 
5189 5191
     ''' <summary>
2  vbnc/vbnc/source/Resources/Errors.resx
@@ -404,7 +404,7 @@
404 404
     <value>CHANGEME</value>
405 405
   </data>
406 406
   <data name="30099" xml:space="preserve">
407  
-    <value>This 'Exit Select' statement is not contained within a 'Select' statement.</value>
  407
+    <value>'Exit Select' can only appear inside a 'Select' statement.</value>
408 408
   </data>
409 409
   <data name="30101" xml:space="preserve">
410 410
     <value>CHANGEME</value>
2  vbnc/vbnc/source/Resources/Source.xml
@@ -474,7 +474,7 @@
474 474
 	</Message>
475 475
 	<Message id="30099" level="Error">
476 476
 		<Comment>NC</Comment>
477  
-		<VBNCValue>This 'Exit Select' statement is not contained within a 'Select' statement.</VBNCValue>
  477
+		<VBNCValue>'Exit Select' can only appear inside a 'Select' statement.</VBNCValue>
478 478
 		<VBValue>'Exit Select' can only appear inside a 'Select' statement.</VBValue>
479 479
 	</Message>
480 480
 	<Message id="30101" level="Error">
5  vbnc/vbnc/source/Statements/ExitStatement.vb
@@ -38,6 +38,11 @@ Public Class ExitStatement
38 38
         m_ExitWhat = ExitWhat
39 39
     End Sub
40 40
 
  41
+    Sub New(ByVal Parent As ParsedObject, ByVal ExitWhat As KS, Location As Span)
  42
+        MyBase.New(Parent, Location)
  43
+        m_ExitWhat = ExitWhat
  44
+    End Sub
  45
+
41 46
     Friend Overrides Function GenerateCode(ByVal Info As EmitInfo) As Boolean
42 47
         Dim result As Boolean = True
43 48
 
4  vbnc/vbnc/source/Statements/Statement.vb
@@ -36,6 +36,10 @@ Public MustInherit Class Statement
36 36
         MyBase.New(Parent)
37 37
     End Sub
38 38
 
  39
+    Sub New(ByVal Parent As ParsedObject, Location As Span)
  40
+        MyBase.New(Parent, Location)
  41
+    End Sub
  42
+
39 43
     ReadOnly Property FindParentCodeBlock() As CodeBlock
40 44
         Get
41 45
             Return MyBase.FindFirstParent(Of CodeBlock)()
11  vbnc/vbnc/tests/Errors/30099.vb
... ...
@@ -0,0 +1,11 @@
  1
+Module Main
  2
+
  3
+	Sub Foo
  4
+	
  5
+        If True Then
  6
+            Exit Select
  7
+        End If
  8
+
  9
+	End Sub
  10
+	
  11
+End Module
4  vbnc/vbnc/tests/tests.xml
@@ -24285,4 +24285,8 @@
24285 24285
 		<file>Errors\30106.vb</file>
24286 24286
 		<error line="6" number="30106" message="Number of indices exceeds the number of dimensions of the indexed array." />
24287 24287
 	</test>
  24288
+	<test id="3148" name="30099" expectedexitcode="1" mytype="empty">
  24289
+		<file>Errors\30099.vb</file>
  24290
+		<error line="6" number="30099" message="'Exit Select' can only appear inside a 'Select' statement." />
  24291
+	</test>
24288 24292
 </rt>

0 notes on commit 0089fde

Please sign in to comment.
Something went wrong with that request. Please try again.