/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
using System;
namespace dnSpy.Contracts.Debugger.Evaluation {
///
/// Creates s
///
public abstract class DbgValueNodeFactory {
///
/// Gets the language
///
public abstract DbgLanguage Language { get; }
///
/// Creates s
///
/// Evaluation info
/// Expression
/// Value node options
/// Eval options
/// State created by or null to store the state in 's context
///
public DbgCreateValueNodeResult Create(DbgEvaluationInfo evalInfo, string expression, DbgValueNodeEvaluationOptions nodeOptions, DbgEvaluationOptions options, object? expressionEvaluatorState) =>
Create(evalInfo, new[] { new DbgExpressionEvaluationInfo(expression, nodeOptions, options, expressionEvaluatorState) })[0];
///
/// Creates a . The returned s are automatically closed when their runtime continues.
///
/// Evaluation info
/// Expressions to evaluate
///
public abstract DbgCreateValueNodeResult[] Create(DbgEvaluationInfo evalInfo, DbgExpressionEvaluationInfo[] expressions);
///
/// Creates s. The returned s are automatically closed when their runtime continues.
///
/// Evaluation info
/// Object ids
/// Options
///
public abstract DbgValueNode[] Create(DbgEvaluationInfo evalInfo, DbgObjectId[] objectIds, DbgValueNodeEvaluationOptions options);
}
///
/// Contains the created or an error message
///
public readonly struct DbgCreateValueNodeResult {
///
/// Gets the created node
///
public DbgValueNode ValueNode { get; }
///
/// true if the expression wasn't evaluated because it causes side effects ( was used)
///
public bool CausesSideEffects { get; }
///
/// Constructor
///
/// New value node
/// true if the expression wasn't evaluated because it causes side effects ( was used)
public DbgCreateValueNodeResult(DbgValueNode node, bool causesSideEffects) {
ValueNode = node ?? throw new ArgumentNullException(nameof(node));
CausesSideEffects = causesSideEffects;
}
}
}