public override AstNode Visit(EventAccessorDefinition node) { // Begin the node. builder.BeginNode(node); // Get the function. Function function = node.GetFunction(); // Ignore declarations. if(node.GetChildren() == null) return builder.EndNode(); // Store the old function. Function oldFunction = currentFunction; currentFunction = function; // Get the function lexical scope. LexicalScope topScope = (LexicalScope)node.GetScope(); PushScope(topScope); // Create the top basic block. BasicBlock topBlock = CreateBasicBlock(); topBlock.SetName("top"); builder.SetBlock(topBlock); // Prepare returning, required by exception handling. PrepareReturning(node, function, topScope); // Store the "value" argument in a local variable. int index = function.IsStatic() ? 0 : 1; LocalVariable valueLocal = node.GetValueLocal(); builder.CreateLoadArg((byte)index++); builder.CreateStoreLocal(valueLocal); // Visit his children. VisitList(node.GetChildren()); // Finish return. FinishReturn(node, function); // Restore the scope. PopScope(); // Restore the current function. currentFunction = oldFunction; return builder.EndNode(); }
public override AstNode Visit(EventAccessorDefinition node) { // Get the function. Function function = node.GetFunction(); if(node.GetChildren() == null) return node; // Store the old function. Function oldFunction = currentFunction; currentFunction = function; // Update the scope. PushScope(node.GetScope()); // Visit his children. VisitList(node.GetChildren()); // Restore the scope. PopScope(); // Restore the current function. currentFunction = oldFunction; return node; }