MCPcopy Index your code
hub / github.com/reactjs/react-rails / processComment

Function processComment

lib/assets/javascripts/JSXTransformer.js:4118–4168  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

4116 }
4117
4118 function processComment(node) {
4119 var lastChild,
4120 trailingComments,
4121 bottomRight = extra.bottomRightStack,
4122 last = bottomRight[bottomRight.length - 1];
4123
4124 if (node.type === Syntax.Program) {
4125 /* istanbul ignore else */
4126 if (node.body.length > 0) {
4127 return;
4128 }
4129 }
4130
4131 if (extra.trailingComments.length > 0) {
4132 if (extra.trailingComments[0].range[0] >= node.range[1]) {
4133 trailingComments = extra.trailingComments;
4134 extra.trailingComments = [];
4135 } else {
4136 extra.trailingComments.length = 0;
4137 }
4138 } else {
4139 if (last && last.trailingComments && last.trailingComments[0].range[0] >= node.range[1]) {
4140 trailingComments = last.trailingComments;
4141 delete last.trailingComments;
4142 }
4143 }
4144
4145 // Eating the stack.
4146 if (last) {
4147 while (last && last.range[0] >= node.range[0]) {
4148 lastChild = last;
4149 last = bottomRight.pop();
4150 }
4151 }
4152
4153 if (lastChild) {
4154 if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= node.range[0]) {
4155 node.leadingComments = lastChild.leadingComments;
4156 delete lastChild.leadingComments;
4157 }
4158 } else if (extra.leadingComments.length > 0 && extra.leadingComments[extra.leadingComments.length - 1].range[1] <= node.range[0]) {
4159 node.leadingComments = extra.leadingComments;
4160 extra.leadingComments = [];
4161 }
4162
4163 if (trailingComments) {
4164 node.trailingComments = trailingComments;
4165 }
4166
4167 bottomRight.push(node);
4168 }
4169
4170 function markerApply(marker, node) {
4171 if (extra.range) {

Callers 1

markerApplyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected