[svn] r7419: nemerle/trunk: macros/DesignPatterns.n
snippets/designpatt/proxy-p.n
nazgul
svnadmin at nemerle.org
Tue Feb 13 22:46:02 CET 2007
Log:
Use CreateAlias API in proxy members API
Author: nazgul
Date: Tue Feb 13 22:45:58 2007
New Revision: 7419
Modified:
nemerle/trunk/macros/DesignPatterns.n
nemerle/trunk/snippets/designpatt/proxy-p.n
Modified: nemerle/trunk/macros/DesignPatterns.n
==============================================================================
--- nemerle/trunk/macros/DesignPatterns.n (original)
+++ nemerle/trunk/macros/DesignPatterns.n Tue Feb 13 22:45:58 2007
@@ -37,6 +37,7 @@
{
def inclusion_regexs = MacrosHelper.AnalyseNameInclusionPatterns (options);
def ftype = f.GetMemType();
+ def fobj = <[ this.$(f.Name : dyn) ]>;
def classty = match (ftype) {
| Class (typeinfo, _) => typeinfo
@@ -54,24 +55,11 @@
match (mem) {
| meth is IMethod
// we must avoid property method here, a little bit hacking solution
- when meth.Attributes & NemerleAttributes.SpecialName == 0 &&
- meth.GetHeader().typarms.Length == 0 =>
+ when meth.Attributes & NemerleAttributes.SpecialName == 0 =>
- // prepare method invocation parameters
- def parms = meth.GetParameters ().Map(fun (p) {
- <[ $(t.ParsedName.NewName (p.name) : name) : $(subst.Apply (p.ty.Fix()) : typed) ]>
- });
- // prepare created method function parameters
- def fparms = parms.Map (Parsetree.Fun_parm);
-
- // define the wrapper method
- t.Define (<[ decl:
- public virtual $(member_name : name) (..$fparms)
- : $(subst.Apply (meth.ReturnType.Fix()) : typed)
- {
- this.$(f.Name : dyn).$(member_name : name) (..$parms)
- }
- ]>)
+ def mods = NemerleAttributes.Virtual %| NemerleAttributes.Public;
+ def parse_tr = meth.GetHeader ().CreateAliasMethod (mods, fobj, subst);
+ t.Define (parse_tr);
| prop is IProperty when prop.GetGetter() != null && !prop.IsIndexer =>
t.Define (<[ decl:
Modified: nemerle/trunk/snippets/designpatt/proxy-p.n
==============================================================================
--- nemerle/trunk/snippets/designpatt/proxy-p.n (original)
+++ nemerle/trunk/snippets/designpatt/proxy-p.n Tue Feb 13 22:45:58 2007
@@ -61,7 +61,7 @@
}
public Gene (x : 'a) : 'a { x }
- public Gene ['b] (x : 'b) : 'b { x }
+ public GeneG ['b] (x : 'b) : 'b { x }
}
class Constructed {
@@ -104,6 +104,7 @@
_ = x.Length;
_ = x.Fire (1);
_ = x.Gene (1);
+ _ = x.GeneG ("dd");
_ = x.Foo;
}
}
More information about the svn
mailing list