public DefinedConstructorProvider(IDefinedTypeInitializer provider, ParseInfo parseInfo, Scope scope, ConstructorContext context) { _parseInfo = parseInfo; _scope = scope.Child(true); _context = context; TypeProvider = provider; _recursiveCallHandler = new RecursiveCallHandler(this, context.SubroutineName); CallInfo = new CallInfo(_recursiveCallHandler, parseInfo.Script, ContentReady); SubroutineName = context.SubroutineName?.Text.RemoveQuotes(); DefinedAt = parseInfo.Script.GetLocation(context.ConstructorToken.Range); // Setup the parameters. ParameterProviders = ParameterProvider.GetParameterProviders(_parseInfo, _scope, _context.Parameters, SubroutineName != null); ParameterTypes = ParameterProviders.Select(p => p.Type).ToArray(); parseInfo.TranslateInfo.StagedInitiation.On(this); parseInfo.Script.AddCodeLensRange(new ReferenceCodeLensRange(this, parseInfo, CodeLensSourceType.Constructor, DefinedAt.range)); parseInfo.Script.Elements.AddDeclarationCall(this, new DeclarationCall(context.ConstructorToken.Range, true)); // Add the CallInfo to the recursion check. parseInfo.TranslateInfo.GetComponent <RecursionCheckComponent>().AddCheck(CallInfo); }