Пример #1
0
        public override AstNode Visit(GetAccessorDefinition 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 and update the 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 indices in local variables.
            int index = function.IsStatic() ? 0 : 1;
            foreach(LocalVariable indexLocal in node.GetIndexerVariables())
            {
                builder.CreateLoadArg((byte)index++);
                builder.CreateStoreLocal(indexLocal);
            }

            // Visit his children.
            VisitList(node.GetChildren());

            // Finish return.
            FinishReturn(node, function);

            // Restore the scope.
            PopScope();

            // Restore the current function.
            currentFunction = oldFunction;

            return builder.EndNode();
        }
Пример #2
0
        public override AstNode Visit(GetAccessorDefinition node)
        {
            // Ignore pure declarations.
            if(node.GetChildren() == null)
                return node;

            // Update the scope.
            PushScope(node.GetScope());

            // Visit the children.
            VisitList(node.GetChildren());

            // Restore the scope.
            PopScope();

            return node;
        }
Пример #3
0
        public override AstNode Visit(GetAccessorDefinition node)
        {
            // Get the function.
            Function function = node.GetFunction();
            if(node.GetChildren() == null)
                return node;

            // Store the definition node in the function.
            if(function.DefinitionNode != null)
                Error(node, "multiples definition of a function.");
            function.DefinitionNode = 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;
        }