mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move generateStructName to CppHelpers
Summary: We'll need this helper in the prop files now so let's move it over to the generic cpp helpers Reviewed By: TheSavior Differential Revision: D16759164 fbshipit-source-id: 8765ffee3bd8219b5f0dc8677362ec45f0a8e2c5
This commit is contained in:
committed by
Facebook Github Bot
parent
ebb412ab00
commit
e6c1e81c60
@@ -80,8 +80,17 @@ function getImports(component: ComponentShape): Set<string> {
|
||||
return imports;
|
||||
}
|
||||
|
||||
function generateStructName(
|
||||
componentName: string,
|
||||
parts: $ReadOnlyArray<string> = [],
|
||||
) {
|
||||
const additional = parts.map(toSafeCppString).join('');
|
||||
return `${componentName}${additional}Struct`;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getCppTypeForAnnotation,
|
||||
getImports,
|
||||
toSafeCppString,
|
||||
generateStructName,
|
||||
};
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {toSafeCppString} = require('./CppHelpers.js');
|
||||
|
||||
// import type {EventTypeShape} from './CodegenSchema';
|
||||
|
||||
function generateStructName(
|
||||
componentName: string,
|
||||
parts: $ReadOnlyArray<string> = [],
|
||||
): string {
|
||||
const additional = parts.map(toSafeCppString).join('');
|
||||
return `${componentName}${additional}Struct`;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateStructName,
|
||||
};
|
||||
+1
-4
@@ -10,11 +10,10 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const {generateStructName} = require('./EventEmitterHelpers.js');
|
||||
const {generateStructName} = require('./CppHelpers.js');
|
||||
|
||||
import type {
|
||||
ComponentShape,
|
||||
EventTypeShape,
|
||||
ObjectPropertyType,
|
||||
SchemaType,
|
||||
} from '../../CodegenSchema';
|
||||
@@ -26,8 +25,6 @@ type ComponentCollection = $ReadOnly<{
|
||||
[component: string]: ComponentShape,
|
||||
}>;
|
||||
|
||||
type SettersSet = Set<string>;
|
||||
|
||||
const template = `
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
+5
-2
@@ -12,8 +12,11 @@
|
||||
|
||||
const nullthrows = require('nullthrows');
|
||||
|
||||
const {getCppTypeForAnnotation, toSafeCppString} = require('./CppHelpers.js');
|
||||
const {generateStructName} = require('./EventEmitterHelpers.js');
|
||||
const {
|
||||
getCppTypeForAnnotation,
|
||||
toSafeCppString,
|
||||
generateStructName,
|
||||
} = require('./CppHelpers.js');
|
||||
|
||||
import type {
|
||||
ComponentShape,
|
||||
|
||||
Reference in New Issue
Block a user