public static void ReadBody(CodeModelBuilder model, IMethodSymbol symbol, IFunctionContext destination) { var syntax = symbol.DeclaringSyntaxReferences .Select(syntaxRef => syntaxRef.GetSyntax()) .FirstOrDefault(node => node is BaseMethodDeclarationSyntax || node is ArrowExpressionClauseSyntax); if (syntax != null) { var reader = new OperationReader(model, destination, syntax); reader.ReadMethodBody(); // destination.Body = new BlockStatement(); // // if (syntax.ExpressionBody != null) // { // destination.Body.Statements.Add(new ReturnStatement { // Expression = ExpressionReader.ReadExpression(model, syntax.ExpressionBody.Expression) // }); // } // else if (syntax.Body != null) // { // foreach (var statementSyntax in syntax.Body.Statements) // { // destination.Body.Statements.Add(StatementReader.ReadStatement(model, statementSyntax)); // } // } } }
public OperationReader(CodeModelBuilder codeModel, IFunctionContext destination, SyntaxNode syntax) { _codeModel = codeModel; _destination = destination; _syntax = syntax; _semanticModel = _codeModel.GetSemanticModel(syntax); }
public void AddHandler(IdentifierName eventName, IFunctionContext handler) { if (!_eventMap.TryGetValue(eventName, out var list)) { list = new List <IFunctionContext>(); _eventMap.Add(eventName, list); } list.Add(handler); }
public FunctionHandler(IFunctionContext functionContext) : base(functionContext) { }
internal ScriptFunction(IFunctionContext block) { Context = block; }
private bool TryParseEventHandlerAttachStatement(AbstractStatement statement, out IdentifierName eventName, out IFunctionContext handler) { eventName = null; handler = null; if (!(statement is ExpressionStatement expressionStatement) || !(expressionStatement.Expression is AssignmentExpression assignment)) { return(false); } if (!(assignment.Left is MemberExpression eventMemberExpression) || !(eventMemberExpression.Member is EventMember eventMember) || !(eventMemberExpression.Target is MemberExpression componentMemberExpression) || !(componentMemberExpression.Target is ThisExpression) || componentMemberExpression.Member != this.DeclaredProperty) { return(false); } if (!(assignment.Right is IFunctionContext function)) { return(false); } eventName = eventMember.Name; handler = function; return(true); }
protected BaseFunction(IFunctionContext functionContext) { Context = functionContext; }
public DefaultMathContext() { _parentContext = null; _variableContext = new DefaultVariableContext(this); _functionContext = new DefaultFunctionContext(this); }
public EvaluatorVisitor(IExpressionContext context, IParametersSymbolTable symbolTable, IFunctionContext functionContext) { m_context = context; m_symbolTable = symbolTable; m_functionContext = functionContext; }
public override void UpsertCompletionCallback(ref ulong key, ref SpanByte value, IFunctionContext <byte[]> ctx) { ctx.EndUpsert(key); }
public override void RMWCompletionCallback(ref ulong key, ref Empty input, IFunctionContext <byte[]> ctx, Status status) { ctx.EndRMW(status); }
/// <inheritdoc /> public override void DeleteCompletionCallback(ref ulong key, IFunctionContext <byte[]> ctx) { ctx.EndDelete(key); }
/// <inheritdoc /> public override void ReadCompletionCallback(ref ulong key, ref Empty input, ref byte[] output, IFunctionContext <byte[]> ctx, Status status) { if (status != Status.OK) { ctx.EndRead(status); } ctx.EndRead(ref output); }