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

  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.    
  21.     // WARNING: This attribute should be sealed but isn't because we accidently shipped
  22.     // it this way. The compiler assumes this attribute is sealed and will not respect
  23.     // subclasses of this attribute.
  24.     [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor)]
  25.     public class JSFunctionAttribute : Attribute
  26.     {
  27.         internal JSFunctionAttributeEnum attributeValue;
  28.         internal JSBuiltin builtinFunction;
  29.        
  30.         public JSFunctionAttribute(JSFunctionAttributeEnum value)
  31.         {
  32.             this.attributeValue = value;
  33.             this.builtinFunction = (JSBuiltin)0;
  34.         }
  35.        
  36.         public JSFunctionAttribute(JSFunctionAttributeEnum value, JSBuiltin builtinFunction)
  37.         {
  38.             this.attributeValue = value;
  39.             this.builtinFunction = builtinFunction;
  40.         }
  41.        
  42.         public JSFunctionAttributeEnum GetAttributeValue()
  43.         {
  44.             return this.attributeValue;
  45.         }
  46.     }
  47.    
  48.     [System.Runtime.InteropServices.GuidAttribute("BA5ED019-F669-3C35-93AC-3ABF776B62B3")]
  49.     [System.Runtime.InteropServices.ComVisible(true)]
  50.     [Flags()]
  51.     public enum JSFunctionAttributeEnum
  52.     {
  53.         None = 0,
  54.         HasArguments = 1,
  55.         HasThisObject = 2,
  56.         IsNested = 4,
  57.         HasStackFrame = 8,
  58.         //For use by debugger to keep outer scope locals in sync with outer scope stack frame
  59.         HasVarArgs = 16,
  60.         HasEngine = 32,
  61.         IsExpandoMethod = 64,
  62.         //A method that is used as a constructor function
  63.         IsInstanceNestedClassConstructor = 128,
  64.         //A constructor of an instance nested class. Takes a trailing hidden parameter providing the nesting class instance.
  65.         // common combinations, not actually used, but improves debugging experience.
  66.         ClassicFunction = HasArguments | HasThisObject | HasEngine,
  67.         NestedFunction = HasStackFrame | IsNested | HasEngine,
  68.         ClassicNestedFunction = ClassicFunction | NestedFunction
  69.     }
  70. }

Developer Fusion