File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
languages/c/templates/datastructures Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ module.exports = {
9
9
constructorAssign : ( node ) => {
10
10
const fields = node . inputs . map ( ( p , idx ) => t ( 'Datastructures.fieldAssign' ) ( {
11
11
name : variable ( p . port ) ,
12
+ fieldType : p . type ,
12
13
index : idx ,
13
14
type : node . type ,
14
15
output : '____TMP____'
15
16
} ) )
16
17
return `
17
- /* ${ JSON . stringify ( node , null , 2 ) } */
18
18
${ sanitize ( node . type . name ) } * ____TMP____ = new ${ sanitize ( node . type . name ) } ();
19
19
${ variable ( node . output . port ) } = ${ t ( 'defType' ) ( node . output . type , '____TMP____' ) } ;
20
20
${ fields . join ( '\n' ) } `
@@ -29,6 +29,6 @@ ${fields.join('\n')}`
29
29
30
30
destructorAssign : ( assign ) => `${ variable ( assign . output . port ) } = ((${ t ( 'dataType' ) ( assign . type . name ) } *)${ variable ( assign . input . port ) } ->data)->get()->arg${ assign . parameter } ;` ,
31
31
32
- fieldAssign : ( assign ) => ` ${ assign . output } ->argp_${ assign . index } = ${ assign . name } ;`
32
+ fieldAssign : ( assign ) => ` ${ assign . output } ->argp_${ assign . index } = __copy_ ${ t ( 'Types.typeName' ) ( assign . fieldType ) } ( ${ assign . name } ) ;`
33
33
}
34
34
}
Original file line number Diff line number Diff line change @@ -30,13 +30,13 @@ struct ${sanitize(typeName)} {
30
30
std::string subType;
31
31
void* data;
32
32
${ orTypes . map ( ( type , idx ) => '\n ' + sanitize ( typeName ) + '(' + sanitize ( type . name ) + '* ptr) {\n' +
33
- ' this->data = (void*)(new ' + t ( 'dataType ' ) ( type . name ) + '(ptr));\n' +
33
+ ' this->data = (void*)(new ' + t ( 'Types.typeName ' ) ( type . name ) + '(ptr));\n' +
34
34
' this->subType = "' + type . name + '";\n' +
35
35
' }' ) . join ( '\n' ) }
36
36
37
37
~${ typeName } () {
38
38
if (false) {}
39
- ${ orTypes . map ( ( type , idx ) => 'else if (this->subType == "' + type . name + '") { delete ((' + t ( 'dataType ' ) ( type . name ) + '*)(this->data))->get( ); }' ) . join ( '\n' ) }
39
+ ${ orTypes . map ( ( type , idx ) => 'else if (this->subType == "' + type . name + '") { delete ((' + t ( 'Types.typeName ' ) ( type . name ) + '*)(this->data)); }' ) . join ( '\n' ) }
40
40
}
41
41
};
42
42
@@ -59,7 +59,7 @@ std::string ${t('Types.toStringName')(struct.metaInformation.type.type.type)} (c
59
59
return `
60
60
std::string ${ t ( 'Types.toStringName' ) ( struct . metaInformation . type . type . type ) } (const ${ sanitize ( struct . metaInformation . type . type . type ) } & obj) {
61
61
if (false) {}
62
- ${ orTypes . map ( ( type , idx ) => 'else if (obj.subType == "' + type . name + '") { return __' + sanitize ( type . name ) + '_to_std__string(*((' + t ( 'dataType ' ) ( type . name ) + '*)(obj.data))->get( )); }' ) . join ( '\n' ) }
62
+ ${ orTypes . map ( ( type , idx ) => 'else if (obj.subType == "' + type . name + '") { return __' + sanitize ( type . name ) + '_to_std__string(*((' + t ( 'Types.typeName ' ) ( type . name ) + '*)(obj.data))); }' ) . join ( '\n' ) }
63
63
}
64
64
`
65
65
} else {
You can’t perform that action at this time.
0 commit comments