[ClavaLaraApi] Several experiments in weaver.JoinPoints
@@ -25,11 +25,78 @@ JoinPoints.prototype.children = function($jp, jpType) {
}
JoinPoints.prototype.descendants = function($jp, jpType) {
+
if($jp === undefined) {
return [];
}
+ //var hasParent = $jp.hasParent;
+ //println("Has parent: " + hasParent);
+
+ //var jpType = $jp.joinPointType;
+ //println(jpType);
+ //println("jp name LARA: " + jpType);
+
+ /*
+ var target = {
+ a: 1,
+ b: 2,
+ c: 3
+ };
+
+ var handler = {
+ get: function(target, name) {
+ return (name in target ? target[name] : 42);
+ }
+ };
+
+ var target = new Proxy(target, handler);
+
+ println(target.a); // 1
+ println(target.b); // 2
+ println(target.c); // 3
+ println(target.meaningOfLife); // 42
+*/
+
+ /*
+ var jpHandle = {
+ get : function(obj, property) {
+ println("Proxy");
+
+ switch(property) {
+ case "descendants":
+ return obj.getDescendants();
+ default:
+ return obj[property];
+ }
+ }
+ };
+ $jp = new Proxy($jp, jpHandle);
+ */
+
+/*
+ println("BEFORE TEST");
+ var test = {
+ a: function() {
+ return this;
+ }
+ };
+
+ test.a()['hello'] = 20;
+ println("TEST: " + test.hello);
+ */
+ /*
+ var a = {};
+ println("a.laraSet: " + a.laraSet);
+ println("$jp.laraSet: " + $jp.laraSet);
+ */
+
+ //println("HEY");
var descendants = $jp.descendants;
+ //println("Descendants LARA: " + descendants);
+ //var descendants2 = $jp.descendants("vardecl");
+ //println("Descendants2 LARA: " + descendants2);
+
if(jpType === undefined) {
return descendants;
}
