public static ValueVariantBase Clone([CanBeNull] this VariableValueVariantBase self,
                                             [NotNull] AnalysisContext context,
                                             GraphNode[] path)
        {
            var clone = self.Clone(context);

            if (clone != null)
            {
                clone.Path = path;
            }

            return(clone);
        }
        public static VariableValueVariantBase Clone([CanBeNull] this VariableValueVariantBase self,
                                                     [NotNull] AnalysisContext context)
        {
            switch (self)
            {
            case null:
                return(null);

            case ArrayVariant arrayVariant:
                return(arrayVariant.Clone(context));

            case CombinedVariant combinedVariant:
                return(combinedVariant.CreateNewInstance(context));

            case VariableVariant variableVariant:
                return(variableVariant.Clone(context));

            default:
                throw new ArgumentOutOfRangeException(nameof(self));
            }
        }
Exemplo n.º 3
0
 protected VariableValueVariantBase([NotNull] VariableValueVariantBase clone, [NotNull] AnalysisContext context)
     : base(clone, context)
 {
     StorageVariable = clone.StorageVariable;
 }