Skip to content

Commit 5eb82ee

Browse files
author
Minggang Wang
committed
Generating the correct type of a property which is a constant string
from .msg Fix #488
1 parent c563501 commit 5eb82ee

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

rosidl_gen/generator.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rosidl-generator",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Generate JavaScript object from ROS IDL(.msg) files",
55
"main": "index.js",
66
"authors": [

rosidl_gen/templates/message.dot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,11 @@ class {{=arrayWrapper}} {
757757
{{? it.spec.constants != undefined && it.spec.constants.length}}
758758
// Define constants ({{=it.spec.constants.length}} in total)
759759
{{~ it.spec.constants :c}}
760+
{{? c.type === "string"}}
761+
Object.defineProperty({{=objectWrapper}}, "{{=c.name}}", {value: "{{=c.value}}", writable: false, enumerable: true, configurable: true});
762+
{{?? true}}
760763
Object.defineProperty({{=objectWrapper}}, "{{=c.name}}", {value: {{=c.value}}, writable: false, enumerable: true, configurable: true});
764+
{{?}}
761765
{{~}}
762766
{{?}}
763767

0 commit comments

Comments
 (0)