Files
Synvoya 67b4525f32 fix(scala): emit field type references for var declarations
The Scala field handler matched only `val_definition`, so a mutable field
(`var b: Repo`), which parses as `var_definition`, had its type reference
silently dropped from the graph. val and var nodes are structurally identical
(both expose a `type` field), so the existing type-collection logic works
unchanged. Widen the guard to accept var_definition.

Adds a var field to the Scala fixture and a regression test.
2026-07-01 16:36:47 +01:00

30 lines
660 B
Scala

import scala.collection.mutable.ListBuffer
case class Config(baseUrl: String, timeout: Int)
trait Loggable
abstract class BaseClient
class HttpClient(config: Config) extends BaseClient with Loggable {
val source: Config = config
var fallback: BaseClient = null
def get(path: String): String = {
buildRequest("GET", path)
}
def post(path: String, body: String): String = {
buildRequest("POST", path)
}
private def buildRequest(method: String, path: String): String = {
s"$method ${config.baseUrl}$path"
}
}
object HttpClientFactory {
def create(baseUrl: String): HttpClient = {
new HttpClient(Config(baseUrl, 30))
}
}