Author: rolf
Date: 2007-05-30 10:26:12 -0400 (Wed, 30 May 2007)
New Revision: 78215

Modified:
   trunk/mono-basic/vbnc/vbnc/source/ChangeLog
   trunk/mono-basic/vbnc/vbnc/source/Descriptors/ParameterDescriptor.vb
   trunk/mono-basic/vbnc/vbnc/source/General/AssemblyInfo.vb
   trunk/mono-basic/vbnc/vbnc/source/General/Helper.vb
Log:
* Descriptors/ParameterDescriptor.vb: Implement RawDefaultValue.
* General/Helper.vb: Only use Missing.Value for missing optional
  default value if the default value is actually missing
  (RawDefaultValue is DBNull.Value). Remove some dead code.

Modified: trunk/mono-basic/vbnc/vbnc/source/ChangeLog
===================================================================
--- trunk/mono-basic/vbnc/vbnc/source/ChangeLog 2007-05-30 14:23:34 UTC (rev 
78214)
+++ trunk/mono-basic/vbnc/vbnc/source/ChangeLog 2007-05-30 14:26:12 UTC (rev 
78215)
@@ -1,5 +1,12 @@
 2007-05-30  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
 
+       * Descriptors/ParameterDescriptor.vb: Implement RawDefaultValue.
+       * General/Helper.vb: Only use Missing.Value for missing optional
+         default value if the default value is actually missing
+         (RawDefaultValue is DBNull.Value). Remove some dead code.
+
+2007-05-30  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
+
        * Members/ExternalSubDeclaration.vb: Make his actually work.
        * Members/VariablePropertyInitializer.vb: Parse external methods
          correctly.

Modified: trunk/mono-basic/vbnc/vbnc/source/Descriptors/ParameterDescriptor.vb
===================================================================
--- trunk/mono-basic/vbnc/vbnc/source/Descriptors/ParameterDescriptor.vb        
2007-05-30 14:23:34 UTC (rev 78214)
+++ trunk/mono-basic/vbnc/vbnc/source/Descriptors/ParameterDescriptor.vb        
2007-05-30 14:26:12 UTC (rev 78215)
@@ -255,9 +255,10 @@
 
     Public Overrides ReadOnly Property RawDefaultValue() As Object
         Get
-            Dim result As Object = MyBase.RawDefaultValue
+            Dim result As Object
+            result = DefaultValue
             DumpMethodInfo(result)
-            Helper.NotImplemented() : Return result
+            Return result
         End Get
     End Property
     Public Overrides Function ToString() As String

Modified: trunk/mono-basic/vbnc/vbnc/source/General/AssemblyInfo.vb
===================================================================
--- trunk/mono-basic/vbnc/vbnc/source/General/AssemblyInfo.vb   2007-05-30 
14:23:34 UTC (rev 78214)
+++ trunk/mono-basic/vbnc/vbnc/source/General/AssemblyInfo.vb   2007-05-30 
14:26:12 UTC (rev 78215)
@@ -49,4 +49,4 @@
 ' You can specify all the values or you can default the Build and Revision 
Numbers 
 ' by using the '*' as shown below:
 
-<Assembly: AssemblyVersion("0.0.0.5532")>
+<Assembly: AssemblyVersion("0.0.0.5533")>

Modified: trunk/mono-basic/vbnc/vbnc/source/General/Helper.vb
===================================================================
--- trunk/mono-basic/vbnc/vbnc/source/General/Helper.vb 2007-05-30 14:23:34 UTC 
(rev 78214)
+++ trunk/mono-basic/vbnc/vbnc/source/General/Helper.vb 2007-05-30 14:26:12 UTC 
(rev 78215)
@@ -3064,7 +3064,9 @@
     ''' <remarks></remarks>
     Shared Function GetOptionalValueExpression(ByVal Parent As ParsedObject, 
ByVal Parameter As ParameterInfo) As Expression
         Dim result As Expression
-        If Helper.CompareType(Parameter.ParameterType, 
Parent.Compiler.TypeCache.System_Object) Then
+        If Helper.CompareType(Parameter.ParameterType, 
Parent.Compiler.TypeCache.System_Object) AndAlso Helper.IsOnMS AndAlso 
Parameter.RawDefaultValue Is DBNull.Value Then
+            'Mono hasn't implemented ParameterInfo.RawDefaultValue yet.
+
             'If an Object parameter does not specify a default value, then the 
expression 
             'System.Reflection.Missing.Value is used. 
             result = New LoadFieldExpression(Parent, 
Parent.Compiler.TypeCache.System_Reflection_Missing__Value)
@@ -3089,237 +3091,6 @@
         Return result
     End Function
 
-    '''' <summary>
-    '''' 
-    '''' </summary>
-    '''' <param name="Parent"></param>
-    '''' <param name="Member"></param>
-    '''' <param name="InputParameters"></param>
-    '''' <param name="Arguments"></param>
-    '''' <param name="TypeArguments"></param>
-    '''' <param name="outExactArguments"></param>
-    '''' <returns></returns>
-    '''' <remarks></remarks>
-    'Shared Function IsApplicable(ByVal Parent As ParsedObject, ByVal Member 
As MemberInfo, ByVal InputParameters As ParameterInfo(), ByVal Arguments As 
ArgumentList, ByVal TypeArguments As TypeArgumentList, ByRef 
outExactArguments() As Generic.List(Of Argument)) As Boolean
-    '    Dim matchedParameters As New Generic.List(Of ParameterInfo)
-    '    Dim exactArguments() As Generic.List(Of Argument) 'This contains the 
arguments in the exact order to emit
-    '    Dim method As MethodBase = TryCast(Member, MethodBase)
-    '    Dim prop As PropertyInfo = TryCast(Member, PropertyInfo)
-
-    '    Dim isLastParamArray As Boolean
-    '    Dim paramArrayParameter As ParameterInfo = Nothing
-    '    Dim paramArrayExpression As ArrayCreationExpression = Nothing
-    '    Dim inputParametersCount As Integer = InputParameters.Length
-
-    '    ReDim exactArguments(1)
-    '    'First element contains arguments to emit invocation of 
-    '    'exact paramarray type (as if it was a normal parameter)
-    '    'SomeMethod(New PType(){p1, p2, p3})
-    '    exactArguments(0) = New Generic.List(Of 
Argument)(Helper.CreateArray(Of Argument)(Nothing, inputParametersCount))
-    '    'Second element contains arguments to emit paramarray invocation
-    '    'SomeMethod(p1, p2, p3)
-    '    exactArguments(1) = New Generic.List(Of Argument)(exactArguments(0))
-
-    '    If inputParametersCount > 0 Then
-    '        isLastParamArray = Helper.IsParamArrayParameter(Parent.Compiler, 
InputParameters(inputParametersCount - 1))
-    '        If isLastParamArray Then
-    '            paramArrayParameter = InputParameters(inputParametersCount - 
1)
-    '            Dim paramArrayArg As New PositionalArgument(Parent)
-
-    '            Helper.Assert(paramArrayExpression Is Nothing)
-    '            paramArrayExpression = New 
ArrayCreationExpression(paramArrayArg)
-    '            paramArrayExpression.Init(paramArrayParameter.ParameterType, 
New Expression() {})
-
-    '            paramArrayArg.Init(paramArrayParameter.Position, 
paramArrayExpression)
-    '            exactArguments(1)(inputParametersCount - 1) = paramArrayArg
-    '        End If
-    '    End If
-
-    '    LogResolutionMessage(Parent.Compiler, "IsApplicable: 
isLastParamArray=" & isLastParamArray.ToString)
-    '    LogResolutionMessage(Parent.Compiler, "IsApplicable: 
inputParametersCount=" & inputParametersCount.ToString)
-
-    '    '(if there are more arguments than parameters and the last parameter 
is not a 
-    '    'paramarray parameter the method should not be applicable)
-    '    If Arguments.Count > InputParameters.Length Then
-    '        If InputParameters.Length < 1 Then
-    '            LogResolutionMessage(Parent.Compiler, "N/A: 1")
-    '            Return False
-    '        End If
-    '        If isLastParamArray = False Then
-    '            LogResolutionMessage(Parent.Compiler, "N/A: 2")
-    '            Return False
-    '        End If
-    '    End If
-
-    '    'Dim numberOfParamArrayElementParameters As Integer
-    '    Dim firstNamedArgument As Integer = Arguments.Count + 1
-    '    For i As Integer = 0 To Arguments.Count - 1
-    '        'First, match each positional argument in order to the list of 
method parameters. 
-    '        'If there are more positional arguments than parameters and the 
last parameter 
-    '        'is not a paramarray, the method is not applicable. Otherwise, 
the paramarray parameter 
-    '        'is expanded with parameters of the paramarray element type to 
match the number
-    '        'of positional arguments. If a positional argument is omitted, 
the method is not applicable.
-    '        If Arguments(i).IsNamedArgument Then
-    '            firstNamedArgument = i
-    '            Exit For '(No more positional arguments)
-    '        End If
-
-    '        If inputParametersCount - 1 < i Then
-    '            '(more positional arguments than parameters)
-    '            If isLastParamArray = False Then '(last parameter is not a 
paramarray)
-    '                LogResolutionMessage(Parent.Compiler, "N/A: 3")
-    '                Return False
-    '            End If
-
-    '            'Add the additional expressions to the param array creation 
expression.
-    '            
Helper.Assert(paramArrayExpression.ArrayElementInitalizer.Initializers.Count = 
1)
-    '            For j As Integer = i To Arguments.Count - 1
-    '                'A paramarray element has to be specified.
-    '                If Arguments(j).Expression Is Nothing Then
-    '                    LogResolutionMessage(Parent.Compiler, "N/A: 4")
-    '                    Return False
-    '                End If
-    '                
paramArrayExpression.ArrayElementInitalizer.AddInitializer(Arguments(j).Expression)
-    '            Next
-    '            Exit For
-    '        Else
-    '            matchedParameters.Add(InputParameters(i))
-
-    '            'Get the default value of the parameter if the specified 
argument has no expression.
-    '            Dim arg As Argument = Nothing
-    '            If Arguments(i).Expression Is Nothing Then
-    '                If InputParameters(i).IsOptional = False Then
-    '                    Helper.Assert(False)
-    '                Else
-    '                    Dim exp As Expression
-    '                    Dim pArg As New PositionalArgument(Parent)
-    '                    exp = GetOptionalValueExpression(pArg, 
InputParameters(i))
-    '                    pArg.Init(InputParameters(i).Position, exp)
-    '                    arg = pArg
-    '                End If
-    '            Else
-    '                arg = Arguments(i)
-    '            End If
-
-    '            exactArguments(0)(i) = arg
-    '            If isLastParamArray AndAlso inputParametersCount - 1 = i Then
-    '                
Helper.Assert(paramArrayExpression.ArrayElementInitalizer.Initializers.Count = 
0)
-    '                
paramArrayExpression.ArrayElementInitalizer.AddInitializer(arg.Expression)
-    '            Else
-    '                exactArguments(1)(i) = arg
-    '            End If
-    '        End If
-    '        '??? If a positional argument is omitted, the method is not 
applicable.
-    '    Next
-
-
-    '    For i As Integer = firstNamedArgument To Arguments.Count - 1
-    '        Helper.Assert(Arguments(i).IsNamedArgument)
-
-    '        'Next, match each named argument to a parameter with the given 
name. 
-    '        'If one of the named arguments fails to match, matches a 
paramarray parameter, 
-    '        'or matches an argument already matched with another positional 
or named argument,
-    '        'the method is not applicable.
-
-    '        Dim namedArgument As NamedArgument = DirectCast(Arguments(i), 
NamedArgument)
-
-    '        Dim matched As Boolean = False
-    '        For j As Integer = 0 To inputParametersCount - 1
-    '            'Next, match each named argument to a parameter with the 
given name. 
-    '            If NameResolution.CompareName(InputParameters(i).Name, 
namedArgument.Name) Then
-    '                If matchedParameters.Contains(InputParameters(i)) Then
-    '                    'If one of the named arguments (...) matches an 
argument already matched with 
-    '                    'another positional or named argument, the method is 
not applicable
-    '                    LogResolutionMessage(Parent.Compiler, "N/A: 5")
-    '                    Return False
-    '                ElseIf Helper.IsParamArrayParameter(Parent.Compiler, 
InputParameters(i)) Then
-    '                    'If one of the named arguments (...) matches a 
paramarray parameter, 
-    '                    '(...) the method is not applicable.
-    '                    LogResolutionMessage(Parent.Compiler, "N/A: 6")
-    '                    Return False
-    '                Else
-    '                    matchedParameters.Add(InputParameters(i))
-    '                    exactArguments(0)(j) = Arguments(i)
-    '                    exactArguments(1)(j) = Arguments(i)
-    '                    matched = True
-    '                    Exit For
-    '                End If
-    '            End If
-    '        Next
-    '        'If one of the named arguments fails to match (...) the method is 
not applicable
-    '        If matched = False Then
-    '            LogResolutionMessage(Parent.Compiler, "N/A: 7")
-    '            Return False
-    '        End If
-    '    Next
-
-    '    'Next, if parameters that have not been matched are not optional, 
-    '    'the method is not applicable. If optional parameters remain, the 
default value 
-    '    'specified in the optional parameter declaration is matched to the 
parameter. 
-    '    'If an Object parameter does not specify a default value, then the 
expression 
-    '    'System.Reflection.Missing.Value is used. If an optional Integer 
parameter 
-    '    'has the 
Microsoft.VisualBasic.CompilerServices.OptionCompareAttribute attribute, 
-    '    'then the literal 1 is supplied for text comparisons and the literal 
0 otherwise.
-
-    '    For i As Integer = 0 To inputParametersCount - 1
-    '        If matchedParameters.Contains(InputParameters(i)) = False Then
-    '            'if parameters that have not been matched are not optional, 
the method is not applicable
-    '            If InputParameters(i).IsOptional = False AndAlso 
InputParameters(i) Is paramArrayParameter = False Then
-    '                LogResolutionMessage(Parent.Compiler, "N/A: 8")
-    '                Return False
-    '            End If
-
-    '            Dim exp As Expression
-    '            Dim arg As New PositionalArgument(Parent)
-    '            exp = GetOptionalValueExpression(arg, InputParameters(i))
-    '            arg.Init(InputParameters(i).Position, exp)
-    '            exactArguments(0)(i) = arg
-    '            If IsParamArrayParameter(Parent.Compiler, InputParameters(i)) 
= False Then
-    '                'he arraycreation has already been created and added to 
the exactArguments(1).
-    '                exactArguments(1)(i) = arg
-    '            End If
-    '        End If
-    '    Next
-
-    '    'Finally, if type arguments have been specified, they are matched 
against
-    '    'the type parameter list. If the two lists do not have the same 
number of elements, 
-    '    'the method is not applicable, unless the type argument list is 
empty. If the 
-    '    'type argument list is empty, type inferencing is used to try and 
infer 
-    '    'the type argument list. If type inferencing fails, the method is not 
applicable.
-    '    'Otherwise, the type arguments are filled in the place of the 
-    '    'type parameters in the signature.
-    '    Dim genericTypeArgumentCount As Integer
-    '    Dim genericTypeArguments As Type()
-    '    If method IsNot Nothing AndAlso method.IsGenericMethod Then
-    '        genericTypeArguments = method.GetGenericArguments()
-    '        genericTypeArgumentCount = genericTypeArguments.Length
-    '    ElseIf prop IsNot Nothing Then
-    '        'property cannot be generic.
-    '    End If
-
-    '    If genericTypeArgumentCount > 0 AndAlso (TypeArguments Is Nothing 
OrElse TypeArguments.List.Count = 0) Then
-    '        'If the Then type argument list is empty, type inferencing is 
used to try and infer 
-    '        'the type argument list.
-    '        Helper.NotImplementedYet("Type argument inference")
-    '    ElseIf TypeArguments IsNot Nothing AndAlso TypeArguments.List.Count > 
0 Then
-    '        'If the two lists do not have the same number of elements, the 
method is not applicable
-    '        If TypeArguments.List.Count <> genericTypeArgumentCount Then
-    '            LogResolutionMessage(Parent.Compiler, "N/A: 9")
-    '            Return False
-    '        End If
-
-    '        Helper.NotImplemented("Type argument matching")
-    '    End If
-
-    '    outExactArguments = exactArguments
-
-    '    Helper.AssertNotNothing(exactArguments(0))
-    '    Helper.AssertNotNothing(exactArguments(1))
-    '    Helper.Assert(exactArguments(0).Count = exactArguments(1).Count)
-
-    '    Return True 'Method is applicable!!
-    'End Function
-
     Shared Function ArgumentsToExpressions(ByVal Arguments As Generic.List(Of 
Argument)) As Expression()
         Dim result(Arguments.Count - 1) As Expression
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to