Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -68,10 +68,10 @@ btest: mcs2.exe mcs3.exe
ls -l mcs2.exe mcs3.exe
mcs2.exe: $(PROGRAM)
$(TIME) $(RUNTIME) $(RUNTIME_FLAGS) $(PROGRAM) $(USE_MCS_FLAGS) -target:exe -out:$@ $(BUILT_SOURCES) @$(response)
$(TIME) $(RUNTIME) $(RUNTIME_FLAGS) $(PROGRAM) $(USE_MCS_FLAGS) $(MCS_REFERENCES) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
mcs3.exe: mcs2.exe
$(TIME) $(RUNTIME) $(RUNTIME_FLAGS) ./mcs2.exe $(USE_MCS_FLAGS) -target:exe -out:$@ $(BUILT_SOURCES) @$(response)
$(TIME) $(RUNTIME) $(RUNTIME_FLAGS) ./mcs2.exe $(USE_MCS_FLAGS) $(MCS_REFERENCES) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
wc:
wc -l $(BUILT_SOURCES) `cat $(sourcefile)`

View File

@@ -1215,7 +1215,7 @@ namespace Mono.CSharp
paths.AddRange (compiler.Settings.ReferencesLookupPaths);
}
public abstract bool HasObjectType (T assembly);
public abstract T HasObjectType (T assembly);
protected abstract string[] GetDefaultReferences ();
public abstract T LoadAssemblyFile (string fileName, bool isImplicitReference);
public abstract void LoadReferences (ModuleContainer module);
@@ -1282,8 +1282,13 @@ namespace Mono.CSharp
//
// corlib assembly is the first referenced assembly which contains System.Object
//
if (HasObjectType (assembly.Item2)) {
corlib_assembly = assembly.Item2;
corlib_assembly = HasObjectType (assembly.Item2);
if (corlib_assembly != null) {
if (corlib_assembly != assembly.Item2) {
var ca = corlib_assembly;
i = loaded.FindIndex (l => l.Item2 == ca);
}
loaded.RemoveAt (i);
break;
}

View File

@@ -1 +1 @@
0f7ea925d9e3382fab323c3950fb1a16c48a47b5
e5d0b1f173584fe1676d1379efa1df8a35346731

View File

@@ -2149,11 +2149,6 @@ namespace Mono.CSharp {
this.name = name;
}
static void Error_MethodGroupWithTypeArguments (ResolveContext rc, Location loc)
{
rc.Report.Error (8084, loc, "An argument to nameof operator cannot be method group with type arguments");
}
protected override Expression DoResolve (ResolveContext rc)
{
throw new NotSupportedException ();
@@ -2169,9 +2164,9 @@ namespace Mono.CSharp {
rc.Report.FeatureIsNotAvailable (rc.Module.Compiler, Location, "nameof operator");
var res = sn.LookupNameExpression (rc, MemberLookupRestrictions.IgnoreAmbiguity | MemberLookupRestrictions.NameOfExcluded);
if (sn.HasTypeArguments && res is MethodGroupExpr) {
Error_MethodGroupWithTypeArguments (rc, expr.Location);
}
var me = res as MemberExpr;
if (me != null)
me.ResolveNameOf (rc, sn);
return true;
}
@@ -2197,20 +2192,9 @@ namespace Mono.CSharp {
return false;
}
var mg = res as MethodGroupExpr;
if (mg != null) {
var emg = res as ExtensionMethodGroupExpr;
if (emg != null && !emg.ResolveNameOf (rc, ma)) {
return true;
}
if (!mg.HasAccessibleCandidate (rc)) {
ErrorIsInaccesible (rc, ma.GetSignatureForError (), loc);
}
if (ma.HasTypeArguments) {
Error_MethodGroupWithTypeArguments (rc, ma.Location);
}
var me = res as MemberExpr;
if (me != null) {
me.ResolveNameOf (rc, ma);
}
//

View File

@@ -526,6 +526,19 @@ namespace Mono.CSharp
return da;
}
public Dictionary<Statement, List<DefiniteAssignmentBitSet>> CopyLabelStack ()
{
if (LabelStack == null)
return null;
var dest = new Dictionary<Statement, List<DefiniteAssignmentBitSet>> ();
foreach (var entry in LabelStack) {
dest.Add (entry.Key, new List<DefiniteAssignmentBitSet> (entry.Value));
}
return dest;
}
public bool IsDefinitelyAssigned (VariableInfo variable)
{
return variable.IsAssigned (DefiniteAssignment);
@@ -536,6 +549,11 @@ namespace Mono.CSharp
return variable.IsStructFieldAssigned (DefiniteAssignment, name);
}
public void SetLabelStack (Dictionary<Statement, List<DefiniteAssignmentBitSet>> labelStack)
{
LabelStack = labelStack;
}
public void SetVariableAssigned (VariableInfo variable, bool generatedAssignment = false)
{
variable.SetAssigned (DefiniteAssignment, generatedAssignment);

View File

@@ -2465,6 +2465,12 @@ namespace Mono.CSharp
case '\"':
++str_quote;
break;
case '\\':
// Skip escaped " character
c = reader.Read ();
if (c == -1)
res = false;
break;
case -1:
res = false;
break;

View File

@@ -18,7 +18,7 @@ using System.Diagnostics;
using System.Text;
using Mono.CompilerServices.SymbolWriter;
#if NET_2_1
#if MOBILE
using XmlElement = System.Object;
#else
using System.Xml;

View File

@@ -1 +1 @@
020166ddf94f9f86b0a2c64c968df999e14695e3
39ee29f1c5df056194e1d3f7e14c8e2577c863cd

View File

@@ -1134,7 +1134,7 @@ namespace Mono.CSharp
QuitRequested = true;
}
#if !NET_2_1
#if !MOBILE
/// <summary>
/// Describes an object or a type.
/// </summary>

View File

@@ -1 +1 @@
2a9aa97fed0e62be46728b7c4dccb871de0ff0cc
2968ee08584f544f7869efba43e4007b9f259888

View File

@@ -773,6 +773,7 @@ namespace Mono.CSharp {
TypeSpec[] targs;
TypeSpec[] ifaces_defined;
TypeSpec effective_base;
MemberCache interface_cache;
//
// Creates type owned type parameter
@@ -882,6 +883,12 @@ namespace Mono.CSharp {
}
}
public MemberCache InterfaceCache {
get {
return interface_cache;
}
}
//
// Unexpanded interfaces list
//
@@ -1351,13 +1358,27 @@ namespace Mono.CSharp {
// 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
//
bool has_user_base_type = false;
if (BaseType.BuiltinType != BuiltinTypeSpec.Type.Object && BaseType.BuiltinType != BuiltinTypeSpec.Type.ValueType) {
cache.AddBaseType (BaseType);
has_user_base_type = true;
}
if (InterfacesDefined != null) {
var icache = cache;
if (has_user_base_type) {
//
// type-parameter lookup rules are more complicated that other types lookup rules.
// Effective base class and its base types member have priority over interface
// constraints which means we cannot lookup interface members before class members
// hence we setup secondary cache for such cases.
//
interface_cache = new MemberCache ();
icache = interface_cache;
}
foreach (var iface_type in InterfacesDefined) {
cache.AddInterface (iface_type);
icache.AddInterface (iface_type);
}
}
@@ -1370,8 +1391,14 @@ namespace Mono.CSharp {
var ifaces = tps == null ? ta.Interfaces : tps.InterfacesDefined;
if (ifaces != null) {
var icache = cache;
if (has_user_base_type) {
interface_cache = new MemberCache ();
icache = interface_cache;
}
foreach (var iface_type in ifaces) {
cache.AddInterface (iface_type);
icache.AddInterface (iface_type);
}
}
}

View File

@@ -239,6 +239,7 @@ namespace Mono.CSharp
readonly List<Tuple<AssemblyName, string, Assembly>> loaded_names;
static readonly Dictionary<string, string[]> sdk_directory;
Dictionary<AssemblyName, List<AssemblyReferenceMessageInfo>> resolved_version_mismatches;
static readonly TypeName objectTypeName = new TypeName ("System", "Object");
static StaticLoader ()
{
@@ -257,7 +258,7 @@ namespace Mono.CSharp
this.importer = importer;
domain = new Universe (UniverseOptions.MetadataOnly | UniverseOptions.ResolveMissingMembers |
UniverseOptions.DisableFusion | UniverseOptions.DecodeVersionInfoAttributeBlobs |
UniverseOptions.DeterministicOutput);
UniverseOptions.DeterministicOutput | UniverseOptions.DisableDefaultAssembliesLookup);
domain.AssemblyResolve += AssemblyReferenceResolver;
loaded_names = new List<Tuple<AssemblyName, string, Assembly>> ();
@@ -355,26 +356,23 @@ namespace Mono.CSharp
}
if (version_mismatch != null) {
if (version_mismatch is AssemblyBuilder)
if (is_fx_assembly || version_mismatch is AssemblyBuilder)
return version_mismatch;
var ref_an = new AssemblyName (refname);
var v1 = ref_an.Version;
var v2 = version_mismatch.GetName ().Version;
AssemblyReferenceMessageInfo messageInfo;
if (v1 > v2) {
var messageInfo = new AssemblyReferenceMessageInfo (ref_an, report => {
messageInfo = new AssemblyReferenceMessageInfo (ref_an, report => {
report.SymbolRelatedToPreviousError (args.RequestingAssembly.Location);
report.Error (1705, 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));
});
AddReferenceVersionMismatch (args.RequestingAssembly.GetName (), messageInfo);
return version_mismatch;
}
if (!is_fx_assembly) {
var messageInfo = new AssemblyReferenceMessageInfo (ref_an, report => {
} else {
messageInfo = new AssemblyReferenceMessageInfo (ref_an, report => {
if (v1.Major != v2.Major || v1.Minor != v2.Minor) {
report.Warning (1701, 2,
"Assuming assembly reference `{0}' matches assembly `{1}'. You may need to supply runtime policy",
@@ -385,10 +383,10 @@ namespace Mono.CSharp
refname, version_mismatch.GetName ().FullName);
}
});
AddReferenceVersionMismatch (args.RequestingAssembly.GetName (), messageInfo);
}
AddReferenceVersionMismatch (args.RequestingAssembly.GetName (), messageInfo);
return version_mismatch;
}
@@ -452,10 +450,15 @@ namespace Mono.CSharp
return list;
}
public override bool HasObjectType (Assembly assembly)
public override Assembly HasObjectType (Assembly assembly)
{
try {
return assembly.GetType (compiler.BuiltinTypes.Object.FullName) != null;
// System.Object can be forwarded and ikvm
// transparently finds it in target assembly therefore
// need to return actual obj assembly becauase in such
// case it's different to assembly parameter
var obj = assembly.FindType (objectTypeName);
return obj == null ? null : obj.Assembly;
} catch (Exception e) {
throw new InternalErrorException (e, "Failed to load assembly `{0}'", assembly.FullName);
}

View File

@@ -142,6 +142,7 @@ namespace Mono.CSharp
compiled_types = new Dictionary<MetaType, TypeSpec> (40, ReferenceEquality<MetaType>.Default);
assembly_2_definition = new Dictionary<Assembly, IAssemblyDefinition> (ReferenceEquality<Assembly>.Default);
IgnorePrivateMembers = true;
IgnoreCompilerGeneratedField = true;
}
#region Properties
@@ -154,6 +155,8 @@ namespace Mono.CSharp
public bool IgnorePrivateMembers { get; set; }
public bool IgnoreCompilerGeneratedField { get; set; }
#endregion
public abstract void AddCompiledType (TypeBuilder builder, TypeSpec spec);
@@ -179,8 +182,10 @@ namespace Mono.CSharp
break;
default:
// Ignore private fields (even for error reporting) to not require extra dependencies
if ((IgnorePrivateMembers && !declaringType.IsStruct) ||
HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace))
if (IgnorePrivateMembers && !declaringType.IsStruct)
return null;
if (IgnoreCompilerGeneratedField && HasAttribute (CustomAttributeData.GetCustomAttributes (fi), "CompilerGeneratedAttribute", CompilerServicesNamespace))
return null;
mod = Modifiers.PRIVATE;

View File

@@ -254,7 +254,7 @@ namespace Mono.CSharp
// Special format which encodes original variable name and
// it's scope to support lifted variables debugging. This
// is same what csc does and allows to correctly set fields
// scope information (like ambiguity, our of scope, etc).
// scope information (like ambiguity, out of scope, etc).
//
var id = rc.CurrentBlock.Explicit.GetDebugSymbolScopeIndex ();
return "<" + local_info.Name + ">__" + id;
@@ -1067,6 +1067,7 @@ namespace Mono.CSharp
method.Block = new ToplevelBlock (method.Compiler, method.ParameterInfo, loc,
ToplevelBlock.Flags.CompilerGenerated | ToplevelBlock.Flags.NoFlowAnalysis);
method.Block.AddStatement (new TryFinallyBlockProxyStatement (this, block));
// Cannot it add to storey because it'd be emitted before nested

View File

@@ -22,7 +22,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
<Commandlineparameters>y.cs</Commandlineparameters>
<Commandlineparameters></Commandlineparameters>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>

View File

@@ -406,8 +406,13 @@ namespace Mono.CSharp {
public static MemberSpec FindMember (TypeSpec container, MemberFilter filter, BindingRestriction restrictions)
{
if (filter.Kind == MemberKind.Method && container.Kind == MemberKind.TypeParameter && filter.Parameters == null)
throw new NotSupportedException ("type parameters methods cannot be lookup up due to two stage setup");
IList<MemberSpec> applicable;
var top_container = container;
do {
IList<MemberSpec> applicable;
if (container.MemberCache.member_hash.TryGetValue (filter.Name, out applicable)) {
// Start from the end because interface members are in reverse order
for (int i = applicable.Count - 1; i >= 0; i--) {
@@ -438,6 +443,26 @@ namespace Mono.CSharp {
container = container.BaseType;
} while (container != null);
var tps = top_container as TypeParameterSpec;
if (tps != null && tps.InterfaceCache != null) {
if (tps.InterfaceCache.member_hash.TryGetValue (filter.Name, out applicable)) {
for (int i = applicable.Count - 1; i >= 0; i--) {
var entry = applicable [i];
if ((restrictions & BindingRestriction.NoAccessors) != 0 && entry.IsAccessor)
continue;
if ((restrictions & BindingRestriction.OverrideOnly) != 0 && (entry.Modifiers & Modifiers.OVERRIDE) == 0)
continue;
if (!filter.Equals (entry))
continue;
return entry;
}
}
}
return null;
}
@@ -450,9 +475,9 @@ namespace Mono.CSharp {
//
public static IList<MemberSpec> FindMembers (TypeSpec container, string name, bool declaredOnlyClass)
{
IList<MemberSpec> applicable;
do {
IList<MemberSpec> applicable;
if (container.MemberCache.member_hash.TryGetValue (name, out applicable) || declaredOnlyClass)
return applicable;
@@ -462,6 +487,17 @@ namespace Mono.CSharp {
return null;
}
public static IList<MemberSpec> FindInterfaceMembers (TypeParameterSpec typeParameter, string name)
{
if (typeParameter.InterfaceCache != null) {
IList<MemberSpec> applicable;
typeParameter.InterfaceCache.member_hash.TryGetValue (name, out applicable);
return applicable;
}
return null;
}
//
// Finds the nested type in container
//

View File

@@ -21,7 +21,7 @@ using System.Linq;
using Mono.CompilerServices.SymbolWriter;
using System.Runtime.CompilerServices;
#if NET_2_1
#if MOBILE
using XmlElement = System.Object;
#else
using System.Xml;

View File

@@ -17,7 +17,7 @@ using System.Collections.Generic;
using System.Text;
using Mono.CompilerServices.SymbolWriter;
#if NET_2_1
#if MOBILE
using XmlElement = System.Object;
#endif
@@ -1210,12 +1210,11 @@ namespace Mono.CSharp
backing_field = new Field (Parent,
new TypeExpression (MemberType, Location),
Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.DEBUGGER_HIDDEN | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
MemberName, null);
Parent.PartialContainer.Members.Add (backing_field);
backing_field.Initializer = Initializer;
backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;
// Call define because we passed fields definition
backing_field.Define ();

View File

@@ -418,7 +418,7 @@ namespace Mono.CSharp
default_references.Add ("System");
default_references.Add ("System.Xml");
#if NET_2_1
#if MOBILE
default_references.Add ("System.Net");
default_references.Add ("System.Windows");
default_references.Add ("System.Windows.Browser");
@@ -440,9 +440,9 @@ namespace Mono.CSharp
return Path.GetDirectoryName (typeof (object).Assembly.Location);
}
public override bool HasObjectType (Assembly assembly)
public override Assembly HasObjectType (Assembly assembly)
{
return assembly.GetType (compiler.BuiltinTypes.Object.FullName) != null;
return assembly.GetType (compiler.BuiltinTypes.Object.FullName) == null ? null : assembly;
}
public override Assembly LoadAssemblyFile (string assembly, bool isImplicitReference)

View File

@@ -61,12 +61,10 @@ namespace Mono.CSharp {
8009, 8094
};
static HashSet<int> AllWarningsHashSet;
public Report (CompilerContext context, ReportPrinter printer)
{
if (context == null)
throw new ArgumentNullException ("settings");
throw new ArgumentNullException ("context");
if (printer == null)
throw new ArgumentNullException ("printer");
@@ -175,18 +173,6 @@ namespace Mono.CSharp {
extra_information.Add (msg);
}
public bool CheckWarningCode (int code, Location loc)
{
if (AllWarningsHashSet == null)
AllWarningsHashSet = new HashSet<int> (AllWarnings);
if (AllWarningsHashSet.Contains (code))
return true;
Warning (1691, 1, loc, "`{0}' is not a valid warning number", code);
return false;
}
public void ExtraInformation (Location loc, string msg)
{
extra_information.Add (String.Format ("{0} {1}", loc, msg));
@@ -1109,8 +1095,7 @@ namespace Mono.CSharp {
public void WarningDisable (Location location, int code, Report Report)
{
if (Report.CheckWarningCode (code, location))
regions.Add (new Disable (location.Row, code));
regions.Add (new Disable (location.Row, code));
}
public void WarningEnable (int line)
@@ -1120,9 +1105,6 @@ namespace Mono.CSharp {
public void WarningEnable (Location location, int code, CompilerContext context)
{
if (!context.Report.CheckWarningCode (code, location))
return;
if (context.Settings.IsWarningDisabledGlobally (code))
context.Report.Warning (1635, 1, location, "Cannot restore warning `CS{0:0000}' because it was disabled globally", code);

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