示例#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;
 }