Commit 25911e25 authored by Miro Knejp's avatar Miro Knejp

Cleanup of unused variables and superfluous includes

parent 8bc6b51a
......@@ -4,7 +4,6 @@
#import "TXSSortItems+Private.h"
#import "TXSSortItems.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIDate.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#import "TXSItemList+Private.h"
......@@ -12,7 +11,6 @@
#import "TXSTextboxListener+Private.h"
#include <exception>
#include <utility>
#include <vector>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
......
......@@ -5,7 +5,6 @@
#import "TXSTextboxListener.h"
#import "DJIObjcWrapperCache+Private.h"
#import "TXSItemList+Private.h"
#include <vector>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
......
......@@ -64,7 +64,6 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
})
}
def headerName(ident: String): String = idObjc.ty(ident) + "." + spec.objcHeaderExt
def bodyName(ident: String): String = idObjc.ty(ident) + "." + spec.objcppExt // Must be a Obj-C++ file in case the constants are not compile-time constant expressions
def writeObjcConstVariable(w: IndentWriter, c: Const, s: String): Unit = {
......@@ -159,10 +158,8 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
w.wl("@end")
})
refs.body.add("#include <vector>")
refs.body.add("#import " + q(spec.objcIncludePrefix + headerName(ident)))
if (i.consts.nonEmpty) {
refs.body.add("#import " + q(spec.objcIncludePrefix + marshal.headerName(ident)))
writeObjcFile(bodyName(ident.name), origin, refs.body, w => {
generateObjcConstants(w, i.consts, self)
})
......@@ -221,6 +218,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
}
w.wl
w.wl("@end")
// Constants come last in case one of them is of the record's type
if (r.consts.nonEmpty) {
w.wl
for (c <- r.consts) {
......
......@@ -6,7 +6,6 @@ import djinni.meta._
class ObjcMarshal(spec: Spec) extends Marshal(spec) {
// For JNI typename() is always fully qualified and describes the mangled Java type to be used in field/method signatures
override def typename(tm: MExpr): String = {
val (name, _) = toObjcType(tm)
name
......
......@@ -34,7 +34,6 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
class ObjcRefs() {
var body = mutable.TreeSet[String]()
var header = mutable.TreeSet[String]()
var privHeader = mutable.TreeSet[String]()
def find(ty: TypeRef) { find(ty.resolved) }
......@@ -72,7 +71,6 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
refs.privHeader.add("#include <memory>")
refs.privHeader.add("!#include " + q(spec.objcppIncludeCppPrefix + spec.cppFileIdentStyle(ident) + "." + spec.cppHeaderExt))
refs.body.add("#include <vector>")
refs.body.add("!#import " + q(spec.objcppIncludeObjcPrefix + headerName(ident)))
def writeObjcFuncDecl(method: Interface.Method, w: IndentWriter) {
......@@ -112,7 +110,6 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
refs.body.add("#import " + q(spec.objcBaseLibIncludePrefix + "DJICppWrapperCache+Private.h"))
refs.body.add("#include <utility>")
refs.body.add("#import " + q(spec.objcBaseLibIncludePrefix + "DJIError.h"))
refs.body.add("#import " + q(spec.objcBaseLibIncludePrefix + "DJIDate.h"))
refs.body.add("#include <exception>")
writeObjcFile(privateBodyName(ident.name), origin, refs.body, w => {
......@@ -168,7 +165,6 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
}
if (i.ext.objc) {
val objcExtSelf = objcppMarshal.helperClass("objc_proxy")
refs.body.add("#import " + q(spec.objcBaseLibIncludePrefix + "DJIObjcWrapperCache+Private.h"))
refs.body.add("!#import " + q(spec.objcppIncludePrefix + objcppMarshal.privateHeaderName(ident.name)))
......@@ -176,9 +172,9 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
arcAssert(w)
w.wl
wrapNamespace(w, spec.objcppNamespace, w => {
w.wl(s"class $helperClass::$objcExtSelf final")
w.wl(s"class $helperClass::ObjcProxy final")
w.wl(s": public $cppSelf")
w.wl(s", public ::djinni::DbxObjcWrapperCache<$objcExtSelf>::Handle") // Use base class to avoid name conflicts with user-defined methods having the same name as this new data member
w.wl(s", public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle") // Use base class to avoid name conflicts with user-defined methods having the same name as this new data member
w.bracedSemi {
w.wlOutdent("public:")
w.wl("using Handle::Handle;")
......@@ -199,13 +195,13 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
w.wl
w.wl(s"auto $helperClass::toCpp(ObjcType objc) -> CppType")
w.braced {
w.wl(s"return objc ? ::djinni::DbxObjcWrapperCache<$objcExtSelf>::getInstance()->get(objc) : nullptr;")
w.wl(s"return objc ? ::djinni::DbxObjcWrapperCache<ObjcProxy>::getInstance()->get(objc) : nullptr;")
}
w.wl
w.wl(s"auto $helperClass::fromCpp(const CppType& cpp) -> ObjcType")
w.braced {
w.wl(s"assert(!cpp || dynamic_cast<$objcExtSelf*>(cpp.get()));")
w.wl(s"return cpp ? static_cast<$objcExtSelf&>(*cpp).Handle::get() : nil;")
w.wl(s"assert(!cpp || dynamic_cast<ObjcProxy*>(cpp.get()));")
w.wl(s"return cpp ? static_cast<ObjcProxy&>(*cpp).Handle::get() : nil;")
}
})
})
......@@ -221,7 +217,6 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
val objcName = ident.name + (if (r.ext.objc) "_base" else "")
val noBaseSelf = objcMarshal.typename(ident, r) // Used for constant names
val self = objcMarshal.typename(objcName, r)
val cppSelf = cppMarshal.fqTypename(ident, r)
refs.privHeader.add("!#import " + q(spec.objcppIncludeObjcPrefix + (if(r.ext.objc) "../" else "") + headerName(ident)))
......
......@@ -6,7 +6,6 @@
#import "DBClientReturnedRecord+Private.h"
#import "DJIMarshal+Private.h"
#import "DJIObjcWrapperCache+Private.h"
#include <vector>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
......
......@@ -4,12 +4,10 @@
#import "DBConstantsInterface+Private.h"
#import "DBConstantsInterface.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIDate.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>
#include <vector>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
......
......@@ -2,7 +2,6 @@
// This file generated by Djinni from constants.djinni
#import "DBConstantsInterface.h"
#include <vector>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
......
......@@ -5,12 +5,10 @@
#import "DBCppException.h"
#import "DBCppException+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIDate.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>
#include <vector>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
......
......@@ -11,12 +11,10 @@
#import "DBSetRecord+Private.h"
#import "DBToken+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIDate.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>
#include <vector>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
......
......@@ -4,11 +4,9 @@
#import "DBToken+Private.h"
#import "DBToken.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIDate.h"
#import "DJIError.h"
#include <exception>
#include <utility>
#include <vector>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment