addObjectSymbol method

Danger<CitrusSymbolTable, CitrusSymbolTableException> addObjectSymbol(
  1. String symbolName,
  2. CitrusObject symbolValue
)

Implementation

Danger<CitrusSymbolTable, CitrusSymbolTableException> addObjectSymbol(String symbolName, CitrusObject symbolValue) {

    final log = Log(classLocation: runtimeType, functionLocation: 'addObjectSymbol');

    final symbol = ObjectSymbol(symbolName, symbolValue);

    final addResult = objectSymbolRoster.add(symbol);
    log.add(addResult);
    if (addResult is! Success<CitrusSymbolRoster<ObjectSymbol>, CitrusSymbolExceptionA>) return Failure(CitrusSymbolTableExceptionG(), log.monitor({
        'duplicate object symbol name': symbolName,
        'object symbol name list': objectSymbolRoster.nameList,
    }));

    final result = CitrusSymbolTable.result(this.textSymbolRoster, this.temporarySymbolRoster, this.textArraySymbolRoster, this.fragmentSymbolRoster, this.flagSymbolRoster, addResult.wrapped, this.objectArraySymbolRoster, this.objectDefinitionRoster);
    log.add(result);
    if (result is! Success<CitrusSymbolTable, CitrusSymbolTableExceptionA>) return Failure(result.asException, log);

    return Success(result.wrapped, log);

}