Author: raja
Date: 2005-04-08 05:12:02 -0400 (Fri, 08 Apr 2005)
New Revision: 42679

Added:
   trunk/mcs/tests/test-361-2.cs
   trunk/mcs/tests/test-361.cs
Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/attribute.cs
   trunk/mcs/mcs/cs-parser.jay
   trunk/mcs/tests/ChangeLog
   trunk/mcs/tests/Makefile
Log:
In mcs:
        Fix #74484.
        * attribute.cs (Attribute.GetAttributeUsage): Resolve
        AttributeUsageAttribute in the emitcontext of the attribute class,
        not in the emitcontext of the attributable entity it was attached to.
        * cs-parser.jay: Use 'current_class', not 'current_container',
        when creating a GlobalAttribute.

In tests:
        * test-361.cs, test-361-2.cs: New test from #74484.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-04-08 09:06:22 UTC (rev 42678)
+++ trunk/mcs/mcs/ChangeLog     2005-04-08 09:12:02 UTC (rev 42679)
@@ -1,3 +1,12 @@
+2005-04-08  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       Fix #74484.
+       * attribute.cs (Attribute.GetAttributeUsage): Resolve
+       AttributeUsageAttribute in the emitcontext of the attribute class,
+       not in the emitcontext of the attributable entity it was attached to.
+       * cs-parser.jay: Use 'current_class', not 'current_container',
+       when creating a GlobalAttribute.
+
 2005-04-08  Alp Toker  <[EMAIL PROTECTED]>
 
        * pending.cs: The fix to #58413 failed to compile methods implementing

Modified: trunk/mcs/mcs/attribute.cs
===================================================================
--- trunk/mcs/mcs/attribute.cs  2005-04-08 09:06:22 UTC (rev 42678)
+++ trunk/mcs/mcs/attribute.cs  2005-04-08 09:12:02 UTC (rev 42679)
@@ -640,18 +640,14 @@
                                return ua;
                        }
 
-                       if (attr_class.OptAttributes == null) {
-                               usage_attr_cache.Add (Type, 
DefaultUsageAttribute);
-                               return DefaultUsageAttribute;
-                       }
+                       Attribute a = attr_class.OptAttributes == null
+                               ? null
+                               : attr_class.OptAttributes.Search 
(TypeManager.attribute_usage_type, attr_class.EmitContext);
 
-                       Attribute a = attr_class.OptAttributes.Search 
(TypeManager.attribute_usage_type, ec);
-                       if (a == null) {
-                               usage_attr_cache.Add (Type, 
DefaultUsageAttribute);
-                               return DefaultUsageAttribute;
-                       }
+                       ua = a == null
+                               ? DefaultUsageAttribute 
+                               : a.GetAttributeUsageAttribute 
(attr_class.EmitContext);
 
-                       ua = a.GetAttributeUsageAttribute (ec);
                        usage_attr_cache.Add (Type, ua);
                        return ua;
                }

Modified: trunk/mcs/mcs/cs-parser.jay
===================================================================
--- trunk/mcs/mcs/cs-parser.jay 2005-04-08 09:06:22 UTC (rev 42678)
+++ trunk/mcs/mcs/cs-parser.jay 2005-04-08 09:12:02 UTC (rev 42679)
@@ -598,7 +598,7 @@
                Expression left_expr = left == null ? null : 
left.GetTypeExpression (loc);
 
                if (current_attr_target == "assembly" || current_attr_target == 
"module")
-                       $$ = new GlobalAttribute (current_container, 
current_attr_target,
+                       $$ = new GlobalAttribute (current_class, 
current_attr_target,
                                                  left_expr, identifier, 
(ArrayList) $3, loc);
                else
                        $$ = new Attribute (current_attr_target, left_expr, 
identifier, (ArrayList) $3, loc);
@@ -4833,7 +4833,7 @@
                else
                        yyparse (lexer);
                Tokenizer tokenizer = lexer as Tokenizer;
-               tokenizer.cleanup ();           
+               tokenizer.cleanup ();
        } catch (Exception e){
                // 
                // Removed for production use, use parser verbose to get the 
output.
@@ -4843,6 +4843,8 @@
                if (yacc_verbose_flag > 0)
                        Console.WriteLine (e);
        }
+
+       RootContext.Tree.Types.NamespaceEntry = null;
 }
 
 void CheckToken (int error, int yyToken, string msg)

Modified: trunk/mcs/tests/ChangeLog
===================================================================
--- trunk/mcs/tests/ChangeLog   2005-04-08 09:06:22 UTC (rev 42678)
+++ trunk/mcs/tests/ChangeLog   2005-04-08 09:12:02 UTC (rev 42679)
@@ -1,3 +1,7 @@
+2005-04-08  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * test-361.cs, test-361-2.cs: New test from #74484.
+
 2005-04-05  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * mtest-8-dll.cs, mtest-8-exe.cs: New test from #73820.

Modified: trunk/mcs/tests/Makefile
===================================================================
--- trunk/mcs/tests/Makefile    2005-04-08 09:06:22 UTC (rev 42678)
+++ trunk/mcs/tests/Makefile    2005-04-08 09:12:02 UTC (rev 42679)
@@ -8,7 +8,7 @@
 include ../build/rules.make
 
 DISTFILES = README.tests harness.mk $(wildcard *.cs) $(wildcard *.il) 
$(wildcard *.xml) $(wildcard *.inc) \
-       test-353-2.cs
+       test-353-2.cs test-361-2.cs
 
 with_mono_path = 
MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
 
@@ -31,7 +31,7 @@
 NEW_TEST_SOURCES_common = xml-033 xml-034 xml-035 xml-036 test-329 2test-16 
test-330 a-parameter5 test-331 test-332 \
                          test-333 test-311 test-335 test-336 test-337 test-287 
test-338 test-339 test-341 test-334 test-342 \
                          test-344 test-345 test-346 test-347 test-348 test-349 
test-350 test-351 test-352 test-353 test-354 test-355 \
-                         test-356 test-357 test-358 test-359 test-360 \
+                         test-356 test-357 test-358 test-359 test-360 test-361 
\
        mtest-7-dll mtest-7-exe \
        mtest-8-dll mtest-8-exe
 
@@ -152,7 +152,7 @@
 # Some tests may require additional files to be available in the current 
directory.
 # To promote interoperability, we prefer that those files not be referred to 
with ../ or ..\\
 # To that end, we will copy those files to the test-harness directory, so that 
we can refer to simple filenames.
-TEST_HARNESS_EXTRAS = $(wildcard *.inc) test-74.cs test-353-2.cs
+TEST_HARNESS_EXTRAS = $(wildcard *.inc) test-74.cs test-353-2.cs test-361-2.cs
 
 all-local install-local uninstall-local:
 

Added: trunk/mcs/tests/test-361-2.cs
===================================================================
--- trunk/mcs/tests/test-361-2.cs       2005-04-08 09:06:22 UTC (rev 42678)
+++ trunk/mcs/tests/test-361-2.cs       2005-04-08 09:12:02 UTC (rev 42679)
@@ -0,0 +1,5 @@
+// Subordinate test file for test-361.cs
+
+using System;
+[AttributeUsage (AttributeTargets.Class)]
+class X : Attribute { }

Added: trunk/mcs/tests/test-361.cs
===================================================================
--- trunk/mcs/tests/test-361.cs 2005-04-08 09:06:22 UTC (rev 42678)
+++ trunk/mcs/tests/test-361.cs 2005-04-08 09:12:02 UTC (rev 42679)
@@ -0,0 +1,6 @@
+// Compiler options: test-361-2.cs
+
+[X]
+class Test {
+       static void Main () { }
+}

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to