kimgr / asn1ate

A Python library for translating ASN.1 into other forms.
Other
69 stars 41 forks source link

KeyError: if the type is in another module. #60

Closed CoderHuo closed 6 years ago

CoderHuo commented 6 years ago

ASN.1 module:

IMPORTS
    SLPAddress, QoP, PosMethod  FROM ULP-Components
    Ver2-SUPL-INIT-extension    FROM ULP-Version-2-message-extensions
    Ver2-Notification-extension FROM ULP-Version-2-parameter-extensions
    Ver3-SUPL-INIT-extension    FROM ULP-Version-3-message-extensions;

Notification ::= SEQUENCE {
  notificationType  NotificationType,
  encodingType      EncodingType OPTIONAL,
  requestorId       OCTET STRING(SIZE (1..maxReqLength)) OPTIONAL,
  requestorIdType   FormatIndicator OPTIONAL,
  clientName        OCTET STRING(SIZE (1..maxClientLength)) OPTIONAL,
  clientNameType    FormatIndicator OPTIONAL,
  ...,
  ver2-Notification-extension   Ver2-Notification-extension OPTIONAL}

ULP-Version-2-parameter-extensions defines the Ver2-Notification-extension define type.

Debug:

    return module.resolve_type_decl(module.user_types()[type_decl.type_name], referenced_modules)
KeyError: 'Ver2-Notification-extension'

(edit: formatted the code sample and removed some accidental styling /kimgr)

kimgr commented 6 years ago

There are (at least) two problems here:

But even so, there are problems with asn1ate and multi-modules, see existing issues #44 and #59.

CoderHuo commented 6 years ago

Thank you .