Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/mcs/cs-parser.jay')
-rw-r--r--mcs/mcs/cs-parser.jay92
1 files changed, 64 insertions, 28 deletions
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index 3b1c82ec761..3c043b2e0c6 100644
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -620,7 +620,7 @@ attribute
: attribute_name opt_attribute_arguments
{
MemberName mname = (MemberName) $1;
- object[] arguments = (object[]) $2;
+ ArrayList arguments = (ArrayList) $2;
MemberName left = mname.Left;
string identifier = mname.Name;
@@ -654,18 +654,29 @@ attribute_arguments
if ($1 == null)
$$ = null;
else {
- $$ = new object [] { $1, null };
+ ArrayList args = new ArrayList (4);
+ args.Add ($1);
+
+ $$ = args;
}
}
- | positional_argument_list COMMA named_argument_list
+ | positional_argument_list COMMA named_argument_list
{
- $$ = new object[] { $1, $3 };
+ ArrayList args = new ArrayList (4);
+ args.Add ($1);
+ args.Add ($3);
+
+ $$ = args;
}
- | named_argument_list
+ | named_argument_list
{
- $$ = new object [] { null, $1 };
+ ArrayList args = new ArrayList (4);
+ args.Add (null);
+ args.Add ($1);
+
+ $$ = args;
}
- ;
+ ;
opt_positional_argument_list
@@ -758,15 +769,21 @@ struct_declaration
STRUCT member_name
{
MemberName name = MakeName ((MemberName) $5);
- current_class = new Struct (
- current_namespace, current_class, name, (int) $2,
- (Attributes) $1);
-
if ($3 != null) {
- current_container = current_container.AddPartial (current_class);
+ ClassPart part = PartialContainer.CreatePart (
+ current_namespace, current_class, name, (int) $2,
+ (Attributes) $1, Kind.Struct, (Location) $3);
+
+ current_container = part.PartialContainer;
+ current_class = part;
} else {
+ current_class = new Struct (
+ current_namespace, current_class, name, (int) $2,
+ (Attributes) $1);
+
current_container.AddClassOrStruct (current_class);
current_container = current_class;
+ RootContext.Tree.RecordDecl (current_namespace.NS, name, current_class);
}
}
opt_class_base
@@ -775,7 +792,7 @@ struct_declaration
current_class.Bases = (ArrayList) $7;
if (RootContext.Documentation != null)
- current_container.DocComment = Lexer.consume_doc_comment ();
+ current_class.DocComment = Lexer.consume_doc_comment ();
}
struct_body
{
@@ -1452,15 +1469,21 @@ interface_declaration
{
MemberName name = MakeName ((MemberName) $5);
- current_class = new Interface (
- current_namespace, current_class, name, (int) $2,
- (Attributes) $1);
-
if ($3 != null) {
- current_container = current_container.AddPartial (current_class);
+ ClassPart part = PartialContainer.CreatePart (
+ current_namespace, current_class, name, (int) $2,
+ (Attributes) $1, Kind.Interface, (Location) $3);
+
+ current_container = part.PartialContainer;
+ current_class = part;
} else {
+ current_class = new Interface (
+ current_namespace, current_class, name, (int) $2,
+ (Attributes) $1);
+
current_container.AddInterface (current_class);
current_container = current_class;
+ RootContext.Tree.RecordDecl (current_namespace.NS, name, current_class);
}
}
opt_class_base
@@ -1468,7 +1491,7 @@ interface_declaration
current_class.Bases = (ArrayList) $7;
if (RootContext.Documentation != null) {
- current_container.DocComment = Lexer.consume_doc_comment ();
+ current_class.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
}
@@ -3491,15 +3514,27 @@ class_declaration
MemberName name = MakeName ((MemberName) $5);
int mod_flags = (int) $2;
- current_class = new Class (
- current_namespace, current_class, name,
- mod_flags, (Attributes) $1);
-
if ($3 != null) {
- current_container = current_container.AddPartial (current_class);
+ ClassPart part = PartialContainer.CreatePart (
+ current_namespace, current_class, name, mod_flags,
+ (Attributes) $1, Kind.Class, (Location) $3);
+
+ current_container = part.PartialContainer;
+ current_class = part;
} else {
+ if ((mod_flags & Modifiers.STATIC) != 0) {
+ current_class = new StaticClass (
+ current_namespace, current_class, name,
+ mod_flags, (Attributes) $1);
+ } else {
+ current_class = new Class (
+ current_namespace, current_class, name,
+ mod_flags, (Attributes) $1);
+ }
+
current_container.AddClassOrStruct (current_class);
current_container = current_class;
+ RootContext.Tree.RecordDecl (current_namespace.NS, name, current_class);
}
}
opt_class_base
@@ -3514,7 +3549,7 @@ class_declaration
}
if (RootContext.Documentation != null) {
- current_container.DocComment = Lexer.consume_doc_comment ();
+ current_class.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
}
@@ -4659,12 +4694,13 @@ TypeContainer pop_current_class ()
TypeContainer retval = current_class;
current_class = (TypeContainer) current_class.Parent;
- current_container = current_class.IsPartial ? current_class.PartialContainer : current_class;
+ current_container = (TypeContainer) current_container.Parent;
if (current_class != current_container) {
- if (current_class.PartialContainer != current_container)
+ if (((ClassPart) current_class).PartialContainer != current_container)
throw new InternalErrorException ("current_container and current_class are out of sync");
- }
+ } else if (current_container is ClassPart)
+ current_container = ((ClassPart) current_class).PartialContainer;
return retval;
}