• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# JSNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: VisitNodeInternalUp

        private void VisitNodeInternalUp(JSNode node, IEnumerable<SequencePoint> sequencePoints)
        {
            if (node == null)
            {
                return;
            }

            if (sequencePoints != null && node.SymbolInfo == null)
            {
                node.SymbolInfo = new SymbolInfo(sequencePoints, true);
            }

            foreach (var child in node.Children)
            {
                if (child == null)
                {
                    continue;
                }

                if (child.SymbolInfo != null)
                {
                    sequencePoints = child.SymbolInfo.SequencePoints;
                }

                VisitNodeInternalUp(child, sequencePoints);
            }
        }
开发者ID:sq,项目名称:JSIL,代码行数:27,代码来源:AttachSymbolInfoToStatements.cs


示例2: EliminateVariable

        protected void EliminateVariable (JSNode context, JSVariable variable, JSExpression replaceWith, QualifiedMemberIdentifier method) {
            {
                var replacer = new VariableEliminator(
                    variable,
                    JSChangeTypeExpression.New(replaceWith, variable.GetActualType(TypeSystem), TypeSystem)
                );
                replacer.Visit(context);
            }

            {
                var replacer = new VariableEliminator(variable, replaceWith);
                var assignments = (from a in FirstPass.Assignments where 
                                       variable.Equals(a.NewValue) ||
                                       a.NewValue.SelfAndChildrenRecursive.Any(variable.Equals)
                                       select a).ToArray();

                foreach (var a in assignments) {
                    if (!variable.Equals(a.NewValue))
                        replacer.Visit(a.NewValue);
                }
            }

            Variables.Remove(variable.Identifier);
            FunctionSource.InvalidateFirstPass(method);
        }
开发者ID:Don191,项目名称:JSIL,代码行数:25,代码来源:EliminateSingleUseTemporaries.cs


示例3: JSAstCursor

        public JSAstCursor(JSNode root, params string[] namesToSkip)
        {
            Root = root;
            NamesToSkip = new HashSet<string>(namesToSkip);

            Reset();
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:7,代码来源:JSAstCursor.cs


示例4: State

 public State (JSNode node, string name, int depth, int nodeIndex, int? statementIndex) {
     Node = node;
     Name = name;
     Depth = depth;
     NodeIndex = nodeIndex;
     StatementIndex = statementIndex;
 }
开发者ID:Don191,项目名称:JSIL,代码行数:7,代码来源:JSAstCursor.cs


示例5: DeconstructMutationAssignment

        public static JSExpression DeconstructMutationAssignment (
            JSNode parentNode, JSBinaryOperatorExpression boe, TypeSystem typeSystem, TypeReference intermediateType
        ) {
            var assignmentOperator = boe.Operator as JSAssignmentOperator;
            if (assignmentOperator == null)
                return null;

            JSBinaryOperator replacementOperator;
            if (!IntroduceEnumCasts.ReverseCompoundAssignments.TryGetValue(assignmentOperator, out replacementOperator))
                return null;

            var leftType = boe.Left.GetActualType(typeSystem);

            var newBoe = new JSBinaryOperatorExpression(
                JSOperator.Assignment, MakeLhsForAssignment(boe.Left),
                new JSBinaryOperatorExpression(
                    replacementOperator, boe.Left, boe.Right, intermediateType
                ),
                leftType
            );

            var result = ConvertReadExpressionToWriteExpression(newBoe, typeSystem);
            if (parentNode is JSExpressionStatement) {
                return result;
            } else {
                var comma = new JSCommaExpression(
                    newBoe, boe.Left
                );
                return comma;
            }
        }
开发者ID:TukekeSoft,项目名称:JSIL,代码行数:31,代码来源:DecomposeMutationOperators.cs


示例6: SkipNode

        private void SkipNode (JSNode node, string name, Indices indices, int depth) {
            indices.GetNodeIndex();

            if (node is JSStatement)
                indices.GetStatementIndex();

            foreach (var e in VisitChildren(node, indices, depth)) {
                foreach (var c in e)
                    ;
            }
        }
开发者ID:Don191,项目名称:JSIL,代码行数:11,代码来源:JSAstCursor.cs


示例7: IsPropertySetterInvocation

        public static bool IsPropertySetterInvocation(JSNode parentNode, JSBinaryOperatorExpression boe, out JSPropertyAccess pa)
        {
            var isValidParent =
                (parentNode is JSExpressionStatement);

            pa = boe.Left as JSPropertyAccess;

            return (pa != null) &&
                pa.IsWrite &&
                (boe.Operator == JSOperator.Assignment) &&
                isValidParent &&
                CanConvertToInvocation(pa);
        }
开发者ID:snuderl,项目名称:JSIL,代码行数:13,代码来源:ConvertPropertyAccessesToInvocations.cs


示例8: ReplaceChild

        public override void ReplaceChild (JSNode oldChild, JSNode newChild) {
            if (oldChild == null)
                throw new ArgumentNullException("oldChild");

            var stmt = newChild as JSStatement;
            if (stmt == null)
                return;

            for (int i = 0, c = Statements.Count; i < c; i++) {
                if (Statements[i] == oldChild)
                    Statements[i] = stmt;
            }
        }
开发者ID:GlennSandoval,项目名称:JSIL,代码行数:13,代码来源:JSStatementTypes.cs


示例9: IsPropertyGetterInvocation

        public static bool IsPropertyGetterInvocation(JSNode parentNode, JSPropertyAccess pa)
        {
            var parentBoe = parentNode as JSBinaryOperatorExpression;
            var parentUoe = parentNode as JSUnaryOperatorExpression;

            bool isMutation = (
                    (parentUoe != null) &&
                    (parentUoe.Operator is JSUnaryMutationOperator)
                ) || (
                    (parentBoe != null) &&
                    (parentBoe.Operator is JSAssignmentOperator) &&
                    (pa == parentBoe.Left)
                );

            return !pa.IsWrite &&
                !isMutation &&
                CanConvertToInvocation(pa);
        }
开发者ID:snuderl,项目名称:JSIL,代码行数:18,代码来源:ConvertPropertyAccessesToInvocations.cs


示例10: VisitNode

        public override void VisitNode(JSNode node)
        {
            if (node == null)
            {
                return;
            }

            if (node.SymbolInfo != null /* && node.SymbolInfo.Inferred*/)
            {
                if ((ParentNode is JSForLoop && ((JSForLoop) ParentNode).Condition == node))
                {
                }
                else
                {
                    node.SymbolInfo = null;
                }
            }

            VisitChildren(node);
        }
开发者ID:sq,项目名称:JSIL,代码行数:20,代码来源:FixSymbolInfo.cs


示例11: VisitNode

        private IEnumerable<State> VisitNode (JSNode node, string name = null, Indices indices = null, int depth = 0) {
            int? statementIndex = null;

            if (indices == null)
                indices = new Indices();

            int nodeIndex = indices.GetNodeIndex();

            if (node is JSStatement)
                statementIndex = indices.GetStatementIndex();

            yield return new State(
                node, name, depth, nodeIndex, statementIndex
            );

            foreach (var e in VisitChildren(node, indices, depth)) {
                foreach (var c in e)
                    yield return c;
            }
        }
开发者ID:Don191,项目名称:JSIL,代码行数:20,代码来源:JSAstCursor.cs


示例12: VisitNodeInternalDown

        private void VisitNodeInternalDown(JSNode node)
        {
            if (node == null)
            {
                return;
            }

            foreach (var child in node.Children)
            {
                VisitNodeInternalDown(child);
            }

            if (node.SymbolInfo == null)
            {
                var childSymboInfo = node.Children.Where(item => item != null).Select(item => item.SymbolInfo).FirstOrDefault(item => item != null);
                if (childSymboInfo != null)
                {
                    node.SymbolInfo = new SymbolInfo(childSymboInfo.SequencePoints, true);
                }
            }
        }
开发者ID:sq,项目名称:JSIL,代码行数:21,代码来源:AttachSymbolInfoToStatements.cs


示例13: ReplaceChild

        public override void ReplaceChild(JSNode oldChild, JSNode newChild)
        {
            if (oldChild == null)
                throw new ArgumentNullException("oldChild");

            if (CatchVariable == oldChild)
                CatchVariable = (JSVariable)newChild;

            if (Catch == oldChild)
                Catch = (JSStatement)newChild;

            if (Finally == oldChild)
                Finally = (JSStatement)newChild;

            Body.ReplaceChild(oldChild, newChild);
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:16,代码来源:JSStatementTypes.cs


示例14: GetChild

        protected static bool GetChild(JSNode parent, int index, out JSNode node, out string name)
        {
            var self = (JSLabelGroupStatement)parent;

            if (index >= self.Labels.Count) {
                node = null;
                name = null;
                return false;
            }

            node = self.Labels.AtIndex(index).Value;
            name = "Labels";
            return true;
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:14,代码来源:JSStatementTypes.cs


示例15: ReplaceChild

        public override void ReplaceChild(JSNode oldChild, JSNode newChild)
        {
            if (GenericArguments == null)
                return;

            var oldExpression = oldChild as JSExpression;
            var newExpression = newChild as JSExpression;

            if (
                (oldExpression != null) &&
                ((newExpression != null) == (newChild != null))
            ) {
                for (var i = 0; i < GenericArguments.Length; i++) {
                    if (GenericArguments[i] == oldExpression)
                        GenericArguments[i] = newExpression;
                }
            }
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:18,代码来源:JSIdentifierTypes.cs


示例16: VisitChildren

        private IEnumerable<IEnumerable<State>> VisitChildren(JSNode node, Indices indices, int depth)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            JSNode nextSibling = null;
            string nextSiblingName = null;

            int nextDepth = depth + 1;

            using (var e = node.Children.EnumeratorTemplate)
            while (e.MoveNext()) {
                var toVisit = nextSibling;
                var toVisitName = nextSiblingName;
                nextSibling = e.Current;
                nextSiblingName = e.CurrentName;

                if (toVisit != null) {
                    if (toVisitName == null || !NamesToSkip.Contains(toVisitName)) {
                        yield return VisitNode(toVisit, toVisitName, indices, nextDepth);
                    } else {
                        SkipNode(toVisit, toVisitName, indices, nextDepth);
                    }
                }
            }

            if (nextSibling != null) {
                if (nextSiblingName == null || !NamesToSkip.Contains(nextSiblingName)) {
                    yield return VisitNode(nextSibling, nextSiblingName, indices, nextDepth);
                } else {
                    SkipNode(nextSibling, nextSiblingName, indices, nextDepth);
                }
            }
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:34,代码来源:JSAstCursor.cs


示例17: EliminateVariable

        protected void EliminateVariable(JSNode context, JSVariable variable, JSExpression replaceWith)
        {
            {
                var replacer = new VariableEliminator(
                    variable,
                    JSChangeTypeExpression.New(replaceWith, TypeSystem, variable.GetExpectedType(TypeSystem))
                );
                replacer.Visit(context);
            }

            {
                var replacer = new VariableEliminator(variable, replaceWith);
                var assignments = (from a in FirstPass.Assignments where
                                       variable.Equals(a.NewValue) ||
                                       a.NewValue.AllChildrenRecursive.Any((_n) => variable.Equals(_n))
                                       select a).ToArray();

                foreach (var a in assignments) {
                    if (variable.Equals(a.NewValue)) {
                        FirstPass.Assignments.Remove(a);
                        FirstPass.Assignments.Add(
                            new FunctionAnalysis1stPass.Assignment(
                                a.StatementIndex, a.NodeIndex,
                                a.Target, replaceWith, a.Operator,
                                a.TargetType, a.SourceType
                            )
                        );
                    } else {
                        replacer.Visit(a.NewValue);
                    }
                }
            }

            Variables.Remove(variable.Identifier);
        }
开发者ID:robashton,项目名称:JSIL,代码行数:35,代码来源:EliminateSingleUseTemporaries.cs


示例18: ReplaceChild

        public override void ReplaceChild(JSNode oldChild, JSNode newChild)
        {
            if (oldChild == null)
                throw new ArgumentNullException("oldChild");

            var boe = newChild as JSBinaryOperatorExpression;

            if (boe == null)
                Declarations.RemoveAll((c) => c == oldChild);
            else
                for (int i = 0, c = Declarations.Count; i < c; i++) {
                    if (Declarations[i] == oldChild)
                        Declarations[i] = boe;
                }
        }
开发者ID:carcer,项目名称:JSIL,代码行数:15,代码来源:JSStatementTypes.cs


示例19: Emit

 public void Emit(JSNode node)
 {
 }
开发者ID:nanexcool,项目名称:ilwasm,代码行数:3,代码来源:NullAstEmitter.cs


示例20: VisitControlFlowNode

        protected void VisitControlFlowNode(JSNode node)
        {
            var stackSlice = Stack.Take(3).ToArray();
            var parentEs = stackSlice[1] as JSExpressionStatement;
            var parentBlock = stackSlice[2] as JSBlockStatement;

            if ((parentEs != null) && (parentBlock == BlockStack.Peek())) {
                AbsoluteJumpsSeen += 1;

                if (AbsoluteJumpsSeen > 1) {
                    if (TraceLevel >= 1)
                        Console.WriteLine("// Eliminating {0}", node);

                    var replacement = new JSNullExpression();
                    ParentNode.ReplaceChild(node, replacement);
                    return;
                } else {
                    if (TraceLevel >= 3)
                        Console.WriteLine("// Not eliminating {0}", node);
                }
            }

            VisitChildren(node);
        }
开发者ID:nateleroux,项目名称:JSIL,代码行数:24,代码来源:ControlFlowSimplifier.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# JSONArray类代码示例发布时间:2022-05-24
下一篇:
C# JSExpression类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap