Comments (6)
Couldn't figure out how to make a second pull requests whilst I have one already outstanding against the master repository. Anyhow, my change is here.
As you will see from the my commit, I left in the original code that searches the context for the name of the function, but this code is only executed when the methodName is not already remembered in advance.
I have looked at your fix to this problem here and note that you're doing something similar. Myself, I wasn't confident enough to remove altogether the search of the context for the method name.
Christian
from angular-aop.
Please verify whether the issue is fixed after the merge to close it.
from angular-aop.
Hi Minko,
I don't think including the methodName in the list of arguments is working. What I'm seeing is the methodName repeated multiple times in the args parameter supplied to the advice. I think the problem occurs when you have multiple aspects being applied to the same function.
For example, I have some code that adds a tracing aspect to a matching function:
subject = execute(trace.error).onThrowOf(subject, methodMatcher);
subject = execute(trace.begin).before(subject, methodMatcher);
subject = execute(trace.end).after(subject, methodMatcher);
The end result of the above code is an Aspect[POINTCUTS.AFTER] wrapping an Aspect[POINTCUTS.BEFORE] wrapping an Aspect[POINTCUTS.ON_THROW]. Each of these wrappers adds the methodName to the arguments that eventually get passed to the original function and hence the duplication of method name.
I think you will have to do what I did, or something similar: store the methodName on the Aspect instance itself. As a reminder this is my commit that shows how I coded this.
Also I can see other bugs in the promise related join points. I will supply a fix for those once we've moved forward from this issue.
Christian
from angular-aop.
Thank you for the feedback!
Yesterday I merged your changes for the promise related fixes so I think they should be ok now.
Now I hope that everything is fixed. I had about an hour and I think I found the base problem which was connected with the arguments passing and simple problem in _getMethodName
which was getting the name of the wrapper instead of the base function.
There was also an issue when afterResolveOf
is used with onRejectOf
. In afterResolveOf
new promise is created which wasn't rejected when needed.
Another change is that few new properties are added to the advices parameters:
resolveArgs
rejectArgs
I think they might be useful in some cases.
Please let me know if there are still existing problems.
from angular-aop.
Great Minko. I've tested the latest code and the fix seems to work nicely.
I'm going to make a couple of more suggestions, but this particular issue I think can be closed.
from angular-aop.
OK. I'm closing it.
from angular-aop.
Related Issues (12)
- Enhancement: add pointcut onNotify HOT 4
- ngResource gets incorrectly wrapped into a function aspect HOT 2
- Typescript: undefined is not a function HOT 18
- AngularAOP for advising controller HOT 2
- IE9 HOT 10
- joinpoint.proceed() HOT 2
- resolveArgs is empty in onResolve and AfterResolve HOT 2
- How can I use the library for AOP on every controller and directive function call? HOT 5
- Reduce the number of recursively wrapped aspects HOT 3
- Enhancement: aspect be able to alter the arguments and return values HOT 9
- Circular dependency when using woven service (or dependent one) in the aspect HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-aop.