当前位置: 首页>>代码示例>>C#>>正文


C# mdr.AddOwnPropertyDescriptorByFieldId方法代码示例

本文整理汇总了C#中mdr.AddOwnPropertyDescriptorByFieldId方法的典型用法代码示例。如果您正苦于以下问题:C# mdr.AddOwnPropertyDescriptorByFieldId方法的具体用法?C# mdr.AddOwnPropertyDescriptorByFieldId怎么用?C# mdr.AddOwnPropertyDescriptorByFieldId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mdr的用法示例。


在下文中一共展示了mdr.AddOwnPropertyDescriptorByFieldId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddSymbolsToContext

 private static void AddSymbolsToContext(List<JSSymbol> symbols, mdr.DObject context)
 {
   //This is called when we are sharing the context, so should be careful not to add fields that are already there
   //Technically, this is the generic and safe way to do this. 
   for (var i = symbols.Count - 1; i >= 0; --i)
   {
     var symbol = symbols[i];
     if (symbol.SymbolType == JSSymbol.SymbolTypes.ClosedOnLocal)
     {
       var pd = context.Map.GetPropertyDescriptorByFieldId(symbol.FieldId); //TODO: can this be made faster?
       if (pd == null)
         context.AddOwnPropertyDescriptorByFieldId(symbol.FieldId, PropertyDescriptor.Attributes.Data | PropertyDescriptor.Attributes.NotConfigurable);
     }
   }
 }
开发者ID:reshadi2,项目名称:mcjs,代码行数:15,代码来源:JSFunctionContext.cs

示例2: CreateArgumentsObject

    public static mdr.DArray CreateArgumentsObject(ref mdr.CallFrame callFrame, mdr.DObject context)
    {
      var metadata = (JSFunctionMetadata)callFrame.Function.Metadata;
      Debug.Assert(metadata.Scope.HasArgumentsSymbol, "Invalid situation, created arguments for the wrong scope!");
      mdr.DArray arguments = null;
      if (metadata.Scope.IsEvalFunction)
      {
        //Read from context
        var tmp = new mdr.DValue();
        context.GetField(JSFunctionArguments.Name, ref tmp);
        arguments = tmp.AsDArray();
      }
      else
      {
        arguments = CreateArgumentsObject(ref callFrame);
        var parameters = metadata.FunctionIR.Parameters;
        Debug.Assert(arguments.Length >= parameters.Count, "arguments array is not large enough to hold all arguments.");
        for (var i = parameters.Count - 1; i >= 0; --i)
        {
          var symbol = parameters[i].Symbol;
          var paramIndex = symbol.ParameterIndex;
          Debug.Assert(paramIndex == i, "Invalid situation!, Parameter indexes don't match!");

          if (symbol.SymbolType == JSSymbol.SymbolTypes.ClosedOnLocal)
          {
            var pd = context.AddOwnPropertyDescriptorByFieldId(symbol.FieldId, mdr.PropertyDescriptor.Attributes.Accessor | mdr.PropertyDescriptor.Attributes.NotConfigurable);
            context.Fields[pd.Index].Set(new ArgumentAccessor(arguments, paramIndex));
          }
        }
        if (metadata.Scope.HasEval)
          context.SetField(JSFunctionArguments.Name, arguments);
      }
      return arguments;
    }
开发者ID:reshadi2,项目名称:mcjs,代码行数:34,代码来源:JSFunctionArguments.cs

示例3: DeclareVariable

    public static void DeclareVariable(mdr.DObject context, string field, int fieldId, ref Stack stack)
    {
      //we may be looking at a global or this might be second time we call this function with the same context, so following assert will fail (incorrectly)
      //Debug.Assert(!context.HasOwnPropertyByFieldId(fieldId), "Cannot redeclare local variable {0}", field);

      context.AddOwnPropertyDescriptorByFieldId(fieldId, mdr.PropertyDescriptor.Attributes.Data | mdr.PropertyDescriptor.Attributes.NotConfigurable);
    }
开发者ID:reshadi2,项目名称:mcjs,代码行数:7,代码来源:Stack.cs


注:本文中的mdr.AddOwnPropertyDescriptorByFieldId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。