1 2/* Compiler implementation of the D programming language 3 * Copyright (C) 2015-2019 by The D Language Foundation, All Rights Reserved 4 * written by Michel Fortin 5 * http://www.digitalmars.com 6 * Distributed under the Boost Software License, Version 1.0. 7 * http://www.boost.org/LICENSE_1_0.txt 8 * https://github.com/D-Programming-Language/dmd/blob/master/src/objc_stubs.c 9 */ 10 11#include "objc.h" 12#include "aggregate.h" 13#include "scope.h" 14 15class FuncDeclaration; 16 17// MARK: ObjcSelector 18 19ObjcSelector::ObjcSelector(const char *, size_t, size_t) 20{ 21 printf("Should never be called when D_OBJC is false\n"); 22 assert(0); 23} 24 25ObjcSelector *ObjcSelector::lookup(const char *) 26{ 27 printf("Should never be called when D_OBJC is false\n"); 28 assert(0); 29 return NULL; 30} 31 32ObjcSelector *ObjcSelector::lookup(const char *, size_t, size_t) 33{ 34 printf("Should never be called when D_OBJC is false\n"); 35 assert(0); 36 return NULL; 37} 38 39ObjcSelector *ObjcSelector::create(FuncDeclaration *) 40{ 41 printf("Should never be called when D_OBJC is false\n"); 42 assert(0); 43 return NULL; 44} 45 46class UnsupportedObjc : public Objc 47{ 48 void setObjc(ClassDeclaration *cd) 49 { 50 cd->error("Objective-C classes not supported"); 51 } 52 53 void setObjc(InterfaceDeclaration *id) 54 { 55 id->error("Objective-C interfaces not supported"); 56 } 57 58 void setSelector(FuncDeclaration *, Scope *) 59 { 60 // noop 61 } 62 63 void validateSelector(FuncDeclaration *) 64 { 65 // noop 66 } 67 68 void checkLinkage(FuncDeclaration *) 69 { 70 // noop 71 } 72}; 73 74static Objc *_objc; 75 76Objc *objc() 77{ 78 return _objc; 79} 80 81void Objc::_init() 82{ 83 _objc = new UnsupportedObjc(); 84} 85