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


C# JSNode类代码示例

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


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


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