Skip to content
Snippets Groups Projects
Commit 88385388 authored by Lev Walkin's avatar Lev Walkin
Browse files

class dereference

parent 8c62613b
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
-- 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
-- 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
-- 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment