[svn] r6542: nemerle/trunk/ncc/hierarchy: CustomAttribute.n TypeBuilder.n TypeInfo.n

nazgul svnadmin at nemerle.org
Thu Aug 17 00:30:46 CEST 2006


Log:
Bring back API compatibility

Author: nazgul
Date: Thu Aug 17 00:30:43 2006
New Revision: 6542

Modified:
   nemerle/trunk/ncc/hierarchy/CustomAttribute.n
   nemerle/trunk/ncc/hierarchy/TypeBuilder.n
   nemerle/trunk/ncc/hierarchy/TypeInfo.n

Modified: nemerle/trunk/ncc/hierarchy/CustomAttribute.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/CustomAttribute.n	(original)
+++ nemerle/trunk/ncc/hierarchy/CustomAttribute.n	Thu Aug 17 00:30:43 2006
@@ -552,7 +552,7 @@
   
   public partial class Modifiers
   {
-    public FindAttribute (looking_for : TypeInfo, env : GlobalEnv) : option [PT.PExpr * list [PT.PExpr]]
+    public FindAttributeWithArgs (looking_for : TypeInfo, env : GlobalEnv) : option [PT.PExpr * list [PT.PExpr]]
     {
       mutable result = None ();
       // find our attribute
@@ -569,6 +569,23 @@
       result
     }
     
+    public FindAttribute (looking_for : TypeInfo, env : GlobalEnv) : option [PT.PExpr]
+    {
+      mutable result = None ();
+      // find our attribute
+      foreach (expr in custom_attrs)
+        match (env.Manager.AttributeCompiler.ResolveAttribute (env, expr)) {
+          | Some ((t, _)) =>
+            when (looking_for.Equals (t)) {
+              result = Some (expr);
+              Nemerle.Imperative.Break ()
+            }
+            
+          | _ => ()
+        }
+      result
+    }
+        
     internal SaveCustomAttributes (ti : TypeBuilder,
                                    adder : SY.AttributeTargets * 
                                            SR.Emit.CustomAttributeBuilder -> string) : void

Modified: nemerle/trunk/ncc/hierarchy/TypeBuilder.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeBuilder.n	(original)
+++ nemerle/trunk/ncc/hierarchy/TypeBuilder.n	Thu Aug 17 00:30:43 2006
@@ -494,8 +494,12 @@
     })
   }
 
+  public FindAttributeWithArgs (looking_for : TypeInfo) : option [PT.PExpr * list [PT.PExpr]]
+  {
+    GetModifiers ().FindAttributeWithArgs (looking_for, this.GlobalEnv)
+  }
 
-  public FindAttribute (looking_for : TypeInfo) : option [PT.PExpr * list [PT.PExpr]]
+  public FindAttribute (looking_for : TypeInfo) : option [PT.PExpr]
   {
     GetModifiers ().FindAttribute (looking_for, this.GlobalEnv)
   }

Modified: nemerle/trunk/ncc/hierarchy/TypeInfo.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeInfo.n	(original)
+++ nemerle/trunk/ncc/hierarchy/TypeInfo.n	Thu Aug 17 00:30:43 2006
@@ -198,7 +198,7 @@
   
   internal virtual GetObsoletionDetails () : string * bool
   {
-    def (_, parms) = GetModifiers ().FindAttribute (this.GlobalEnv.Manager.InternalType.Obsolete_tc, this.GlobalEnv).Value;
+    def (_, parms) = GetModifiers ().FindAttributeWithArgs (this.GlobalEnv.Manager.InternalType.Obsolete_tc, this.GlobalEnv).Value;
     mutable msg = null, is_error = false;
     foreach (x in parms) {
       | <[ $(m : string) ]> => msg = m;



More information about the svn mailing list