// (C) 2001, 2002, 2003 Ximian, Inc.
// (C) 2004 Novell, Inc.
//
-#define PRODUCTION
+
+#if !DEBUG
+ #define PRODUCTION
+#endif
+
using System;
using System.IO;
using System.Collections;
//
if (SymbolWriter == null) {
Report.Warning (
- -18, "Could not find the symbol writer assembly (Mono.CompilerServices.SymbolWriter.dll). This is normally an installation problem. Please make sure to compile and install the mcs/class/Mono.CompilerServices.SymbolWriter directory.");
+ -18, 1, "Could not find the symbol writer assembly (Mono.CompilerServices.SymbolWriter.dll). This is normally an installation problem. Please make sure to compile and install the mcs/class/Mono.CompilerServices.SymbolWriter directory.");
return;
}
}
if (an.KeyPair != null) {
// If we are going to strong name our assembly make
// sure all its refs are strong named
- foreach (Assembly a in TypeManager.GetAssemblies ()) {
+ foreach (Assembly a in RootNamespace.Global.Assemblies) {
AssemblyName ref_name = a.GetName ();
byte [] b = ref_name.GetPublicKeyToken ();
if (b == null || b.Length == 0) {
- Report.Warning (1577, "Assembly generation failed " +
+ Report.Error (1577, "Assembly generation failed " +
"-- Referenced assembly '" +
ref_name.Name +
"' does not have a strong name.");
/// </summary>
public bool DoFlowAnalysis;
+ /// <summary>
+ /// Whether we're control flow analysis disabled on struct
+ /// </summary>
+ public bool OmitStructFlowAnalysis;
+
/// <summary>
/// Keeps track of the Type to LocalBuilder temporary storage created
/// to store structures (used to compute the address of the structure
public void CaptureThis ()
{
- capture_context.CaptureThis ();
+ capture_context.CaptureThis (CurrentAnonymousMethod);
}
return false;
}
- public void EmitMeta (ToplevelBlock b, InternalParameters ip)
+ public void EmitMeta (ToplevelBlock b)
{
if (capture_context != null)
capture_context.EmitAnonymousHelperClasses (this);
// currently can not cope with ig == null during resolve (which must
// be fixed for switch statements to work on anonymous methods).
//
- public void EmitTopBlock (IMethodData md, ToplevelBlock block, InternalParameters ip)
+ public void EmitTopBlock (IMethodData md, ToplevelBlock block)
{
if (block == null)
return;
bool unreachable;
- if (ResolveTopBlock (null, block, ip, md, out unreachable)){
- EmitMeta (block, ip);
+ if (ResolveTopBlock (null, block, md.ParameterInfo, md, out unreachable)){
+ EmitMeta (block);
current_phase = Phase.Emitting;
EmitResolvedTopBlock (block, unreachable);
bool resolved;
public bool ResolveTopBlock (EmitContext anonymous_method_host, ToplevelBlock block,
- InternalParameters ip, IMethodData md, out bool unreachable)
+ Parameters ip, IMethodData md, out bool unreachable)
{
current_phase = Phase.Resolving;
capture_context = block.CaptureContext;
- if (!Location.IsNull (loc))
+ if (!loc.IsNull)
CurrentFile = loc.File;
#if PRODUCTION
/// </summary>
public void Mark (Location loc, bool check_file)
{
- if ((CodeGen.SymbolWriter == null) || Location.IsNull (loc))
+ if ((CodeGen.SymbolWriter == null) || loc.IsNull)
return;
if (check_file && (CurrentFile != loc.File))
return;
- CodeGen.SymbolWriter.MarkSequencePoint (ig, loc.Row, 0);
+ CodeGen.SymbolWriter.MarkSequencePoint (ig, loc.Row, loc.Column);
}
public void DefineLocalVariable (string name, LocalBuilder builder)
}
- public abstract class CommonAssemblyModulClass: Attributable {
+ public abstract class CommonAssemblyModulClass : Attributable {
protected CommonAssemblyModulClass ():
base (null)
{
}
}
- public class AssemblyClass: CommonAssemblyModulClass {
+ public class AssemblyClass : CommonAssemblyModulClass {
// TODO: make it private and move all builder based methods here
public AssemblyBuilder Builder;
bool is_cls_compliant;
+ bool wrap_non_exception_throws;
+
public Attribute ClsCompliantAttribute;
ListDictionary declarative_security;
public AssemblyClass (): base ()
{
- is_cls_compliant = false;
+ wrap_non_exception_throws = true;
}
public bool IsClsCompliant {
}
}
+ public bool WrapNonExceptionThrows {
+ get {
+ return wrap_non_exception_throws;
+ }
+ }
+
public override AttributeTargets AttributeTargets {
get {
return AttributeTargets.Assembly;
}
}
- public override bool IsClsCompliaceRequired(DeclSpace ds)
+ public override bool IsClsComplianceRequired(DeclSpace ds)
{
return is_cls_compliant;
}
- public void ResolveClsCompliance ()
+ public void Resolve ()
{
ClsCompliantAttribute = ResolveAttribute (TypeManager.cls_compliant_attribute_type);
- if (ClsCompliantAttribute == null)
- return;
+ if (ClsCompliantAttribute != null) {
+ is_cls_compliant = ClsCompliantAttribute.GetClsCompliantAttributeValue (null);
+ }
- is_cls_compliant = ClsCompliantAttribute.GetClsCompliantAttributeValue (null);
+#if NET_2_0
+ Attribute a = ResolveAttribute (TypeManager.runtime_compatibility_attr_type);
+ if (a != null) {
+ object val = a.GetPropertyValue ("WrapNonExceptionThrows");
+ if (val != null)
+ wrap_non_exception_throws = (bool)val;
+ }
+#endif
}
// fix bug #56621
}
}
catch (Exception) {
- Error_AssemblySigning ("The speficied file `" + RootContext.StrongNameKeyFile + "' is incorrectly encoded");
+ Error_AssemblySigning ("The specified file `" + RootContext.StrongNameKeyFile + "' is incorrectly encoded");
Environment.Exit (1);
}
}
case "System.Reflection.AssemblyKeyFileAttribute":
if (RootContext.StrongNameKeyFile != null) {
Report.SymbolRelatedToPreviousError (a.Location, a.Name);
- Report.Warning (1616, "Option `{0}' overrides attribute `{1}' given in a source file or added module",
+ Report.Warning (1616, 1, "Option `{0}' overrides attribute `{1}' given in a source file or added module",
"keyfile", "System.Reflection.AssemblyKeyFileAttribute");
}
else {
case "System.Reflection.AssemblyKeyNameAttribute":
if (RootContext.StrongNameKeyContainer != null) {
Report.SymbolRelatedToPreviousError (a.Location, a.Name);
- Report.Warning (1616, "Option `{0}' overrides attribute `{1}' given in a source file or added module",
+ Report.Warning (1616, 1, "Option `{0}' overrides attribute `{1}' given in a source file or added module",
"keycontainer", "System.Reflection.AssemblyKeyNameAttribute");
}
else {
"ECMA key can only be used to delay-sign assemblies");
}
else {
- Error_AssemblySigning ("The speficied file `" + RootContext.StrongNameKeyFile + "' does not have a private key");
+ Error_AssemblySigning ("The specified file `" + RootContext.StrongNameKeyFile + "' does not have a private key");
}
return null;
}
}
}
else {
- Error_AssemblySigning ("The speficied file `" + RootContext.StrongNameKeyFile + "' does not exist");
+ Error_AssemblySigning ("The specified file `" + RootContext.StrongNameKeyFile + "' does not exist");
return null;
}
return an;
Report.RuntimeMissingSupport (Location.Null, "assembly permission setting");
}
}
+
+#if NET_2_0
+ if (!OptAttributes.Contains (TypeManager.runtime_compatibility_attr_type, null)) {
+ ConstructorInfo ci = TypeManager.runtime_compatibility_attr_type.GetConstructor (TypeManager.NoTypes);
+ PropertyInfo pi = TypeManager.runtime_compatibility_attr_type.GetProperty ("WrapNonExceptionThrows");
+ Builder.SetCustomAttribute (new CustomAttributeBuilder (ci, new object [0],
+ new PropertyInfo [] { pi }, new object[] { true } ));
+ }
+#endif
}
public override string[] ValidAttributeTargets {
}
}
- public class ModuleClass: CommonAssemblyModulClass {
+ public class ModuleClass : CommonAssemblyModulClass {
// TODO: make it private and move all builder based methods here
public ModuleBuilder Builder;
bool m_module_is_unsafe;
}
}
- public override bool IsClsCompliaceRequired(DeclSpace ds)
+ public override bool IsClsComplianceRequired(DeclSpace ds)
{
return CodeGen.Assembly.IsClsCompliant;
}
{
if (a.Type == TypeManager.cls_compliant_attribute_type) {
if (CodeGen.Assembly.ClsCompliantAttribute == null) {
- Report.Warning (3012, a.Location, "You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking");
+ Report.Warning (3012, 1, a.Location, "You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking");
}
else if (CodeGen.Assembly.IsClsCompliant != a.GetBoolean ()) {
Report.SymbolRelatedToPreviousError (CodeGen.Assembly.ClsCompliantAttribute.Location, CodeGen.Assembly.ClsCompliantAttribute.GetSignatureForError ());