class dereference

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1088 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2006-03-17 02:37:08 +00:00
parent 8b7de5fe57
commit 72a6e62356
4 changed files with 87 additions and 0 deletions

View File

@ -25,6 +25,25 @@ asn1f_class_access(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
errno = ESRCH;
return NULL;
}
if(ioclass->expr_type == A1TC_REFERENCE) {
ioclass = asn1f_lookup_symbol(arg,
ioclass->module, ioclass->reference);
if(ioclass == NULL) {
errno = ESRCH;
return NULL;
}
}
if(ioclass->expr_type != A1TC_CLASSDEF) {
if(!(ioclass->_mark & TM_BROKEN)) {
ioclass->_mark |= TM_BROKEN;
FATAL("Class field %s lookup at line %d in something that is not a class: %s at line %d",
asn1f_printable_reference(ref), ref->_lineno,
ioclass->Identifier,
ioclass->_lineno);
}
errno = EINVAL;
return NULL;
}
classfield = asn1f_lookup_child(ioclass, ref->components[1].name);
if(classfield == NULL) {

View File

@ -0,0 +1,23 @@
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .100
ModuleClassSample
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 100 }
DEFINITIONS ::=
BEGIN
REF-ID ::= TYPE-IDENTIFIER
RefID ::= SEQUENCE {
field REF-ID.&id,
params REF-ID.&Type
}
SupportedReferences REF-ID ::= { ... }
END

View File

@ -0,0 +1,23 @@
-- SE: Semantic error
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .101
ModuleClassMisUse
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 101 }
DEFINITIONS ::=
BEGIN
NOTCLASS ::= SEQUENCE { ... }
REF-ID ::= NOTCLASS
RefID ::= SEQUENCE {
field REF-ID.&id,
params REF-ID.&Type
}
END

View File

@ -0,0 +1,22 @@
-- SE: Semantic error
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .102
ModuleClassMisUse
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 102 }
DEFINITIONS ::=
BEGIN
REF-ID ::= REF-ID2
REF-ID2 ::= REF-ID
RefID ::= SEQUENCE {
field REF-ID.&id,
params REF-ID.&Type
}
END