Skip to content

Commit 3a7c47c

Browse files
committed
Put the actual default value for built-ins in the generated code
1 parent 5de5e09 commit 3a7c47c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/gentypes.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function _importdeps!(mod::ROSModule, deps::Vector)
216216
for d in deps
217217
#We don't care about array types when doing dependency resolution
218218
dclean = _check_array_type(d)[1]
219-
if ! (dclean in keys(_ros_builtin_types))
219+
if ! haskey(_ros_builtin_types, dclean)
220220
@debug("Dependency: ", d)
221221
pkgname, typename = _splittypestr(dclean)
222222

@@ -496,13 +496,15 @@ function _addtypemember!(exprs, namestr, typestr)
496496
typestr, arraylen = _check_array_type(typestr)
497497
if _isrostype(typestr)
498498
j_typ = symbol(_splittypestr(typestr)[2])
499+
#Default has to be deferred until the types exist
499500
j_def = Expr(:call, j_typ)
500501
else
501502
if ! haskey(_ros_builtin_types, typestr)
502503
error("Message generation; unknown type '$typestr'")
503504
end
504505
j_typ = _ros_builtin_types[typestr]
505-
j_def = Expr(:call, :_typedefault, j_typ)
506+
#Compute the default value now
507+
j_def = @eval _typedefault($j_typ)
506508
end
507509

508510
namesym = symbol(namestr)

0 commit comments

Comments
 (0)