--- /dev/null
+/*******************************************************************************
+ * Copyright (c) Jonas Bonér, Alexandre Vasseur
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *******************************************************************************/
+package org.aspectj.weaver.ast;
+
+import org.aspectj.weaver.ResolvedTypeX;
+
+/**
+ * Represents a cast expression.
+ * <p/>
+ * Used when aspectOf is not existing in the aspect class (no pre-processing of aspects) ie when
+ * Object Aspects.aspectOf(..) API is used.
+ *
+ * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
+ */
+public class CastExpr extends Expr {
+
+ private String m_castToTypeName;
+
+ private CallExpr m_expr;
+
+ public CastExpr(CallExpr expr, String castToSignature) {
+ super();
+ m_expr = expr;
+ m_castToTypeName = castToSignature;
+ }
+
+ public void accept(IExprVisitor v) {
+ v.visit(m_expr);
+ v.visit(this);
+ }
+
+ public String getTypeName() {
+ return m_castToTypeName;
+ }
+
+ public ResolvedTypeX getType() {
+ throw new RuntimeException("not supported");
+ }
+}
public static final Expr[] NONE = new Expr[0];
public abstract void accept(IExprVisitor v);
+
public abstract ResolvedTypeX getType();
public static FieldGet makeFieldGet(Member myField, ResolvedTypeX inAspect) {
return new FieldGet(myField, inAspect);
}
- public static Expr makeCallExpr(Member member, Expr[] exprs, ResolvedTypeX returnType) {
+
+ public static CallExpr makeCallExpr(Member member, Expr[] exprs, ResolvedTypeX returnType) {
return new CallExpr(member, exprs, returnType);
}
+ public static Expr makeStringConstantExpr(final String stringConst) {
+ return new StringConstExpr(stringConst);
+ }
+
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) Jonas Bonér, Alexandre Vasseur
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *******************************************************************************/
+package org.aspectj.weaver.ast;
+
+import org.aspectj.weaver.Member;
+import org.aspectj.weaver.TypeX;
+
+/**
+ * Represents a field access on a given type.
+ * <p/>
+ * Used when aspectOf is not existing in the aspect class (no pre-processing of aspects)
+ *
+ * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
+ */
+public class FieldGetOn extends FieldGet {
+
+ private TypeX m_declaringType;
+
+ public FieldGetOn(Member field, TypeX declaringType) {
+ super(field, null);
+ m_declaringType = declaringType;
+ }
+
+ public TypeX getDeclaringType() {
+ return m_declaringType;
+ }
+
+ public void accept(IExprVisitor v) {
+ v.visit(this);
+ }
+
+}
void visit(Var i);
void visit(FieldGet fieldGet);
void visit(CallExpr callExpr);
+
+ /**
+ * Visit a string constant
+ * @param stringConstExpr
+ */
+ void visit(StringConstExpr stringConstExpr);
+
+ /**
+ * Visit a CHECKCAST instruction
+ * @param castExpr
+ */
+ void visit(CastExpr castExpr);
+
+ /**
+ * Visit a field GET
+ * @param fieldGetOn
+ */
+ void visit(FieldGetOn fieldGetOn);
+
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) Jonas Bonér, Alexandre Vasseur
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *******************************************************************************/
+package org.aspectj.weaver.ast;
+
+import org.aspectj.weaver.ast.Expr;
+import org.aspectj.weaver.ast.IExprVisitor;
+import org.aspectj.weaver.ResolvedTypeX;
+
+/**
+ * Represents a String constant instruction.
+ * <p/>
+ * Used when aspectOf is not existing in the aspect class (no pre-processing of aspects)
+ *
+ * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
+ */
+public class StringConstExpr extends Expr {
+
+ private String m_stringConst;
+
+ public StringConstExpr(String stringConst) {
+ super();
+ m_stringConst = stringConst;
+ }
+
+ public void accept(IExprVisitor v) {
+ v.visit(this);
+ }
+
+ public ResolvedTypeX getType() {
+ throw new RuntimeException("not supported");
+ }
+
+ public String getStringConst() {
+ return m_stringConst;
+ }
+}