[Pkg-mozext-commits] [adblock-plus] 33/464: Another form of inheritance. There are a lot of these, aren't there?

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:43:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit c30b7e451c6bd953c8f82f89b782a9a81126aaa5
Author: Joshua Cranmer <Pidgeot18 at gmail.com>
Date:   Mon May 11 15:42:21 2009 -0400

    Another form of inheritance. There are a lot of these, aren't there?
---
 utils/cleanast.js | 5 +++++
 utils/jstypes.js  | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/utils/cleanast.js b/utils/cleanast.js
index f1a5c32..16306d9 100644
--- a/utils/cleanast.js
+++ b/utils/cleanast.js
@@ -176,7 +176,12 @@ function make_object(stub) {
   stub.getters = {};
   stub.setters = {};
   let ast = stub.init;
+  let proto = stub.init.op == JSOP_GETPROP && stub.init.atom == 'prototype';
   delete stub['init'];
+  if (proto) {
+	  stub.inherits = [ast.kids[0].atom];
+	  return stub;
+  }
   for each (let init in ast.kids) {
     if (init.type != 6) {
       dump_ast(init);
diff --git a/utils/jstypes.js b/utils/jstypes.js
index baa4e8f..7b0716c 100644
--- a/utils/jstypes.js
+++ b/utils/jstypes.js
@@ -15,14 +15,16 @@ function divine_inheritance(clazz, constants) {
     let xpcom = clazz.variables.QueryInterface.init;
     assert(xpcom.op == JSOP_CALL && xpcom.kids[0].atom == "generateQI");
 
-    clazz.inherits = [];
+    if (!clazz.inherits)
+      clazz.inherits = [];
     for each (let iface in xpcom.kids[1].kids)
       clazz.inherits.push(iface.atom);
     return;
   }
   
   if ("QueryInterface" in clazz.functions) {
-    clazz.inherits = [];
+    if (!clazz.inherits)
+      clazz.inherits = [];
     function findInterfaces(ast) {
 	    if (ast.op == JSOP_GETPROP && ast.kids[0]) {
 		    let check = ast.kids[0];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list