Browse Source

Updated mcs sources.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
48b696888c
  1. 17
      ICSharpCode.NRefactory.CSharp/Parser/mcs/assembly.cs
  2. 25
      ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs
  3. 57
      ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs
  4. 24
      ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs
  5. 28
      ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs

17
ICSharpCode.NRefactory.CSharp/Parser/mcs/assembly.cs

@ -318,17 +318,16 @@ namespace Mono.CSharp @@ -318,17 +318,16 @@ namespace Mono.CSharp
string assembly_name = a.GetString ();
if (assembly_name.Length == 0)
return;
AssemblyName aname = null;
try {
aname = new AssemblyName (assembly_name);
} catch (Exception) {
#if STATIC
ParsedAssemblyName aname;
ParseAssemblyResult r = Fusion.ParseAssemblyName (assembly_name, out aname);
if (r != ParseAssemblyResult.OK) {
Report.Warning (1700, 3, a.Location, "Assembly reference `{0}' is invalid and cannot be resolved",
assembly_name);
return;
}
if (aname.Version != null || aname.CultureInfo != null || aname.ProcessorArchitecture != ProcessorArchitecture.None) {
if (aname.Version != null || aname.Culture != null || aname.ProcessorArchitecture != ProcessorArchitecture.None) {
Report.Error (1725, a.Location,
"Friend assembly reference `{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture or processor architecture specified",
assembly_name);
@ -336,13 +335,13 @@ namespace Mono.CSharp @@ -336,13 +335,13 @@ namespace Mono.CSharp
return;
}
// TODO: GetPublicKey () does not work on .NET when AssemblyName is constructed from a string
if (public_key != null && aname.GetPublicKey () == null) {
if (public_key != null && !aname.HasPublicKey) {
Report.Error (1726, a.Location,
"Friend assembly reference `{0}' is invalid. Strong named assemblies must specify a public key in their InternalsVisibleTo declarations",
assembly_name);
return;
}
#endif
} else if (a.Type == pa.RuntimeCompatibility) {
wrap_non_exception_throws_custom = true;
} else if (a.Type == pa.AssemblyFileVersion) {
@ -827,7 +826,7 @@ namespace Mono.CSharp @@ -827,7 +826,7 @@ namespace Mono.CSharp
Compiler.TimeReporter.Stop (TimeReporter.TimerType.OutputSave);
// Save debug symbols file
if (symbol_writer != null) {
if (symbol_writer != null && Compiler.Report.Errors == 0) {
// TODO: it should run in parallel
Compiler.TimeReporter.Start (TimeReporter.TimerType.DebugSave);
symbol_writer.WriteSymbolFile (SymbolWriter.GetGuid (module.Builder));

25
ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs

@ -3264,7 +3264,7 @@ namespace Mono.CSharp { @@ -3264,7 +3264,7 @@ namespace Mono.CSharp {
return LowerBoundInference (u_ac.Element, v_i);
}
if (TypeManager.IsGenericType (v)) {
if (v.IsGenericOrParentIsGeneric) {
//
// if V is a constructed type C<V1..Vk> and there is a unique type C<U1..Uk>
// such that U is identical to, inherits from (directly or indirectly),
@ -3292,8 +3292,8 @@ namespace Mono.CSharp { @@ -3292,8 +3292,8 @@ namespace Mono.CSharp {
}
}
TypeSpec [] unique_candidate_targs = null;
TypeSpec[] ga_v = TypeManager.GetTypeArguments (v);
TypeSpec[] unique_candidate_targs = null;
var ga_v = TypeSpec.GetAllTypeArguments (v);
foreach (TypeSpec u_candidate in u_candidates) {
//
// The unique set of types U1..Uk means that if we have an interface I<T>,
@ -3301,7 +3301,7 @@ namespace Mono.CSharp { @@ -3301,7 +3301,7 @@ namespace Mono.CSharp {
// type I<T> by applying type U because T could be int or long
//
if (unique_candidate_targs != null) {
TypeSpec[] second_unique_candidate_targs = TypeManager.GetTypeArguments (u_candidate);
TypeSpec[] second_unique_candidate_targs = TypeSpec.GetAllTypeArguments (u_candidate);
if (TypeSpecComparer.Equals (unique_candidate_targs, second_unique_candidate_targs)) {
unique_candidate_targs = second_unique_candidate_targs;
continue;
@ -3327,15 +3327,25 @@ namespace Mono.CSharp { @@ -3327,15 +3327,25 @@ namespace Mono.CSharp {
for (int i = 0; i < unique_candidate_targs.Length; ++i)
unique_candidate_targs[i] = u_candidate;
} else {
unique_candidate_targs = TypeManager.GetTypeArguments (u_candidate);
unique_candidate_targs = TypeSpec.GetAllTypeArguments (u_candidate);
}
}
if (unique_candidate_targs != null) {
var ga_open_v = open_v.TypeParameters;
int score = 0;
int tp_index = -1;
TypeParameterSpec[] tps = null;
for (int i = 0; i < unique_candidate_targs.Length; ++i) {
Variance variance = ga_open_v [i].Variance;
if (tp_index < 0) {
while (v.Arity == 0)
v = v.DeclaringType;
tps = v.MemberDefinition.TypeParameters;
tp_index = tps.Length - 1;
}
Variance variance = tps [tp_index--].Variance;
TypeSpec u_i = unique_candidate_targs [i];
if (variance == Variance.None || TypeSpec.IsValueType (u_i)) {
@ -3349,6 +3359,7 @@ namespace Mono.CSharp { @@ -3349,6 +3359,7 @@ namespace Mono.CSharp {
++score;
}
}
return score;
}
}

57
ICSharpCode.NRefactory.CSharp/Parser/mcs/statement.cs

@ -667,6 +667,32 @@ namespace Mono.CSharp { @@ -667,6 +667,32 @@ namespace Mono.CSharp {
}
}
public class StatementErrorExpression : Statement
{
readonly Expression expr;
public StatementErrorExpression (Expression expr)
{
this.expr = expr;
}
public Expression Expression {
get {
return expr;
}
}
protected override void DoEmit (EmitContext ec)
{
throw new NotSupportedException ();
}
protected override void CloneTo (CloneContext clonectx, Statement target)
{
throw new NotImplementedException ();
}
}
//
// Simple version of statement list not requiring a block
//
@ -6161,35 +6187,4 @@ namespace Mono.CSharp { @@ -6161,35 +6187,4 @@ namespace Mono.CSharp {
return visitor.Visit (this);
}
}
public class StatementErrorExpression : Statement
{
readonly Expression expr;
public Expression Expression {
get {
return expr;
}
}
public StatementErrorExpression (Expression expr)
{
this.expr = expr;
}
protected override void DoEmit (EmitContext ec)
{
throw new NotImplementedException ();
}
protected override void CloneTo (CloneContext clonectx, Statement target)
{
throw new NotImplementedException ();
}
public override object Accept (StructuralVisitor visitor)
{
return visitor.Visit (this);
}
}
}

24
ICSharpCode.NRefactory.CSharp/Parser/mcs/typespec.cs

@ -390,6 +390,30 @@ namespace Mono.CSharp @@ -390,6 +390,30 @@ namespace Mono.CSharp
return true;
}
//
// Returns all type arguments, usefull for nested types
//
public static TypeSpec[] GetAllTypeArguments (TypeSpec type)
{
IList<TypeSpec> targs = TypeSpec.EmptyTypes;
do {
if (type.Arity > 0) {
if (targs.Count == 0) {
targs = type.TypeArguments;
} else {
var list = targs as List<TypeSpec> ?? new List<TypeSpec> (targs);
list.AddRange (type.TypeArguments);
targs = list;
}
}
type = type.declaringType;
} while (type != null);
return targs as TypeSpec[] ?? ((List<TypeSpec>) targs).ToArray ();
}
public AttributeUsageAttribute GetAttributeUsage (PredefinedAttribute pa)
{
if (Kind != MemberKind.Class)

28
ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
// Dual licensed under the terms of the MIT X11 or GNU GPL
//
// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
// Copyright 2011 Xamarin Inc
//
using System;
@ -178,7 +179,7 @@ namespace Mono.CSharp @@ -178,7 +179,7 @@ namespace Mono.CSharp
{
return null;
}
public virtual object Visit (EmptyExpression emptyExpression)
{
return null;
@ -200,73 +201,66 @@ namespace Mono.CSharp @@ -200,73 +201,66 @@ namespace Mono.CSharp
return null;
}
public virtual object Visit (While whileStatement)
{
return null;
}
public virtual object Visit (For forStatement)
{
return null;
}
public virtual object Visit (StatementExpression statementExpression)
{
return null;
}
public virtual object Visit (StatementErrorExpression errorStatement)
{
return null;
}
public virtual object Visit (Return returnStatement)
{
return null;
}
public virtual object Visit (Goto gotoStatement)
{
return null;
}
public virtual object Visit (LabeledStatement labeledStatement)
{
return null;
}
public virtual object Visit (GotoDefault gotoDefault)
{
return null;
}
public virtual object Visit (GotoCase gotoCase)
{
return null;
}
public virtual object Visit (Throw throwStatement)
{
return null;
}
public virtual object Visit (Break breakStatement)
{
return null;
}
public virtual object Visit (Continue continueStatement)
{
return null;
}
public virtual object Visit (Block blockStatement)
{
return null;
@ -287,19 +281,16 @@ namespace Mono.CSharp @@ -287,19 +281,16 @@ namespace Mono.CSharp
return null;
}
public virtual object Visit (Unchecked uncheckedStatement)
{
return null;
}
public virtual object Visit (Checked checkedStatement)
{
return null;
}
public virtual object Visit (Unsafe unsafeStatement)
{
return null;
@ -317,7 +308,6 @@ namespace Mono.CSharp @@ -317,7 +308,6 @@ namespace Mono.CSharp
return null;
}
public virtual object Visit (TryCatch tryCatchStatement)
{
return null;
@ -445,7 +435,6 @@ namespace Mono.CSharp @@ -445,7 +435,6 @@ namespace Mono.CSharp
return null;
}
public virtual object Visit (Conditional conditionalExpression)
{
return null;
@ -646,10 +635,5 @@ namespace Mono.CSharp @@ -646,10 +635,5 @@ namespace Mono.CSharp
{
return null;
}
public virtual object Visit (StatementErrorExpression statementErrorExpression)
{
return null;
}
}
}
Loading…
Cancel
Save