MCPcopy Create free account
hub / github.com/coder/coder / resolveBinaryExpr

Function resolveBinaryExpr

scripts/metricsdocgen/scanner/scanner.go:300–307  ·  view source on GitHub ↗

resolveBinaryExpr resolves a binary expression (string concatenation) to a string. It recursively resolves the left and right operands. Example: - "coderd_" + "api_" + "requests": "coderd_api_requests" - namespace + "_" + metricName: resolved concatenation

(expr *ast.BinaryExpr, decls declarations)

Source from the content-addressed store, hash-verified

298// - "coderd_" + "api_" + "requests": "coderd_api_requests"
299// - namespace + "_" + metricName: resolved concatenation
300func resolveBinaryExpr(expr *ast.BinaryExpr, decls declarations) string {
301 left := resolveStringExpr(expr.X, decls)
302 right := resolveStringExpr(expr.Y, decls)
303 if left != "" && right != "" {
304 return left + right
305 }
306 return ""
307}
308
309// extractStringSlice extracts a []string from a composite literal.
310// Example:

Callers 2

resolveStringExprFunction · 0.85
collectDeclsFunction · 0.85

Calls 1

resolveStringExprFunction · 0.85

Tested by

no test coverage detected