File tree Expand file tree Collapse file tree 4 files changed +58
-1
lines changed Expand file tree Collapse file tree 4 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ public function evaluate(?Token $expr): Token {
137
137
switch ($ expr ->type ) {
138
138
case Token::IDENTIFIER :
139
139
if ($ this ->isDefined ($ expr ->value )) {
140
- return $ this ->evaluate (... $ this ->definitions [$ expr ->value ]);
140
+ return $ this ->evaluate ($ this ->definitions [$ expr ->value ]);
141
141
}
142
142
return new Token (Token::NUMBER , '0 ' , 'computed ' );
143
143
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test for issue #2
3
+ --FILE--
4
+
5
+ #ifndef TEST
6
+ #define TEST 1
7
+ #endif
8
+
9
+ #if TEST
10
+ int bar;
11
+ #endif
12
+
13
+ --EXPECT--
14
+ int bar;
Original file line number Diff line number Diff line change
1
+
2
+ #ifndef TEST
3
+ #define TEST 1
4
+ #endif
5
+
6
+ #if TEST
7
+ int bar ;
8
+ #endif
9
+
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types=1 );
2
+ namespace PHPCParser \Test \c ;
3
+ use PHPCParser \CParser ;
4
+ use PHPCParser \Printer ;
5
+ use PHPCParser \Printer \Dumper ;
6
+ use PHPCParser \Printer \C ;
7
+ use PHPUnit \Framework \TestCase ;
8
+
9
+ /**
10
+ * Note: this is a generated file, do not edit this!!!
11
+ */
12
+ class issue_2Test extends TestCase {
13
+
14
+ const EXPECTED = 'int bar; ' ;
15
+
16
+ protected CParser $ parser ;
17
+ protected Printer $ printer ;
18
+
19
+ public function setUp (): void {
20
+ $ this ->parser = new CParser ;
21
+ $ this ->parser ->addSearchPath (__DIR__ );
22
+ $ this ->parser ->addSearchPath (__DIR__ . '/../../include ' );
23
+ $ this ->printer = new C ;
24
+ }
25
+
26
+ /**
27
+ * @textdox Test for issue #2
28
+ */
29
+ public function testCode () {
30
+ $ translationUnit = $ this ->parser ->parse (__DIR__ . '/issue_2Test.c ' );
31
+ $ actual = $ this ->printer ->print ($ translationUnit );
32
+ $ this ->assertEquals (self ::EXPECTED , trim ($ actual ));
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments