Browse Source

Updated mcs.

newNRvisualizers
Mike Krüger 13 years ago
parent
commit
6820c5d253
  1. 13
      ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs
  2. 9307
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  3. 62
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay
  4. 2
      ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs
  5. 27
      ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs
  6. 49
      ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs
  7. 4
      ICSharpCode.NRefactory.CSharp/Parser/mcs/flowanalysis.cs
  8. 10
      ICSharpCode.NRefactory.CSharp/Parser/mcs/generic.cs
  9. 14
      ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs

13
ICSharpCode.NRefactory.CSharp/Parser/mcs/class.cs

@ -1031,6 +1031,9 @@ namespace Mono.CSharp @@ -1031,6 +1031,9 @@ namespace Mono.CSharp
internal override void GenerateDocComment (DocumentationBuilder builder)
{
if (IsPartialPart)
return;
base.GenerateDocComment (builder);
foreach (var member in members)
@ -3452,6 +3455,16 @@ namespace Mono.CSharp @@ -3452,6 +3455,16 @@ namespace Mono.CSharp
get { return IsExplicitImpl || base.IsUsed; }
}
public override void SetConstraints (List<Constraints> constraints_list)
{
if (((ModFlags & Modifiers.OVERRIDE) != 0 || IsExplicitImpl)) {
Report.Error (460, Location,
"`{0}': Cannot specify constraints for overrides and explicit interface implementation methods",
GetSignatureForError ());
}
base.SetConstraints (constraints_list);
}
}
public abstract class MemberBase : MemberCore

9307
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs

File diff suppressed because it is too large Load Diff

62
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

@ -544,7 +544,7 @@ namespace_declaration @@ -544,7 +544,7 @@ namespace_declaration
var name = (MemberName) $3;
var ns = new NamespaceContainer (name, current_namespace);
lbag.AddLocation (current_container, GetLocation ($2));
lbag.AddLocation (ns, GetLocation ($2));
current_namespace.AddTypeContainer (ns);
}
;
@ -1015,6 +1015,14 @@ constant_declaration @@ -1015,6 +1015,14 @@ constant_declaration
lbag.AddMember (current_field, GetModifierLocations (), GetLocation ($3), GetLocation ($9));
current_field = null;
}
| opt_attributes
opt_modifiers
CONST type error
{
Error_SyntaxError (yyToken);
current_type.AddMember (new Const (current_type, (FullNamedExpression) $4, (Modifiers) $2, MemberName.Null, (Attributes) $1));
}
;
opt_constant_declarators
@ -1242,10 +1250,7 @@ method_declaration @@ -1242,10 +1250,7 @@ method_declaration
if (doc_support)
Lexer.doc_state = XmlCommentState.NotAllowed;
// Add it early in the case of body being eof for full ast
Method m = (Method) $1;
async_block = (m.ModFlags & Modifiers.ASYNC) != 0;
current_type.AddMember (m);
// Was added earlier in the case of body being eof for full ast
}
method_body
{
@ -1285,26 +1290,35 @@ method_header @@ -1285,26 +1290,35 @@ method_header
}
opt_formal_parameter_list CLOSE_PARENS
{
lexer.ConstraintsParsing = true;
}
opt_type_parameter_constraints_clauses
{
lexer.ConstraintsParsing = false;
valid_param_mod = 0;
MemberName name = (MemberName) $4;
current_local_parameters = (ParametersCompiled) $7;
var method = Method.Create (current_type, (FullNamedExpression) $3, (Modifiers) $2,
name, current_local_parameters, (Attributes) $1, $10 != null);
name, current_local_parameters, (Attributes) $1);
current_type.AddMember (method);
async_block = (method.ModFlags & Modifiers.ASYNC) != 0;
if ($10 != null)
method.SetConstraints ((List<Constraints>) $10);
if (doc_support)
method.DocComment = Lexer.consume_doc_comment ();
lbag.AddMember (method, GetModifierLocations (), GetLocation ($5), GetLocation ($8));
$$ = method;
lexer.ConstraintsParsing = true;
}
opt_type_parameter_constraints_clauses
{
lexer.ConstraintsParsing = false;
if ($10 != null) {
var method = (Method) $9;
method.SetConstraints ((List<Constraints>) $10);
}
$$ = $9;
}
| opt_attributes
opt_modifiers
@ -1335,7 +1349,9 @@ method_header @@ -1335,7 +1349,9 @@ method_header
modifiers |= Modifiers.PARTIAL;
var method = Method.Create (current_type, new TypeExpression (compiler.BuiltinTypes.Void, GetLocation ($4)),
modifiers, name, current_local_parameters, (Attributes) $1, $11 != null);
modifiers, name, current_local_parameters, (Attributes) $1);
current_type.AddMember (method);
if ($11 != null)
method.SetConstraints ((List<Constraints>) $11);
@ -1357,7 +1373,9 @@ method_header @@ -1357,7 +1373,9 @@ method_header
"Member modifier `{0}' must precede the member type and name", ModifiersExtensions.Name ((Modifiers) $4));
var method = Method.Create (current_type, (FullNamedExpression) $3,
0, name, (ParametersCompiled) $7, (Attributes) $1, false);
0, name, (ParametersCompiled) $7, (Attributes) $1);
current_type.AddMember (method);
current_local_parameters = (ParametersCompiled) $7;
@ -1376,7 +1394,9 @@ method_header @@ -1376,7 +1394,9 @@ method_header
MemberName name = (MemberName) $4;
var method = Method.Create (current_type, (FullNamedExpression) $3, (Modifiers) $2,
name, current_local_parameters, (Attributes) $1, false);
name, current_local_parameters, (Attributes) $1);
current_type.AddMember (method);
if (doc_support)
method.DocComment = Lexer.consume_doc_comment ();
@ -2392,6 +2412,14 @@ event_declaration @@ -2392,6 +2412,14 @@ event_declaration
current_event = null;
current_local_parameters = null;
}
| opt_attributes
opt_modifiers
EVENT type error
{
Error_SyntaxError (yyToken);
current_type.AddMember (new EventField (current_type, (FullNamedExpression) $4, (Modifiers) $2, MemberName.Null, (Attributes) $1));
}
;
opt_event_initializer

2
ICSharpCode.NRefactory.CSharp/Parser/mcs/decl.cs

@ -472,7 +472,7 @@ namespace Mono.CSharp { @@ -472,7 +472,7 @@ namespace Mono.CSharp {
caching_flags |= Flags.IsAssigned;
}
public void SetConstraints (List<Constraints> constraints_list)
public virtual void SetConstraints (List<Constraints> constraints_list)
{
var tparams = member_name.TypeParameters;
if (tparams == null) {

27
ICSharpCode.NRefactory.CSharp/Parser/mcs/ecore.cs

@ -3,11 +3,11 @@ @@ -3,11 +3,11 @@
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
// Marek Safar (marek.safar@seznam.cz)
// Marek Safar (marek.safar@gmail.com)
//
// Copyright 2001, 2002, 2003 Ximian, Inc.
// Copyright 2003-2008 Novell, Inc.
// Copyright 2011 Xamarin Inc.
// Copyright 2011-2012 Xamarin Inc.
//
//
@ -1024,15 +1024,30 @@ namespace Mono.CSharp { @@ -1024,15 +1024,30 @@ namespace Mono.CSharp {
if (es == null)
Error_InvalidExpressionStatement (ec);
if (ec.CurrentAnonymousMethod is AsyncInitializer && !(e is Assign) &&
(e.Type.IsGenericTask || e.Type == ec.Module.PredefinedTypes.Task.TypeSpec)) {
ec.Report.Warning (4014, 1, e.Location,
"The statement is not awaited and execution of current method continues before the call is completed. Consider using `await' operator");
if (!(e is Assign) && (e.Type.IsGenericTask || e.Type == ec.Module.PredefinedTypes.Task.TypeSpec)) {
WarningAsyncWithoutWait (ec, e);
}
return es;
}
static void WarningAsyncWithoutWait (BlockContext bc, Expression e)
{
if (bc.CurrentAnonymousMethod is AsyncInitializer) {
bc.Report.Warning (4014, 1, e.Location,
"The statement is not awaited and execution of current method continues before the call is completed. Consider using `await' operator");
return;
}
var inv = e as Invocation;
if (inv != null && inv.MethodGroup != null && inv.MethodGroup.BestCandidate.IsAsync) {
// The warning won't be reported for imported methods to maintain warning compatiblity with csc
bc.Report.Warning (4014, 1, e.Location,
"The statement is not awaited and execution of current method continues before the call is completed. Consider using `await' operator or calling `Wait' method");
return;
}
}
/// <summary>
/// Requests the expression to be emitted in a `statement'
/// context. This means that no new value is left on the

49
ICSharpCode.NRefactory.CSharp/Parser/mcs/expression.cs

@ -6180,7 +6180,7 @@ namespace Mono.CSharp @@ -6180,7 +6180,7 @@ namespace Mono.CSharp
// We use this to store all the data values in the order in which we
// will need to store them in the byte blob later
//
array_data = new List<Expression> ();
array_data = new List<Expression> (probe.Count);
bounds = new Dictionary<int, int> ();
}
@ -6486,12 +6486,12 @@ namespace Mono.CSharp @@ -6486,12 +6486,12 @@ namespace Mono.CSharp
}
break;
case BuiltinTypeSpec.Type.Float:
element = BitConverter.GetBytes ((float) v);
var fval = SingleConverter.SingleToInt32Bits((float) v);
for (int j = 0; j < factor; ++j)
data[idx + j] = element[j];
if (!BitConverter.IsLittleEndian)
System.Array.Reverse (data, idx, 4);
data[idx] = (byte) (fval & 0xff);
data[idx + 1] = (byte) ((fval >> 8) & 0xff);
data[idx + 2] = (byte) ((fval >> 16) & 0xff);
data[idx + 3] = (byte) (fval >> 24);
break;
case BuiltinTypeSpec.Type.Double:
element = BitConverter.GetBytes ((double) v);
@ -6818,38 +6818,7 @@ namespace Mono.CSharp @@ -6818,38 +6818,7 @@ namespace Mono.CSharp
//
class ImplicitlyTypedArrayCreation : ArrayCreation
{
sealed class InferenceContext : TypeInferenceContext
{
class ExpressionBoundInfo : BoundInfo
{
readonly Expression expr;
public ExpressionBoundInfo (Expression expr)
: base (expr.Type, BoundKind.Lower)
{
this.expr = expr;
}
public override bool Equals (BoundInfo other)
{
// We are using expression not type for conversion check
// no optimization based on types is possible
return false;
}
public override Expression GetTypeExpression ()
{
return expr;
}
}
public void AddExpression (Expression expr)
{
AddToBounds (new ExpressionBoundInfo (expr), 0);
}
}
InferenceContext best_type_inference;
TypeInferenceContext best_type_inference;
public ImplicitlyTypedArrayCreation (ComposedTypeSpecifier rank, ArrayInitializer initializers, Location loc)
: base (null, rank, initializers, loc)
@ -6868,7 +6837,7 @@ namespace Mono.CSharp @@ -6868,7 +6837,7 @@ namespace Mono.CSharp
dimensions = rank.Dimension;
best_type_inference = new InferenceContext ();
best_type_inference = new TypeInferenceContext ();
if (!ResolveInitializers (ec))
return null;
@ -6913,7 +6882,7 @@ namespace Mono.CSharp @@ -6913,7 +6882,7 @@ namespace Mono.CSharp
{
element = element.Resolve (ec);
if (element != null)
best_type_inference.AddExpression (element);
best_type_inference.AddCommonTypeBound (element.Type);
return element;
}

4
ICSharpCode.NRefactory.CSharp/Parser/mcs/flowanalysis.cs

@ -117,7 +117,7 @@ namespace Mono.CSharp @@ -117,7 +117,7 @@ namespace Mono.CSharp
// </summary>
public readonly Location Location;
static int next_id = 0;
static int next_id;
int id;
// <summary>
@ -163,7 +163,7 @@ namespace Mono.CSharp @@ -163,7 +163,7 @@ namespace Mono.CSharp
MyBitVector locals;
bool is_unreachable;
static int next_id = 0;
static int next_id;
int id;
//

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

@ -505,7 +505,7 @@ namespace Mono.CSharp { @@ -505,7 +505,7 @@ namespace Mono.CSharp {
// Copy constraint from resolved part to partial container
spec.SpecialConstraint = tp.spec.SpecialConstraint;
spec.InterfacesDefined = tp.spec.InterfacesDefined;
spec.Interfaces = tp.spec.Interfaces;
spec.TypeArguments = tp.spec.TypeArguments;
spec.BaseType = tp.spec.BaseType;
@ -2716,7 +2716,7 @@ namespace Mono.CSharp { @@ -2716,7 +2716,7 @@ namespace Mono.CSharp {
Upper = 2
}
protected class BoundInfo : IEquatable<BoundInfo>
struct BoundInfo : IEquatable<BoundInfo>
{
public readonly TypeSpec Type;
public readonly BoundKind Kind;
@ -2732,14 +2732,14 @@ namespace Mono.CSharp { @@ -2732,14 +2732,14 @@ namespace Mono.CSharp {
return Type.GetHashCode ();
}
public virtual Expression GetTypeExpression ()
public Expression GetTypeExpression ()
{
return new TypeExpression (Type, Location.Null);
}
#region IEquatable<BoundInfo> Members
public virtual bool Equals (BoundInfo other)
public bool Equals (BoundInfo other)
{
return Type == other.Type && Kind == other.Kind;
}
@ -2795,7 +2795,7 @@ namespace Mono.CSharp { @@ -2795,7 +2795,7 @@ namespace Mono.CSharp {
AddToBounds (new BoundInfo (type, BoundKind.Lower), 0);
}
protected void AddToBounds (BoundInfo bound, int index)
void AddToBounds (BoundInfo bound, int index)
{
//
// Some types cannot be used as type arguments

14
ICSharpCode.NRefactory.CSharp/Parser/mcs/method.cs

@ -243,6 +243,12 @@ namespace Mono.CSharp { @@ -243,6 +243,12 @@ namespace Mono.CSharp {
}
}
public bool IsAsync {
get {
return (Modifiers & Modifiers.ASYNC) != 0;
}
}
public bool IsExtensionMethod {
get {
return IsStatic && parameters.HasExtensionMethodType;
@ -846,16 +852,10 @@ namespace Mono.CSharp { @@ -846,16 +852,10 @@ namespace Mono.CSharp {
}
public static Method Create (TypeDefinition parent, FullNamedExpression returnType, Modifiers mod,
MemberName name, ParametersCompiled parameters, Attributes attrs, bool hasConstraints)
MemberName name, ParametersCompiled parameters, Attributes attrs)
{
var m = new Method (parent, returnType, mod, name, parameters, attrs);
if (hasConstraints && ((mod & Modifiers.OVERRIDE) != 0 || m.IsExplicitImpl)) {
m.Report.Error (460, m.Location,
"`{0}': Cannot specify constraints for overrides and explicit interface implementation methods",
m.GetSignatureForError ());
}
if ((mod & Modifiers.PARTIAL) != 0) {
const Modifiers invalid_partial_mod = Modifiers.AccessibilityMask | Modifiers.ABSTRACT | Modifiers.EXTERN |
Modifiers.NEW | Modifiers.OVERRIDE | Modifiers.SEALED | Modifiers.VIRTUAL;

Loading…
Cancel
Save