File tree Expand file tree Collapse file tree 1 file changed +41
-23
lines changed
Expand file tree Collapse file tree 1 file changed +41
-23
lines changed Original file line number Diff line number Diff line change @@ -69,29 +69,47 @@ function getPrimitiveNameByType(type) {
6969
7070function getTypedArrayName(type) {
7171 const t = type.type.toLowerCase();
72- if (t === 'int8') {
73- return 'Int8Array';
74- } else if (t === 'uint8') {
75- return 'Uint8Array';
76- } else if (t === 'int16') {
77- return 'Int16Array';
78- } else if (t === 'uint16') {
79- return 'Uint16Array';
80- } else if (t === 'int32') {
81- return 'Int32Array';
82- } else if (t === 'uint32') {
83- return 'Uint32Array';
84- } else if (t === 'float64') {
85- return 'Float64Array';
86- } else if (t === 'float32') {
87- return 'Float32Array';
88- } else if (t === 'char') {
89- return 'Int8Array';
90- } else if (t === 'byte') {
91- return 'Uint8Array';
92- } else {
93- return '';
94- }
72+ let typedArrayName;
73+
74+ switch (t) {
75+ case 'byte':
76+ case 'octet':
77+ case 'uint8':
78+ typedArrayName = 'Uint8Array';
79+ break;
80+ case 'char':
81+ case 'int8':
82+ typedArrayName = 'Int8Array';
83+ break;
84+ case 'int16':
85+ case 'short':
86+ typedArrayName = 'Int16Array';
87+ break;
88+ case 'uint16':
89+ case 'unsigned short':
90+ typedArrayName = 'Uint16Array';
91+ break;
92+ case 'int32':
93+ case 'long':
94+ typedArrayName = 'Int32Array';
95+ break;
96+ case 'uint32':
97+ case 'unsigned long':
98+ typedArrayName = 'Uint32Array';
99+ break;
100+ case 'float':
101+ case 'float32':
102+ typedArrayName = 'Float32Array';
103+ break;
104+ case 'double':
105+ case 'float64':
106+ typedArrayName = 'Float64Array';
107+ break;
108+ default:
109+ typedArrayName = '';
110+ }
111+
112+ return typedArrayName;
95113}
96114
97115function getTypedArrayElementName(type) {
You can’t perform that action at this time.
0 commit comments