@react-native/codegen 0.72.3 → 0.72.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CodegenSchema.d.ts +10 -10
- package/lib/CodegenSchema.js.flow +6 -1
- package/lib/SchemaValidator.d.ts +1 -1
- package/lib/generators/RNCodegen.d.ts +98 -0
- package/lib/generators/RNCodegen.js +33 -4
- package/lib/generators/RNCodegen.js.flow +35 -4
- package/lib/generators/components/ComponentsGeneratorUtils.js +2 -0
- package/lib/generators/components/ComponentsGeneratorUtils.js.flow +2 -0
- package/lib/generators/components/CppHelpers.js +2 -0
- package/lib/generators/components/CppHelpers.js.flow +2 -0
- package/lib/generators/components/GeneratePropsH.js +2 -0
- package/lib/generators/components/GeneratePropsH.js.flow +2 -0
- package/lib/generators/components/GeneratePropsJavaDelegate.js +2 -0
- package/lib/generators/components/GeneratePropsJavaDelegate.js.flow +2 -0
- package/lib/generators/components/GeneratePropsJavaInterface.js +2 -0
- package/lib/generators/components/GeneratePropsJavaInterface.js.flow +2 -0
- package/lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js.flow +3 -1
- package/lib/generators/components/GeneratePropsJavaPojo/serializePojo.js +5 -0
- package/lib/generators/components/GeneratePropsJavaPojo/serializePojo.js.flow +6 -0
- package/lib/generators/components/GenerateViewConfigJs.js +1 -0
- package/lib/generators/components/GenerateViewConfigJs.js.flow +1 -0
- package/lib/generators/components/JavaHelpers.js +7 -0
- package/lib/generators/components/JavaHelpers.js.flow +8 -0
- package/lib/generators/components/__test_fixtures__/fixtures.js +29 -0
- package/lib/generators/components/__test_fixtures__/fixtures.js.flow +30 -0
- package/lib/parsers/error-utils.js +9 -15
- package/lib/parsers/error-utils.js.flow +12 -15
- package/lib/parsers/flow/components/__test_fixtures__/fixtures.js +5 -1
- package/lib/parsers/flow/components/__test_fixtures__/fixtures.js.flow +5 -1
- package/lib/parsers/flow/components/componentsUtils.js +4 -0
- package/lib/parsers/flow/components/componentsUtils.js.flow +4 -0
- package/lib/parsers/flow/components/index.js +18 -113
- package/lib/parsers/flow/components/index.js.flow +15 -46
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js +4 -4
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js.flow +4 -4
- package/lib/parsers/flow/modules/index.js +41 -307
- package/lib/parsers/flow/modules/index.js.flow +18 -233
- package/lib/parsers/flow/parser.js +68 -12
- package/lib/parsers/flow/parser.js.flow +67 -3
- package/lib/parsers/parser.d.ts +2 -2
- package/lib/parsers/parser.js.flow +65 -3
- package/lib/parsers/parserMock.js +44 -0
- package/lib/parsers/parserMock.js.flow +52 -1
- package/lib/parsers/parsers-commons.js +361 -4
- package/lib/parsers/parsers-commons.js.flow +341 -4
- package/lib/parsers/parsers-primitives.js +119 -3
- package/lib/parsers/parsers-primitives.js.flow +128 -3
- package/lib/parsers/schema/index.d.ts +1 -1
- package/lib/parsers/typescript/components/__test_fixtures__/fixtures.js +5 -1
- package/lib/parsers/typescript/components/__test_fixtures__/fixtures.js.flow +5 -1
- package/lib/parsers/typescript/components/componentsUtils.js +8 -0
- package/lib/parsers/typescript/components/componentsUtils.js.flow +8 -0
- package/lib/parsers/typescript/components/index.js +20 -115
- package/lib/parsers/typescript/components/index.js.flow +17 -48
- package/lib/parsers/typescript/modules/index.js +103 -421
- package/lib/parsers/typescript/modules/index.js.flow +84 -285
- package/lib/parsers/typescript/parser.js +69 -12
- package/lib/parsers/typescript/parser.js.flow +68 -3
- package/lib/parsers/utils.js +4 -0
- package/lib/parsers/utils.js.flow +3 -0
- package/package.json +1 -1
- package/lib/parsers/flow/Visitor.js +0 -37
- package/lib/parsers/flow/Visitor.js.flow +0 -41
- package/lib/parsers/flow/components/options.js +0 -72
- package/lib/parsers/flow/components/options.js.flow +0 -87
- package/lib/parsers/typescript/Visitor.js +0 -42
- package/lib/parsers/typescript/Visitor.js.flow +0 -47
- package/lib/parsers/typescript/components/options.js +0 -72
- package/lib/parsers/typescript/components/options.js.flow +0 -87
|
@@ -38,22 +38,27 @@ function _toPrimitive(input, hint) {
|
|
|
38
38
|
}
|
|
39
39
|
return (hint === 'string' ? String : Number)(input);
|
|
40
40
|
}
|
|
41
|
+
const _require = require('./modules'),
|
|
42
|
+
flowTranslateTypeAnnotation = _require.flowTranslateTypeAnnotation;
|
|
43
|
+
|
|
41
44
|
// $FlowFixMe[untyped-import] there's no flowtype flow-parser
|
|
42
45
|
const flowParser = require('flow-parser');
|
|
43
|
-
const
|
|
44
|
-
buildSchema =
|
|
45
|
-
const
|
|
46
|
-
Visitor =
|
|
47
|
-
const
|
|
48
|
-
buildComponentSchema =
|
|
49
|
-
const
|
|
50
|
-
wrapComponentSchema =
|
|
51
|
-
const
|
|
52
|
-
buildModuleSchema =
|
|
46
|
+
const _require2 = require('../parsers-commons'),
|
|
47
|
+
buildSchema = _require2.buildSchema;
|
|
48
|
+
const _require3 = require('../parsers-primitives'),
|
|
49
|
+
Visitor = _require3.Visitor;
|
|
50
|
+
const _require4 = require('./components'),
|
|
51
|
+
buildComponentSchema = _require4.buildComponentSchema;
|
|
52
|
+
const _require5 = require('../schema.js'),
|
|
53
|
+
wrapComponentSchema = _require5.wrapComponentSchema;
|
|
54
|
+
const _require6 = require('../parsers-commons.js'),
|
|
55
|
+
buildModuleSchema = _require6.buildModuleSchema;
|
|
56
|
+
const _require7 = require('./utils'),
|
|
57
|
+
resolveTypeAnnotation = _require7.resolveTypeAnnotation;
|
|
53
58
|
const fs = require('fs');
|
|
54
|
-
const
|
|
59
|
+
const _require8 = require('../errors'),
|
|
55
60
|
UnsupportedObjectPropertyTypeAnnotationParserError =
|
|
56
|
-
|
|
61
|
+
_require8.UnsupportedObjectPropertyTypeAnnotationParserError;
|
|
57
62
|
class FlowParser {
|
|
58
63
|
constructor() {
|
|
59
64
|
_defineProperty(
|
|
@@ -111,6 +116,8 @@ class FlowParser {
|
|
|
111
116
|
buildModuleSchema,
|
|
112
117
|
Visitor,
|
|
113
118
|
this,
|
|
119
|
+
resolveTypeAnnotation,
|
|
120
|
+
flowTranslateTypeAnnotation,
|
|
114
121
|
);
|
|
115
122
|
}
|
|
116
123
|
parseModuleFixture(filename) {
|
|
@@ -244,6 +251,55 @@ class FlowParser {
|
|
|
244
251
|
return types;
|
|
245
252
|
}, {});
|
|
246
253
|
}
|
|
254
|
+
callExpressionTypeParameters(callExpression) {
|
|
255
|
+
return callExpression.typeArguments || null;
|
|
256
|
+
}
|
|
257
|
+
computePartialProperties(
|
|
258
|
+
properties,
|
|
259
|
+
hasteModuleName,
|
|
260
|
+
types,
|
|
261
|
+
aliasMap,
|
|
262
|
+
enumMap,
|
|
263
|
+
tryParse,
|
|
264
|
+
cxxOnly,
|
|
265
|
+
) {
|
|
266
|
+
return properties.map(prop => {
|
|
267
|
+
return {
|
|
268
|
+
name: prop.key.name,
|
|
269
|
+
optional: true,
|
|
270
|
+
typeAnnotation: flowTranslateTypeAnnotation(
|
|
271
|
+
hasteModuleName,
|
|
272
|
+
prop.value,
|
|
273
|
+
types,
|
|
274
|
+
aliasMap,
|
|
275
|
+
enumMap,
|
|
276
|
+
tryParse,
|
|
277
|
+
cxxOnly,
|
|
278
|
+
this,
|
|
279
|
+
),
|
|
280
|
+
};
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
functionTypeAnnotation(propertyValueType) {
|
|
284
|
+
return propertyValueType === 'FunctionTypeAnnotation';
|
|
285
|
+
}
|
|
286
|
+
getTypeArgumentParamsFromDeclaration(declaration) {
|
|
287
|
+
return declaration.typeArguments.params;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* This FlowFixMe is supposed to refer to typeArgumentParams and
|
|
292
|
+
* funcArgumentParams of generated AST.
|
|
293
|
+
*/
|
|
294
|
+
getNativeComponentType(typeArgumentParams, funcArgumentParams) {
|
|
295
|
+
return {
|
|
296
|
+
propsTypeName: typeArgumentParams[0].id.name,
|
|
297
|
+
componentName: funcArgumentParams[0].value,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
getAnnotatedElementProperties(annotatedElement) {
|
|
301
|
+
return annotatedElement.right.properties;
|
|
302
|
+
}
|
|
247
303
|
}
|
|
248
304
|
module.exports = {
|
|
249
305
|
FlowParser,
|
|
@@ -18,19 +18,24 @@ import type {
|
|
|
18
18
|
NativeModuleParamTypeAnnotation,
|
|
19
19
|
NativeModuleEnumMemberType,
|
|
20
20
|
NativeModuleEnumMembers,
|
|
21
|
+
NativeModuleAliasMap,
|
|
22
|
+
NativeModuleEnumMap,
|
|
21
23
|
} from '../../CodegenSchema';
|
|
22
24
|
import type {ParserType} from '../errors';
|
|
23
25
|
import type {Parser} from '../parser';
|
|
24
|
-
import type {TypeDeclarationMap} from '../utils';
|
|
26
|
+
import type {ParserErrorCapturer, TypeDeclarationMap} from '../utils';
|
|
27
|
+
|
|
28
|
+
const {flowTranslateTypeAnnotation} = require('./modules');
|
|
25
29
|
|
|
26
30
|
// $FlowFixMe[untyped-import] there's no flowtype flow-parser
|
|
27
31
|
const flowParser = require('flow-parser');
|
|
28
32
|
|
|
29
33
|
const {buildSchema} = require('../parsers-commons');
|
|
30
|
-
const {Visitor} = require('
|
|
34
|
+
const {Visitor} = require('../parsers-primitives');
|
|
31
35
|
const {buildComponentSchema} = require('./components');
|
|
32
36
|
const {wrapComponentSchema} = require('../schema.js');
|
|
33
|
-
const {buildModuleSchema} = require('
|
|
37
|
+
const {buildModuleSchema} = require('../parsers-commons.js');
|
|
38
|
+
const {resolveTypeAnnotation} = require('./utils');
|
|
34
39
|
|
|
35
40
|
const fs = require('fs');
|
|
36
41
|
|
|
@@ -101,6 +106,8 @@ class FlowParser implements Parser {
|
|
|
101
106
|
buildModuleSchema,
|
|
102
107
|
Visitor,
|
|
103
108
|
this,
|
|
109
|
+
resolveTypeAnnotation,
|
|
110
|
+
flowTranslateTypeAnnotation,
|
|
104
111
|
);
|
|
105
112
|
}
|
|
106
113
|
|
|
@@ -253,6 +260,63 @@ class FlowParser implements Parser {
|
|
|
253
260
|
return types;
|
|
254
261
|
}, {});
|
|
255
262
|
}
|
|
263
|
+
|
|
264
|
+
callExpressionTypeParameters(callExpression: $FlowFixMe): $FlowFixMe | null {
|
|
265
|
+
return callExpression.typeArguments || null;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
computePartialProperties(
|
|
269
|
+
properties: Array<$FlowFixMe>,
|
|
270
|
+
hasteModuleName: string,
|
|
271
|
+
types: TypeDeclarationMap,
|
|
272
|
+
aliasMap: {...NativeModuleAliasMap},
|
|
273
|
+
enumMap: {...NativeModuleEnumMap},
|
|
274
|
+
tryParse: ParserErrorCapturer,
|
|
275
|
+
cxxOnly: boolean,
|
|
276
|
+
): Array<$FlowFixMe> {
|
|
277
|
+
return properties.map(prop => {
|
|
278
|
+
return {
|
|
279
|
+
name: prop.key.name,
|
|
280
|
+
optional: true,
|
|
281
|
+
typeAnnotation: flowTranslateTypeAnnotation(
|
|
282
|
+
hasteModuleName,
|
|
283
|
+
prop.value,
|
|
284
|
+
types,
|
|
285
|
+
aliasMap,
|
|
286
|
+
enumMap,
|
|
287
|
+
tryParse,
|
|
288
|
+
cxxOnly,
|
|
289
|
+
this,
|
|
290
|
+
),
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
functionTypeAnnotation(propertyValueType: string): boolean {
|
|
296
|
+
return propertyValueType === 'FunctionTypeAnnotation';
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
getTypeArgumentParamsFromDeclaration(declaration: $FlowFixMe): $FlowFixMe {
|
|
300
|
+
return declaration.typeArguments.params;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* This FlowFixMe is supposed to refer to typeArgumentParams and
|
|
305
|
+
* funcArgumentParams of generated AST.
|
|
306
|
+
*/
|
|
307
|
+
getNativeComponentType(
|
|
308
|
+
typeArgumentParams: $FlowFixMe,
|
|
309
|
+
funcArgumentParams: $FlowFixMe,
|
|
310
|
+
): {[string]: string} {
|
|
311
|
+
return {
|
|
312
|
+
propsTypeName: typeArgumentParams[0].id.name,
|
|
313
|
+
componentName: funcArgumentParams[0].value,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
getAnnotatedElementProperties(annotatedElement: $FlowFixMe): $FlowFixMe {
|
|
318
|
+
return annotatedElement.right.properties;
|
|
319
|
+
}
|
|
256
320
|
}
|
|
257
321
|
|
|
258
322
|
module.exports = {
|
package/lib/parsers/parser.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { SchemaType } from
|
|
9
|
-
import type { ParserType } from
|
|
8
|
+
import type { SchemaType } from '../CodegenSchema';
|
|
9
|
+
import type { ParserType } from './errors';
|
|
10
10
|
|
|
11
11
|
// useful members only for downstream
|
|
12
12
|
export interface Parser {
|
|
@@ -18,9 +18,11 @@ import type {
|
|
|
18
18
|
NativeModuleParamTypeAnnotation,
|
|
19
19
|
NativeModuleEnumMemberType,
|
|
20
20
|
NativeModuleEnumMembers,
|
|
21
|
+
NativeModuleAliasMap,
|
|
22
|
+
NativeModuleEnumMap,
|
|
21
23
|
} from '../CodegenSchema';
|
|
22
24
|
import type {ParserType} from './errors';
|
|
23
|
-
import type {TypeDeclarationMap} from './utils';
|
|
25
|
+
import type {ParserErrorCapturer, TypeDeclarationMap} from './utils';
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* This is the main interface for Parsers of various languages.
|
|
@@ -161,8 +163,8 @@ export interface Parser {
|
|
|
161
163
|
|
|
162
164
|
/**
|
|
163
165
|
* Given a typeAnnotation, it returns the annotated element.
|
|
164
|
-
* @
|
|
165
|
-
* @
|
|
166
|
+
* @parameter typeAnnotation: the annotation for a type.
|
|
167
|
+
* @parameter types: a map of type declarations.
|
|
166
168
|
* @returns: the annotated element.
|
|
167
169
|
*/
|
|
168
170
|
extractAnnotatedElement(
|
|
@@ -174,4 +176,64 @@ export interface Parser {
|
|
|
174
176
|
* Given the AST, returns the TypeDeclarationMap
|
|
175
177
|
*/
|
|
176
178
|
getTypes(ast: $FlowFixMe): TypeDeclarationMap;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Given a callExpression, it returns the typeParameters of the callExpression.
|
|
182
|
+
* @parameter callExpression: the callExpression.
|
|
183
|
+
* @returns: the typeParameters of the callExpression or null if it does not exist.
|
|
184
|
+
*/
|
|
185
|
+
callExpressionTypeParameters(callExpression: $FlowFixMe): $FlowFixMe | null;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Given an array of properties from a Partial type, it returns an array of remaped properties.
|
|
189
|
+
* @parameter properties: properties from a Partial types.
|
|
190
|
+
* @parameter hasteModuleName: a string with the native module name.
|
|
191
|
+
* @parameter types: a map of type declarations.
|
|
192
|
+
* @parameter aliasMap: a map of type aliases.
|
|
193
|
+
* @parameter enumMap: a map of type enums.
|
|
194
|
+
* @parameter tryParse: a parser error capturer.
|
|
195
|
+
* @parameter cxxOnly: a boolean specifying if the module is Cxx only.
|
|
196
|
+
* @returns: an array of remaped properties
|
|
197
|
+
*/
|
|
198
|
+
computePartialProperties(
|
|
199
|
+
properties: Array<$FlowFixMe>,
|
|
200
|
+
hasteModuleName: string,
|
|
201
|
+
types: TypeDeclarationMap,
|
|
202
|
+
aliasMap: {...NativeModuleAliasMap},
|
|
203
|
+
enumMap: {...NativeModuleEnumMap},
|
|
204
|
+
tryParse: ParserErrorCapturer,
|
|
205
|
+
cxxOnly: boolean,
|
|
206
|
+
): Array<$FlowFixMe>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Given a propertyValueType, it returns a boolean specifying if the property is a function type annotation.
|
|
210
|
+
* @parameter propertyValueType: the propertyValueType.
|
|
211
|
+
* @returns: a boolean specifying if the property is a function type annotation.
|
|
212
|
+
*/
|
|
213
|
+
functionTypeAnnotation(propertyValueType: string): boolean;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Given a declaration, it returns the typeArgumentParams of the declaration.
|
|
217
|
+
* @parameter declaration: the declaration.
|
|
218
|
+
* @returns: the typeArgumentParams of the declaration.
|
|
219
|
+
*/
|
|
220
|
+
getTypeArgumentParamsFromDeclaration(declaration: $FlowFixMe): $FlowFixMe;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Given a typeArgumentParams and funcArgumentParams it returns a native component type.
|
|
224
|
+
* @parameter typeArgumentParams: the typeArgumentParams.
|
|
225
|
+
* @parameter funcArgumentParams: the funcArgumentParams.
|
|
226
|
+
* @returns: a native component type.
|
|
227
|
+
*/
|
|
228
|
+
getNativeComponentType(
|
|
229
|
+
typeArgumentParams: $FlowFixMe,
|
|
230
|
+
funcArgumentParams: $FlowFixMe,
|
|
231
|
+
): {[string]: string};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Given a annotatedElement, it returns the properties of annotated element.
|
|
235
|
+
* @parameter annotatedElement: the annotated element.
|
|
236
|
+
* @returns: the properties of annotated element.
|
|
237
|
+
*/
|
|
238
|
+
getAnnotatedElementProperties(annotatedElement: $FlowFixMe): $FlowFixMe;
|
|
177
239
|
}
|
|
@@ -164,4 +164,48 @@ export class MockedParser {
|
|
|
164
164
|
getTypes(ast) {
|
|
165
165
|
return {};
|
|
166
166
|
}
|
|
167
|
+
callExpressionTypeParameters(callExpression) {
|
|
168
|
+
return callExpression.typeArguments || null;
|
|
169
|
+
}
|
|
170
|
+
computePartialProperties(
|
|
171
|
+
properties,
|
|
172
|
+
hasteModuleName,
|
|
173
|
+
types,
|
|
174
|
+
aliasMap,
|
|
175
|
+
enumMap,
|
|
176
|
+
tryParse,
|
|
177
|
+
cxxOnly,
|
|
178
|
+
) {
|
|
179
|
+
return [
|
|
180
|
+
{
|
|
181
|
+
name: 'a',
|
|
182
|
+
optional: true,
|
|
183
|
+
typeAnnotation: {
|
|
184
|
+
type: 'StringTypeAnnotation',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'b',
|
|
189
|
+
optional: true,
|
|
190
|
+
typeAnnotation: {
|
|
191
|
+
type: 'BooleanTypeAnnotation',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
functionTypeAnnotation(propertyValueType) {
|
|
197
|
+
return propertyValueType === 'FunctionTypeAnnotation';
|
|
198
|
+
}
|
|
199
|
+
getTypeArgumentParamsFromDeclaration(declaration) {
|
|
200
|
+
return declaration.typeArguments.params;
|
|
201
|
+
}
|
|
202
|
+
getNativeComponentType(typeArgumentParams, funcArgumentParams) {
|
|
203
|
+
return {
|
|
204
|
+
propsTypeName: typeArgumentParams[0].id.name,
|
|
205
|
+
componentName: funcArgumentParams[0].value,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
getAnnotatedElementProperties(annotatedElement) {
|
|
209
|
+
return annotatedElement.right.properties;
|
|
210
|
+
}
|
|
167
211
|
}
|
|
@@ -20,8 +20,10 @@ import type {
|
|
|
20
20
|
NativeModuleParamTypeAnnotation,
|
|
21
21
|
NativeModuleEnumMemberType,
|
|
22
22
|
NativeModuleEnumMembers,
|
|
23
|
+
NativeModuleAliasMap,
|
|
24
|
+
NativeModuleEnumMap,
|
|
23
25
|
} from '../CodegenSchema';
|
|
24
|
-
import type {TypeDeclarationMap} from './utils';
|
|
26
|
+
import type {ParserErrorCapturer, TypeDeclarationMap} from './utils';
|
|
25
27
|
|
|
26
28
|
// $FlowFixMe[untyped-import] there's no flowtype flow-parser
|
|
27
29
|
const flowParser = require('flow-parser');
|
|
@@ -180,4 +182,53 @@ export class MockedParser implements Parser {
|
|
|
180
182
|
getTypes(ast: $FlowFixMe): TypeDeclarationMap {
|
|
181
183
|
return {};
|
|
182
184
|
}
|
|
185
|
+
|
|
186
|
+
callExpressionTypeParameters(callExpression: $FlowFixMe): $FlowFixMe | null {
|
|
187
|
+
return callExpression.typeArguments || null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
computePartialProperties(
|
|
191
|
+
properties: Array<$FlowFixMe>,
|
|
192
|
+
hasteModuleName: string,
|
|
193
|
+
types: TypeDeclarationMap,
|
|
194
|
+
aliasMap: {...NativeModuleAliasMap},
|
|
195
|
+
enumMap: {...NativeModuleEnumMap},
|
|
196
|
+
tryParse: ParserErrorCapturer,
|
|
197
|
+
cxxOnly: boolean,
|
|
198
|
+
): Array<$FlowFixMe> {
|
|
199
|
+
return [
|
|
200
|
+
{
|
|
201
|
+
name: 'a',
|
|
202
|
+
optional: true,
|
|
203
|
+
typeAnnotation: {type: 'StringTypeAnnotation'},
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'b',
|
|
207
|
+
optional: true,
|
|
208
|
+
typeAnnotation: {type: 'BooleanTypeAnnotation'},
|
|
209
|
+
},
|
|
210
|
+
];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
functionTypeAnnotation(propertyValueType: string): boolean {
|
|
214
|
+
return propertyValueType === 'FunctionTypeAnnotation';
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
getTypeArgumentParamsFromDeclaration(declaration: $FlowFixMe): $FlowFixMe {
|
|
218
|
+
return declaration.typeArguments.params;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
getNativeComponentType(
|
|
222
|
+
typeArgumentParams: $FlowFixMe,
|
|
223
|
+
funcArgumentParams: $FlowFixMe,
|
|
224
|
+
): {[string]: string} {
|
|
225
|
+
return {
|
|
226
|
+
propsTypeName: typeArgumentParams[0].id.name,
|
|
227
|
+
componentName: funcArgumentParams[0].value,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
getAnnotatedElementProperties(annotatedElement: $FlowFixMe): $FlowFixMe {
|
|
232
|
+
return annotatedElement.right.properties;
|
|
233
|
+
}
|
|
183
234
|
}
|