/**
 * Copyright (c) 2016-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */ import * as AlgebraicType from '../algebraic-type' ; import * as Code from '../code' ; import * as Error from '../error' ; import * as FileWriter from '../file-writer' ; import * as Maybe from '../maybe' ; import * as ObjC from '../objc' ; import * as ObjectSpec from '../object-spec' ; function copyInstanceMethod ( ) { return { preprocessors : [ ] , belongsToProtocol : 'NSCopying' , code : [ 'return self;' ] , comments : [ ] , compilerAttributes : [ ] , keywords : [ { name : 'copyWithZone' , argument : { name : 'zone' , modifiers : [ ObjC . KeywordArgumentModifier . Nullable ( ) ] , type : { name : 'NSZone' , reference : 'NSZone *' } } } , ] , returnType : { type : { name : 'id' , reference : 'id' } , modifiers : [ ] } } ; } export function createPlugin ( ) { return { additionalFiles : function ( objectType ) : Code . File [ ] { return [ ] ; } , transformBaseFile : function ( objectType , baseFile ) : Code . File { return baseFile ; } , additionalTypes : function ( objectType ) : ObjectSpec . Type [ ] { return [ ] ; } , attributes : function ( objectType ) : ObjectSpec . Attribute [ ] { return [ ] ; } , classMethods : function ( objectType ) : ObjC . Method [ ] { return [ ] ; } , transformFileRequest : function ( request ) : FileWriter . Request { return request ; } , fileType : function ( objectType ) : Code . FileType | null { return null ; } , forwardDeclarations : function ( objectType ) : ObjC . ForwardDeclaration [ ] { return [ ] ; } , functions : function ( objectType ) : ObjC . Function [ ] { return [ ] ; } , headerComments : function ( objectType ) : ObjC . Comment [ ] { return [ ] ; } , implementedProtocols : function ( objectType ) : ObjC . ImplementedProtocol [ ] { return [ { name : 'NSCopying' } , ] ; } , imports : function ( objectType ) : ObjC . Import [ ] { return [ ] ; } , instanceMethods : function ( objectType ) : ObjC . Method [ ] { return [ copyInstanceMethod ( ) ] ; } , macros : function ( valueType ) : ObjC . Macro [ ] { return [ ] ; } , properties : function ( objectType ) : ObjC . Property [ ] { return [ ] ; } , requiredIncludesToRun : [ 'RMCopying' ] , staticConstants : function ( objectType ) : ObjC . Constant [ ] { return [ ] ; } , validationErrors : function ( objectType ) : Error . Error [ ] { return [ ] ; } , nullability : function ( objectType ) : ObjC . ClassNullability | null { return null ; } , subclassingRestricted : function ( objectType ) : boolean { return false ; } } ; } export function createAlgebraicTypePlugin ( ) { return { additionalFiles : function ( algebraicType ) : Code . File [ ] { return [ ] ; } , transformBaseFile : function ( algebraicType , baseFile ) : Code . File { return baseFile ; } , blockTypes : function ( algebraicType ) : ObjC . BlockType [ ] { return [ ] ; } , classMethods : function ( algebraicType ) : ObjC . Method [ ] { return [ ] ; } , enumerations : function ( algebraicType ) : ObjC . Enumeration [ ] { return [ ] ; } , transformFileRequest : function ( request ) : FileWriter . Request { return request ; } , fileType : function ( algebraicType ) : Code . FileType | null { return null ; } , forwardDeclarations : function ( algebraicType ) : ObjC . ForwardDeclaration [ ] { return [ ] ; } , functions : function ( algebraicType ) : ObjC . Function [ ] { return [ ] ; } , headerComments : function ( algebraicType ) : ObjC . Comment [ ] { return [ ] ; } , implementedProtocols : function ( algebraicType ) : ObjC . ImplementedProtocol [ ] { return [ { name : 'NSCopying' } , ] ; } , imports : function ( algebraicType ) : ObjC . Import [ ] { return [ ] ; } , instanceMethods : function ( algebraicType ) : ObjC . Method [ ] { return [ copyInstanceMethod ( ) ] ; } , instanceVariables : function ( algebraicType ) : ObjC . InstanceVariable [ ] { return [ ] ; } , macros : function ( algebraicType ) : ObjC . Macro [ ] { return [ ] ; } , requiredIncludesToRun : [ 'RMCopying' ] , staticConstants : function ( algebraicType ) : ObjC . Constant [ ] { return [ ] ; } , validationErrors : function ( algebraicType ) : Error . Error [ ] { return [ ] ; } , nullability : function ( algebraicType ) : ObjC . ClassNullability | null { return null ; } , subclassingRestricted : function ( algebraicType ) : boolean { return false ; } } ; }