コード例 #1
0
        public override void HandleFunctionNode(TreeWalker walker, FunctionNode function)
        {
            List<Node> arguments = function.GetArguments(1);
            LabelNode labelNode = VerifyType<LabelNode>(arguments[0]);

            walker.scriptBuilder.EmitStatement($"jump {TreeWalker.MangleLabelName(labelNode.labelName)}");
        }
コード例 #2
0
        //Return statements can take either no argument, or a label as argument (the return destination).
        public Node HandleReturn()
        {
            Lexeme    returnWord        = Pop();
            LabelNode returnDestination = null;

            if (HasCurrent() && Peek().type == LexemeType.LABEL)
            {
                returnDestination = new LabelNode(Pop());
            }

            return(new ReturnNode(returnWord, returnDestination));
        }
コード例 #3
0
 public override void HandleFunctionNode(TreeWalker walker, FunctionNode function)
 {
     List<Node> arguments = function.GetArguments(1);
     LabelNode gosubTargetLabel = VerifyType<LabelNode>(arguments[0]);
     walker.scriptBuilder.EmitStatement($"call {gosubTargetLabel.labelName}");
 }
コード例 #4
0
 public LabelNode returnDestination; //can be null if no return destination given.
 public ReturnNode(Lexeme lexeme, LabelNode returnDestination) : base(lexeme)
 {
     this.returnDestination = returnDestination;
 }