public RDomRootGroup(Compilation compilation, IFactoryAccess factoryAccess) : base(compilation) { _compilation = compilation; _referencedTypeCache = new ReferencedTypeCache(compilation, factoryAccess); _roots = new RDomCollection <IRoot>(this); }
internal RDomStatementBlockBase(T oldRDom) : base(oldRDom) { Initialize(); _statements = oldRDom.StatementsAll.Copy(this); HasBlock = oldRDom.HasBlock; }
internal RDomLockStatement(RDomLockStatement oldRDom) : base(oldRDom) { Initialize(); _statements = oldRDom.StatementsAll.Copy(this); _hasBlock = oldRDom.HasBlock; _expression = oldRDom.Expression.Copy(); }
internal RDomCheckedStatement(RDomCheckedStatement oldRDom) : base(oldRDom) { Initialize(); _statements = oldRDom.StatementsAll.Copy(this); _hasBlock = oldRDom.HasBlock; _unchecked = oldRDom.Unchecked; }
internal RDomDestructor(RDomDestructor oldRDom) : base(oldRDom) { Initialize(); Attributes.AddOrMoveAttributeRange(oldRDom.Attributes.Select(x => x.Copy())); _statements = oldRDom.StatementsAll.Copy(this); _name = oldRDom.Name; _accessModifier = oldRDom.AccessModifier; }
internal RDomBaseLoop(T oldRDom) : base(oldRDom) { Initialize(); _statements = oldRDom.StatementsAll.Copy(this); _condition = oldRDom.Condition == null ? null : oldRDom.Condition.Copy(); _testAtEnd = oldRDom.TestAtEnd; _hasBlock = oldRDom.HasBlock; }
private void Initialize() { _members = new RDomCollection <ITypeMemberAndDetail>(this); _typeParameters = new RDomCollection <ITypeParameter>(this); _implementedInterfaces = new RDomCollection <IReferencedType>(this); var typeSymbol = Symbol as ITypeSymbol; // TODO: _allImplementedInterfaces = typeSymbol.AllInterfaces //if (typeSymbol == null) throw new NotImplementedException(); }
internal RDomBaseStemContainer(T oldIDom) : base(oldIDom) { Initialize(); var oldRDom = oldIDom as RDomBaseStemContainer <T, TSymbol>; RDomCollection <IStemMemberAndDetail> .Copy(oldRDom.StemMembersAll, _members); //_members = oldRDom.StemMembersAll.Copy(this); }
internal RDomEnum(RDomEnum oldRDom) : base(oldRDom) { Attributes.AddOrMoveAttributeRange(oldRDom.Attributes.Select(x => x.Copy())); _members = oldRDom.Members.Copy(this); _name = oldRDom.Name; _metadataName = oldRDom.MetadataName; _accessModifier = oldRDom.AccessModifier; _declaredAccessModifier = oldRDom.DeclaredAccessModifier; _underlyingType = oldRDom.UnderlyingType == null ? null : oldRDom.UnderlyingType.Copy(); }
internal RDomReferencedType(RDomReferencedType oldRDom) : base(oldRDom) { Initialize(); _name = oldRDom.Name; _namespace = oldRDom.Namespace; _displayAlias = oldRDom.DisplayAlias; _isArray = oldRDom.IsArray; _containingType = oldRDom.ContainingType; _typeArguments = oldRDom.TypeArguments.Copy(this); }
internal RDomTypeParameter(RDomTypeParameter oldRDom) : base(oldRDom) { Initialize(); _constraintTypes = new RDomCollection <IReferencedType>(this); _name = oldRDom.Name; _variance = oldRDom.Variance; _ordinal = oldRDom.Ordinal; _hasConstructorConstraint = oldRDom.HasConstructorConstraint; _hasReferenceTypeConstraint = oldRDom.HasReferenceTypeConstraint; _hasValueTypeConstraint = oldRDom.HasValueTypeConstraint; _constraintTypes = oldRDom.ConstraintTypes.Copy(this); }
internal RDomPropertyAccessor(RDomPropertyAccessor oldRDom) : base(oldRDom) { Initialize(); Attributes.AddOrMoveAttributeRange(oldRDom.Attributes.Select(x => x.Copy())); _statements = oldRDom.StatementsAll.Copy(this); _name = oldRDom.Name; _accessModifier = oldRDom.AccessModifier; _declaredAccessModifier = oldRDom.DeclaredAccessModifier; _hasBlock = oldRDom.HasBlock; _accessorType = oldRDom.AccessorType; }
internal RDomConstructor(RDomConstructor oldRDom) : base(oldRDom) { Initialize(); Attributes.AddOrMoveAttributeRange(oldRDom.Attributes.Select(x => x.Copy())); _parameters = oldRDom.Parameters.Copy(this); _statements = oldRDom.StatementsAll.Copy(this); _initializationArguments = oldRDom.InitializationArguments.Copy(this); _constructorInitializerType = oldRDom.ConstructorInitializerType; _name = oldRDom.Name; _accessModifier = oldRDom.AccessModifier; _declaredAccessModifier = oldRDom.DeclaredAccessModifier; _isStatic = oldRDom.IsStatic; }
internal RDomOperator(RDomOperator oldRDom) : base(oldRDom) { Initialize(); Attributes.AddOrMoveAttributeRange(oldRDom.Attributes.Select(x => x.Copy())); _parameters = oldRDom.Parameters.Copy(this); _statements = oldRDom.StatementsAll.Copy(this); IsStatic = oldRDom.IsStatic; _accessModifier = oldRDom.AccessModifier; _declaredAccessModifier = oldRDom.DeclaredAccessModifier; _name = oldRDom.Name; _type = oldRDom.Type.Copy(); _operator = oldRDom.Operator; }
internal RDomUsingStatement(RDomUsingStatement oldRDom) : base(oldRDom) { Initialize(); _statements = oldRDom.StatementsAll.Copy(this); _hasBlock = oldRDom.HasBlock; if (oldRDom.Expression != null) { _expression = oldRDom.Expression.Copy(); } if (oldRDom.Variable != null) { _variable = oldRDom.Variable.Copy(); } }
internal RDomProperty(RDomProperty oldRDom) : base(oldRDom) { Initialize(); _parameters = oldRDom.Parameters.Copy(this); Attributes.AddOrMoveAttributeRange(oldRDom.Attributes.Select(x => x.Copy())); GetAccessor = oldRDom.GetAccessor == null ? null : oldRDom.GetAccessor.Copy(); SetAccessor = oldRDom.SetAccessor == null ? null : oldRDom.SetAccessor.Copy(); _name = oldRDom.Name; _propertyType = oldRDom.PropertyType.Copy(); _accessModifier = oldRDom.AccessModifier; _declaredAccessModifier = oldRDom.DeclaredAccessModifier; _isAbstract = oldRDom.IsAbstract; _isVirtual = oldRDom.IsVirtual; _isOverride = oldRDom.IsOverride; _isSealed = oldRDom.IsSealed; _isStatic = oldRDom.IsStatic; _isNew = oldRDom.IsNew; }
internal RDomMethod(RDomMethod oldRDom) : base(oldRDom) { Attributes.AddOrMoveAttributeRange(oldRDom.Attributes.Select(x => x.Copy())); _parameters = oldRDom.Parameters.Copy(this); _typeParameters = oldRDom.TypeParameters.Copy(this); _statements = oldRDom.StatementsAll.Copy(this); _name = oldRDom.Name; _returnType = oldRDom.ReturnType.Copy(); _accessModifier = oldRDom.AccessModifier; _declaredAccessModifier = oldRDom.DeclaredAccessModifier; _isAbstract = oldRDom.IsAbstract; _isVirtual = oldRDom.IsVirtual; _isOverride = oldRDom.IsOverride; _isSealed = oldRDom.IsSealed; _isStatic = oldRDom.IsStatic; _isNew = oldRDom.IsNew; _isExtensionMethod = oldRDom.IsExtensionMethod; }
internal RDomBaseType(T oldIDom) : base(oldIDom) { Initialize(); var oldRDom = oldIDom as RDomBaseType <T>; _name = oldRDom.Name; _metadataName = oldRDom.MetadataName; _accessModifier = oldRDom.AccessModifier; _declaredAccessModifier = oldRDom.DeclaredAccessModifier; _memberKind = oldRDom._memberKind; _stemMemberKind = oldRDom._stemMemberKind; Attributes.AddOrMoveAttributeRange(oldRDom.Attributes.Select(x => x.Copy())); RDomCollection <ITypeMemberAndDetail> .Copy(oldRDom.MembersAll, _members); _typeParameters = oldRDom.TypeParameters.Copy(this); // TODO: _allImplementedInterfaces = oldRDom._allImplementedInterfaces.Select(x => x.Copy()); _implementedInterfaces.AddOrMoveRange(oldRDom._implementedInterfaces.Select(x => x.Copy())); }
private void Initialize() { _elements = new RDomCollection <IStructuredDocumentationElement>(this); }
public void Can_create_navigate_and_modify_list() { var csharpCode = @" public class Foo {} "; var root = RDom.CSharp.Load(csharpCode); var cl = root.Classes.First(); var list = new RDomCollection <IClass>(root); list.AddOrMove(cl); for (int i = 0; i < 5; i++) { var newCl = cl.Copy(); newCl.Name = cl.Name + i.ToString().Trim(); list.AddOrMove(newCl); } // Can add correctly? Assert.AreEqual(6, list.Count()); // Can loop var sb = new StringBuilder(); foreach (var foo in list) { sb.AppendLine(foo.Name); } var expected = "Foo\r\nFoo0\r\nFoo1\r\nFoo2\r\nFoo3\r\nFoo4\r\n"; Assert.AreEqual(expected, sb.ToString()); // Can use LINQ var foo3 = list.Skip(4).FirstOrDefault(); Assert.AreEqual("Foo3", foo3.Name); // Parent is set Assert.AreEqual(root, foo3.Parent); // Can remove list.Remove(foo3); Assert.AreEqual("Foo4", list.Skip(4).FirstOrDefault().Name); // Parent is unset Assert.AreEqual(null, foo3.Parent); // Can insert list.InsertOrMove(2, foo3); var test = list.Skip(2).First(); Assert.AreEqual(foo3, test); // Can insert before var fooA = cl.Copy(); fooA.Name = "FooA"; list.InsertOrMoveBefore(foo3, fooA); test = list.Skip(2).First(); Assert.AreEqual(fooA, test); // Can insert after var fooB = cl.Copy(); fooB.Name = "FooB"; list.InsertOrMoveAfter(foo3, fooB); test = list.Skip(4).First(); Assert.AreEqual(fooB, test); // Insert after last simply adds at end var pos = list.Count() + 5; var fooC = cl.Copy(); fooC.Name = "FooC"; list.InsertOrMove(pos, fooC); Assert.AreEqual(fooC, list.Last()); // AddRange var fooD = cl.Copy(); fooD.Name = "FooD"; var fooE = cl.Copy(); fooE.Name = "FooE"; var fooF = cl.Copy(); fooF.Name = "FooF"; list.AddOrMoveRange(new IClass[] { fooD, fooE, fooF }); Assert.AreEqual(12, list.Count()); // Can loop sb = new StringBuilder(); foreach (var foo in list) { sb.AppendLine(foo.Name); } expected = "Foo\r\nFoo0\r\nFooA\r\nFoo3\r\nFooB\r\nFoo1\r\nFoo2\r\nFoo4\r\nFooC\r\nFooD\r\nFooE\r\nFooF\r\n"; Assert.AreEqual(expected, sb.ToString()); }
public RDomStructuredDocumentation(RDomStructuredDocumentation oldRDom) : base(oldRDom) { Initialize(); RDomCollection <IStructuredDocumentationElement> .Copy(oldRDom.Elements, _elements); }
internal RDomInvocationExpression(RDomInvocationExpression oldRDom) : base(oldRDom) { _typeArguments = oldRDom.TypeArguments.Copy(this); _arguments = oldRDom.Arguments.Copy(this); }
internal RDomBlockStatement(RDomBlockStatement oldRDom) : base(oldRDom) { _statements = oldRDom.Statements.Copy(this); }
internal RDomLambdaSingleExpression(RDomLambdaSingleExpression oldRDom) : base(oldRDom) { _parameters = oldRDom.Parameters.Copy(this); }
private void Initialize() { _parameters = new RDomCollection <IParameter>(this); _accessors = new RDomCollection <IAccessor>(this); }
private void Initialize() { ExpressionType = ExpressionType.Invocation; _typeArguments = new RDomCollection<IReferencedType>(this); _arguments = new RDomCollection<IArgument>(this); }
private void Initialize() { _parameters = new RDomCollection<IParameter>(this); _statements = new RDomCollection<IStatementAndDetail>(this); }
internal RDomAttribute(RDomAttribute oldRDom) : base(oldRDom) { _name = oldRDom.Name; _attributeValues = oldRDom.AttributeValues.Copy(this); }
private void Initialize() { _catches = new RDomCollection <ICatchStatement>(this); }
internal RDomLambdaMultiLineExpression(RDomLambdaMultiLineExpression oldRDom) : base(oldRDom) { _parameters = oldRDom.Parameters.Copy(this); _statements = oldRDom.StatementsAll.Copy(this); }
private void Initialize() { _members = new RDomCollection <IStemMemberAndDetail>(this); }
private void Initialize() { _parameters = new RDomCollection<IParameter>(this); }
protected void Initialize() { _statements = new RDomCollection <IStatementAndDetail>(this); }
private void Initialize() { _typeArguments = new RDomCollection <IReferencedType>(this); }
private void Initialize() { _typeParameters = new RDomCollection <ITypeParameter>(this); _parameters = new RDomCollection <IParameter>(this); _statements = new RDomCollection <IStatementAndDetail>(this); }
internal RDomTryStatement(RDomTryStatement oldRDom) : base(oldRDom) { _catches = oldRDom.CatchesAll.Copy(this); _finally = oldRDom.Finally.Copy(); }