MCPcopy Index your code
hub / github.com/react/react / evalStringConcat

Function evalStringConcat

scripts/shared/evalToString.js:9–22  ·  view source on GitHub ↗
(ast)

Source from the content-addressed store, hash-verified

7'use strict';
8
9function evalStringConcat(ast) {
10 switch (ast.type) {
11 case 'StringLiteral':
12 case 'Literal': // ESLint
13 return ast.value;
14 case 'BinaryExpression': // `+`
15 if (ast.operator !== '+') {
16 throw new Error('Unsupported binary operator ' + ast.operator);
17 }
18 return evalStringConcat(ast.left) + evalStringConcat(ast.right);
19 default:
20 throw new Error('Unsupported type ' + ast.type);
21 }
22}
23exports.evalStringConcat = evalStringConcat;
24
25function evalStringAndTemplateConcat(ast, args) {

Callers 2

leaveFunction · 0.85
parseAndEvalFunction · 0.85

Calls

no outgoing calls

Tested by 1

parseAndEvalFunction · 0.68