The Labs \ Source Viewer \ SSCLI \ Microsoft.JScript \ JSMethod

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. namespace Microsoft.JScript
  16. {
  17.    
  18.     using System;
  19.     using System.Reflection;
  20.     using System.Reflection.Emit;
  21.     using System.Globalization;
  22.     using System.Diagnostics;
  23.     using System.Runtime.InteropServices;
  24.    
  25.     [GuidAttribute("561AC104-8869-4368-902F-4E0D7DDEDDDD")]
  26.     [ComVisible(true)]
  27.     public abstract class JSMethod : MethodInfo
  28.     {
  29.         internal object obj;
  30.        
  31.         internal JSMethod(object obj)
  32.         {
  33.             this.obj = obj;
  34.         }
  35.        
  36.         internal abstract object Construct(object[] args);
  37.        
  38.         public override MethodInfo GetBaseDefinition()
  39.         {
  40.             return this;
  41.         }
  42.        
  43.         internal virtual string GetClassFullName()
  44.         {
  45.             if (this.obj is ClassScope) {
  46.                 return ((ClassScope)this.obj).GetFullName();
  47.             }
  48.             throw new JScriptException(JSError.InternalError);
  49.         }
  50.        
  51.         public override object[] GetCustomAttributes(Type t, bool inherit)
  52.         {
  53.             return new object[0];
  54.         }
  55.        
  56.         public override object[] GetCustomAttributes(bool inherit)
  57.         {
  58.             return new object[0];
  59.         }
  60.        
  61.         public override MethodImplAttributes GetMethodImplementationFlags()
  62.         {
  63.             return (MethodImplAttributes)0;
  64.         }
  65.        
  66.         internal abstract MethodInfo GetMethodInfo(CompilerGlobals compilerGlobals);
  67.        
  68.         internal virtual PackageScope GetPackage()
  69.         {
  70.             if (this.obj is ClassScope) {
  71.                 return ((ClassScope)this.obj).GetPackage();
  72.             }
  73.             throw new JScriptException(JSError.InternalError);
  74.         }
  75.        
  76.         #if !DEBUG
  77.         [DebuggerStepThroughAttribute()]
  78.         [DebuggerHiddenAttribute()]
  79.         #endif
  80.         public override object Invoke(object obj, BindingFlags options, Binder binder, object[] parameters, CultureInfo culture)
  81.         {
  82.             return this.Invoke(obj, obj, options, binder, parameters, culture);
  83.         }
  84.        
  85.         internal abstract object Invoke(object obj, object thisob, BindingFlags options, Binder binder, object[] parameters, CultureInfo culture);
  86.        
  87.         public override sealed bool IsDefined(Type type, bool inherit)
  88.         {
  89.             return false;
  90.         }
  91.        
  92.         public override MemberTypes MemberType {
  93.             get { return MemberTypes.Method; }
  94.         }
  95.        
  96.         public override RuntimeMethodHandle MethodHandle {
  97.             get { return this.GetMethodInfo(null).MethodHandle; }
  98.         }
  99.        
  100.         public override Type ReflectedType {
  101.             get { return this.DeclaringType; }
  102.         }
  103.        
  104.         public override ICustomAttributeProvider ReturnTypeCustomAttributes {
  105.             get { return null; }
  106.         }
  107.        
  108.     }
  109. }

Developer Fusion