public static void CheckLifetimes(this ClassMemberSyntax member) { member.Match() .With <ConstructorSyntax>(constructor => { foreach (var parameter in constructor.Parameters) { //TODO parameter.Type.DefaultOwnership(Ownership.BorrowImmutable); } throw new NotImplementedException(); }) .With <FieldSyntax>(field => { throw new NotImplementedException(); }) .Exhaustive(); }
private void Build(ClassMemberSyntax member, ClassBinder containingScope) { member.Match() .With<FieldSyntax>(field => { Build(field.Type.Type, containingScope); if(field.InitExpression != null) Build(field.InitExpression, containingScope); }) .With<ConstructorSyntax>(constructor => { foreach(var parameter in constructor.Parameters) Build(parameter.Type.Type, containingScope); Binder scope = new FunctionBinder(containingScope); binders.Add(constructor, scope); foreach(var statement in constructor.Body) scope = Build(statement, scope); }) .With<DestructorSyntax>(destructor => { foreach(var parameter in destructor.Parameters) if(parameter.Type != null) Build(parameter.Type.Type, containingScope); Binder scope = new FunctionBinder(containingScope); binders.Add(destructor, scope); foreach(var statement in destructor.Body) scope = Build(statement, scope); }) .With<IndexerMethodSyntax>(indexer => { foreach(var parameter in indexer.Parameters) if(parameter.Type != null) Build(parameter.Type.Type, containingScope); // TODO deal with return type Binder scope = new FunctionBinder(containingScope); binders.Add(indexer, scope); foreach(var statement in indexer.Body) scope = Build(statement, scope); }) .With<MethodSyntax>(method => { foreach(var parameter in method.Parameters) if(parameter.Type != null) Build(parameter.Type.Type, containingScope); // TODO deal with return type Binder scope = new FunctionBinder(containingScope); binders.Add(method, scope); foreach(var statement in method.Body) scope = Build(statement, scope); }) .Exhaustive(); }
private void Build(ClassMemberSyntax member, ClassBinder containingScope) { member.Match() .With <FieldSyntax>(field => { Build(field.Type.Type, containingScope); if (field.InitExpression != null) { Build(field.InitExpression, containingScope); } }) .With <ConstructorSyntax>(constructor => { foreach (var parameter in constructor.Parameters) { Build(parameter.Type.Type, containingScope); } Binder scope = new FunctionBinder(containingScope); binders.Add(constructor, scope); foreach (var statement in constructor.Body) { scope = Build(statement, scope); } }) .With <DestructorSyntax>(destructor => { foreach (var parameter in destructor.Parameters) { if (parameter.Type != null) { Build(parameter.Type.Type, containingScope); } } Binder scope = new FunctionBinder(containingScope); binders.Add(destructor, scope); foreach (var statement in destructor.Body) { scope = Build(statement, scope); } }) .With <IndexerMethodSyntax>(indexer => { foreach (var parameter in indexer.Parameters) { if (parameter.Type != null) { Build(parameter.Type.Type, containingScope); } } // TODO deal with return type Binder scope = new FunctionBinder(containingScope); binders.Add(indexer, scope); foreach (var statement in indexer.Body) { scope = Build(statement, scope); } }) .With <MethodSyntax>(method => { foreach (var parameter in method.Parameters) { if (parameter.Type != null) { Build(parameter.Type.Type, containingScope); } } // TODO deal with return type Binder scope = new FunctionBinder(containingScope); binders.Add(method, scope); foreach (var statement in method.Body) { scope = Build(statement, scope); } }) .Exhaustive(); }