public virtual Expression visit(ObjectLiteralProperty objectLiteralProperty) { objectLiteralProperty.name = visitExpression(objectLiteralProperty.name); objectLiteralProperty.value = visitExpression(objectLiteralProperty.value); return(objectLiteralProperty); }
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); } } }
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); }
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); }
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); } } }
public void Visit(ObjectLiteralProperty node) { // not applicable; terminate }
public void Visit(ObjectLiteralProperty node) { Debug.Fail("shouldn't get here"); }
public void Visit(ObjectLiteralProperty node) { // the value is another binding pattern node.IfNotNull(n => n.Value.IfNotNull(v => v.Accept(this))); }
public virtual Expression visit(ObjectLiteralProperty property) { return(property); }
public override bool Walk(ObjectLiteralProperty node) { AddNode(node); return(true); }
public virtual void PostWalk(ObjectLiteralProperty node) { }
public virtual bool Walk(ObjectLiteralProperty node) { return true; }
public virtual bool Walk(ObjectLiteralProperty node) { return(true); }
/// <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); }