summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b32ba7c)
raw | patch | inline | side by side (parent: b32ba7c)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 27 Sep 2017 17:28:08 +0000 (20:28 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 27 Sep 2017 17:28:08 +0000 (20:28 +0300) |
Test.obn | patch | blob | history | |
obn-run-tests.sh | patch | blob | history | |
src/oberon.c | patch | blob | history | |
tests/Test29.obn | [new file with mode: 0644] | patch | blob |
diff --git a/Test.obn b/Test.obn
index 6fae5299c4ceb508ddf3708622d39e419e562a12..da60894a8f758fa1ea09b7ef7f8195caa7367b55 100644 (file)
--- a/Test.obn
+++ b/Test.obn
MODULE Test;
+PROCEDURE A;
+END A;
+
+PROCEDURE B;
+ PROCEDURE A;
+ END A;
+END B;
+
END Test.
diff --git a/obn-run-tests.sh b/obn-run-tests.sh
index 8db6f37b203c5a6c9733df4dc90f79b6dc0f8e2e..2ce75728bd40a4f5c5fb3d3ef6a41f256444f15d 100755 (executable)
--- a/obn-run-tests.sh
+++ b/obn-run-tests.sh
maketest Test26
maketest Test27
maketest Test28
+maketest Test29
diff --git a/src/oberon.c b/src/oberon.c
index cd7e97a18f3cb5531e77bd28d1253a62cdc92b85..82566471b9a11b929d832f2d51ef355aa4d23dfc 100644 (file)
--- a/src/oberon.c
+++ b/src/oberon.c
return result;
}
+static oberon_object_t *
+oberon_find_object_in_scope(oberon_scope_t * scope, char * name, bool check_it)
+{
+ oberon_object_t * result = NULL;
+
+ result = oberon_find_object_in_list(scope -> list, name);
+
+ if(check_it && result == NULL)
+ {
+ oberon_error(scope -> ctx, "undefined ident %s", name);
+ }
+
+ return result;
+}
+
static oberon_object_t *
oberon_create_object(oberon_scope_t * scope, char * name, int class, bool export, bool read_only)
{
oberon_close_scope(ctx -> decl);
oberon_object_t * proc;
- proc = oberon_find_object(ctx -> decl, name, 0);
+ proc = oberon_find_object_in_scope(ctx -> decl, name, 0);
if(proc == NULL)
{
proc = oberon_define_object(ctx -> decl, name, OBERON_CLASS_PROC, export, read_only, false);
diff --git a/tests/Test29.obn b/tests/Test29.obn
--- /dev/null
+++ b/tests/Test29.obn
@@ -0,0 +1,13 @@
+MODULE Test29;
+
+PROCEDURE A;
+END A;
+
+PROCEDURE B;
+ PROCEDURE A;
+ END A;
+END B;
+
+END Test29.
+
+Объявление локальной процедуры не должно конфликтовать с глобальным.