Beispiel #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)}");
        }
Beispiel #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));
        }
Beispiel #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}");
 }
Beispiel #4
0
 public LabelNode returnDestination; //can be null if no return destination given.
 public ReturnNode(Lexeme lexeme, LabelNode returnDestination) : base(lexeme)
 {
     this.returnDestination = returnDestination;
 }