コード例 #1
0
        public virtual Expression visit(ObjectLiteralProperty objectLiteralProperty)
        {
            objectLiteralProperty.name  = visitExpression(objectLiteralProperty.name);
            objectLiteralProperty.value = visitExpression(objectLiteralProperty.value);

            return(objectLiteralProperty);
        }
コード例 #2
0
        public virtual void Visit(ObjectLiteralProperty node)
        {
            if (node != null)
            {
                if (node.Name != null)
                {
                    node.Name.Accept(this);
                }

                if (node.Value != null)
                {
                    node.Value.Accept(this);
                }
            }
        }
コード例 #3
0
        private static ObjectLiteralProperty ConvertToBindingObjectProperty(ObjectLiteralProperty objectProperty)
        {
            ObjectLiteralProperty newProperty = null;

            if (objectProperty != null)
            {
                newProperty = new ObjectLiteralProperty(objectProperty.Context)
                {
                    Name  = ConvertToBindingObjectName(objectProperty.Name),
                    Value = ConvertToBinding(objectProperty.Value),
                    TerminatingContext = objectProperty.TerminatingContext
                };
            }

            return(newProperty);
        }
コード例 #4
0
        private static ObjectLiteralProperty ConvertFromBindingObjectProperty(ObjectLiteralProperty bindingLiteral)
        {
            ObjectLiteralProperty prop = null;

            if (bindingLiteral != null)
            {
                prop = new ObjectLiteralProperty(bindingLiteral.Context)
                {
                    Name  = ConvertFromBindingObjectName(bindingLiteral.Name),
                    Value = ConvertFromBinding(bindingLiteral.Value),
                    TerminatingContext = bindingLiteral.TerminatingContext
                };
            }

            return(prop);
        }
コード例 #5
0
        public void Visit(ObjectLiteralProperty node)
        {
            if (node != null)
            {
                if (node.Name != null)
                {
                    node.Name.Accept(this);
                }

                m_writer.Write(':');

                if (node.Value != null)
                {
                    node.Value.Accept(this);
                }
            }
        }
コード例 #6
0
 public void Visit(ObjectLiteralProperty node)
 {
     // not applicable; terminate
 }
コード例 #7
0
 public void Visit(ObjectLiteralProperty node)
 {
     Debug.Fail("shouldn't get here");
 }
コード例 #8
0
ファイル: BindingsVisitor.cs プロジェクト: zls3201/NUglify
 public void Visit(ObjectLiteralProperty node)
 {
     // the value is another binding pattern
     node.IfNotNull(n => n.Value.IfNotNull(v => v.Accept(this)));
 }
コード例 #9
0
 public virtual Expression visit(ObjectLiteralProperty property)
 {
     return(property);
 }
コード例 #10
0
 public override bool Walk(ObjectLiteralProperty node)
 {
     AddNode(node); return(true);
 }
コード例 #11
0
ファイル: AstVisitor.cs プロジェクト: lioaphy/nodejstools
 public virtual void PostWalk(ObjectLiteralProperty node) { }
コード例 #12
0
ファイル: AstVisitor.cs プロジェクト: lioaphy/nodejstools
 public virtual bool Walk(ObjectLiteralProperty node) { return true; }
コード例 #13
0
 public virtual void PostWalk(ObjectLiteralProperty node)
 {
 }
コード例 #14
0
 public virtual bool Walk(ObjectLiteralProperty node)
 {
     return(true);
 }
コード例 #15
0
        /// <summary>
        /// Gets the name and location information related to the function name binding for a FunctionObject node
        /// </summary>
        private List <BindingInformation> GetBindings(FunctionObject node)
        {
            List <BindingInformation> result = new List <BindingInformation>();
            // Gets the name of an object property that a function is bound to, like the static method foo in the example "object.foo = function () {}"
            BinaryOperator parentBinaryOperator = node.Parent as BinaryOperator;

            if (parentBinaryOperator != null)
            {
                result.AddRange(ExtractBindingsFromBinaryOperator(parentBinaryOperator));
                return(result);
            }

            // Gets the name of an object property that a function is bound to against the prototype, like the instance method foo in the example "object.prototype = {foo: function () {}}"
            ObjectLiteralProperty parentObjectLiteralProperty = node.Parent as ObjectLiteralProperty;

            if (parentObjectLiteralProperty != null)
            {
                // See if we can get the name of the object that this method belongs to
                ObjectLiteral objectLiteralParent = parentObjectLiteralProperty.Parent?.Parent as ObjectLiteral;
                if (objectLiteralParent != null && objectLiteralParent.Parent is BinaryOperator)
                {
                    result.AddRange(ExtractBindingsFromBinaryOperator((BinaryOperator)objectLiteralParent.Parent));
                }

                result.Add(
                    new BindingInformation
                {
                    Name           = parentObjectLiteralProperty.Name.Name,
                    SourcePosition = new SourcePosition
                    {
                        ZeroBasedLineNumber   = parentObjectLiteralProperty.Context.StartLineNumber - 1,
                        ZeroBasedColumnNumber = parentObjectLiteralProperty.Context.StartColumn
                    }
                });
                return(result);
            }

            BindingIdentifier bindingIdentifier = null;

            // Gets the name of a variable that a function is bound to, like foo in the example "var foo = function () {}"
            VariableDeclaration parentVariableDeclaration = node.Parent as VariableDeclaration;

            if (parentVariableDeclaration != null)
            {
                bindingIdentifier = parentVariableDeclaration.Binding as BindingIdentifier;
            }
            // Gets the name bound to the function, like foo in the example "function foo() {}
            else
            {
                bindingIdentifier = node.Binding;
            }

            if (bindingIdentifier != null)
            {
                result.Add(
                    new BindingInformation
                {
                    Name           = bindingIdentifier.Name,
                    SourcePosition = new SourcePosition
                    {
                        ZeroBasedLineNumber = bindingIdentifier.Context.StartLineNumber - 1,
                        // Souce maps work with zero based line and column numbers, the AST works with one based line numbers. We want to use zero-based everywhere.
                        ZeroBasedColumnNumber = bindingIdentifier.Context.StartColumn
                    }
                });
                return(result);
            }

            return(null);
        }
コード例 #16
0
        public virtual void Visit(ObjectLiteralProperty node)
        {
            if (node != null)
            {
                if (node.Name != null)
                {
                    node.Name.Accept(this);
                }

                if (node.Value != null)
                {
                    node.Value.Accept(this);
                }
            }
        }