Inheritance: SyntaxWalkerWithSemantic
コード例 #1
0
        public override void VisitConstructorDeclaration(ConstructorDeclarationSyntax node)
        {
            // ignore static constructors
            if (node.IsStatic())
                return;

            var constructor = new Constructor();
            // read parameters
            var parameterSyntaxReader = new ParameterSyntaxReader(constructor, _semantic);
            parameterSyntaxReader.Visit(node);
            _constructors.AddConstructor(constructor);
            base.VisitConstructorDeclaration(node);
        }
コード例 #2
0
 public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
 {
     var method = new Method(
         node.Identifier.ToString(),
         (ITypeSymbol)_semantic.GetSymbolInfo(node.ReturnType).Symbol);
     // set correct modifiers
     method.IsOverride = node.Modifiers.Any(x => x.IsKind(SyntaxKind.OverrideKeyword));
     method.IsAbstract = node.Modifiers.Any(x => x.IsKind(SyntaxKind.AbstractKeyword));
     // read parameters
     var parameterSyntaxReader = new ParameterSyntaxReader(method, _semantic);
     parameterSyntaxReader.Visit(node);
     _methods.AddMethod(method);
     // we don't care if the method here is abstract or not
     // since methods that are defined directly in the child
     // will never be overridden by mixin methods
 }