Esempio n. 1
0
        public static void TestMethodDefined(IToken methodName, int size, ExpressionValue variable)
        {
            MethodInfo methodInfo = variable.GetType().GetMethod(methodName.Text);

            if (methodInfo == null)
            {
                throw new ParsingException(string.Format(Resources.Can_NOT_find_the_method__0__with__1__parameters_in_class__2__, methodName.Text, size, variable.GetType().Name), methodName);
            }
        }
Esempio n. 2
0
        public static void TestFieldDefined(IToken fieldName, ExpressionValue variable)
        {
            FieldInfo fieldInfo = variable.GetType().GetField(fieldName.Text);

            if (fieldInfo == null)
            {
                PropertyInfo propertyInfo = variable.GetType().GetProperty(fieldName.Text);
                if (propertyInfo == null)
                {
                    throw new ParsingException(string.Format("Cannot find the field {0} in class {1}", fieldName.Text, variable.GetType().Name), fieldName);
                }
            }
        }