Ejemplo n.º 1
0
 public ConstantBindingContainer(
     BindingContainerTypes types,
     ArgumentSyntax constantSyntax,
     BindScopeEnum scope,
     ExpressionStatementSyntax expressionNode,
     ArgumentSyntax?whenArgumentClause,
     IReadOnlyList <IDefinedSetting> settings
     ) : base(types, scope, expressionNode, whenArgumentClause, constantSyntax, settings, false)
 {
     ConstructorArguments = new List <DetectedMethodArgument>();
 }
Ejemplo n.º 2
0
        public BindingContainerWithInstance(
            BindingContainerTypes types,
            IReadOnlyList <DetectedMethodArgument> constructorArguments,
            BindScopeEnum scope,
            ExpressionStatementSyntax expressionNode,
            ArgumentSyntax?whenArgumentClause,
            IReadOnlyList <IDefinedSetting> settings,
            bool isConventional
            ) : base(types, scope, expressionNode, whenArgumentClause, null, settings, isConventional)
        {
            if (constructorArguments is null)
            {
                throw new ArgumentNullException(nameof(constructorArguments));
            }

            ConstructorArguments = constructorArguments;
        }
Ejemplo n.º 3
0
        protected BaseBindingContainer(
            BindingContainerTypes types,
            BindScopeEnum scope,
            ExpressionStatementSyntax expressionNode,
            ArgumentSyntax?whenArgumentClause,
            ArgumentSyntax?constantSyntax,
            IReadOnlyList <IDefinedSetting> settings,
            bool isConventional
            )
        {
            if (types is null)
            {
                throw new ArgumentNullException(nameof(types));
            }

            if (scope == BindScopeEnum.Constant && constantSyntax is null)
            {
                throw new DpdtException(DpdtExceptionTypeEnum.InternalError, $"Misconfiguration between scope and constant syntax");
            }

            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (scope != BindScopeEnum.Constant && !(constantSyntax is null))
            {
                throw new DpdtException(DpdtExceptionTypeEnum.InternalError, $"Misconfiguration between scope and constant syntax");
            }

            _types                   = types;
            Scope                    = scope;
            ExpressionNode           = expressionNode;
            WhenArgumentClause       = whenArgumentClause;
            ConstantSyntax           = constantSyntax;
            _settings                = settings;
            IsConventional           = isConventional;
            UniqueUnstableIdentifier = Guid.NewGuid();

            var uniqueKey0 = expressionNode.SyntaxTree.FilePath.GetStringSha256Hash().SafeSubstring(0, 8);
            var uniqueKey1 = expressionNode.Span.Start;
            var uniqueKey2 = expressionNode.Span.End;
            var uniqueKey3 = types.BindToType.ToGlobalDisplayString().GetStringSha256Hash().SafeSubstring(0, 8);

            _uniqueKey = $"u{uniqueKey0}_{uniqueKey1}_{uniqueKey2}_{uniqueKey3}";
        }