Skip to content

Commit 2cf0713

Browse files
committed
Don't remove blank line
1 parent fed3366 commit 2cf0713

File tree

1 file changed

+15
-29
lines changed

1 file changed

+15
-29
lines changed

rosidl_gen/idl_generator.js

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ const dots = dot.process({
2929
path: path.join(__dirname, '../rosidl_gen/templates'),
3030
});
3131

32-
function removeEmptyLines(str) {
33-
return str.replace(/^\s*\n/gm, '');
34-
}
35-
3632
/**
3733
* Output generated code to disk. Do not overwrite
3834
* an existing file. If file already exists do nothing.
@@ -68,9 +64,7 @@ async function generateServiceJSStruct(
6864
'__' +
6965
serviceInfo.interfaceName +
7066
'.js';
71-
const generatedSrvCode = removeEmptyLines(
72-
dots.service({ serviceInfo: serviceInfo })
73-
);
67+
const generatedSrvCode = dots.service({ serviceInfo: serviceInfo });
7468

7569
// We are going to only generate the service JavaScript file if it meets one
7670
// of the followings:
@@ -91,9 +85,7 @@ async function generateServiceJSStruct(
9185

9286
async function generateServiceEventMsg(serviceInfo, dir) {
9387
const fileName = serviceInfo.interfaceName + '.msg';
94-
const generatedEvent = removeEmptyLines(
95-
dots.service_event({ serviceInfo: serviceInfo })
96-
);
88+
const generatedEvent = dots.service_event({ serviceInfo: serviceInfo });
9789

9890
return writeGeneratedCode(dir, fileName, generatedEvent).then(() => {
9991
serviceInfo.interfaceName += '_Event';
@@ -126,14 +118,12 @@ async function generateServiceEventJSStruct(msgInfo, dir) {
126118
// const AddTwoInts_RequestWrapper = require('../../generated/example_interfaces/example_interfaces__srv__AddTwoInts_Request.js');
127119
// const AddTwoInts_ResponseWrapper = require('../../generated/example_interfaces/example_interfaces__srv__AddTwoInts_Response.js');
128120
msgInfo.isServiceEvent = true;
129-
const generatedCode = removeEmptyLines(
130-
dots.message({
131-
messageInfo: msgInfo,
132-
spec: spec,
133-
json: JSON.stringify(spec, null, ' '),
134-
isDebug: isDebug,
135-
})
136-
);
121+
const generatedCode = dots.message({
122+
messageInfo: msgInfo,
123+
spec: spec,
124+
json: JSON.stringify(spec, null, ' '),
125+
isDebug: isDebug,
126+
});
137127

138128
return writeGeneratedCode(dir, eventFileName, generatedCode);
139129
}
@@ -156,14 +146,12 @@ function generateMessageJSStructFromSpec(messageInfo, dir, spec) {
156146
spec.msgName +
157147
'.js';
158148

159-
const generatedCode = removeEmptyLines(
160-
dots.message({
161-
messageInfo: messageInfo,
162-
spec: spec,
163-
json: JSON.stringify(spec, null, ' '),
164-
isDebug: isDebug,
165-
})
166-
);
149+
const generatedCode = dots.message({
150+
messageInfo: messageInfo,
151+
spec: spec,
152+
json: JSON.stringify(spec, null, ' '),
153+
isDebug: isDebug,
154+
});
167155
return writeGeneratedCode(dir, fileName, generatedCode);
168156
}
169157

@@ -298,9 +286,7 @@ async function generateActionJSStruct(actionInfo, dir) {
298286
'__' +
299287
actionInfo.interfaceName +
300288
'.js';
301-
const generatedCode = removeEmptyLines(
302-
dots.action({ actionInfo: actionInfo })
303-
);
289+
const generatedCode = dots.action({ actionInfo: actionInfo });
304290
dir = path.join(dir, actionInfo.pkgName);
305291
const action = writeGeneratedCode(dir, fileName, generatedCode);
306292

0 commit comments

Comments
 (0)