protected Generator()
        {
            foreach (var method in GetType()
                     .GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
                     .Where(method => method.ReturnType == typeof(void))
                     .Where(method => method.GetParameters().Count() == 1)
                     )
            {
                var parameterType = method.GetParameters().First().ParameterType;
                if (parameterType.IsSubclassOf(typeof(AstNode)))
                {
                    GenerateMappings[parameterType] = MappingInfo.FromMethodInfo(this, method);
                }
            }

            Reset();
        }
示例#2
0
        public Generator()
        {
            foreach (
                var Method
                in
                this.GetType()
                .GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
                .Where(Method => Method.ReturnType == typeof(void))
                .Where(Method => Method.GetParameters().Count() == 1)
                )
            {
                var ParameterType = Method.GetParameters().First().ParameterType;
                if (ParameterType.IsSubclassOf(typeof(AstNode)))
                {
                    GenerateMappings[ParameterType] = MappingInfo.FromMethodInfo(this, Method);
                }
            }

            this.Reset();
        }