AspectsHelper Class

From The Oxygene Language Wiki

Jump to:navigation, search

This is a Language topic
Feel free to add your notes to this topic below.


[Extension]
AspectsHelper = public static class

AspectHelpers is an extension class. It currently has 1 method, the SetBody method that extends the IMethodDefinition Interface. This provides an elegant way of changing the method body through the use of anonymous methods.


Namespace: Cirrus


Members

Method
Description
SetBody(aSelf: IMethodDefinition; aServices: IServices; aDelegate StatementDelegate)SetBody method for the automatically generated statement tree delegate. This method can be used to replace the body of a compiled method, or to add code around the original body:

aMethod.SetBody(aServices, method
    Console.WriteLine('Entering: '+unquote<string>(aMethod.Name));
    try
      Aspects.OriginalBody;
    finally
      Console.WriteLine('Exiting: '+unquote<string>(aMethod.Name));
    end;
  end);

The compiler converts the anonymous method into a tree made out of Statements and Values. It creates an anonymous method from the method that returns this tree of statements and values as a result. The SetBody extension method calls this anonymous method and calls aMethod.ReplaceMethodBody.


See Also


Oxygene-48.png

Area: Oxygene Language
Compiler version: Oxygene 5

Language GlossaryKeywordsTypesFAQHow To

Navigation
Areas
More
Toolbox