mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-15 05:08:49 +08:00
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project. Reviewed By: rickhanlonii, TheSavior Differential Revision: D13974180 fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299
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,
|
|
};
|