Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@@ -12,6 +12,8 @@ EXTRA_DISTFILES = \
cs-parser.jay \
mcs.exe.sources
LIB_REFS = System System.Core System.Xml
ifeq (basic, $(PROFILE))
PROGRAM = basic.exe
sourcefile = mcs.exe.sources
@@ -24,6 +26,16 @@ endif
LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE
ifndef NO_THREAD_ABORT
REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_THREAD_ABORT
endif
ifndef NO_PROCESS_START
REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_PROCESS_START
endif
LOCAL_MCS_FLAGS += $(REFERENCE_SOURCES_FLAGS)
PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/4.5
PROGRAM_COMPILE = $(BOOT_COMPILE)

View File

@@ -1154,7 +1154,8 @@ namespace Mono.CSharp {
prev = null;
}
var body = CompatibleMethodBody (ec, tic, null, delegate_type);
HashSet<LocalVariable> undeclaredVariables = null;
var body = CompatibleMethodBody (ec, tic, null, delegate_type, ref undeclaredVariables);
if (body != null) {
am = body.Compatible (ec, body);
} else {
@@ -1164,6 +1165,10 @@ namespace Mono.CSharp {
if (TypeInferenceReportPrinter != null) {
ec.Report.SetPrinter (prev);
}
if (undeclaredVariables != null) {
body.Block.TopBlock.SetUndeclaredVariables (undeclaredVariables);
}
}
if (am == null)
@@ -1209,8 +1214,8 @@ namespace Mono.CSharp {
// we satisfy the rule by setting the return type on the EmitContext
// to be the delegate type return type.
//
var body = CompatibleMethodBody (ec, null, return_type, delegate_type);
HashSet<LocalVariable> undeclaredVariables = null;
var body = CompatibleMethodBody (ec, null, return_type, delegate_type, ref undeclaredVariables);
if (body == null)
return null;
@@ -1268,6 +1273,15 @@ namespace Mono.CSharp {
throw;
} catch (Exception e) {
throw new InternalErrorException (e, loc);
} finally {
//
// LocalVariable is not stateless and it's not easy to clone because it's
// cached in toplevel block. Unsetting any initialized variables should
// be enough
//
if (undeclaredVariables != null) {
body.Block.TopBlock.SetUndeclaredVariables (undeclaredVariables);
}
}
if (!ec.IsInProbingMode && !etree_conversion) {
@@ -1387,13 +1401,13 @@ namespace Mono.CSharp {
return ExprClassName;
}
AnonymousMethodBody CompatibleMethodBody (ResolveContext ec, TypeInferenceContext tic, TypeSpec return_type, TypeSpec delegate_type)
AnonymousMethodBody CompatibleMethodBody (ResolveContext ec, TypeInferenceContext tic, TypeSpec return_type, TypeSpec delegate_type, ref HashSet<LocalVariable> undeclaredVariables)
{
ParametersCompiled p = ResolveParameters (ec, tic, delegate_type);
if (p == null)
return null;
ParametersBlock b = ec.IsInProbingMode ? (ParametersBlock) Block.PerformClone () : Block;
ParametersBlock b = ec.IsInProbingMode ? (ParametersBlock) Block.PerformClone (ref undeclaredVariables) : Block;
if (b.IsAsync) {
var rt = return_type;

View File

@@ -396,34 +396,40 @@ namespace Mono.CSharp
//
void CheckReferencesPublicToken ()
{
// TODO: It should check only references assemblies but there is
// no working SRE API
foreach (var entry in Importer.Assemblies) {
var a = entry as ImportedAssemblyDefinition;
if (a == null || a.IsMissing)
continue;
if (public_key != null && !a.HasStrongName) {
foreach (var an in builder_extra.GetReferencedAssemblies ()) {
if (public_key != null && an.GetPublicKey ().Length == 0) {
Report.Error (1577, "Referenced assembly `{0}' does not have a strong name",
a.FullName);
an.FullName);
}
var ci = a.Assembly.GetName ().CultureInfo;
var ci = an.CultureInfo;
if (!ci.Equals (CultureInfo.InvariantCulture)) {
Report.Warning (8009, 1, "Referenced assembly `{0}' has different culture setting of `{1}'",
a.Name, ci.Name);
an.Name, ci.Name);
}
if (!a.IsFriendAssemblyTo (this))
var ia = Importer.GetImportedAssemblyDefinition (an);
if (ia == null)
continue;
var attr = a.GetAssemblyVisibleToName (this);
var references = GetNotUnifiedReferences (an);
if (references != null) {
foreach (var r in references) {
Report.SymbolRelatedToPreviousError ( r[0]);
Report.Error (1705, r [1]);
}
}
if (!ia.IsFriendAssemblyTo (this))
continue;
var attr = ia.GetAssemblyVisibleToName (this);
var atoken = attr.GetPublicKeyToken ();
if (ArrayComparer.IsEqual (GetPublicKeyToken (), atoken))
continue;
Report.SymbolRelatedToPreviousError (a.Location);
Report.SymbolRelatedToPreviousError (ia.Location);
Report.Error (281,
"Friend access was granted to `{0}', but the output assembly is named `{1}'. Try adding a reference to `{0}' or change the output assembly name to match it",
attr.FullName, FullName);
@@ -544,6 +550,11 @@ namespace Mono.CSharp
return public_key_token;
}
protected virtual List<string[]> GetNotUnifiedReferences (AssemblyName assemblyName)
{
return null;
}
//
// Either keyFile or keyContainer has to be non-null
//
@@ -1092,7 +1103,7 @@ namespace Mono.CSharp
//
public class AssemblyBuilderExtension
{
readonly CompilerContext ctx;
protected readonly CompilerContext ctx;
public AssemblyBuilderExtension (CompilerContext ctx)
{
@@ -1120,6 +1131,11 @@ namespace Mono.CSharp
ctx.Report.RuntimeMissingSupport (Location.Null, "-win32icon");
}
public virtual AssemblyName[] GetReferencedAssemblies ()
{
return null;
}
public virtual void SetAlgorithmId (uint value, Location loc)
{
ctx.Report.RuntimeMissingSupport (loc, "AssemblyAlgorithmIdAttribute");

View File

@@ -363,7 +363,6 @@ namespace Mono.CSharp {
return this;
}
#if NET_4_0 || MOBILE_DYNAMIC
public override System.Linq.Expressions.Expression MakeExpression (BuilderContext ctx)
{
var tassign = target as IDynamicAssign;
@@ -391,7 +390,6 @@ namespace Mono.CSharp {
return System.Linq.Expressions.Expression.Assign (target_object, source_object);
}
#endif
protected virtual Expression ResolveConversions (ResolveContext ec)
{
source = Convert.ImplicitConversionRequired (ec, source, target.Type, source.Location);

View File

@@ -482,10 +482,7 @@ namespace Mono.CSharp {
return null;
}
ObsoleteAttribute obsolete_attr = Type.GetAttributeObsolete ();
if (obsolete_attr != null) {
AttributeTester.Report_ObsoleteMessage (obsolete_attr, Type.GetSignatureForError (), Location, Report);
}
Type.CheckObsoleteness (context, expression.StartLocation);
ResolveContext rc = null;
@@ -579,8 +576,6 @@ namespace Mono.CSharp {
return false;
}
ObsoleteAttribute obsolete_attr;
if (member is PropertyExpr) {
var pi = ((PropertyExpr) member).PropertyInfo;
@@ -596,7 +591,9 @@ namespace Mono.CSharp {
return false;
}
obsolete_attr = pi.GetAttributeObsolete ();
// if (!context.IsObsolete)
pi.CheckObsoleteness (ec, member.StartLocation);
pi.MemberDefinition.SetIsAssigned ();
} else {
var fi = ((FieldExpr) member).Spec;
@@ -612,13 +609,12 @@ namespace Mono.CSharp {
return false;
}
obsolete_attr = fi.GetAttributeObsolete ();
// if (!context.IsObsolete)
fi.CheckObsoleteness (ec, member.StartLocation);
fi.MemberDefinition.SetIsAssigned ();
}
if (obsolete_attr != null && !context.IsObsolete)
AttributeTester.Report_ObsoleteMessage (obsolete_attr, member.GetSignatureForError (), member.Location, Report);
if (a.Type != member.Type) {
a.Expr = Convert.ImplicitConversionRequired (ec, a.Expr, member.Type, a.Expr.Location);
}

View File

@@ -1 +1 @@
eaa12fa0ebeb5e3ef6cd1632e9d23c532f5446c4
edc538e7d2ed66a09ab7b5cbd397aec15b3ac3d0

View File

@@ -262,9 +262,7 @@ namespace Mono.CSharp
if (sf.IsHiddenLocation (loc))
return false;
#if NET_4_0
methodSymbols.MarkSequencePoint (ig.ILOffset, sf.SourceFileEntry, loc.Row, loc.Column, false);
#endif
return true;
}
@@ -324,9 +322,7 @@ namespace Mono.CSharp
if ((flags & Options.OmitDebugInfo) != 0)
return;
#if NET_4_0
methodSymbols.StartBlock (CodeBlockEntry.Type.Lexical, ig.ILOffset);
#endif
}
public void BeginCompilerScope ()
@@ -334,9 +330,7 @@ namespace Mono.CSharp
if ((flags & Options.OmitDebugInfo) != 0)
return;
#if NET_4_0
methodSymbols.StartBlock (CodeBlockEntry.Type.CompilerGenerated, ig.ILOffset);
#endif
}
public void EndExceptionBlock ()
@@ -349,9 +343,7 @@ namespace Mono.CSharp
if ((flags & Options.OmitDebugInfo) != 0)
return;
#if NET_4_0
methodSymbols.EndBlock (ig.ILOffset);
#endif
}
public void CloseConditionalAccess (TypeSpec type)
@@ -398,6 +390,22 @@ namespace Mono.CSharp
if (IsAnonymousStoreyMutateRequired)
type = CurrentAnonymousMethod.Storey.Mutator.Mutate (type);
if (pinned) {
//
// This is for .net compatibility. I am not sure why pinned
// pointer temps are converted to & even if they are pointers to
// pointers.
//
var pt = type as PointerContainer;
if (pt != null) {
type = pt.Element;
if (type.Kind == MemberKind.Void)
type = Module.Compiler.BuiltinTypes.IntPtr;
return ig.DeclareLocal (type.GetMetaInfo ().MakeByRefType (), true);
}
}
return ig.DeclareLocal (type.GetMetaInfo (), pinned);
}

View File

@@ -111,6 +111,12 @@ namespace Mono.CSharp {
{
visitor.Visit (this);
}
public override void PrepareEmit ()
{
base.PrepareEmit ();
DefineValue ();
}
}
public class ConstSpec : FieldSpec

View File

@@ -1 +1 @@
6864b1150da3754d0aa97fb88c9fdfcf172fe0d3
b0c771f7207b2eb26aa12a288bd58e11f811aae3

View File

@@ -1095,6 +1095,7 @@ namespace Mono.CSharp
case Token.DECIMAL:
case Token.BOOL:
case Token.STRING:
case Token.SBYTE:
return Token.OPEN_PARENS_CAST;
}
}
@@ -4101,8 +4102,6 @@ namespace Mono.CSharp
private void handle_one_line_xml_comment ()
{
int c;
while ((c = peek_char ()) == ' ')
get_char (); // skip heading whitespaces.
while ((c = peek_char ()) != -1 && c != '\n' && c != '\r') {
xml_comment_buffer.Append ((char) get_char ());
}

View File

@@ -508,16 +508,6 @@ namespace Mono.CSharp {
return obsolete;
}
/// <summary>
/// Checks for ObsoleteAttribute presence. It's used for testing of all non-types elements
/// </summary>
public virtual void CheckObsoleteness (Location loc)
{
ObsoleteAttribute oa = GetAttributeObsolete ();
if (oa != null)
AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc, Report);
}
//
// Checks whether the type P is as accessible as this member
//
@@ -534,6 +524,9 @@ namespace Mono.CSharp {
while (TypeManager.HasElementType (p))
p = TypeManager.GetElementType (p);
if (p.BuiltinType != BuiltinTypeSpec.Type.None)
return true;
if (p.IsGenericParameter)
return true;
@@ -553,6 +546,10 @@ namespace Mono.CSharp {
bool same_access_restrictions = false;
for (MemberCore mc = this; !same_access_restrictions && mc != null && mc.Parent != null; mc = mc.Parent) {
var tc = mc as TypeContainer;
if (tc != null && tc.PartialContainer != null)
mc = tc.PartialContainer;
var al = mc.ModFlags & Modifiers.AccessibilityMask;
switch (pAccess) {
case Modifiers.INTERNAL:
@@ -1071,6 +1068,16 @@ namespace Mono.CSharp {
#endregion
public virtual void CheckObsoleteness (IMemberContext mc, Location loc)
{
var oa = GetAttributeObsolete ();
if (oa == null)
return;
if (!mc.IsObsolete)
AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc, mc.Module.Compiler.Report);
}
public virtual ObsoleteAttribute GetAttributeObsolete ()
{
if ((state & (StateFlags.Obsolete | StateFlags.Obsolete_Undetected)) == 0)

View File

@@ -308,6 +308,8 @@ namespace Mono.CSharp {
InvokeBuilder.PrepareEmit ();
if (BeginInvokeBuilder != null) {
BeginInvokeBuilder.TypeExpression = null;
EndInvokeBuilder.TypeExpression = null;
BeginInvokeBuilder.PrepareEmit ();
EndInvokeBuilder.PrepareEmit ();
}

View File

@@ -92,22 +92,9 @@ namespace Mono.CSharp
el.SetAttribute ("name", name);
string normalized = mc.DocComment;
el.InnerXml = normalized;
// csc keeps lines as written in the sources
// and inserts formatting indentation (which
// is different from XmlTextWriter.Formatting
// one), but when a start tag contains an
// endline, it joins the next line. We don't
// have to follow such a hacky behavior.
string [] split =
normalized.Split ('\n');
int j = 0;
for (int i = 0; i < split.Length; i++) {
string s = split [i].TrimEnd ();
if (s.Length > 0)
split [j++] = s;
}
el.InnerXml = line_head + String.Join (
line_head, split, 0, j);
string [] split = normalized.Split ('\n');
el.InnerXml = line_head + String.Join (line_head, split);
return el;
} catch (Exception ex) {
Report.Warning (1570, 1, mc.Location, "XML documentation comment on `{0}' is not well-formed XML markup ({1})",

View File

@@ -201,6 +201,7 @@ namespace Mono.CSharp
public static string GetPackageFlags (string packages, Report report)
{
#if MONO_FEATURE_PROCESS_START
ProcessStartInfo pi = new ProcessStartInfo ();
pi.FileName = "pkg-config";
pi.RedirectStandardOutput = true;
@@ -239,6 +240,9 @@ namespace Mono.CSharp
p.Close ();
return pkgout;
#else
throw new NotSupportedException ("Process.Start is not supported on this platform.");
#endif // MONO_FEATURE_PROCESS_START
}
//

View File

@@ -12,9 +12,11 @@
using System;
using System.Linq;
using SLE = System.Linq.Expressions;
#if NET_4_0 || MOBILE_DYNAMIC
using System.Dynamic;
#if STATIC
using IKVM.Reflection.Emit;
#else
using System.Reflection.Emit;
#endif
namespace Mono.CSharp
@@ -63,14 +65,6 @@ namespace Mono.CSharp
//
public class RuntimeValueExpression : Expression, IDynamicAssign, IMemoryLocation
{
#if !NET_4_0 && !MOBILE_DYNAMIC
public class DynamicMetaObject
{
public TypeSpec RuntimeType;
public TypeSpec LimitType;
public SLE.Expression Expression;
}
#endif
readonly DynamicMetaObject obj;
@@ -146,7 +140,6 @@ namespace Mono.CSharp
return base.MakeExpression (ctx);
#else
#if NET_4_0 || MOBILE_DYNAMIC
if (type.IsStruct && !obj.Expression.Type.IsValueType)
return SLE.Expression.Unbox (obj.Expression, type.GetMetaInfo ());
@@ -154,7 +147,6 @@ namespace Mono.CSharp
if (((SLE.ParameterExpression) obj.Expression).IsByRef)
return obj.Expression;
}
#endif
return SLE.Expression.Convert (obj.Expression, type.GetMetaInfo ());
#endif
@@ -181,7 +173,6 @@ namespace Mono.CSharp
return this;
}
#if NET_4_0 || MOBILE_DYNAMIC
public override SLE.Expression MakeExpression (BuilderContext ctx)
{
#if STATIC
@@ -190,7 +181,6 @@ namespace Mono.CSharp
return SLE.Expression.Block (expr.MakeExpression (ctx), SLE.Expression.Default (type.GetMetaInfo ()));
#endif
}
#endif
}
#endregion
@@ -329,6 +319,50 @@ namespace Mono.CSharp
EmitCall (ec, binder_expr, arguments, true);
}
protected void EmitConditionalAccess (EmitContext ec)
{
var a_expr = arguments [0].Expr;
var des = a_expr as DynamicExpressionStatement;
if (des != null) {
des.EmitConditionalAccess (ec);
}
if (HasConditionalAccess ()) {
var NullOperatorLabel = ec.DefineLabel ();
if (ExpressionAnalyzer.IsInexpensiveLoad (a_expr)) {
a_expr.Emit (ec);
} else {
var lt = new LocalTemporary (a_expr.Type);
lt.EmitAssign (ec, a_expr, true, false);
Arguments [0].Expr = lt;
}
ec.Emit (OpCodes.Brtrue_S, NullOperatorLabel);
if (!ec.ConditionalAccess.Statement) {
if (ec.ConditionalAccess.Type.IsNullableType)
Nullable.LiftedNull.Create (ec.ConditionalAccess.Type, Location.Null).Emit (ec);
else
ec.EmitNull ();
}
ec.Emit (OpCodes.Br, ec.ConditionalAccess.EndLabel);
ec.MarkLabel (NullOperatorLabel);
return;
}
if (a_expr.HasConditionalAccess ()) {
var lt = new LocalTemporary (a_expr.Type);
lt.EmitAssign (ec, a_expr, false, false);
Arguments [0].Expr = lt;
}
}
protected void EmitCall (EmitContext ec, Expression binder, Arguments arguments, bool isStatement)
{
//
@@ -517,6 +551,24 @@ namespace Mono.CSharp
StatementExpression s = new StatementExpression (new SimpleAssign (site_field_expr, new Invocation (new MemberAccess (instanceAccessExprType, "Create"), args)));
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
var conditionalAccessReceiver = IsConditionalAccessReceiver;
var ca = ec.ConditionalAccess;
if (conditionalAccessReceiver) {
ec.ConditionalAccess = new ConditionalAccessContext (type, ec.DefineLabel ()) {
Statement = isStatement
};
//
// Emit conditional access expressions before dynamic call
// is initialized. It pushes site_field_expr on stack before
// the actual instance argument is emited which would cause
// jump from non-empty stack.
//
EmitConditionalAccess (ec);
}
if (s.Resolve (bc)) {
Statement init = new If (new Binary (Binary.Operator.Equality, site_field_expr, new NullLiteral (loc)), s, loc);
init.Emit (ec);
@@ -541,9 +593,15 @@ namespace Mono.CSharp
}
}
Expression target = new DelegateInvocation (new MemberAccess (site_field_expr, "Target", loc).Resolve (bc), args, false, loc).Resolve (bc);
if (target != null)
var target = new DelegateInvocation (new MemberAccess (site_field_expr, "Target", loc).Resolve (bc), args, false, loc).Resolve (bc);
if (target != null) {
target.Emit (ec);
}
if (conditionalAccessReceiver) {
ec.CloseConditionalAccess (!isStatement && type.IsNullableType ? type : null);
ec.ConditionalAccess = ca;
}
}
}
@@ -562,6 +620,12 @@ namespace Mono.CSharp
{
return new MemberAccess (new TypeExpression (binder_type, loc), name, loc);
}
protected virtual bool IsConditionalAccessReceiver {
get {
return false;
}
}
}
//
@@ -686,14 +750,18 @@ namespace Mono.CSharp
class DynamicIndexBinder : DynamicMemberAssignable
{
bool can_be_mutator;
readonly bool conditional_access_receiver;
readonly bool conditional_access;
public DynamicIndexBinder (Arguments args, Location loc)
public DynamicIndexBinder (Arguments args, bool conditionalAccessReceiver, bool conditionalAccess, Location loc)
: base (args, loc)
{
this.conditional_access_receiver = conditionalAccessReceiver;
this.conditional_access = conditionalAccess;
}
public DynamicIndexBinder (CSharpBinderFlags flags, Arguments args, Location loc)
: this (args, loc)
: this (args, false, false, loc)
{
base.flags = flags;
}
@@ -747,22 +815,35 @@ namespace Mono.CSharp
setter_args.Add (new Argument (rhs));
return setter_args;
}
protected override bool IsConditionalAccessReceiver {
get {
return conditional_access_receiver;
}
}
public override bool HasConditionalAccess ()
{
return conditional_access;
}
}
class DynamicInvocation : DynamicExpressionStatement, IDynamicBinder
{
readonly ATypeNameExpression member;
readonly bool conditional_access_receiver;
public DynamicInvocation (ATypeNameExpression member, Arguments args, Location loc)
public DynamicInvocation (ATypeNameExpression member, Arguments args, bool conditionalAccessReceiver, Location loc)
: base (null, args, loc)
{
base.binder = this;
this.member = member;
this.conditional_access_receiver = conditionalAccessReceiver;
}
public static DynamicInvocation CreateSpecialNameInvoke (ATypeNameExpression member, Arguments args, Location loc)
{
return new DynamicInvocation (member, args, loc) {
return new DynamicInvocation (member, args, false, loc) {
flags = CSharpBinderFlags.InvokeSpecialName
};
}
@@ -820,11 +901,36 @@ namespace Mono.CSharp
flags |= CSharpBinderFlags.ResultDiscarded;
base.EmitStatement (ec);
}
protected override bool IsConditionalAccessReceiver {
get {
return conditional_access_receiver;
}
}
public override bool HasConditionalAccess ()
{
return member is ConditionalMemberAccess;
}
}
class DynamicConditionalMemberBinder : DynamicMemberBinder
{
public DynamicConditionalMemberBinder (string name, Arguments args, Location loc)
: base (name, args, loc)
{
}
public override bool HasConditionalAccess ()
{
return true;
}
}
class DynamicMemberBinder : DynamicMemberAssignable
{
readonly string name;
bool conditionalAccessReceiver;
public DynamicMemberBinder (string name, Arguments args, Location loc)
: base (args, loc)
@@ -850,6 +956,20 @@ namespace Mono.CSharp
isSet |= (flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0;
return new Invocation (GetBinder (isSet ? "SetMember" : "GetMember", loc), binder_args);
}
protected override Expression DoResolve (ResolveContext rc)
{
if (!rc.HasSet (ResolveContext.Options.DontSetConditionalAccessReceiver))
conditionalAccessReceiver = HasConditionalAccess () || Arguments [0].Expr.HasConditionalAccess ();
return base.DoResolve (rc);
}
protected override bool IsConditionalAccessReceiver {
get {
return conditionalAccessReceiver;
}
}
}
//

View File

@@ -1 +1 @@
952a85f9aa45898c3fc21f1c1f92ff5f87a2df6a
52da19a1b970748d49991d1a2b47a7bbef11a061

View File

@@ -192,8 +192,13 @@ namespace Mono.CSharp
if (!inited || !invoking)
return;
if (invoke_thread != null)
if (invoke_thread != null) {
#if MONO_FEATURE_THREAD_ABORT
invoke_thread.Abort ();
#else
invoke_thread.Interrupt ();
#endif
}
}
/// <summary>
@@ -367,9 +372,14 @@ namespace Mono.CSharp
invoke_thread = System.Threading.Thread.CurrentThread;
invoking = true;
compiled (ref retval);
#if MONO_FEATURE_THREAD_ABORT
} catch (ThreadAbortException e){
Thread.ResetAbort ();
Console.WriteLine ("Interrupted!\n{0}", e);
#else
} catch (ThreadInterruptedException e) {
Console.WriteLine ("Interrupted!\n{0}", e);
#endif
} finally {
invoking = false;
@@ -415,11 +425,7 @@ namespace Mono.CSharp
};
host.SetBaseTypes (baseclass_list);
#if NET_4_0
var access = AssemblyBuilderAccess.RunAndCollect;
#else
var access = AssemblyBuilderAccess.Run;
#endif
var a = new AssemblyDefinitionDynamic (module, "completions");
a.Create (AppDomain.CurrentDomain, access);
module.SetDeclaringAssembly (a);
@@ -694,11 +700,7 @@ namespace Mono.CSharp
assembly = new AssemblyDefinitionDynamic (module, current_debug_name, current_debug_name);
assembly.Importer = importer;
} else {
#if NET_4_0
access = AssemblyBuilderAccess.RunAndCollect;
#else
access = AssemblyBuilderAccess.Run;
#endif
assembly = new AssemblyDefinitionDynamic (module, current_debug_name);
}

View File

@@ -1 +1 @@
3c2d3fbe2cac6adc7835cf53aa766fffd4381e86
c5139d57f673c5d02f003618a9d64ccc09dcc2a1

View File

@@ -195,9 +195,7 @@ namespace Mono.CSharp {
continue;
if (obsoleteCheck) {
ObsoleteAttribute obsolete_attr = t.GetAttributeObsolete ();
if (obsolete_attr != null)
AttributeTester.Report_ObsoleteMessage (obsolete_attr, t.GetSignatureForError (), c.Location, context.Module.Compiler.Report);
t.CheckObsoleteness (context, c.Location);
}
ConstraintChecker.Check (context, t, c.Location);
@@ -651,10 +649,10 @@ namespace Mono.CSharp {
var meta_constraints = new List<MetaType> (spec.TypeArguments.Length);
foreach (var c in spec.TypeArguments) {
//
// Inflated type parameters can collide with special constraint types, don't
// Inflated type parameters can collide with base type constraint, don't
// emit any such type parameter.
//
if (c.BuiltinType == BuiltinTypeSpec.Type.Object || c.BuiltinType == BuiltinTypeSpec.Type.ValueType)
if (c.IsClass && spec.BaseType.BuiltinType != BuiltinTypeSpec.Type.Object)
continue;
meta_constraints.Add (c.GetMetaInfo ());
@@ -1140,7 +1138,7 @@ namespace Mono.CSharp {
//
// Iterate over inflated interfaces
//
foreach (var iface in Interfaces) {
foreach (var iface in InterfacesDefined) {
found = false;
if (other.InterfacesDefined != null) {
foreach (var oiface in other.Interfaces) {
@@ -1173,7 +1171,7 @@ namespace Mono.CSharp {
//
// Iterate over inflated interfaces
//
foreach (var oiface in other.Interfaces) {
foreach (var oiface in other.InterfacesDefined) {
found = false;
if (InterfacesDefined != null) {
@@ -1336,12 +1334,26 @@ namespace Mono.CSharp {
{
cache = new MemberCache ();
if (targs != null) {
foreach (var ta in targs) {
var tps = ta as TypeParameterSpec;
var b_type = tps == null ? ta : tps.GetEffectiveBase ();
//
// Find the most specific type when base type was inflated from base constraints
//
if (b_type != null && !b_type.IsStructOrEnum && TypeSpec.IsBaseClass (b_type, BaseType, false))
BaseType = b_type;
}
}
//
// For a type parameter the membercache is the union of the sets of members of the types
// specified as a primary constraint or secondary constraint
//
if (BaseType.BuiltinType != BuiltinTypeSpec.Type.Object && BaseType.BuiltinType != BuiltinTypeSpec.Type.ValueType)
if (BaseType.BuiltinType != BuiltinTypeSpec.Type.Object && BaseType.BuiltinType != BuiltinTypeSpec.Type.ValueType) {
cache.AddBaseType (BaseType);
}
if (InterfacesDefined != null) {
foreach (var iface_type in InterfacesDefined) {
@@ -1349,25 +1361,13 @@ namespace Mono.CSharp {
}
}
//
// Import interfaces after base type to match behavior from ordinary classes
//
if (targs != null) {
foreach (var ta in targs) {
var tps = ta as TypeParameterSpec;
IList<TypeSpec> ifaces;
TypeSpec b_type;
if (tps != null) {
b_type = tps.GetEffectiveBase ();
ifaces = tps.InterfacesDefined;
} else {
b_type = ta;
ifaces = ta.Interfaces;
}
//
// Don't add base type which was inflated from base constraints but it's not valid
// in C# context
//
if (b_type != null && b_type.BuiltinType != BuiltinTypeSpec.Type.Object && b_type.BuiltinType != BuiltinTypeSpec.Type.ValueType && !b_type.IsStructOrEnum)
cache.AddBaseType (b_type);
var ifaces = tps == null ? ta.Interfaces : tps.InterfacesDefined;
if (ifaces != null) {
foreach (var iface_type in ifaces) {
@@ -1940,6 +1940,14 @@ namespace Mono.CSharp {
return definition.GetMetaInfo ().MakeGenericType (all.ToArray ());
}
public override void CheckObsoleteness (IMemberContext mc, Location loc)
{
base.CheckObsoleteness (mc, loc);
foreach (var ta in TypeArguments)
ta.CheckObsoleteness (mc, loc);
}
public override ObsoleteAttribute GetAttributeObsolete ()
{
return open_type.GetAttributeObsolete ();
@@ -3103,21 +3111,36 @@ namespace Mono.CSharp {
return ExactInference (ac_u.Element, ac_v.Element);
}
// If V is constructed type and U is constructed type
//
// If V is constructed type and U is constructed type or dynamic
//
if (TypeManager.IsGenericType (v)) {
if (!TypeManager.IsGenericType (u) || v.MemberDefinition != u.MemberDefinition)
return 0;
if (u.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
TypeSpec [] ga_u = TypeManager.GetTypeArguments (u);
TypeSpec [] ga_v = TypeManager.GetTypeArguments (v);
if (ga_u.Length != ga_v.Length)
return 0;
var ga_v = v.TypeArguments;
int score = 0;
for (int i = 0; i < ga_u.Length; ++i)
score += ExactInference (ga_u [i], ga_v [i]);
int score = 0;
for (int i = 0; i < ga_v.Length; ++i)
score += ExactInference (u, ga_v [i]);
return System.Math.Min (1, score);
return System.Math.Min (1, score);
} else {
if (!TypeManager.IsGenericType (u) || v.MemberDefinition != u.MemberDefinition)
return 0;
var ga_u = u.TypeArguments;
var ga_v = v.TypeArguments;
if (u.TypeArguments.Length != u.TypeArguments.Length)
return 0;
int score = 0;
for (int i = 0; i < ga_v.Length; ++i)
score += ExactInference (ga_u [i], ga_v [i]);
return System.Math.Min (1, score);
}
}
// If V is one of the unfixed type arguments

View File

@@ -220,6 +220,11 @@ namespace Mono.CSharp
return Builder.__AddModule (moduleFile);
}
protected override List<string[]> GetNotUnifiedReferences (AssemblyName assemblyName)
{
return loader.GetNotUnifiedReferences (assemblyName);
}
protected override void SaveModule (PortableExecutableKinds pekind, ImageFileMachine machine)
{
module.Builder.__Save (pekind, machine);
@@ -233,13 +238,17 @@ namespace Mono.CSharp
Assembly corlib;
readonly List<Tuple<AssemblyName, string, Assembly>> loaded_names;
static readonly Dictionary<string, string[]> sdk_directory;
Dictionary<AssemblyName, List<string[]>> resolved_version_mismatches;
static StaticLoader ()
{
sdk_directory = new Dictionary<string, string[]> ();
sdk_directory.Add ("2", new string[] { "2.0", "net_2_0", "v2.0.50727" });
sdk_directory.Add ("4", new string[] { "4.0", "net_4_0", "v4.0.30319" });
sdk_directory.Add ("4.5", new string[] { "4.5", "net_4_5", "v4.0.30319" });
sdk_directory.Add ("2", new string[] { "2.0-api", "v2.0.50727" });
sdk_directory.Add ("2.0", new string[] { "2.0-api", "v2.0.50727" });
sdk_directory.Add ("4", new string[] { "4.0-api", "v4.0.30319" });
sdk_directory.Add ("4.0", new string[] { "4.0-api", "v4.0.30319" });
sdk_directory.Add ("4.5", new string[] { "4.5-api", "v4.0.30319" });
sdk_directory.Add ("4.6", new string [] { "4.5", "net_4_x", "v4.0.30319" });
}
public StaticLoader (StaticImporter importer, CompilerContext compiler)
@@ -259,7 +268,7 @@ namespace Mono.CSharp
string sdk_path = null;
string sdk_version = compiler.Settings.SdkVersion ?? "4.5";
string sdk_version = compiler.Settings.SdkVersion ?? "4.6";
string[] sdk_sub_dirs;
if (!sdk_directory.TryGetValue (sdk_version, out sdk_sub_dirs))
@@ -353,11 +362,23 @@ namespace Mono.CSharp
var v2 = version_mismatch.GetName ().Version;
if (v1 > v2) {
// compiler.Report.SymbolRelatedToPreviousError (args.RequestingAssembly.Location);
compiler.Report.Error (1705, "Assembly `{0}' references `{1}' which has a higher version number than imported assembly `{2}'",
args.RequestingAssembly.FullName, refname, version_mismatch.GetName ().FullName);
if (resolved_version_mismatches == null)
resolved_version_mismatches = new Dictionary<AssemblyName, List<string[]>> ();
return domain.CreateMissingAssembly (args.Name);
var an = args.RequestingAssembly.GetName ();
List<string[]> names;
if (!resolved_version_mismatches.TryGetValue (an, out names)) {
names = new List<string[]> ();
resolved_version_mismatches.Add (an, names);
}
names.Add (new[] {
args.RequestingAssembly.Location,
string.Format ("Assembly `{0}' depends on `{1}' which has a higher version number than referenced assembly `{2}'",
args.RequestingAssembly.FullName, refname, version_mismatch.GetName ().FullName)
});
return version_mismatch;
}
if (!is_fx_assembly) {
@@ -412,6 +433,15 @@ namespace Mono.CSharp
return default_references.ToArray ();
}
public List<string[]> GetNotUnifiedReferences (AssemblyName assemblyName)
{
List<string[]> list = null;
if (resolved_version_mismatches != null)
resolved_version_mismatches.TryGetValue (assemblyName, out list);
return list;
}
public override bool HasObjectType (Assembly assembly)
{
try {
@@ -590,7 +620,25 @@ namespace Mono.CSharp
public override void DefineWin32IconResource (string fileName)
{
builder.__DefineIconResource (File.ReadAllBytes (fileName));
byte[] bytes;
try {
bytes = File.ReadAllBytes (fileName);
} catch (Exception e) {
ctx.Report.Error (7064, Location.Null, "Error opening icon file `{0}'. {1}", fileName, e.Message);
return;
}
builder.__DefineIconResource (bytes);
}
public override AssemblyName[] GetReferencedAssemblies ()
{
foreach (var m in builder.Modules) {
if (m is ModuleBuilder)
return m.__GetReferencedAssemblies ();
}
return new AssemblyName [0];
}
public override void SetAlgorithmId (uint value, Location loc)

Some files were not shown because too many files have changed in this diff Show More