forked from freebasic/fbc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fbc: fixed / changed symbol lookups to search the entire symbol hash …
…list - fixed sf.net #871 & #730 but altering the symbol lookup algorithm - sf.net #871: Inherited methods without this shadowed by global functions - sf.net #730: Using quirk keywords as identifier leads to parsing problems later - symb.bas:symbLookup() now makes multiple passes on the symbol hash list to find the symbol - previously, symbLookup() was exiting out early and not finding the correct symbol
- Loading branch information
Showing
7 changed files
with
351 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
' TEST_MODE : COMPILE_ONLY_OK | ||
|
||
type preserve | ||
i as integer | ||
end type | ||
|
||
redim array(0 to 1) as integer | ||
redim preserve array(0 to 2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
' TEST_MODE : COMPILE_ONLY_OK | ||
|
||
namespace aaa | ||
enum explicit | ||
A | ||
end enum | ||
|
||
enum E explicit | ||
B | ||
end enum | ||
end namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
' TEST_MODE : COMPILE_ONLY_OK | ||
|
||
'' Create enum named "explicit" (not an unnamed enum with EXPLICIT access) | ||
enum explicit | ||
A | ||
end enum | ||
|
||
'' should be no syntax error ("explicit" not recognized as keyword) | ||
enum E explicit | ||
B | ||
end enum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "fbcunit.bi" | ||
|
||
'' inherited methods called without 'this' should be preferred over the globally defined procedure | ||
|
||
dim shared f_count as integer = 0 | ||
dim shared af_count as integer = 0 | ||
|
||
private sub f() | ||
f_count += 1 | ||
end sub | ||
|
||
type A | ||
i as integer | ||
declare sub f() | ||
end type | ||
|
||
sub A.f() | ||
af_count += 1 | ||
end sub | ||
|
||
type B extends A | ||
declare sub test_proc() | ||
end type | ||
|
||
sub B.test_proc() | ||
CU_ASSERT( f_count = 0 ) | ||
CU_ASSERT( af_count = 0 ) | ||
|
||
f() | ||
|
||
CU_ASSERT( f_count = 0 ) | ||
CU_ASSERT( af_count = 1 ) | ||
|
||
.f() | ||
|
||
CU_ASSERT( f_count = 1 ) | ||
CU_ASSERT( af_count = 1 ) | ||
|
||
..f() | ||
|
||
CU_ASSERT( f_count = 2 ) | ||
CU_ASSERT( af_count = 1 ) | ||
|
||
this.f() | ||
|
||
CU_ASSERT( f_count = 2 ) | ||
CU_ASSERT( af_count = 2 ) | ||
|
||
base.f() | ||
|
||
CU_ASSERT( f_count = 2 ) | ||
CU_ASSERT( af_count = 3 ) | ||
|
||
end sub | ||
|
||
|
||
SUITE( fbc_tests.structs.member_proc_shadow ) | ||
TEST( default ) | ||
dim x as B | ||
x.test_proc() | ||
END_TEST | ||
|
||
END_SUITE | ||
|
Oops, something went wrong.