[Mono-vb] Mbas doesn't compile
A Rafael D Teixeira
rafael.teixeirabr@terra.com.br
Mon, 02 Feb 2004 11:54:26 -0200
On Mon, 2004-02-02 at 09:33, Jochen Wezel wrote:
> Hi Rafael!
> By the way: what about the automatic Imports? Does it work?
>
> -Jochen
Well, as I expected it doesn't work because the lookup code for
unqualified symbol, doesn't know about the Imported module:
mono -O=all ./mbas.exe --stacktrace --verbosegetoptions
/libpath:../class/lib /r:Mono.GetOptions
/r:System.Data,System.Windows.Forms --main WriteOK testmbas/WriteOK.vb
testmbas/WriteOK2.mbs
<libpath> set to [../class/lib]
<reference> set to [Mono.GetOptions]
<reference> set to [System.Data]
<reference> set to [System.Windows.Forms]
<main> set to [WriteOK]
argument [testmbas/WriteOK.vb]
argument [testmbas/WriteOK2.mbs]
testmbas/WriteOK.vb(38,18) error BC0103: The name `IsNumeric' could not
be found in `WriteOK'
at Mono.MonoBASIC.Report.Error()
at Mono.MonoBASIC.Expression.Error()
at Mono.MonoBASIC.Expression.Resolve()
at Mono.MonoBASIC.Invocation.DoResolve()
at Mono.MonoBASIC.Expression.Resolve()
at Mono.MonoBASIC.Binary.DoResolve()
at Mono.MonoBASIC.Expression.Resolve()
at Mono.MonoBASIC.Binary.DoResolve()
at Mono.MonoBASIC.Expression.Resolve()
at Mono.MonoBASIC.Binary.DoResolve()
at Mono.MonoBASIC.Expression.Resolve()
at Mono.MonoBASIC.Binary.DoResolve()
at Mono.MonoBASIC.Expression.Resolve()
at Mono.MonoBASIC.Binary.DoResolve()
at Mono.MonoBASIC.Expression.Resolve()
at Mono.MonoBASIC.Statement.ResolveBoolean()
at Mono.MonoBASIC.If.Resolve()
at Mono.MonoBASIC.Block.Resolve()
at Mono.MonoBASIC.Block.Resolve()
at Mono.MonoBASIC.Block.Resolve()
at Mono.MonoBASIC.Block.Resolve()
at Mono.MonoBASIC.Block.Resolve()
at Mono.MonoBASIC.Block.Resolve()
at Mono.MonoBASIC.Block.Resolve()
at Mono.MonoBASIC.EmitContext.EmitTopBlock()
at Mono.MonoBASIC.MethodData.Emit()
at Mono.MonoBASIC.Method.Emit()
at Mono.MonoBASIC.TypeContainer.Emit()
at Mono.MonoBASIC.RootContext.EmitCode()
at Mono.Languages.Driver.GenerateAssembly()
at Mono.Languages.Driver.CompileAll()
at Mono.Languages.Driver.MainDriver()
at Mono.Languages.Driver.Main()
...
with a modified testmbas/WriteOK.vb
=========================================
[rafael@redhat9 mbas]$ cat testmbas/WriteOK.vb
Option Explicit
Option Strict Off
Option Compare Text
Imports System, IO = System.Console
Imports Microsoft.VisualBasic.Information
Module WriteOK
Sub Main()
Dim nodim as integer ' comment out to test explicit
Dim octalLit as integer = &O177
Dim hexLit as long = &h1F34A6BFL
dim singleLit as single = -1.1F
dim doubleLit as double = 8e-3
dim decimalLit as decimal = 1.1234567890123456789012D
dim charLit as char = "?"c
dim dateLit as date = #10/23/2003#
REM Testing old-fashioned comments
Console.WriteLine("OK!") ' Simple comments
WriteOK2.[Sub]()
IO.WriteLine("OK! ""via"" aliased name") ' from alias
Console.WriteLine(Microsoft.VisualBasic.Strings.Right("123",1))
nodim = 1 ' test for explicit
Console.WriteLine("nodim {0}" + _
Constants.vbCRLF + "octalLit {1}" + _
Constants.vbCRLF + "hexLit {2}" + _
Constants.vbCRLF + "singleLit {3}" + _
Constants.vbCRLF + "doubleLit {4}" + _
Constants.vbCRLF + "decimalLit {5}" + _
Constants.vbCRLF + "charLit {6}" + _
Constants.vbCRLF + "dateLit {7}", _
nodim, octalLit, hexLit, singleLit, doubleLit,
decimalLit, charLit, dateLit)
Console.WriteLine(123.ToString("g"))
WriteOK5.ModuleSub() ' 122
' ModuleSub() ' 103
Console.WriteLine(Strings.ChrW(64))
Console.Write("Positive cases for IsNumeric: ")
if (IsNumeric(octalLit) And IsNumeric(hexLit) And
IsNumeric(singleLit) And IsNumeric(doubleLit) And IsNumeric(decimalLit)
And IsNumeric("123")) then
Console.WriteLine("OK")
else
Console.WriteLine("FAILED")
end if
Console.Write("Negative cases for IsNumeric: ")
if not (IsNumeric(nothing) Or IsNumeric(charLit) or
IsNumeric(dateLit) or IsNumeric("123 ABC")) then
Console.WriteLine("OK")
else
Console.WriteLine("FAILED")
end if
End Sub
End Module
Public Class WriteOK2
Friend Shared Sub [Sub]() ' Escaped identifier
Dim Text as string ' here 'Text' isn't a keyword
Dim sometext = "Yeah! Some Text" 'TODO: still case
sensitive on identifiers
Dim someOtherText as string = "Blah! Some Other Text"
' Const sometext = "Yeah! Some Text" ' FIXME: raises
InvalidCastException in yyParse
' Const someOtherText as string = "Blah! Some Other Text"
' FIXME: raises InvalidCastException in yyParse
Text = "This is a test!"
Console.WriteLine("Sub:OK! - """ & Text & """ " & someText & " "
& someOtherText)
#If CAUSEERRORS
Yield 1
Yield Stop
#End If
End Sub
End Class
Public Module WriteOK5
Public Sub ModuleSub()
Console.WriteLine("ModuleSub:OK!")
End Sub
End Module
=========================================
But now I know where to search...
Thanks
--
Rafael Teixeira
Brazilian Polymath
Mono Hacker since 16 Jul 2001
Mono Brasil Founding Member
English Blog: http://monoblog.blogspot.com/
Brazilian Portuguese Blog: http://monoblog.weblogger.terra.com.br/