//
#define USE_OLD
-namespace Mono.CSharp {
+namespace Mono.MonoBASIC {
using System;
using System.Collections;
using System.Reflection;
{
Error (
23, "Operator " + OperName (Oper) +
- " cannot be applied to operand of type `" +
- TypeManager.CSharpName (t) + "'");
+ " cannot be applied to operand of type '" +
+ TypeManager.MonoBASIC_Name (t) + "'");
}
/// <remarks>
// <summary>
// This routine will attempt to simplify the unary expression when the
- // argument is a constant. The result is returned in `result' and the
+ // argument is a constant. The result is returned in 'result' and the
// function returns true or false depending on whether a reduction
// was performed or not
// </summary>
if (expr_type == TypeManager.uint64_type){
//
- // FIXME: Handle exception of `long value'
+ // FIXME: Handle exception of 'long value'
// -92233720368547758087 (-2^63) to be wrote as
// decimal integer literal.
//
}
Error (187, "No such operator '" + OperName (Oper) + "' defined for type '" +
- TypeManager.CSharpName (expr_type) + "'");
+ TypeManager.MonoBASIC_Name (expr_type) + "'");
return null;
}
}
/// <summary>
- /// This will emit the child expression for `ec' avoiding the logical
+ /// This will emit the child expression for 'ec' avoiding the logical
/// not. The parent will take care of changing brfalse/brtrue
/// </summary>
public void EmitLogicalNot (EmitContext ec)
/// classes (indexers require temporary access; overloaded require method)
///
/// Maybe we should have classes PreIncrement, PostIncrement, PreDecrement,
- /// PostDecrement, that way we could save the `Mode' byte as well.
+ /// PostDecrement, that way we could save the 'Mode' byte as well.
/// </remarks>
public class UnaryMutator : ExpressionStatement {
public enum Mode : byte {
{
Error (
23, "Operator " + OperName (mode) +
- " cannot be applied to operand of type `" +
- TypeManager.CSharpName (t) + "'");
+ " cannot be applied to operand of type '" +
+ TypeManager.MonoBASIC_Name (t) + "'");
}
/// <summary>
- /// Returns whether an object of type `t' can be incremented
+ /// Returns whether an object of type 't' can be incremented
/// or decremented with add/sub (ie, basically whether we can
/// use pre-post incr-decr operations on it, but it is not a
/// System.Decimal, which we require operator overloading to catch)
}
Error (187, "No such operator '" + OperName (mode) + "' defined for type '" +
- TypeManager.CSharpName (expr_type) + "'");
+ TypeManager.MonoBASIC_Name (expr_type) + "'");
return null;
}
}
/// <summary>
- /// Base class for the `Is' and `As' classes.
+ /// Base class for the 'Is' and 'As' classes.
/// </summary>
///
/// <remarks>
- /// FIXME: Split this in two, and we get to save the `Operator' Oper
+ /// FIXME: Split this in two, and we get to save the 'Operator' Oper
/// size.
/// </remarks>
public abstract class Probe : Expression {
}
/// <summary>
- /// Implementation of the `is' operator.
+ /// Implementation of the 'is' operator.
/// </summary>
public class Is : Probe {
public Is (Expression expr, Expression probe_type, Location l)
IntConstant.EmitInt (ig, 1);
return;
case Action.LeaveOnStack:
- // the `e != null' rule.
+ // the 'e != null' rule.
return;
case Action.Probe:
ig.Emit (OpCodes.Isinst, probe_type);
if (warning_always_matches)
Warning (
183,
- "The expression is always of type `" +
- TypeManager.CSharpName (probe_type) + "'");
+ "The expression is always of type '" +
+ TypeManager.MonoBASIC_Name (probe_type) + "'");
else if (warning_never_matches){
if (!(probe_type.IsInterface || expr.Type.IsInterface))
Warning (
184,
- "The expression is never of type `" +
- TypeManager.CSharpName (probe_type) + "'");
+ "The expression is never of type '" +
+ TypeManager.MonoBASIC_Name (probe_type) + "'");
}
}
}
/// <summary>
- /// Implementation of the `as' operator.
+ /// Implementation of the 'as' operator.
/// </summary>
public class As : Probe {
public As (Expression expr, Expression probe_type, Location l)
static void Error_CannotConvertType (Type source, Type target, Location loc)
{
Report.Error (
- 39, loc, "as operator can not convert from `" +
- TypeManager.CSharpName (source) + "' to `" +
- TypeManager.CSharpName (target) + "'");
+ 39, loc, "as operator can not convert from '" +
+ TypeManager.MonoBASIC_Name (source) + "' to '" +
+ TypeManager.MonoBASIC_Name (target) + "'");
}
public override Expression DoResolve (EmitContext ec)
if (TypeManager.IsValueType (probe_type)){
Report.Error (77, loc, "The as operator should be used with a reference type only (" +
- TypeManager.CSharpName (probe_type) + " is a value type");
+ TypeManager.MonoBASIC_Name (probe_type) + " is a value type)");
return null;
}
if (expr.Type == target_type)
return expr;
- return ConvertImplicit (ec, expr, target_type, new Location (-1));
+ return ConvertImplicit (ec, expr, target_type, Location.Null);
}
public static void Error_OperatorAmbiguous (Location loc, Operator oper, Type l, Type r)
{
Report.Error (
- 34, loc, "Operator `" + OperName (oper)
- + "' is ambiguous on operands of type `"
- + TypeManager.CSharpName (l) + "' "
- + "and `" + TypeManager.CSharpName (r)
+ 34, loc, "Operator '" + OperName (oper)
+ + "' is ambiguous on operands of type '"
+ + TypeManager.MonoBASIC_Name (l) + "' "
+ + "and '" + TypeManager.MonoBASIC_Name (r)
+ "'");
}
static public void Error_OperatorCannotBeApplied (Location loc, string name, Type l, Type r)
{
Report.Error (19, loc,
- "Operator " + name + " cannot be applied to operands of type `" +
- TypeManager.CSharpName (l) + "' and `" +
- TypeManager.CSharpName (r) + "'");
+ "Operator " + name + " cannot be applied to operands of type '" +
+ TypeManager.MonoBASIC_Name (l) + "' and '" +
+ TypeManager.MonoBASIC_Name (r) + "'");
}
void Error_OperatorCannotBeApplied ()
/// context of a conditional bool expression. This function will return
/// false if it is was possible to use EmitBranchable, or true if it was.
///
- /// The expression's code is generated, and we will generate a branch to `target'
+ /// The expression's code is generated, and we will generate a branch to 'target'
/// if the resulting expression value is equal to isTrue
/// </remarks>
public bool EmitBranchable (EmitContext ec, Label target, bool onTrue)
bool is_add;
//
- // We assume that `l' is always a pointer
+ // We assume that 'l' is always a pointer
//
public PointerArithmetic (bool is_addition, Expression l, Expression r, Type t,
Location loc)
if (ConvertImplicit (ec, falseExpr, true_type, loc) != null){
Error (172,
"Can not compute type of conditional expression " +
- "as `" + TypeManager.CSharpName (trueExpr.Type) +
- "' and `" + TypeManager.CSharpName (falseExpr.Type) +
+ "as '" + TypeManager.MonoBASIC_Name (trueExpr.Type) +
+ "' and '" + TypeManager.MonoBASIC_Name (falseExpr.Type) +
"' convert implicitly to each other");
return null;
}
} else {
Error (173, "The type of the conditional expression can " +
"not be computed because there is no implicit conversion" +
- " from `" + TypeManager.CSharpName (trueExpr.Type) + "'" +
- " and `" + TypeManager.CSharpName (falseExpr.Type) + "'");
+ " from '" + TypeManager.MonoBASIC_Name (trueExpr.Type) + "'" +
+ " and '" + TypeManager.MonoBASIC_Name (falseExpr.Type) + "'");
return null;
}
}
eclass = ExprClass.Variable;
}
- // Setting `is_readonly' to false will allow you to create a writable
+ // Setting 'is_readonly' to false will allow you to create a writable
// reference to a read-only variable. This is used by foreach and using.
public LocalVariableReference (Block block, string name, Location l,
VariableInfo variable_info, bool is_readonly)
return null;
if (is_readonly){
- Error (1604, "cannot assign to `" + Name + "' because it is readonly");
+ Error (1604, "cannot assign to '" + Name + "' because it is readonly");
return null;
}
if (!ec.CurrentBranching.IsParameterAssigned (idx)) {
Report.Error (165, loc,
- "Use of unassigned local variable `" + name + "'");
+ "Use of unassigned local variable '" + name + "'");
return false;
}
if (!ec.CurrentBranching.IsParameterAssigned (idx, field_name)) {
Report.Error (170, loc,
- "Use of possibly unassigned field `" + field_name + "'");
+ "Use of possibly unassigned field '" + field_name + "'");
return false;
}
public class Invocation : ExpressionStatement {
public ArrayList Arguments;
- Expression expr;
+ public Expression expr;
MethodBase method = null;
bool is_base;
-
+ bool is_left_hand; // Needed for late bound calls
static Hashtable method_parameter_cache;
static MemberFilter CompareName;
/// <summary>
/// Returns the Parameters (a ParameterData interface) for the
- /// Method `mb'
+ /// Method 'mb'
/// </summary>
public static ParameterData GetParameterData (MethodBase mb)
{
// An implicit constant expression conversion permits the following
// conversions:
//
- // * A constant-expression of type `int' can be converted to type
+ // * A constant-expression of type 'int' can be converted to type
// sbyte, byute, short, ushort, uint, ulong provided the value of
// of the expression is withing the range of the destination type.
//
string ret_type = "";
if (mb is MethodInfo)
- ret_type = TypeManager.CSharpName (((MethodInfo) mb).ReturnType) + " ";
+ ret_type = TypeManager.MonoBASIC_Name (((MethodInfo) mb).ReturnType) + " ";
StringBuilder sb = new StringBuilder (ret_type + mb.Name);
ParameterData pd = GetParameterData (mb);
~(Parameter.Modifier.OUT | Parameter.Modifier.REF);
if (a_mod == p_mod || (a_mod == Parameter.Modifier.NONE && p_mod == Parameter.Modifier.PARAMS)) {
- if (a_mod == Parameter.Modifier.NONE)
- if (!ImplicitConversionExists (ec, a.Expr, ptype))
+ if (a_mod == Parameter.Modifier.NONE)
+ if (! (ImplicitConversionExists (ec, a.Expr, ptype) || RuntimeConversionExists (ec, a.Expr, ptype)) )
return false;
if ((a_mod & Parameter.Modifier.ISBYREF) != 0) {
return false;
}
} else
- return false;
-
+ return false;
return true;
}
Type current_type = null;
int argument_count;
ArrayList candidates = new ArrayList ();
-
+
foreach (MethodBase candidate in me.Methods){
int x;
for (int j = 0; j < argument_count; j++) {
Argument a = (Argument) Arguments [j];
Expression a_expr = a.Expr;
- Type parameter_type = pd.ParameterType (j);
-
+ Type parameter_type = pd.ParameterType(j);
+
+ if (parameter_type == null)
+ {
+ Error_WrongNumArguments(loc, (InvokingProperty == null)?((delegate_type == null)?FullMethodDesc (method):delegate_type.ToString ()):InvokingProperty, argument_count);
+ return false;
+ }
if (pd.ParameterModifier (j) == Parameter.Modifier.PARAMS &&
- chose_params_expanded)
+ chose_params_expanded)
parameter_type = TypeManager.TypeToCoreType (parameter_type.GetElementType ());
if (a.Type != parameter_type){
return true;
}
+
+ public override Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ this.is_left_hand = true;
+ return DoResolve (ec);
+ }
public override Expression DoResolve (EmitContext ec)
{
if (expr is BaseAccess)
is_base = true;
- expr = expr.Resolve (ec, ResolveFlags.VariableOrValue | ResolveFlags.MethodGroup);
+ if ((ec.ReturnType != null) && (expr.ToString() == ec.BlockName)) {
+ ec.InvokingOwnOverload = true;
+ expr = expr.Resolve (ec, ResolveFlags.MethodGroup);
+ ec.InvokingOwnOverload = false;
+ }
+ else
+ {
+ ec.InvokingOwnOverload = false;
+ expr = expr.Resolve (ec, ResolveFlags.VariableOrValue | ResolveFlags.MethodGroup);
+ }
if (expr == null)
return null;
-
+
if (expr is Invocation) {
// FIXME Calls which return an Array are not resolved (here or in the grammar)
expr = expr.Resolve(ec);
}
-
+
if (!(expr is MethodGroupExpr))
{
Type expr_type = expr.Type;
this.expr, Arguments, loc)).Resolve (ec);
}
}
- /*
- if (!(expr is MethodGroupExpr)){
- expr.Error118 (ResolveFlags.MethodGroup);
- return null;
- }
- */
//
// Next, evaluate all the expressions in the argument list
return null;
}
}
-
+
if (expr is MethodGroupExpr)
{
MethodGroupExpr mg = (MethodGroupExpr) expr;
return null;
}
- MethodInfo mi = method as MethodInfo;
- if (mi != null)
+ if ((method as MethodInfo) != null)
{
+ MethodInfo mi = method as MethodInfo;
type = TypeManager.TypeToCoreType (mi.ReturnType);
if (!mi.IsStatic && !mg.IsExplicitImpl && (mg.InstanceExpression == null))
SimpleName.Error_ObjectRefRequired (ec, loc, mi.Name);
}
+ if ((method as ConstructorInfo) != null)
+ {
+ ConstructorInfo ci = method as ConstructorInfo;
+ type = TypeManager.void_type;
+ if (!ci.IsStatic && !mg.IsExplicitImpl && (mg.InstanceExpression == null))
+ SimpleName.Error_ObjectRefRequired (ec, loc, ci.Name);
+ }
+
if (type.IsPointer)
{
if (!ec.InUnsafe)
expr_to_return = pe.DoResolve (ec);
expr_to_return.eclass = ExprClass.PropertyAccess;
}
+ else
+ {
+ throw new Exception("Error resolving Property Access expression\n" + pe.ToString());
+ }
}
- if (expr is FieldExpr || expr is LocalVariableReference) {
- // If we are here, expr must be an ArrayAccess
- // FIXME: we should check dimensions, etc.
- ArrayList idxs = new ArrayList();
- foreach (Argument a in Arguments)
+ if (expr is FieldExpr || expr is LocalVariableReference || expr is ParameterReference) {
+ if (expr.Type.IsArray) {
+ // If we are here, expr must be an ArrayAccess
+ ArrayList idxs = new ArrayList();
+ foreach (Argument a in Arguments)
+ {
+ idxs.Add (a.Expr);
+ }
+ ElementAccess ea = new ElementAccess (expr, idxs, expr.Location);
+ ArrayAccess aa = new ArrayAccess (ea, expr.Location);
+ expr_to_return = aa.DoResolve(ec);
+ expr_to_return.eclass = ExprClass.Variable;
+ }
+ else
{
- idxs.Add (a.Expr);
+ // We can't resolve now, but we
+ // have to try to access the array with a call
+ // to LateIndexGet/Set in the runtime
+ Expression lig_call_expr;
+
+ if (!is_left_hand)
+ lig_call_expr = Mono.MonoBASIC.Parser.DecomposeQI("Microsoft.VisualBasic.CompilerServices.LateBinding.LateIndexGet", Location.Null);
+ else
+ lig_call_expr = Mono.MonoBASIC.Parser.DecomposeQI("Microsoft.VisualBasic.CompilerServices.LateBinding.LateIndexSet", Location.Null);
+ Expression obj_type = Mono.MonoBASIC.Parser.DecomposeQI("System.Object", Location.Null);
+ ArrayList adims = new ArrayList();
+
+ ArrayList ainit = new ArrayList();
+ foreach (Argument a in Arguments)
+ ainit.Add ((Expression) a.Expr);
+
+ adims.Add ((Expression) new IntLiteral (Arguments.Count));
+
+ Expression oace = new ArrayCreation (obj_type, adims, "", ainit, Location.Null);
+
+ ArrayList args = new ArrayList();
+ args.Add (new Argument(expr, Argument.AType.Expression));
+ args.Add (new Argument(oace, Argument.AType.Expression));
+ args.Add (new Argument(NullLiteral.Null, Argument.AType.Expression));
+
+ Expression lig_call = new Invocation (lig_call_expr, args, Location.Null);
+ expr_to_return = lig_call.Resolve(ec);
+ expr_to_return.eclass = ExprClass.Variable;
}
- ElementAccess ea = new ElementAccess (expr, idxs, expr.Location);
- ArrayAccess aa = new ArrayAccess (ea, expr.Location);
- expr_to_return = aa.DoResolve(ec);
- expr_to_return.eclass = ExprClass.Variable;
}
return expr_to_return;
}
+ static void Error_WrongNumArguments (Location loc, String name, int arg_count)
+ {
+ Report.Error (1501, loc, "No overload for method `" + name + "' takes `" +
+ arg_count + "' arguments");
+ }
+
// <summary>
// Emits the list of arguments as an array
// </summary>
///
/// The MethodBase argument might be null if the
/// emission of the arguments is known not to contain
- /// a `params' field (for example in constructors or other routines
+ /// a 'params' field (for example in constructors or other routines
/// that keep their arguments in this structure)
/// </summary>
public static void EmitArguments (EmitContext ec, MethodBase mb, ArrayList arguments)
}
/// <remarks>
- /// is_base tells whether we want to force the use of the `call'
+ /// is_base tells whether we want to force the use of the 'call'
/// opcode instead of using callvirt. Call is required to call
/// a specific method, while callvirt will always use the most
/// recent method in the vtable.
}
//
- // This checks the `ConditionalAttribute' on the method, and the
+ // This checks the 'ConditionalAttribute' on the method, and the
// ObsoleteAttribute
//
TypeManager.MethodFlags flags = TypeManager.GetMethodFlags (method, loc);
// To enable this, look into:
// test-34 and test-89 and self bootstrapping.
//
- // For instance, we can avoid a copy by using `newobj'
+ // For instance, we can avoid a copy by using 'newobj'
// instead of Call + Push-temp on value types.
// value_target = MyEmptyExpression;
}
if (type.IsInterface || type.IsAbstract){
Error (
- 144, "It is not possible to create instances of interfaces " +
- "or abstract classes");
+ 30376, "It is not possible to create instances of Interfaces " +
+ "or classes marked as MustInherit");
return null;
}
//
// The list of Argument types.
- // This is used to construct the `newarray' or constructor signature
+ // This is used to construct the 'newarray' or constructor signature
//
ArrayList arguments;
void Error_IncorrectArrayInitializer ()
{
- Error (178, "Incorrectly structured array initializer");
+ Error (30567, "Incorrectly structured array initializer");
}
public bool CheckIndices (EmitContext ec, ArrayList probe, int idx, bool specified_dims)
{
if (specified_dims) {
- Console.WriteLine ("specified_dims");
Argument a = (Argument) arguments [idx];
if (!a.Resolve (ec, loc))
}
//
- // Converts `source' to an int, uint, long or ulong.
+ // Converts 'source' to an int, uint, long or ulong.
//
Expression ExpressionToArrayArgument (EmitContext ec, Expression source)
{
StringBuilder array_qualifier = new StringBuilder (rank);
//
- // `In the first form allocates an array instace of the type that results
+ // 'In the first form allocates an array instace of the type that results
// from deleting each of the individual expression from the expression list'
//
if (num_arguments > 0) {
//
Expression array_type_expr;
array_type_expr = new ComposedCast (requested_base_type, array_qualifier.ToString (), loc);
+ string sss = array_qualifier.ToString ();
type = ec.DeclSpace.ResolveType (array_type_expr, false, loc);
if (type == null)
}
/// <summary>
- /// Represents the `this' construct
+ /// Represents the 'this' construct
/// </summary>
public class This : Expression, IAssignMethod, IMemoryLocation, IVariable {
vi.SetAssigned (ec);
if (ec.TypeContainer is Class){
- Error (1604, "Cannot assign to `this'");
+ Error (1604, "Cannot assign to 'this'");
return null;
}
//
// consider: struct X { int val; int P { set { val = value; }}}
//
- // Yes, this looks very bad. Look at `NOTAS' for
+ // Yes, this looks very bad. Look at 'NOTAS' for
// an explanation.
// ec.ig.Emit (OpCodes.Ldarga_S, (byte) 0);
}
return null;
if (!TypeManager.IsUnmanagedType (type_queried)){
- Report.Error (208, "Cannot take the size of an unmanaged type (" + TypeManager.CSharpName (type_queried) + ")");
+ Report.Error (208, "Cannot take the size of an unmanaged type (" + TypeManager.MonoBASIC_Name (type_queried) + ")");
return null;
}
static void error176 (Location loc, string name)
{
- Report.Error (176, loc, "Static member `" +
+ Report.Error (176, loc, "Static member '" +
name + "' cannot be accessed " +
"with an instance reference, qualify with a " +
"type name instead");
{
bool left_is_type, left_is_explicit;
- // If `left' is null, then we're called from SimpleNameResolve and this is
+ // If 'left' is null, then we're called from SimpleNameResolve and this is
// a member in the currently defining class.
if (left == null) {
left_is_type = ec.IsStatic || ec.IsFieldInitializer;
left_is_explicit = false;
- // Implicitly default to `this' unless we're static.
+ // Implicitly default to 'this' unless we're static.
if (!ec.IsStatic && !ec.IsFieldInitializer && !ec.InEnumContext)
left = ec.This;
} else {
Enum en = TypeManager.LookupEnum (decl_type);
Constant c;
- if (en != null)
+ if (en != null) {
c = Constantify (o, en.UnderlyingType);
- else
+ return new EnumConstant (c, en.UnderlyingType);
+ }
+ else {
c = Constantify (o, enum_member.Type);
+ return new EnumConstant (c, enum_member.Type);
+ }
+
- return new EnumConstant (c, decl_type);
}
Expression exp = Constantify (o, t);
if (IdenticalNameAndTypeName (ec, left_original, loc))
return member_lookup;
- if (left_is_explicit) {
+ /*if (left_is_explicit) {
error176 (loc, me.Name);
return null;
- }
+ }*/
}
//
Type expr_type = expr.Type;
if ((expr is TypeExpr) && (expr_type.IsSubclassOf (TypeManager.enum_type))){
-
Enum en = TypeManager.LookupEnum (expr_type);
if (en != null) {
object value = en.LookupEnumValue (ec, Identifier, loc);
-
+ expr_type = TypeManager.int32_type;
if (value != null){
Constant c = Constantify (value, en.UnderlyingType);
- return new EnumConstant (c, expr_type);
+ return new EnumConstant (c, en.UnderlyingType);
}
}
}
if (expr_type.IsPointer){
- Error (23, "The `.' operator can not be applied to pointer operands (" +
- TypeManager.CSharpName (expr_type) + ")");
+ Error (23, "The '.' operator can not be applied to pointer operands (" +
+ TypeManager.MonoBASIC_Name (expr_type) + ")");
return null;
}
member_lookup = MemberLookup (ec, expr_type, Identifier, loc);
- if (member_lookup == null){
+ if (member_lookup == null)
+ {
// Error has already been reported.
if (errors < Report.Errors)
return null;
-
+
//
// Try looking the member up from the same type, if we find
// it, we know that the error was due to limited visibility
object lookup = TypeManager.MemberLookup (
expr_type, expr_type, AllMemberTypes, AllBindingFlags |
BindingFlags.NonPublic, Identifier);
+
if (lookup == null)
- Error (117, "`" + expr_type + "' does not contain a " +
- "definition for `" + Identifier + "'");
- else if ((expr_type != ec.ContainerType) &&
- ec.ContainerType.IsSubclassOf (expr_type)){
-
- // Although a derived class can access protected members of
- // its base class it cannot do so through an instance of the
- // base class (CS1540). If the expr_type is a parent of the
- // ec.ContainerType and the lookup succeeds with the latter one,
- // then we are in this situation.
-
- lookup = TypeManager.MemberLookup (
- ec.ContainerType, ec.ContainerType, AllMemberTypes,
- AllBindingFlags, Identifier);
-
- if (lookup != null)
- Error (1540, "Cannot access protected member `" +
+ Error (30456, "'" + expr_type + "' does not contain a definition for '" + Identifier + "'");
+ else
+ {
+ if ((expr_type != ec.ContainerType) &&
+ ec.ContainerType.IsSubclassOf (expr_type))
+ {
+
+ // Although a derived class can access protected members of
+ // its base class it cannot do so through an instance of the
+ // base class (CS1540). If the expr_type is a parent of the
+ // ec.ContainerType and the lookup succeeds with the latter one,
+ // then we are in this situation.
+
+ lookup = TypeManager.MemberLookup(
+ ec.ContainerType, ec.ContainerType, AllMemberTypes,
+ AllBindingFlags, Identifier);
+
+ if (lookup != null)
+ Error (1540, "Cannot access protected member '" +
expr_type + "." + Identifier + "' " +
- "via a qualifier of type `" +
- TypeManager.CSharpName (expr_type) + "'; the " +
- "qualifier must be of type `" +
- TypeManager.CSharpName (ec.ContainerType) + "' " +
+ "via a qualifier of type '" + TypeManager.MonoBASIC_Name (expr_type) + "'; the " +
+ "qualifier must be of type '" + TypeManager.MonoBASIC_Name (ec.ContainerType) + "' " +
"(or derived from it)");
- else
- Error (122, "`" + expr_type + "." + Identifier + "' " +
+ else
+ Error (30390, "'" + expr_type + "." + Identifier + "' " +
"is inaccessible because of its protection level");
- } else
- Error (122, "`" + expr_type + "." + Identifier + "' " +
+ } else
+ Error (30390, "'" + expr_type + "." + Identifier + "' " +
"is inaccessible because of its protection level");
-
+ }
return null;
}
}
}
+
+
/// <summary>
/// Implements checked expressions
/// </summary>
ElementAccess ea;
LocalTemporary [] cached_locations;
-
+
public ArrayAccess (ElementAccess ea_data, Location l)
{
ea = ea_data;
#endif
Type t = ea.Expr.Type;
+/*
+ if (t == typeof (System.Object))
+ {
+ // We can't resolve now, but we
+ // have to try to access the array with a call
+ // to LateIndexGet in the runtime
+
+ Expression lig_call_expr = Mono.MonoBASIC.Parser.DecomposeQI("Microsoft.VisualBasic.CompilerServices.LateBinding.LateIndexGet", Location.Null);
+ Expression obj_type = Mono.MonoBASIC.Parser.DecomposeQI("System.Object", Location.Null);
+ ArrayList adims = new ArrayList();
+
+ ArrayList ainit = new ArrayList();
+ foreach (Argument a in ea.Arguments)
+ ainit.Add ((Expression) a.Expr);
+
+ adims.Add ((Expression) new IntLiteral (ea.Arguments.Count));
+
+ Expression oace = new ArrayCreation (obj_type, adims, "", ainit, Location.Null);
+
+ ArrayList args = new ArrayList();
+ args.Add (new Argument(ea.Expr, Argument.AType.Expression));
+ args.Add (new Argument(oace, Argument.AType.Expression));
+ args.Add (new Argument(NullLiteral.Null, Argument.AType.Expression));
+
+ Expression lig_call = new Invocation (lig_call_expr, args, Location.Null);
+ lig_call = lig_call.Resolve(ec);
+ return lig_call;
+ }
+*/
if (t.GetArrayRank () != ea.Arguments.Count){
ea.Error (22,
"Incorrect number of indexes for array " +
}
/// <summary>
- /// Emits the right opcode to load an object of Type `t'
+ /// Emits the right opcode to load an object of Type 't'
/// from an array of T
/// </summary>
static public void EmitLoadOpcode (ILGenerator ig, Type type)
}
/// <summary>
- /// Emits the right opcode to store an object of Type `t'
+ /// Emits the right opcode to store an object of Type 't'
/// from an array of T.
/// </summary>
static public void EmitStoreOpcode (ILGenerator ig, Type t)
}
Report.Error (21, loc,
- "Type `" + TypeManager.CSharpName (lookup_type) +
+ "Type '" + TypeManager.MonoBASIC_Name (lookup_type) +
"' does not have any indexers defined");
return null;
}
return null;
//
- // Step 1: Query for all `Item' *properties*. Notice
+ // Step 1: Query for all 'Item' *properties*. Notice
// that the actual methods are pointed from here.
//
// This is a group of properties, piles of them.
if (get == null){
Error (154, "indexer can not be used in this context, because " +
- "it lacks a `get' accessor");
+ "it lacks a 'get' accessor");
return null;
}
}
if (set == null){
- Error (200, "indexer X.this [" + TypeManager.CSharpName (right_type) +
- "] lacks a `set' accessor");
+ Error (200, "indexer X.this [" + TypeManager.MonoBASIC_Name (right_type) +
+ "] lacks a 'set' accessor");
return null;
}
/// The base operator for method names
/// </summary>
public class BaseAccess : Expression {
- string member;
+ public string member;
public BaseAccess (string member, Location l)
{
Expression e;
if (ec.IsStatic){
- Error (1511, "Keyword base is not allowed in static method");
+ Error (1511, "Keyword MyBase is not allowed in static method");
return null;
}
-
+
+ if (member == "New")
+ member = ".ctor";
+
member_lookup = MemberLookup (ec, base_type, base_type, member,
AllMemberTypes, AllBindingFlags, loc);
+
if (member_lookup == null) {
- Error (117,
- TypeManager.CSharpName (base_type) + " does not " +
- "contain a definition for `" + member + "'");
+ Error (30456,
+ TypeManager.MonoBASIC_Name (base_type) + " does not " +
+ "contain a definition for '" + member + "'");
return null;
}
/// we only care about the side effect conversions to be performed
///
/// This is also now used as a placeholder where a no-action expression
- /// is needed (the `New' class).
+ /// is needed (the 'New' class).
/// </summary>
public class EmptyExpression : Expression {
public EmptyExpression ()
}
//
- // Implements the `stackalloc' keyword
+ // Implements the 'stackalloc' keyword
//
public class StackAlloc : Expression {
Type otype;