Author: jambunathan
Date: 2005-02-28 12:02:32 -0500 (Mon, 28 Feb 2005)
New Revision: 41288
Modified:
trunk/mcs/bmcs/ChangeLog
trunk/mcs/bmcs/ecore.cs
trunk/mcs/bmcs/expression.cs
Log:
* ecore.cs (StringToExpression):
* expression.cs (ImplicitInvocation, ImplicitNew): VB.NET specific
helper classes and methods.
Modified: trunk/mcs/bmcs/ChangeLog
===================================================================
--- trunk/mcs/bmcs/ChangeLog 2005-02-28 16:28:56 UTC (rev 41287)
+++ trunk/mcs/bmcs/ChangeLog 2005-02-28 17:02:32 UTC (rev 41288)
@@ -1,5 +1,11 @@
2005-02-28 Jambunathan K <[EMAIL PROTECTED]>
+ * ecore.cs (StringToExpression):
+ * expression.cs (ImplicitInvocation, ImplicitNew): VB.NET specific
+ helper classes and methods.
+
+2005-02-28 Jambunathan K <[EMAIL PROTECTED]>
+
* assign.cs, attribute.cs, cfold.cs, const.cs, constant.cs,
* convert.cs, ecore.cs, enum.cs, expression.cs, generic.cs,
* iterator.cs, statement.cs : Broadly, what C# spec terms as
Modified: trunk/mcs/bmcs/ecore.cs
===================================================================
--- trunk/mcs/bmcs/ecore.cs 2005-02-28 16:28:56 UTC (rev 41287)
+++ trunk/mcs/bmcs/ecore.cs 2005-02-28 17:02:32 UTC (rev 41288)
@@ -1335,6 +1335,42 @@
{
Report.Error (248, loc, "Cannot create an array with a
negative size");
}
+
+
+ /// <summary>
+ /// Converts a String to an equivalent SimpleName or a
+ /// MemberAccess expression
+ /// </summary>
+
+ public static Expression StringToExpression (string name,
Location loc)
+ {
+ int pos;
+ string left;
+ string right;
+
+ Expression expr = null;
+
+ pos = name.IndexOf('.');
+ while (pos != -1)
+ {
+ left = name.Substring (0, pos);
+ right = name.Substring (pos + 1);
+
+ if (expr == null)
+ expr = new SimpleName (left, loc);
+ else
+ expr = new MemberAccess (expr, left,
loc);
+
+ name = right;
+ pos = name.IndexOf('.');
+ }
+
+ if (expr == null)
+ return new SimpleName (name, loc);
+ else
+ return new MemberAccess (expr, name, loc);
+
+ }
//
// Converts `source' to an int, uint, long or ulong.
Modified: trunk/mcs/bmcs/expression.cs
===================================================================
--- trunk/mcs/bmcs/expression.cs 2005-02-28 16:28:56 UTC (rev 41287)
+++ trunk/mcs/bmcs/expression.cs 2005-02-28 17:02:32 UTC (rev 41288)
@@ -4273,7 +4273,7 @@
/// <summary>
/// Invocation of methods or delegates.
/// </summary>
- public class Invocation : ExpressionStatement {
+ public class Invocation : ExpressionStatement {
public readonly ArrayList Arguments;
public Expression expr;
@@ -4293,6 +4293,12 @@
// FIXME: only allow expr to be a method invocation or a
// delegate invocation (7.5.5)
//
+
+ protected Invocation ()
+ {
+ Arguments = new ArrayList ();
+ }
+
public Invocation (Expression expr, ArrayList arguments,
Location l)
{
this.expr = expr;
@@ -5619,6 +5625,34 @@
}
}
+
+ /// <summary>
+ /// ImplicitInvocation of methods or delegates. Used by the
+ /// VB.NET compiler specifically to emit calls to the
+ /// Microsoft.VisualBasic.CompilerServices helper routines
+ /// </summary>
+
+ public class ImplicitInvocation : Invocation
+ {
+ const string DEFAULT_NS_PREFIX =
"Microsoft.VisualBasic.CompilerServices";
+
+ public ImplicitInvocation (string klass, string method,
Location l, params Expression [] exprs)
+ : this (DEFAULT_NS_PREFIX, klass, method, l, exprs)
+ {
+ }
+
+ public ImplicitInvocation (string ns, string klass, string
method, Location l, params Expression [] exprs)
+ {
+ string name = ns + "." + klass + "." + method;
+ this.expr = StringToExpression (name, l);
+
+ foreach (Expression expr in exprs)
+ Arguments.Add (new Argument (expr,
Argument.AType.Expression));
+
+ loc =l;
+ }
+ }
+
public class InvocationOrCast : ExpressionStatement
{
Expression expr;
@@ -5757,7 +5791,12 @@
Expression value_target;
bool value_target_set = false;
bool is_type_parameter = false;
-
+
+ protected New ()
+ {
+ Arguments = new ArrayList ();
+ }
+
public New (Expression requested_type, ArrayList arguments,
Location l)
{
RequestedType = requested_type;
@@ -6050,6 +6089,26 @@
}
}
+ /// <summary>
+ /// Implicit Creation of types. Used by the VB.NET compiler
+ /// (in the context of Type Conversions) to emit calls to the
+ /// appropriate constructors available in the core libraries.
+ /// </summary>
+
+ public class ImplicitNew : New
+ {
+ public ImplicitNew (string ns, string name, Location l, params
Expression [] exprs)
+ {
+ name = ns + "." + name;
+ this.RequestedType= StringToExpression (name, l);
+
+ foreach (Expression expr in exprs)
+ Arguments.Add (new Argument (expr,
Argument.AType.Expression));
+
+ loc =l;
+ }
+ }
+
/// <summary>
/// 14.5.10.2: Represents an array creation expression.
/// </summary>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches