// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.npc.util.expression.compile.ast;

import java.text.ParseException;
import com.hypixel.hytale.server.npc.util.expression.compile.CompileContext;
import com.hypixel.hytale.server.npc.util.expression.compile.Parser;
import com.hypixel.hytale.server.npc.util.expression.compile.Token;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.npc.util.expression.compile.OperatorUnary;

public class ASTOperatorUnary extends ASTOperator
{
    public ASTOperatorUnary(@Nonnull final OperatorUnary operatorUnary, @Nonnull final Token token, final int tokenPosition, @Nonnull final AST argument) {
        super(operatorUnary.getResultType(), token, tokenPosition);
        this.addArgument(argument);
        this.codeGen = operatorUnary.getCodeGen();
    }
    
    @Override
    public boolean isConstant() {
        return false;
    }
    
    public static void fromUnaryOperator(@Nonnull final Parser.ParsedToken operand, @Nonnull final CompileContext compileContext) throws ParseException {
        // 
        // This method could not be decompiled.
        // 
        // Original Bytecode:
        // 
        //     1: getfield        com/hypixel/hytale/server/npc/util/expression/compile/Parser$ParsedToken.tokenPosition:I
        //     4: istore_2        /* tokenPosition */
        //     5: aload_0         /* operand */
        //     6: getfield        com/hypixel/hytale/server/npc/util/expression/compile/Parser$ParsedToken.token:Lcom/hypixel/hytale/server/npc/util/expression/compile/Token;
        //     9: astore_3        /* token */
        //    10: aload_1         /* compileContext */
        //    11: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/CompileContext.getOperandStack:()Ljava/util/Stack;
        //    14: astore          operandStack
        //    16: aload           operandStack
        //    18: invokevirtual   java/util/Stack.pop:()Ljava/lang/Object;
        //    21: checkcast       Lcom/hypixel/hytale/server/npc/util/expression/compile/ast/AST;
        //    24: astore          node
        //    26: aload_3         /* token */
        //    27: aload           node
        //    29: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/ast/AST.returnType:()Lcom/hypixel/hytale/server/npc/util/expression/ValueType;
        //    32: invokestatic    com/hypixel/hytale/server/npc/util/expression/compile/OperatorUnary.findOperator:(Lcom/hypixel/hytale/server/npc/util/expression/compile/Token;Lcom/hypixel/hytale/server/npc/util/expression/ValueType;)Lcom/hypixel/hytale/server/npc/util/expression/compile/OperatorUnary;
        //    35: astore          operatorUnary
        //    37: aload           operatorUnary
        //    39: ifnonnull       60
        //    42: new             Ljava/text/ParseException;
        //    45: dup            
        //    46: aload_3         /* token */
        //    47: invokestatic    java/lang/String.valueOf:(Ljava/lang/Object;)Ljava/lang/String;
        //    50: invokedynamic   BootstrapMethod #0, makeConcatWithConstants:(Ljava/lang/String;)Ljava/lang/String;
        //    55: iload_2         /* tokenPosition */
        //    56: invokespecial   java/text/ParseException.<init>:(Ljava/lang/String;I)V
        //    59: athrow         
        //    60: aload           node
        //    62: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/ast/AST.isConstant:()Z
        //    65: ifeq            172
        //    68: aload           operatorUnary
        //    70: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/OperatorUnary.hasCodeGen:()Z
        //    73: ifeq            172
        //    76: aload_1         /* compileContext */
        //    77: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/CompileContext.getExecutionContext:()Lcom/hypixel/hytale/server/npc/util/expression/ExecutionContext;
        //    80: astore          executionContext
        //    82: aload_1         /* compileContext */
        //    83: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/CompileContext.getInstructions:()Ljava/util/List;
        //    86: astore          instructionList
        //    88: aload           instructionList
        //    90: invokeinterface java/util/List.clear:()V
        //    95: aload           node
        //    97: aload           instructionList
        //    99: aconst_null    
        //   100: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/ast/AST.genCode:(Ljava/util/List;Lcom/hypixel/hytale/server/npc/util/expression/Scope;)Lcom/hypixel/hytale/server/npc/util/expression/ValueType;
        //   103: pop            
        //   104: aload           instructionList
        //   106: aload           operatorUnary
        //   108: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/OperatorUnary.getCodeGen:()Ljava/util/function/Function;
        //   111: aconst_null    
        //   112: invokeinterface java/util/function/Function.apply:(Ljava/lang/Object;)Ljava/lang/Object;
        //   117: checkcast       Lcom/hypixel/hytale/server/npc/util/expression/ExecutionContext$Instruction;
        //   120: invokeinterface java/util/List.add:(Ljava/lang/Object;)Z
        //   125: pop            
        //   126: aload           executionContext
        //   128: aload           instructionList
        //   130: invokevirtual   com/hypixel/hytale/server/npc/util/expression/ExecutionContext.execute:(Ljava/util/List;)Lcom/hypixel/hytale/server/npc/util/expression/ValueType;
        //   133: astore          ret
        //   135: aload           ret
        //   137: getstatic       com/hypixel/hytale/server/npc/util/expression/ValueType.VOID:Lcom/hypixel/hytale/server/npc/util/expression/ValueType;
        //   140: if_acmpne       153
        //   143: new             Ljava/lang/IllegalStateException;
        //   146: dup            
        //   147: ldc             "Failed to evaluate constant unary AST"
        //   149: invokespecial   java/lang/IllegalStateException.<init>:(Ljava/lang/String;)V
        //   152: athrow         
        //   153: aload           operandStack
        //   155: aload_3         /* token */
        //   156: iload_2         /* tokenPosition */
        //   157: aload           executionContext
        //   159: invokevirtual   com/hypixel/hytale/server/npc/util/expression/ExecutionContext.top:()Lcom/hypixel/hytale/server/npc/util/expression/ExecutionContext$Operand;
        //   162: invokestatic    invokestatic   !!! ERROR
        //   165: invokevirtual   java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
        //   168: pop            
        //   169: goto            210
        //   172: aload           operatorUnary
        //   174: invokevirtual   com/hypixel/hytale/server/npc/util/expression/compile/OperatorUnary.hasCodeGen:()Z
        //   177: ifeq            202
        //   180: aload           operandStack
        //   182: new             Lcom/hypixel/hytale/server/npc/util/expression/compile/ast/ASTOperatorUnary;
        //   185: dup            
        //   186: aload           operatorUnary
        //   188: aload_3         /* token */
        //   189: iload_2         /* tokenPosition */
        //   190: aload           node
        //   192: invokespecial   com/hypixel/hytale/server/npc/util/expression/compile/ast/ASTOperatorUnary.<init>:(Lcom/hypixel/hytale/server/npc/util/expression/compile/OperatorUnary;Lcom/hypixel/hytale/server/npc/util/expression/compile/Token;ILcom/hypixel/hytale/server/npc/util/expression/compile/ast/AST;)V
        //   195: invokevirtual   java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
        //   198: pop            
        //   199: goto            210
        //   202: aload           operandStack
        //   204: aload           node
        //   206: invokevirtual   java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
        //   209: pop            
        //   210: goto            233
        //   213: astore          e
        //   215: new             Ljava/text/ParseException;
        //   218: dup            
        //   219: aload_0         /* operand */
        //   220: getfield        com/hypixel/hytale/server/npc/util/expression/compile/Parser$ParsedToken.tokenString:Ljava/lang/String;
        //   223: invokedynamic   BootstrapMethod #1, makeConcatWithConstants:(Ljava/lang/String;)Ljava/lang/String;
        //   228: iload_2         /* tokenPosition */
        //   229: invokespecial   java/text/ParseException.<init>:(Ljava/lang/String;I)V
        //   232: athrow         
        //   233: return         
        //    Exceptions:
        //  throws java.text.ParseException
        //    StackMapTable: 00 07 FF 00 3C 00 07 07 00 1C 07 00 26 01 07 00 B7 07 00 2C 07 00 31 07 00 02 00 00 FE 00 5C 07 00 6F 07 00 59 07 00 75 F8 00 12 1D F9 00 07 42 07 00 91 13
        //    Exceptions:
        //  Try           Handler
        //  Start  End    Start  End    Type                              
        //  -----  -----  -----  -----  ----------------------------------
        //  16     210    213    233    Ljava/util/NoSuchElementException;
        // 
        // The error that occurred was:
        // 
        // java.lang.ClassCastException
        // 
        throw new IllegalStateException("An error occurred while decompiling this method.");
    }
}
