fromStruct static method

Implementation

static Danger<CitrusSymbolTable, CitrusSymbolTableException> fromStruct(CitrusSymbolTableStruct struct) {

    final log = Log(classLocation: CitrusSymbolTable, functionLocation: 'fromStruct');

    final permanentlySymbolRosterResult = CitrusSymbolRoster.result(struct.textSymbolRoster);
    log.add(permanentlySymbolRosterResult);
    if (permanentlySymbolRosterResult is! Success<CitrusSymbolRoster<TextSymbol>, CitrusSymbolExceptionA>) return Failure(CitrusSymbolTableExceptionG(), log);

    final temporarySymbolRosterResult = CitrusSymbolRoster.result(struct.temporarySymbolRoster);
    log.add(temporarySymbolRosterResult);
    if (temporarySymbolRosterResult is! Success<CitrusSymbolRoster<TemporarySymbol>, CitrusSymbolExceptionA>) return Failure(CitrusSymbolTableExceptionG(), log);

    final arraySymbolRosterResult = CitrusSymbolRoster.result(struct.textArraySymbolRoster);
    log.add(arraySymbolRosterResult);
    if (arraySymbolRosterResult is! Success<CitrusSymbolRoster<TextArraySymbol>, CitrusSymbolExceptionA>) return Failure(CitrusSymbolTableExceptionG(), log);

    final fragmentSymbolRosterResult = CitrusSymbolRoster.result(struct.fragmentSymbolRoster);
    log.add(fragmentSymbolRosterResult);
    if (fragmentSymbolRosterResult is! Success<CitrusSymbolRoster<FragmentSymbol>, CitrusSymbolExceptionA>) return Failure(CitrusSymbolTableExceptionG(), log);

    final flagSymbolRosterResult = CitrusSymbolRoster.result(struct.flagSymbolRoster);
    log.add(flagSymbolRosterResult);
    if (flagSymbolRosterResult is! Success<CitrusSymbolRoster<FlagSymbol>, CitrusSymbolExceptionA>) return Failure(CitrusSymbolTableExceptionG(), log);

    final objectSymbolRosterResult = CitrusSymbolRoster.result(struct.objectSymbolRoster);
    log.add(objectSymbolRosterResult);
    if (objectSymbolRosterResult is! Success<CitrusSymbolRoster<ObjectSymbol>, CitrusSymbolExceptionA>) return Failure(CitrusSymbolTableExceptionG(), log);

    final objectTextArraySymbolRosterResult = CitrusSymbolRoster.result(struct.objectArraySymbolRoster);
    log.add(objectTextArraySymbolRosterResult);
    if (objectTextArraySymbolRosterResult is! Success<CitrusSymbolRoster<ObjectArraySymbol>, CitrusSymbolExceptionA>) return Failure(CitrusSymbolTableExceptionG(), log);

    final objectDefinitionRosterResult = ObjectDefinitionRoster.result(struct.objectDefinitionRoster);
    log.add(objectDefinitionRosterResult);
    if (objectDefinitionRosterResult is! Success<ObjectDefinitionRoster, ObjectDefinitionExceptionA>) return Failure(CitrusSymbolTableExceptionH(), log);

    final result = CitrusSymbolTable.result(
        permanentlySymbolRosterResult.wrapped,
        temporarySymbolRosterResult.wrapped,
        arraySymbolRosterResult.wrapped,
        fragmentSymbolRosterResult.wrapped,
        flagSymbolRosterResult.wrapped,
        objectSymbolRosterResult.wrapped,
        objectTextArraySymbolRosterResult.wrapped,
        objectDefinitionRosterResult.wrapped,
    );
    log.add(result);

    return Danger.fromDanger(result, log);

}