當前位置: 首頁>>代碼示例>>C#>>正文


C# Scripting.CodeContext類代碼示例

本文整理匯總了C#中Microsoft.Scripting.CodeContext的典型用法代碼示例。如果您正苦於以下問題:C# CodeContext類的具體用法?C# CodeContext怎麽用?C# CodeContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CodeContext類屬於Microsoft.Scripting命名空間,在下文中一共展示了CodeContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Call

 public static object Call(CodeContext/*!*/ context, TypeGroup/*!*/ self, params object[] args) {
     return PythonCalls.Call(
         context,
         DynamicHelpers.GetPythonTypeFromType(self.NonGenericType),
         args ?? ArrayUtils.EmptyObjects
     );
 }
開發者ID:nieve,項目名稱:ironruby,代碼行數:7,代碼來源:TypeGroupOps.cs

示例2: GetValue

 /// <summary>
 /// Convenience function for users to call directly
 /// </summary>
 public object GetValue(CodeContext context, object instance) {
     object value;
     if (TryGetValue(context, instance, DynamicHelpers.GetPythonType(instance), out value)) {
         return value;
     }
     throw new InvalidOperationException("cannot get field");
 }
開發者ID:techarch,項目名稱:ironruby,代碼行數:10,代碼來源:ReflectedField.cs

示例3: CreateCodeContext

 public static CodeContext CreateCodeContext(Type[] extensionTypes)
 {
     DefaultLanguageContext dlc = new DefaultLanguageContext();
     CodeContext cc = new CodeContext(new Scope(), dlc, new ModuleContext(null));
     dlc._binder = new DefaultActionBinder(cc, extensionTypes);
     return cc;
 }
開發者ID:robertlj,項目名稱:IronScheme,代碼行數:7,代碼來源:DefaultLanguageContext.cs

示例4: TraceBackFrame

 internal TraceBackFrame(CodeContext context, TotemDictionary globals, object locals, FunctionCode code)
 {
     _globals = globals;
     _locals = locals;
     _code = code;
     _context = context;
 }
開發者ID:Alxandr,項目名稱:IronTotem-3.0,代碼行數:7,代碼來源:TraceBack.cs

示例5: PythonTypeChangedEventArgs

 public PythonTypeChangedEventArgs(CodeContext context, SymbolId changed, ChangeType type, object previous, object newValue) {
     _context = context;
     _changed = changed;
     _type = type;
     _previous = previous;
     _newValue = newValue;
 }
開發者ID:JamesTryand,項目名稱:IronScheme,代碼行數:7,代碼來源:PythonTypeChangedEventArgs.cs

示例6: InvariantContext

 static InvariantContext()
 {
     Instance = new InvariantContext();
     ModuleContext moduleContext = new ModuleContext(null);
     moduleContext.ShowCls = true;
     CodeContext = new CodeContext(new Scope(null), Instance, moduleContext);
 }
開發者ID:robertlj,項目名稱:IronScheme,代碼行數:7,代碼來源:InvariantContext.cs

示例7: DynamicStackFrame

 public DynamicStackFrame(CodeContext context, MethodBase method, string funcName, string filename, int line) {
     _context = context;
     _funcName = funcName;
     _filename = filename;
     _lineNo = line;
     _method = method;
 }
開發者ID:JamesTryand,項目名稱:IronScheme,代碼行數:7,代碼來源:DynamicStackFrame.cs

示例8: CheckCodeContext

 protected static object CheckCodeContext(CodeContext cc)
 {
   if (cc != null && cc.Scope.Parent.Parent == null)
   {
     return null;
   }
   return cc;
 }
開發者ID:JamesTryand,項目名稱:IronScheme,代碼行數:8,代碼來源:Closure.cs

示例9: TryGetValue

 internal override bool TryGetValue(CodeContext context, object instance, PythonType owner, out object value) {
     if (instance != null || owner == TypeCache.Null) {
         CheckSelf(context, instance);
         value = UncheckedGetAttribute(instance);
         return true;
     }
     value = this;
     return true;
 }
開發者ID:CookieEaters,項目名稱:FireHTTP,代碼行數:9,代碼來源:BuiltinMethodDescriptor.cs

示例10: Build

 public override object Build(CodeContext context, object[] args, object[] parameters, object ret)
 {
     if (_returnArgs.Count == 1) {
         return GetValue(args, ret, _returnArgs[0]);
     } else {
         object[] retValues = new object[_returnArgs.Count];
         int rIndex = 0;
         foreach (int index in _returnArgs) {
             retValues[rIndex++] = GetValue(args, ret, index);
         }
         return _binder.GetByRefArray(retValues);
     }
 }
開發者ID:robertlj,項目名稱:IronScheme,代碼行數:13,代碼來源:ByRefReturnBuilder.cs

示例11: Initialize

        internal static void Initialize(IronSchemeLanguageProvider ironSchemeLanguageProvider)
        {
            lp = ironSchemeLanguageProvider;
              se = lp.GetEngine() as IronSchemeScriptEngine;

              scriptmodule = ScriptDomainManager.CurrentManager.Host.DefaultModule as ScriptModule;

              ModuleContext mc = new ModuleContext(scriptmodule);

              mc.CompilerContext = new CompilerContext(SourceUnit.CreateSnippet(se, ""));

              cc = new CodeContext(scriptmodule.Scope, se.GetLanguageContext(), mc);

              binder = new IronScheme.Actions.IronSchemeActionBinder(cc);

              Generator.initme = true;
        }
開發者ID:kkirstein,項目名稱:IronScheme,代碼行數:17,代碼來源:Generator.Helpers.cs

示例12: AddGenerators

 public static void AddGenerators(CodeContext cc, Assembly assembly)
 {
   foreach (Type t in assembly.GetExportedTypes())
   {
     if (Attribute.IsDefined(t, typeof(GeneratorAttribute)))
     {
       IGenerator g = Activator.CreateInstance(t) as IGenerator;
       
       foreach (GeneratorAttribute ga in t.GetCustomAttributes(typeof(GeneratorAttribute), false))
       {
         string name = ga.Name;
         object s = SymbolTable.StringToObject(name);
         cc.Scope.SetName((SymbolId)s, g);
       }
     }
   }
 }
開發者ID:JamesTryand,項目名稱:IronScheme,代碼行數:17,代碼來源:Generator.Handlers.cs

示例13: TrySetValue

        internal override bool TrySetValue(CodeContext context, object instance, PythonType owner, object value) {
            if (Setter.Length == 0) {
                return false;
            }

            if (instance == null) {
                foreach (MethodInfo mi in Setter) {
                    if(mi.IsStatic && DeclaringType != owner.UnderlyingSystemType) {
                        return false;
                    } else if (mi.IsProtected()) {
                        throw PythonOps.TypeErrorForProtectedMember(owner.UnderlyingSystemType, _info.Name);
                    }
                }
            } else if (instance != null) {
                foreach (MethodInfo mi in Setter) {
                    if (mi.IsStatic) {
                        return false;
                    }
                }
            }

            return CallSetter(context, PythonContext.GetContext(context).GetGenericCallSiteStorage(), instance, ArrayUtils.EmptyObjects, value);
        }
開發者ID:joshholmes,項目名稱:ironruby,代碼行數:23,代碼來源:ReflectedProperty.cs

示例14: TryGetValue

        internal override bool TryGetValue(CodeContext context, object instance, PythonType owner, out object value) {
            PerfTrack.NoteEvent(PerfTrack.Categories.Properties, this);

            value = CallGetter(context, owner, PythonContext.GetContext(context).GetGenericCallSiteStorage0(), instance);
            return true;
        }
開發者ID:joshholmes,項目名稱:ironruby,代碼行數:6,代碼來源:ReflectedProperty.cs

示例15: __repr__

 public string/*!*/ __repr__(CodeContext/*!*/ context) {
     return string.Format("<property# {0} on {1}>",
         __name__,
         DynamicHelpers.GetPythonTypeFromType(DeclaringType).Name);
 }
開發者ID:joshholmes,項目名稱:ironruby,代碼行數:5,代碼來源:ReflectedProperty.cs


注:本文中的Microsoft.Scripting.CodeContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。