travis-ci
4670 of 5656 branches covered (82.57%)
13 of 13 new or added lines in 2 files covered. (100.0%)
10412 of 11525 relevant lines covered (90.34%)
5850.54 hits per line
1 |
"use strict";
|
|
2 |
|
|
3 |
const Node = require("./Node");
|
19 only 2387.2 ✔ |
4 |
|
|
5 |
function _isMultilineComment(comment) { |
|
6 |
return comment && comment.indexOf("\n") !== -1; |
|
7 |
} |
|
8 |
|
|
9 |
class Comment extends Node { |
|
10 |
constructor(def) { |
|
11 |
super("Comment"); |
2,430 only 2387.2 ✔ |
12 |
|
|
13 |
const comment = def.comment; |
2,430 only 2387.2 ✔ |
14 |
|
|
15 |
if (_isMultilineComment(comment)) {
|
|
16 |
this.comment = `/*\n${comment}\n*/`; |
1 only 2387.2 ✔ |
17 |
} else {
|
|
18 |
this.comment = `// ${comment}`; |
2,429 only 2387.2 ✔ |
19 |
} |
|
20 |
} |
|
21 |
|
|
22 |
generateCode() { |
|
23 |
return this; |
2,430 only 2387.2 ✔ |
24 |
} |
|
25 |
|
|
26 |
writeCode(writer) { |
|
27 |
var name = this.comment; |
2,412 only 2387.2 ✔ |
28 |
writer.write(name); |
2,412 only 2387.2 ✔ |
29 |
} |
|
30 |
|
|
31 |
toString() { |
|
32 |
return this.comment; |
× |
33 |
} |
|
34 |
} |
|
35 |
|
|
36 |
module.exports = Comment; |
19 only 2387.2 ✔ |