Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

function Parser::parseSuperPropertyOrCall

Parses a super call or a super property

Return value

Node\Node|null

1 call to Parser::parseSuperPropertyOrCall()
Parser::parseLeftHandSideExpression in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses a left hand side expression

File

vendor/mck89/peast/lib/Peast/Syntax/Parser.php, line 3639

Class

Parser
Parser class

Namespace

Peast\Syntax

Code

protected function parseSuperPropertyOrCall() {
    if ($token = $this->scanner
        ->consume("super")) {
        $super = $this->completeNode($this->createNode("Super", $token));
        if (($args = $this->parseArguments()) !== null) {
            $node = $this->createNode("CallExpression", $token);
            $node->setArguments($args);
            $node->setCallee($super);
            return $this->completeNode($node);
        }
        $node = $this->createNode("MemberExpression", $token);
        $node->setObject($super);
        if ($this->scanner
            ->consume(".")) {
            if ($property = $this->parseIdentifier(static::$identifierName)) {
                $node->setProperty($property);
                return $this->completeNode($node);
            }
        }
        elseif ($this->scanner
            ->consume("[") && ($property = $this->isolateContext(array(
            "allowIn" => true,
        ), "parseExpression")) && $this->scanner
            ->consume("]")) {
            $node->setProperty($property);
            $node->setComputed(true);
            return $this->completeNode($node);
        }
        $this->error();
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal