Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Expression.java
*
* Copyright (c) 2013 Mike Strobel
*
* This source code is based on Mono.Cecil from Jb Evain, Copyright (c) Jb Evain;
* and ILSpy/ICSharpCode from SharpDevelop, Copyright (c) AlphaSierraPapa.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0.
* A copy of the license can be found in the License.html file at the root of this distribution.
* By using this source code in any fashion, you are agreeing to be bound by the terms of the
* Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*/
package com.strobel.decompiler.ast;
import com.strobel.annotations.NotNull;
import com.strobel.annotations.Nullable;
import com.strobel.assembler.metadata.FieldReference;
import com.strobel.assembler.metadata.MemberReference;
import com.strobel.assembler.metadata.MethodReference;
import com.strobel.assembler.metadata.TypeReference;
import com.strobel.collections.SmartList;
import com.strobel.componentmodel.Key;
import com.strobel.componentmodel.UserDataStore;
import com.strobel.componentmodel.UserDataStoreBase;
import com.strobel.core.ArrayUtilities;
import com.strobel.core.Comparer;
import com.strobel.core.StringUtilities;
import com.strobel.core.VerifyArgument;
import com.strobel.decompiler.DecompilerHelpers;
import com.strobel.decompiler.ITextOutput;
import com.strobel.decompiler.NameSyntax;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static com.strobel.decompiler.DecompilerHelpers.writeType;
public final class Expression extends Node implements Cloneable, UserDataStore {
public static final Object ANY_OPERAND = new Object();
/** a constant to indicate that no bytecode offset is known for an expression */
public static final int MYSTERY_OFFSET = -34;
private final SmartList _arguments = new SmartList<>();
private final SmartList _ranges = new SmartList() {
@Override
public boolean add(final Range range) {
return !contains(range) && super.add(range);
}
@Override
public void add(final int index, final Range element) {
if (contains(element)) {
return;
}
super.add(index, element);
}
};
private AstCode _code;
private Object _operand;
/** the offset of 'this' Expression, as computed for its bytecode by the Java compiler */
private int _offset;
private TypeReference _expectedType;
private TypeReference _inferredType;
private UserDataStoreBase _userData;
public Expression(final AstCode code, final Object operand, final int offset, final List arguments) {
_code = VerifyArgument.notNull(code, "code");
_operand = VerifyArgument.notInstanceOf(Expression.class, operand, "operand");
_offset = offset;
if (arguments != null) {
_arguments.addAll(arguments);
}
}
public Expression(final AstCode code, final Object operand, final int offset, final Expression... arguments) {
_code = VerifyArgument.notNull(code, "code");
_operand = VerifyArgument.notInstanceOf(Expression.class, operand, "operand");
_offset = offset;
if (arguments != null) {
Collections.addAll(_arguments, arguments);
}
}
public final List getArguments() {
return _arguments;
}
public final AstCode getCode() {
return _code;
}
public final void setCode(final AstCode code) {
_code = code;
}
public final Object getOperand() {
return _operand;
}
public final void setOperand(final Object operand) {
_operand = operand;
}
/**
* Returns the bytecode offset for 'this' expression, as computed by the Java compiler.
*/
public final int getOffset() {
return _offset;
}
public final TypeReference getExpectedType() {
return _expectedType;
}
public final void setExpectedType(final TypeReference expectedType) {
_expectedType = expectedType;
}
public final TypeReference getInferredType() {
return _inferredType;
}
public final void setInferredType(final TypeReference inferredType) {
_inferredType = inferredType;
}
public final boolean isBranch() {
return _operand instanceof Label ||
_operand instanceof Label[];
}
public final List