protected override IPhpValue VisitMethodExpression(MethodExpression src) { if (src.Method.IsStatic) { var phpClassName = state.Principles.GetPhpType(src.Method.DeclaringType, true, state.Principles.CurrentType); if (phpClassName.IsEmpty) { throw new Exception("phpClassName cannot be null"); } phpClassName = phpClassName.MakeAbsolute(); var className = new PhpConstValue(phpClassName.FullName); var methodTranslationInfo = state.Principles.GetOrMakeTranslationInfo(src.Method); if (!src.Method.IsPublic) { WriteWarning(string.Format("Using not public method {0}.{1} as expression", src.Method.DeclaringType, src.Method.Name)); } var methodName = new PhpConstValue(methodTranslationInfo.ScriptName); var arrayCreation = new PhpArrayCreateExpression(className, methodName); return(SimplifyPhpExpression(arrayCreation)); } { // ryzykuję z this var targetObject = new PhpThisExpression(); var methodTranslationInfo = state.Principles.GetOrMakeTranslationInfo(src.Method); var methodName = new PhpConstValue(methodTranslationInfo.ScriptName); var arrayCreation = new PhpArrayCreateExpression(targetObject, methodName); return(SimplifyPhpExpression(arrayCreation)); } }
protected virtual T VisitPhpThisExpression(PhpThisExpression node) { if (ThrowNotImplementedException) { throw new NotImplementedException(string.Format("Method {0} is not supported in class {1}", "VisitPhpThisExpression", this.GetType().FullName)); } return(default(T)); }
protected override IPhpValue VisitPhpThisExpression(PhpThisExpression node) { return(node); }