//
if (SymbolWriter == null) {
Report.Warning (
- -18, "Could not find the symbol writer assembly (Mono.CSharp.Debugger.dll). This is normally an installation problem. Please make sure to compile and install the mcs/class/Mono.CSharp.Debugger directory.");
+ -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.");
return;
}
}
DeclSpace = ds;
CheckState = RootContext.Checked;
ConstantCheckState = true;
+
+ if ((return_type is TypeBuilder) && return_type.IsGenericTypeDefinition)
+ throw new Exception ("FUCK");
IsStatic = (code_flags & Modifiers.STATIC) != 0;
InIterator = (code_flags & Modifiers.METHOD_YIELDS) != 0;
CurrentFile = loc.File;
#if PRODUCTION
- try {
+ try {
#endif
int errors = Report.Errors;
unreachable = true;
}
#if PRODUCTION
- } catch (Exception e) {
- Console.WriteLine ("Exception caught by the compiler while compiling:");
- Console.WriteLine (" Block that caused the problem begin at: " + loc);
-
- if (CurrentBlock != null){
- Console.WriteLine (" Block being compiled: [{0},{1}]",
- CurrentBlock.StartLocation, CurrentBlock.EndLocation);
- }
- Console.WriteLine (e.GetType ().FullName + ": " + e.Message);
+ } catch (Exception e) {
+ Console.WriteLine ("Exception caught by the compiler while compiling:");
+ Console.WriteLine (" Block that caused the problem begin at: " + loc);
+
+ if (CurrentBlock != null){
+ Console.WriteLine (" Block being compiled: [{0},{1}]",
+ CurrentBlock.StartLocation, CurrentBlock.EndLocation);
+ }
+ Console.WriteLine (e.GetType ().FullName + ": " + e.Message);
throw;
}
#endif
Report.Error (1643, loc, "Not all code paths return a value in anonymous method of type `{0}'",
CurrentAnonymousMethod.Type);
} else {
- Report.Error (161, loc, "Not all code paths return a value");
+ Report.Error (161, loc, "Not all code paths return a value");
}
return false;
if (!InIterator && !HasReturnLabel)
HasReturnLabel = true;
- }
+ }
//
// Creates a field `name' with the type `t' on the proxy class
return;
}
OptAttributes.AddAttributes (attrs);
- OptAttributes.CheckTargets (this);
}
public virtual void Emit (TypeContainer tc)
if (OptAttributes == null)
return null;
- EmitContext temp_ec = new EmitContext (new RootTypes (), Mono.CSharp.Location.Null, null, null, 0, false);
+ // Ensure that we only have GlobalAttributes, since the Search below isn't safe with other types.
+ if (!OptAttributes.CheckTargets (this))
+ return null;
+
+ EmitContext temp_ec = new EmitContext (RootContext.Tree.Types, Mono.CSharp.Location.Null, null, null, 0, false);
Attribute a = OptAttributes.Search (TypeManager.cls_compliant_attribute_type, temp_ec);
if (a != null) {
a.Resolve (temp_ec);
public AssemblyBuilder Builder;
bool is_cls_compliant;
+ public Attribute ClsCompliantAttribute;
ListDictionary declarative_security;
public void ResolveClsCompliance ()
{
- Attribute a = GetClsCompliantAttribute ();
- if (a == null)
+ ClsCompliantAttribute = GetClsCompliantAttribute ();
+ if (ClsCompliantAttribute == null)
return;
- is_cls_compliant = a.GetClsCompliantAttributeValue (null);
+ is_cls_compliant = ClsCompliantAttribute.GetClsCompliantAttributeValue (null);
}
// fix bug #56621
}
}
+ // TODO: rewrite this code (to kill N bugs and make it faster) and use standard ApplyAttribute way.
public AssemblyName GetAssemblyName (string name, string output)
{
if (OptAttributes != null) {
foreach (Attribute a in OptAttributes.Attrs) {
- if (a.Target != AttributeTargets.Assembly)
- continue;
+ // cannot rely on any resolve-based members before you call Resolve
+ if (a.ExplicitTarget == null || a.ExplicitTarget != "assembly")
+ continue;
+
// TODO: This code is buggy: comparing Attribute name without resolving it is wrong.
// However, this is invoked by CodeGen.Init, at which time none of the namespaces
// are loaded yet.
return;
}
- ApplyAttributeBuilder (null, new CustomAttributeBuilder (TypeManager.unverifiable_code_ctor, new object [0]));
+ Builder.SetCustomAttribute (new CustomAttributeBuilder (TypeManager.unverifiable_code_ctor, new object [0]));
}
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
{
- if (a != null && a.Type == TypeManager.cls_compliant_attribute_type) {
- Report.Warning (3012, a.Location, "You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking");
+ 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");
+ }
+ else if (CodeGen.Assembly.IsClsCompliant != a.GetBoolean ()) {
+ Report.SymbolRelatedToPreviousError (CodeGen.Assembly.ClsCompliantAttribute.Location, CodeGen.Assembly.ClsCompliantAttribute.Name);
+ Report.Error (3017, a.Location, "You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly");
+ return;
+ }
}
Builder.SetCustomAttribute (customBuilder);