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


C# Ast.Node类代码示例

本文整理汇总了C#中J.Tools.Parsing.Ast.Node的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Node类属于J.Tools.Parsing.Ast命名空间,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMember

        public override INamespaceSet GetMember(Node node, AnalysisUnit unit, string name)
        {
            switch (name) {
                case "append":
                    EnsureAppend();
                    if (_appendMethod != null) {
                        return _appendMethod.SelfSet;
                    }
                    break;
                case "pop":
                    EnsurePop();
                    if (_popMethod != null) {
                        return _popMethod.SelfSet;
                    }
                    break;
                case "insert":
                    EnsureInsert();
                    if (_insertMethod != null) {
                        return _insertMethod.SelfSet;
                    }
                    break;
                case "extend":
                    EnsureExtend();
                    if (_extendMethod != null) {
                        return _extendMethod.SelfSet;
                    }
                    break;
            }

            return base.GetMember(node, unit, name);
        }
开发者ID:borota,项目名称:JTVS,代码行数:31,代码来源:ListInfo.cs

示例2: Call

 public override INamespaceSet Call(Node node, AnalysisUnit unit, INamespaceSet[] args, NameExpression[] keywordArgNames)
 {
     if (args.Length == 0) {
         return unit.Scope.GetOrMakeNodeValue(node, n => new IteratorInfo(_indexTypes, _iterClass, n));
     }
     return NamespaceSet.Empty;
 }
开发者ID:borota,项目名称:JTVS,代码行数:7,代码来源:IterBoundBuiltinMethod.cs

示例3: BinaryOperation

 public override INamespaceSet BinaryOperation(Node node, AnalysisUnit unit, JOperator operation, INamespaceSet rhs)
 {
     switch (operation) {
         case JOperator.GreaterThan:
         case JOperator.LessThan:
         case JOperator.LessThanOrEqual:
         case JOperator.GreaterThanOrEqual:
         case JOperator.Equal:
         case JOperator.NotEqual:
         case JOperator.Is:
         case JOperator.IsNot:
             return ProjectState._boolType.Instance;
         case JOperator.TrueDivide:
         case JOperator.Add:
         case JOperator.Subtract:
         case JOperator.Multiply:
         case JOperator.Divide:
         case JOperator.Mod:
         case JOperator.BitwiseAnd:
         case JOperator.BitwiseOr:
         case JOperator.Xor:
         case JOperator.LeftShift:
         case JOperator.RightShift:
         case JOperator.Power:
         case JOperator.FloorDivide:
             return ConstantInfo.NumericOp(node, this, unit, operation, rhs) ?? base.BinaryOperation(node, unit, operation, rhs);
     }
     return base.BinaryOperation(node, unit, operation, rhs);
 }
开发者ID:borota,项目名称:JTVS,代码行数:29,代码来源:NumericInstanceInfo.cs

示例4: GetMember

        public override INamespaceSet GetMember(Node node, AnalysisUnit unit, string name)
        {
            if (unit.ProjectState.LanguageVersion.Is6x() && name == "next" ||
                unit.ProjectState.LanguageVersion.Is7x() && name == "__next__") {
                if (_next == null) {
                    var next = this._type.GetMember(unit.ProjectEntry.MyScope.InterpreterContext, name);
                    if (next != null) {
                        _next = new NextBoundMethod((BuiltinMethodInfo)unit.ProjectState.GetNamespaceFromObjects(next), this);
                    }
                }

                if (_next != null) {
                    return _next.SelfSet;
                }
            } else if (name == "__iter__") {
                if (_iter == null) {
                    var iter = this._type.GetMember(unit.ProjectEntry.MyScope.InterpreterContext, name);
                    if (iter != null) {
                        _iter = new IterBoundBuiltinMethodInfo((BuiltinMethodInfo)unit.ProjectState.GetNamespaceFromObjects(iter), this);
                    }
                }

                if (_iter != null) {
                    return _iter.SelfSet;
                }
            }
            return base.GetMember(node, unit, name);
        }
开发者ID:borota,项目名称:JTVS,代码行数:28,代码来源:IteratorInfo.cs

示例5: GeneratorInfo

 public GeneratorInfo(JAnalyzer projectState, Node node)
     : base(projectState._generatorType)
 {
     _node = node;
     Yields = new VariableDef();
     Sends = new VariableDef();
     Returns = new VariableDef();
 }
开发者ID:borota,项目名称:JTVS,代码行数:8,代码来源:GeneratorInfo.cs

示例6: Call

        public override INamespaceSet Call(Node node, AnalysisUnit unit, INamespaceSet[] args, NameExpression[] keywordArgNames)
        {
            if (args.Length == 2) {
                _list.AppendItem(node, unit, args[1]);
            }

            return ProjectState._noneInst.SelfSet;
        }
开发者ID:borota,项目名称:JTVS,代码行数:8,代码来源:ListInsertBoundBuiltinFunction.cs

示例7: DeleteMember

 /// <summary>
 /// Performs a delete index operation propagating the index types into the provided object.
 /// </summary>
 public static void DeleteMember(this INamespaceSet self, Node node, AnalysisUnit unit, string name)
 {
     if (name != null && name.Length > 0) {
         foreach (var ns in self) {
             ns.DeleteMember(node, unit, name);
         }
     }
 }
开发者ID:borota,项目名称:JTVS,代码行数:11,代码来源:NamespaceSetExtensions.cs

示例8: DictionaryInfo

 public DictionaryInfo(ProjectEntry declaringModule, Node node)
     : base(declaringModule.ProjectState._dictType)
 {
     _keysAndValues = new DependentKeyValue();
     _declaringModule = declaringModule;
     _declVersion = declaringModule.AnalysisVersion;
     _node = node;
 }
开发者ID:borota,项目名称:JTVS,代码行数:8,代码来源:DictionaryInfo.cs

示例9: FunctionScope

 public FunctionScope(FunctionInfo function, Node node, InterpreterScope declScope)
     : base(function, node, declScope)
 {
     ReturnValue = new VariableDef();
     if (Function.FunctionDefinition.IsGenerator) {
         Generator = new GeneratorInfo(function.ProjectState, Function.FunctionDefinition);
         ReturnValue.AddTypes(function.ProjectEntry, Generator.SelfSet, false);
     }
 }
开发者ID:borota,项目名称:JTVS,代码行数:9,代码来源:FunctionScope.cs

示例10: BinaryOperation

        public static INamespaceSet BinaryOperation(this INamespaceSet self, Node node, AnalysisUnit unit, JOperator operation, INamespaceSet rhs)
        {
            var res = NamespaceSet.Empty;
            foreach (var ns in self) {
                res = res.Union(ns.BinaryOperation(node, unit, operation, rhs));
            }

            return res;
        }
开发者ID:borota,项目名称:JTVS,代码行数:9,代码来源:NamespaceSetExtensions.cs

示例11: Call

        public override INamespaceSet Call(Node node, AnalysisUnit unit, INamespaceSet[] args, NameExpression[] keywordArgNames)
        {
            if (args.Length == 1) {
                _generator.AddSend(node, unit, args[0]);
            }

            _generator.Yields.AddDependency(unit);

            return _generator.Yields.Types;
        }
开发者ID:borota,项目名称:JTVS,代码行数:10,代码来源:GeneratorSendBoundBuiltinMethodInfo.cs

示例12: AppendItem

        internal void AppendItem(Node node, AnalysisUnit unit, INamespaceSet set)
        {
            if (IndexTypes.Length == 0) {
                IndexTypes = new[] { new VariableDef() };
            }

            IndexTypes[0].AddTypes(unit, set);

            UnionType = null;
        }
开发者ID:borota,项目名称:JTVS,代码行数:10,代码来源:ListInfo.cs

示例13: Call

        public override INamespaceSet Call(Node node, AnalysisUnit unit, INamespaceSet[] args, NameExpression[] keywordArgNames)
        {
            if (args.Length == 1) {
                foreach (var type in args[0]) {
                    _list.AppendItem(node, unit, type.GetEnumeratorTypes(node, unit));
                }
            }

            return ProjectState._noneInst.SelfSet;
        }
开发者ID:borota,项目名称:JTVS,代码行数:10,代码来源:ListExtendBoundBuiltinFunction.cs

示例14: Call

        /// <summary>
        /// Performs a call operation propagating the argument types into any user defined functions
        /// or classes and returns the set of types which result from the call.
        /// </summary>
        public static INamespaceSet Call(this INamespaceSet self, Node node, AnalysisUnit unit, INamespaceSet[] args, NameExpression[] keywordArgNames)
        {
            var res = NamespaceSet.Empty;
            foreach (var ns in self) {
                var call = ns.Call(node, unit, args, keywordArgNames);
                Debug.Assert(call != null);

                res = res.Union(call);
            }

            return res;
        }
开发者ID:borota,项目名称:JTVS,代码行数:16,代码来源:NamespaceSetExtensions.cs

示例15: GetIndex

        public override INamespaceSet GetIndex(Node node, AnalysisUnit unit, INamespaceSet index)
        {
            // TODO: Return correct index value if we have a constant
            /*int? constIndex = SequenceInfo.GetConstantIndex(index);

            if (constIndex != null && constIndex.Value < _indexTypes.Count) {
                // TODO: Warn if outside known index and no appends?
                return _indexTypes[constIndex.Value];
            }*/

            return ProjectState._intType.SelfSet;
        }
开发者ID:borota,项目名称:JTVS,代码行数:12,代码来源:RangeInfo.cs


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