本文整理汇总了C#中Dynamo.Models.NodeModel.GetAstIdentifierForOutputIndex方法的典型用法代码示例。如果您正苦于以下问题:C# NodeModel.GetAstIdentifierForOutputIndex方法的具体用法?C# NodeModel.GetAstIdentifierForOutputIndex怎么用?C# NodeModel.GetAstIdentifierForOutputIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dynamo.Models.NodeModel
的用法示例。
在下文中一共展示了NodeModel.GetAstIdentifierForOutputIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertWatchContent
/// <summary>
/// Validates the watch content with the source nodes output.
/// </summary>
/// <param name="watch">WatchViewModel of the watch node</param>
/// <param name="sourceNode">NodeModel for source to watch node</param>
public void AssertWatchContent(WatchViewModel watch, NodeModel sourceNode)
{
string var = sourceNode.GetAstIdentifierForOutputIndex(0).Name;
RuntimeMirror mirror = null;
Assert.DoesNotThrow(() => mirror = ViewModel.Model.EngineController.GetMirror(var));
Assert.IsNotNull(mirror);
AssertWatchContent(watch, mirror.GetData());
}
示例2: BuildAstForPartialMultiOutput
protected override void BuildAstForPartialMultiOutput(
NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
{
base.BuildAstForPartialMultiOutput(model, rhs, resultAst);
var emptyList = AstFactory.BuildExprList(new List<AssociativeNode>());
var previewIdInit = AstFactory.BuildAssignment(model.AstIdentifierForPreview, emptyList);
resultAst.Add(previewIdInit);
resultAst.AddRange(
Definition.ReturnKeys.Select(
(rtnKey, idx) =>
AstFactory.BuildAssignment(
AstFactory.BuildIdentifier(
model.AstIdentifierForPreview.Name,
AstFactory.BuildStringNode(rtnKey)),
model.GetAstIdentifierForOutputIndex(idx))));
}
示例3: BuildAstForPartialMultiOutput
/// <summary>
/// Produces AST for a partial function application of a multi-output function.
/// </summary>
/// <param name="model">NodeModel to produce AST for.</param>
/// <param name="rhs">AST representing the partial application. This will need to be used to assign all output port identifiers.</param>
/// <param name="resultAst">Result accumulator: add all new output AST to this list.</param>
protected virtual void BuildAstForPartialMultiOutput(
NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
{
var missingAmt =
Enumerable.Range(0, model.InPortData.Count).Count(x => !model.HasInput(x));
var tmp =
AstFactory.BuildIdentifier("__partial_" + model.GUID.ToString().Replace('-', '_'));
resultAst.Add(AstFactory.BuildAssignment(tmp, rhs));
resultAst.AddRange(
(Definition.ReturnKeys ?? Enumerable.Empty<string>()).Select(
AstFactory.BuildStringNode)
.Select(
(rtnKey, index) =>
AstFactory.BuildAssignment(
model.GetAstIdentifierForOutputIndex(index),
AstFactory.BuildFunctionObject(
"__ComposeBuffered",
3,
new[] { 0, 1 },
new List<AssociativeNode>
{
AstFactory.BuildExprList(
new List<AssociativeNode>
{
AstFactory.BuildFunctionObject(
"__GetOutput",
2,
new[] { 1 },
new List<AssociativeNode>
{
AstFactory.BuildNullNode(),
rtnKey
}),
tmp
}),
AstFactory.BuildIntNode(missingAmt),
AstFactory.BuildNullNode()
}))));
}
示例4: AssignIdentifiersForFunctionCall
protected override void AssignIdentifiersForFunctionCall(
NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
{
if (model.OutPortData.Count == 1)
{
resultAst.Add(AstFactory.BuildAssignment(model.AstIdentifierForPreview, rhs));
resultAst.Add(
AstFactory.BuildAssignment(
model.GetAstIdentifierForOutputIndex(0),
model.AstIdentifierForPreview));
}
else
base.AssignIdentifiersForFunctionCall(model, rhs, resultAst);
}
示例5: AssignIdentifiersForFunctionCall
/// <summary>
/// Produces AST that assigns all necessary Identifiers for the given NodeModel from
/// the produced function call AST.
/// </summary>
/// <param name="model">Model to produce AST for.</param>
/// <param name="rhs">AST for the function call. This will need to be used to assign all output port identifiers.</param>
/// <param name="resultAst">Result accumulator: add all new output AST to this list.</param>
protected virtual void AssignIdentifiersForFunctionCall(NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
{
resultAst.Add(AstFactory.BuildAssignment(model.AstIdentifierForPreview, rhs));
var keys = Definition.ReturnKeys ?? Enumerable.Empty<string>();
resultAst.AddRange(
from item in keys.Zip(Enumerable.Range(0, keys.Count()), (key, idx) => new { key, idx })
let outputIdentiferNode = model.GetAstIdentifierForOutputIndex(item.idx)
let outputIdentifier = outputIdentiferNode.ToString()
let getValueCall = AstFactory.BuildFunctionCall(
BuiltInMethods.GetMethodName(BuiltInMethods.MethodID.kTryGetValueFromNestedDictionaries),
new List<AssociativeNode> {model.AstIdentifierForPreview, AstFactory.BuildStringNode(item.key)})
select
AstFactory.BuildAssignment(outputIdentiferNode, getValueCall));
}
示例6: AssignIdentifiersForFunctionCall
/// <summary>
/// Produces AST that assigns all necessary Identifiers for the given NodeModel from
/// the produced function call AST.
/// </summary>
/// <param name="model">Model to produce AST for.</param>
/// <param name="rhs">AST for the function call. This will need to be used to assign all output port identifiers.</param>
/// <param name="resultAst">Result accumulator: add all new output AST to this list.</param>
protected virtual void AssignIdentifiersForFunctionCall(NodeModel model, AssociativeNode rhs, List<AssociativeNode> resultAst)
{
resultAst.Add(AstFactory.BuildAssignment(model.AstIdentifierForPreview, rhs));
resultAst.AddRange(
(from item in
(Definition.ReturnKeys ?? Enumerable.Empty<string>()).Select(
(key, idx) => new { key, idx })
let outputIdentiferNode = model.GetAstIdentifierForOutputIndex(item.idx)
let outputIdentifier = outputIdentiferNode.ToString()
let thisIdentifierNode =
AstFactory.BuildIdentifier(
model.AstIdentifierForPreview.Name,
AstFactory.BuildStringNode(item.key))
let thisIdentifier = thisIdentifierNode.ToString()
where !string.Equals(outputIdentifier, thisIdentifier)
select
AstFactory.BuildAssignment(outputIdentiferNode, thisIdentifierNode)));
}