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

K SatyaSudha ksathyasudha at novell.com
Thu Jul 21 23:54:57 EDT 2005


Hello Rafael,

I had checked this before commiting the patch. vbc/VS doesnt allow you to specify more than one label in a given line. I mean only the first <identifier_or_literal> followed by colon is treated as a label. The testcase (that you gave below) did not compile with vbc (7.1 as well as 8.0). It gives the following error :

Y:\mono\20050125\mcs\mbas\Test\conversionTests\test1.vb(14) : error BC30132: Label 'B' is not defined.

                  Goto B
                       ~
Y:\mono\20050125\mcs\mbas\Test\conversionTests\test1.vb(19) : error BC30451: Name 'B' is not declared.

                A: B: C: Return
                   ~
Y:\mono\20050125\mcs\mbas\Test\conversionTests\test1.vb(19) : error BC30451: Name 'C' is not declared.

                A: B: C: Return

With VisualStudio, it automatically changes the statement : 'A: B: C: Return" *-> "A:      B() : C() : Return"

Also, if we have a method called 'F' and have a statement like 'F:F', vbc treats the first 'F' as a label and the second 'F' as invocation without parenthesis.

However, there seems to be a problem with the patch. It doesnt handle cases like 'A:b:c:', statements ending with a ":". I'll try to fix this soon.

Can you point me to the regression you found? Is it BlockStatementA.vb ?

Thanks,
Sudha.

>>> Rafael Teixeira <monoman at gmail.com> 07/22/05 3:21 AM >>>
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)

Suggestions?

-- 
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!
_______________________________________________
Mono-vb mailing list
Mono-vb at lists.ximian.com 
http://lists.ximian.com/mailman/listinfo/mono-vb



More information about the Mono-vb mailing list