AST node for an indexed property reference, such as foo['bar'] or foo[2] . This is sometimes called an "element-get" operation, hence the name of the node.

Node type is Rhino.Token.GETELEM .

The node bounds extend from the beginning position of the target through the closing right-bracket. In the presence of a syntax error, the right bracket position is -1, and the node ends at the end of the element expression.

Inheritance: AstNode
Example #1
0
		private Node TransformElementGet(ElementGet node)
		{
			// OPT: could optimize to createPropertyGet
			// iff elem is string that can not be number
			Node target = Transform(node.GetTarget());
			decompiler.AddToken(Token.LB);
			Node element = Transform(node.GetElement());
			decompiler.AddToken(Token.RB);
			return new Node(Token.GETELEM, target, element);
		}
Example #2
0
		// only used for destructuring forms
		internal void DecompileElementGet(ElementGet node)
		{
			Decompile(node.GetTarget());
			decompiler.AddToken(Token.LB);
			Decompile(node.GetElement());
			decompiler.AddToken(Token.RB);
		}