Use CGIndenter for CGGetPerInterfaceObject.definition_body.

This commit is contained in:
Ms2ger 2014-06-21 13:38:57 +02:00
parent 44a609d563
commit b717fbe868

View file

@ -1941,25 +1941,25 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
def definition_body(self): def definition_body(self):
return CGGeneric(""" return CGGeneric("""
/* aGlobal and aReceiver are usually the same, but they can be different /* aGlobal and aReceiver are usually the same, but they can be different
too. For example a sandbox often has an xray wrapper for a window as the too. For example a sandbox often has an xray wrapper for a window as the
prototype of the sandbox's global. In that case aReceiver is the xray prototype of the sandbox's global. In that case aReceiver is the xray
wrapper and aGlobal is the sandbox's global. wrapper and aGlobal is the sandbox's global.
*/ */
assert!(((*JS_GetClass(aGlobal)).flags & JSCLASS_DOM_GLOBAL) != 0); assert!(((*JS_GetClass(aGlobal)).flags & JSCLASS_DOM_GLOBAL) != 0);
/* Check to see whether the interface objects are already installed */ /* Check to see whether the interface objects are already installed */
let protoOrIfaceArray = GetProtoOrIfaceArray(aGlobal); let protoOrIfaceArray = GetProtoOrIfaceArray(aGlobal);
let cachedObject: *mut JSObject = *protoOrIfaceArray.offset(%s as int); let cachedObject: *mut JSObject = *protoOrIfaceArray.offset(%s as int);
if cachedObject.is_null() { if cachedObject.is_null() {
let tmp: *mut JSObject = CreateInterfaceObjects(aCx, aGlobal, aReceiver); let tmp: *mut JSObject = CreateInterfaceObjects(aCx, aGlobal, aReceiver);
assert!(tmp.is_not_null()); assert!(tmp.is_not_null());
*protoOrIfaceArray.offset(%s as int) = tmp; *protoOrIfaceArray.offset(%s as int) = tmp;
tmp tmp
} else { } else {
cachedObject cachedObject
}""" % (self.id, self.id)) }""" % (self.id, self.id))
class CGGetProtoObjectMethod(CGGetPerInterfaceObject): class CGGetProtoObjectMethod(CGGetPerInterfaceObject):
""" """
@ -1969,12 +1969,12 @@ class CGGetProtoObjectMethod(CGGetPerInterfaceObject):
CGGetPerInterfaceObject.__init__(self, descriptor, "GetProtoObject", CGGetPerInterfaceObject.__init__(self, descriptor, "GetProtoObject",
"PrototypeList::", pub=True) "PrototypeList::", pub=True)
def definition_body(self): def definition_body(self):
return CGList([ return CGIndenter(CGList([
CGGeneric(""" CGGeneric("""
/* Get the interface prototype object for this class. This will create the /* Get the interface prototype object for this class. This will create the
object as needed. */"""), object as needed. */"""),
CGGetPerInterfaceObject.definition_body(self), CGGetPerInterfaceObject.definition_body(self),
]) ]))
class CGGetConstructorObjectMethod(CGGetPerInterfaceObject): class CGGetConstructorObjectMethod(CGGetPerInterfaceObject):
""" """
@ -1984,12 +1984,12 @@ class CGGetConstructorObjectMethod(CGGetPerInterfaceObject):
CGGetPerInterfaceObject.__init__(self, descriptor, "GetConstructorObject", CGGetPerInterfaceObject.__init__(self, descriptor, "GetConstructorObject",
"constructors::") "constructors::")
def definition_body(self): def definition_body(self):
return CGList([ return CGIndenter(CGList([
CGGeneric(""" CGGeneric("""
/* Get the interface object for this class. This will create the object as /* Get the interface object for this class. This will create the object as
needed. */"""), needed. */"""),
CGGetPerInterfaceObject.definition_body(self), CGGetPerInterfaceObject.definition_body(self),
]) ]))
class CGDefineDOMInterfaceMethod(CGAbstractMethod): class CGDefineDOMInterfaceMethod(CGAbstractMethod):
""" """