mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: This is very much a work in progress. Moving it into the open source repo to be able to hook it up to generate some Fabric files. Will continue to iterate on it in the open. Reviewed By: hramos, mdvacca Differential Revision: D13500969 fbshipit-source-id: 79082447dc52b5834f24eb72bc6e07200b324238
38 lines
802 B
JavaScript
38 lines
802 B
JavaScript
/**
|
|
* 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';
|
|
|
|
function getCppTypeForAnnotation(
|
|
type:
|
|
| 'BooleanTypeAnnotation'
|
|
| 'StringTypeAnnotation'
|
|
| 'Int32TypeAnnotation'
|
|
| 'FloatTypeAnnotation',
|
|
): string {
|
|
switch (type) {
|
|
case 'BooleanTypeAnnotation':
|
|
return 'bool';
|
|
case 'StringTypeAnnotation':
|
|
return 'std::string';
|
|
case 'Int32TypeAnnotation':
|
|
return 'int';
|
|
case 'FloatTypeAnnotation':
|
|
return 'Float';
|
|
default:
|
|
(type: empty);
|
|
throw new Error(`Receieved invalid typeAnnotation ${type}`);
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
getCppTypeForAnnotation,
|
|
};
|