Skip to content

Commit b4ec5ae

Browse files
committed
Remove unused scope defines
1 parent 2079da4 commit b4ec5ae

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ XP Compiler ChangeLog
33

44
## ?.?.? / ????-??-??
55

6+
* Removed unused scope defines - @thekid
67
* Fixed endless loop for unclosed argument lists - @thekid
78
* Fixed type annotations not being parsed - @thekid
89

src/main/php/lang/ast/Parse.class.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,6 @@ private function setup() {
519519
}
520520

521521
$variable= $this->token;
522-
$this->scope->define($variable->value, $variable);
523-
524522
$this->token= $this->advance();
525523
$this->token= $this->expect(')');
526524

@@ -1072,7 +1070,7 @@ private function advance() {
10721070
list($value, $line)= $this->tokens->current();
10731071
$this->tokens->next();
10741072
if ('name' === $type) {
1075-
$node= $this->scope->find($value) ?: new Node($this->symbol($value) ?: clone $this->symbol('(name)'));
1073+
$node= new Node($this->symbol($value) ?: clone $this->symbol('(name)'));
10761074
} else if ('operator' === $type) {
10771075
$node= new Node($this->symbol($value));
10781076
} else if ('string' === $type || 'integer' === $type || 'decimal' === $type) {

src/main/php/lang/ast/Scope.class.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ public function __construct(self $parent= null) {
2929
$this->parent= $parent;
3030
}
3131

32-
public function define($name, $node) {
33-
$definition= clone $node;
34-
$definition->symbol->nud= function($self) { return $self; };
35-
$definition->symbol->led= null;
36-
$definition->symbol->std= null;
37-
$definition->symbol->lbp= 0;
38-
$this->defines[$name]= $definition;
39-
}
40-
4132
/**
4233
* Sets package
4334
*
@@ -79,8 +70,4 @@ public function resolve($name) {
7970
return $name;
8071
}
8172
}
82-
83-
public function find($name) {
84-
return isset($this->defines[$name]) ? $this->defines[$name] : null;
85-
}
8673
}

0 commit comments

Comments
 (0)