@typemove/move 1.0.0-rc.6 → 1.0.0-rc.8
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/package.json +1 -1
- package/src/abstract-codegen.ts +15 -1
- package/src/utils.ts +8 -0
package/package.json
CHANGED
package/src/abstract-codegen.ts
CHANGED
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
SPLITTER,
|
|
17
17
|
upperFirst,
|
|
18
18
|
VECTOR_STR,
|
|
19
|
+
camel,
|
|
19
20
|
} from './utils.js'
|
|
20
|
-
import { camel } from 'radash'
|
|
21
21
|
import { TypeDescriptor } from './types.js'
|
|
22
22
|
import { ChainAdapter } from './chain-adapter.js'
|
|
23
23
|
|
|
@@ -345,6 +345,20 @@ export abstract class AbstractCodegen<ModuleTypes, StructType> {
|
|
|
345
345
|
return genericString
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
// generateTypeParameters(struct: TypeDescriptor, useAny = false) {
|
|
349
|
+
// let genericString = ''
|
|
350
|
+
//
|
|
351
|
+
// if (struct.typeArgs && struct.typeArgs.length > 0) {
|
|
352
|
+
// const params = struct.typeArgs
|
|
353
|
+
// .map((_, idx) => {
|
|
354
|
+
// return useAny ? 'any' : 'T' + idx
|
|
355
|
+
// })
|
|
356
|
+
// .join(',')
|
|
357
|
+
// genericString = `<${params}>`
|
|
358
|
+
// }
|
|
359
|
+
// return genericString
|
|
360
|
+
// }
|
|
361
|
+
|
|
348
362
|
generateCallArgsStructs(
|
|
349
363
|
module: InternalMoveModule,
|
|
350
364
|
func: InternalMoveFunction
|
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InternalMoveModule, InternalMoveStruct } from './internal-models.js'
|
|
2
|
+
import { camel as camelRadash } from 'radash'
|
|
2
3
|
|
|
3
4
|
export const SPLITTER = '::'
|
|
4
5
|
|
|
@@ -51,6 +52,8 @@ const KEYWORDS = new Set([
|
|
|
51
52
|
'number',
|
|
52
53
|
'bigint',
|
|
53
54
|
'any',
|
|
55
|
+
'new',
|
|
56
|
+
'delete',
|
|
54
57
|
])
|
|
55
58
|
|
|
56
59
|
export function normalizeToJSName(name: string) {
|
|
@@ -81,3 +84,8 @@ export function structQname(
|
|
|
81
84
|
export function upperFirst(str: string): string {
|
|
82
85
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
83
86
|
}
|
|
87
|
+
|
|
88
|
+
export function camel(str: string): string {
|
|
89
|
+
const base = camelRadash(str)
|
|
90
|
+
return str.endsWith('_') ? base + '_' : base
|
|
91
|
+
}
|