aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2005-04-19 12:27:55 +0000
committeraclement <aclement>2005-04-19 12:27:55 +0000
commit262c370ae11d10fe89c1fefb0ffb3d358a6bb6f6 (patch)
tree79981772039ce1209c7c5f9d3c9aa8c6a7d53d3d /weaver
parent8d6f7108914750b3e213a1d8f6fe2551ca6bc113 (diff)
downloadaspectj-262c370ae11d10fe89c1fefb0ffb3d358a6bb6f6.tar.gz
aspectj-262c370ae11d10fe89c1fefb0ffb3d358a6bb6f6.zip
from branch: new exprs supported
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/ast/CastExpr.java44
-rw-r--r--weaver/src/org/aspectj/weaver/ast/Expr.java8
-rw-r--r--weaver/src/org/aspectj/weaver/ast/FieldGetOn.java37
-rw-r--r--weaver/src/org/aspectj/weaver/ast/IExprVisitor.java19
-rw-r--r--weaver/src/org/aspectj/weaver/ast/StringConstExpr.java41
5 files changed, 148 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/ast/CastExpr.java b/weaver/src/org/aspectj/weaver/ast/CastExpr.java
new file mode 100644
index 000000000..1e6302a90
--- /dev/null
+++ b/weaver/src/org/aspectj/weaver/ast/CastExpr.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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");
+ }
+}
diff --git a/weaver/src/org/aspectj/weaver/ast/Expr.java b/weaver/src/org/aspectj/weaver/ast/Expr.java
index f66010991..fd4b7a46c 100644
--- a/weaver/src/org/aspectj/weaver/ast/Expr.java
+++ b/weaver/src/org/aspectj/weaver/ast/Expr.java
@@ -25,13 +25,19 @@ public abstract class Expr extends ASTNode {
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);
+ }
+
}
diff --git a/weaver/src/org/aspectj/weaver/ast/FieldGetOn.java b/weaver/src/org/aspectj/weaver/ast/FieldGetOn.java
new file mode 100644
index 000000000..63f175c10
--- /dev/null
+++ b/weaver/src/org/aspectj/weaver/ast/FieldGetOn.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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);
+ }
+
+}
diff --git a/weaver/src/org/aspectj/weaver/ast/IExprVisitor.java b/weaver/src/org/aspectj/weaver/ast/IExprVisitor.java
index ea18ff327..4f9373593 100644
--- a/weaver/src/org/aspectj/weaver/ast/IExprVisitor.java
+++ b/weaver/src/org/aspectj/weaver/ast/IExprVisitor.java
@@ -19,5 +19,24 @@ public interface IExprVisitor {
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);
+
}
diff --git a/weaver/src/org/aspectj/weaver/ast/StringConstExpr.java b/weaver/src/org/aspectj/weaver/ast/StringConstExpr.java
new file mode 100644
index 000000000..cb1024b7c
--- /dev/null
+++ b/weaver/src/org/aspectj/weaver/ast/StringConstExpr.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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;
+ }
+}