* merged attribute.cs, ecore.cs, namespace.cs and statement.cs from mcs/mcs, to resync
svn path=/trunk/mcs/; revision=5674
+2002-07-09 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * merged attribute.cs, ecore.cs, namespace.cs and statement.cs from mcs/mcs, to resync
+
2002-07-06 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
* merged attribute.cs, class.cs, codegen.cs, ecore.cs, expression.cs,
modifiers.cs, namespace.cs, report.cs, rootcontext.cs, statement.cs and typemanager.cs from mcs/mcs, to resync
}
}
+ if (entry_point == null)
+ entry_point = name;
+
MethodBuilder mb = builder.DefinePInvokeMethod (
- name, dll_name, flags | MethodAttributes.HideBySig,
+ name, dll_name, entry_point, flags | MethodAttributes.HideBySig,
CallingConventions.Standard,
ret_type,
param_types,
/// <summary>
/// Performs the explicit numeric conversions
/// </summary>
- static Expression ConvertNumericExplicit (EmitContext ec, Expression expr,
- Type target_type)
+ static Expression ConvertNumericExplicit (EmitContext ec, Expression expr, Type target_type)
{
Type expr_type = expr.Type;
public ConvCast (EmitContext ec, Expression child, Type return_type, Mode m)
: base (child, return_type)
{
- mode = m;
checked_state = ec.CheckState;
+ mode = m;
}
public override Expression DoResolve (EmitContext ec)
if (FieldInfo.IsStatic)
ig.Emit (OpCodes.Ldsflda, FieldInfo);
else {
- InstanceExpression.Emit (ec);
+ if (InstanceExpression is IMemoryLocation)
+ ((IMemoryLocation)InstanceExpression).AddressOf (ec, AddressOp.LoadStore);
+ else
+ InstanceExpression.Emit (ec);
ig.Emit (OpCodes.Ldflda, FieldInfo);
}
}
imports_namespace_directive
: IMPORTS qualified_identifier EOL
{
- current_namespace.Using ((string) $2);
+ current_namespace.Using ((string) $2, lexer.Location);
}
;
string name;
ArrayList using_clauses;
Hashtable aliases;
- bool decl_found = false;
+ public bool DeclarationFound = false;
/// <summary>
/// Constructor Takes the current namespace and the
}
}
- /// <summary>
- /// When a declaration is found in a namespace,
- /// we call this function, to emit an error if the
- /// program attempts to use a using clause afterwards
- /// </summary>
- public void DeclarationFound ()
- {
- decl_found = true;
- }
-
/// <summary>
/// Records a new namespace for resolving name references
/// </summary>
- public void Using (string ns)
+ public void Using (string ns, Location loc)
{
- if (decl_found){
- Report.Error (1529, "A using clause must precede all other namespace elements");
+ if (DeclarationFound){
+ Report.Error (1529, loc, "A using clause must precede all other namespace elements");
return;
}
}
ec.Breaks = true;
- ig.Emit (OpCodes.Br, ec.LoopEnd);
+ if (ec.InTry || ec.InCatch)
+ ig.Emit (OpCodes.Leave, ec.LoopEnd);
+ else
+ ig.Emit (OpCodes.Br, ec.LoopEnd);
return false;
}
public override bool Resolve (EmitContext ec)
{
- return Block.Resolve (ec);
+ bool previous_state = ec.CheckState;
+ bool previous_state_const = ec.ConstantCheckState;
+
+ ec.CheckState = true;
+ ec.ConstantCheckState = true;
+ bool ret = Block.Resolve (ec);
+ ec.CheckState = previous_state;
+ ec.ConstantCheckState = previous_state_const;
+
+ return ret;
}
-
+
public override bool Emit (EmitContext ec)
{
bool previous_state = ec.CheckState;