[mono-vb] Regression with your latest patch to mbas

Rafael Teixeira monoman at gmail.com
Thu Jul 21 17:51:16 EDT 2005

On Thu, 2005-07-21 at 07:20 -0400, Sudha  wrote:
> +    if (IsLabel() && is_first_token_in_line)
> +       return Token.LABELNAME;
> +

I don't have windows/vbc ready to check it but I do think that is
valid to have multiple labels in the same line (yes it is an allowed
bad practice), so that checking for is_first_token_in_line may not be
good enough.

Previously to update my copy with your patch applied this source
compiled and executed OK. I'll incorporate it as
MultipleLabelsInSameLine.vb in test/tests.

' Positive Test
' Test multiple labels in same line
' the production for LabelName is
' LabelName ::= Identifier | IntLiteral
' vide vbls71 section 10.1 Blocks
Module Z

        Public Sub Main(args as string())

                Dim X as boolean = false

                D: If X = true Then
                  Goto B
                End If
                Goto 20
                10:     Goto D

                A: B: C: Return
                20: X = true
                Goto 10

        End Sub

End Module


now it gives

MultipleLabelsInSameLine.vb(13,14) error BC30132: No such label 'B' in
this scope
MultipleLabelsInSameLine.vb(18,9) error BC30451: The name 'B' could
not be found in 'Z'
MultipleLabelsInSameLine.vb(18,10) error BC30451: The name 'C' could
not be found in 'Z'
Compilation failed: 3 Error(s), 0 warnings

So we need to better identify labels to cover this case. 
Also we have a testcase where a parenthesis-less invocation of a
method followed by a colon is correctly identified as such by vbc and
is thought as an label by mbas, so some resolve-time magic is also
needed to deal with language ambiguity (of what VB.NET is really rich)


Rafael "Monoman" Teixeira
I'm trying to become a "Rosh Gadol" before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!

More information about the Mono-vb mailing list