summaryrefslogtreecommitdiff
path: root/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'node.h')
-rw-r--r--node.h99
1 files changed, 52 insertions, 47 deletions
diff --git a/node.h b/node.h
index 9af249e..7db04c5 100644
--- a/node.h
+++ b/node.h
@@ -6,7 +6,7 @@
$Date: 1995/01/10 10:42:41 $
created at: Fri May 28 15:14:02 JST 1993
- Copyright (C) 1994 Yukihiro Matsumoto
+ Copyright (C) 1995 Yukihiro Matsumoto
************************************************/
@@ -70,6 +70,7 @@ enum node_type {
NODE_UNDEF,
NODE_CLASS,
NODE_MODULE,
+ NODE_CREF,
NODE_INC,
NODE_DOT3,
NODE_ATTRSET,
@@ -165,73 +166,77 @@ typedef struct RNode {
#define nd_super u3.id
#define nd_modl u1.id
+#define nd_clss u1.value
#define nd_beg u1.node
#define nd_end u2.node
#define nd_state u3.state
#define nd_rval u3.node
-#define NEW_METHOD(n,x) newnode(NODE_METHOD,x,n,Qnil)
+#define NEW_METHOD(n,x) newnode(NODE_METHOD,x,n,0)
#define NEW_FBODY(n,i,o) newnode(NODE_FBODY,n,i,o)
-#define NEW_DEFN(i,d,p) newnode(NODE_DEFN,p,i,d)
-#define NEW_DEFS(r,i,d) newnode(NODE_DEFS,r,i,d)
-#define NEW_CFUNC(f,c) newnode(NODE_CFUNC,f,c,Qnil)
+#define NEW_DEFN(i,a,d,p) newnode(NODE_DEFN,p,i,NEW_RFUNC(a,d))
+#define NEW_DEFS(r,i,a,d) newnode(NODE_DEFS,r,i,NEW_RFUNC(a,d))
+#define NEW_CFUNC(f,c) newnode(NODE_CFUNC,f,c,0)
#define NEW_RFUNC(b1,b2) NEW_SCOPE(block_append(b1,b2))
#define NEW_SCOPE(b) newnode(NODE_SCOPE,local_tbl(),(b),local_cnt(0))
-#define NEW_BLOCK(a) newnode(NODE_BLOCK,a,1,Qnil)
+#define NEW_BLOCK(a) newnode(NODE_BLOCK,a,1,0)
#define NEW_IF(c,t,e) newnode(NODE_IF,c,t,e)
-#define NEW_EXNOT(c) newnode(NODE_EXNOT,c,Qnil,Qnil)
-#define NEW_CASE(h,b) newnode(NODE_CASE,h,b,Qnil)
+#define NEW_EXNOT(c) newnode(NODE_EXNOT,c,0,0)
+#define NEW_CASE(h,b) newnode(NODE_CASE,h,b,0)
#define NEW_WHEN(c,t,e) newnode(NODE_WHEN,c,t,e)
-#define NEW_WHILE(c,b) newnode(NODE_WHILE,c,b,Qnil)
-#define NEW_WHILE2(c,b) newnode(NODE_WHILE2,c,b,Qnil)
+#define NEW_WHILE(c,b) newnode(NODE_WHILE,c,b,0)
+#define NEW_WHILE2(c,b) newnode(NODE_WHILE2,c,b,0)
#define NEW_FOR(v,i,b) newnode(NODE_FOR,v,b,i)
#define NEW_ITER(v,i,b) newnode(NODE_ITER,v,b,i)
#define NEW_BEGIN(b,ex,en) newnode(NODE_BEGIN,b,ex,en)
-#define NEW_REDO() newnode(NODE_REDO,Qnil,Qnil,Qnil)
-#define NEW_BREAK() newnode(NODE_BREAK,Qnil,Qnil,Qnil)
-#define NEW_CONT() newnode(NODE_CONTINUE,Qnil,Qnil,Qnil)
-#define NEW_RETRY() newnode(NODE_RETRY,Qnil,Qnil,Qnil)
-#define NEW_RET(s) newnode(NODE_RETURN,s,Qnil,Qnil)
-#define NEW_FAIL(s) newnode(NODE_FAIL,s,Qnil,Qnil)
-#define NEW_YIELD(a) newnode(NODE_YIELD,a,Qnil,Qnil)
+#define NEW_REDO() newnode(NODE_REDO,0,0,0)
+#define NEW_BREAK() newnode(NODE_BREAK,0,0,0)
+#define NEW_CONT() newnode(NODE_CONTINUE,0,0,0)
+#define NEW_RETRY() newnode(NODE_RETRY,0,0,0)
+#define NEW_RET(s) newnode(NODE_RETURN,s,0,0)
+#define NEW_FAIL(s) newnode(NODE_FAIL,s,0,0)
+#define NEW_YIELD(a) newnode(NODE_YIELD,a,0,0)
#define NEW_LIST(a) NEW_ARRAY(a)
-#define NEW_ARRAY(a) newnode(NODE_ARRAY,a,1,Qnil)
-#define NEW_ZARRAY() newnode(NODE_ZARRAY,Qnil,Qnil,Qnil)
-#define NEW_HASH(a) newnode(NODE_HASH,a,Qnil,Qnil)
-#define NEW_AND(a,b) newnode(NODE_AND,a,b,Qnil)
-#define NEW_OR(a,b) newnode(NODE_OR,a,b,Qnil)
-#define NEW_NOT(a) newnode(NODE_NOT,Qnil,a,Qnil)
-#define NEW_MASGN(l,r) newnode(NODE_MASGN,l,r,Qnil)
+#define NEW_ARRAY(a) newnode(NODE_ARRAY,a,1,0)
+#define NEW_ZARRAY() newnode(NODE_ZARRAY,0,0,0)
+#define NEW_HASH(a) newnode(NODE_HASH,a,0,0)
+#define NEW_AND(a,b) newnode(NODE_AND,a,b,0)
+#define NEW_OR(a,b) newnode(NODE_OR,a,b,0)
+#define NEW_NOT(a) newnode(NODE_NOT,0,a,0)
+#define NEW_MASGN(l,r) newnode(NODE_MASGN,l,r,0)
#define NEW_GASGN(v,val) newnode(NODE_GASGN,v,val,rb_global_entry(v))
#define NEW_LASGN(v,val) newnode(NODE_LASGN,v,val,local_cnt(v))
-#define NEW_IASGN(v,val) newnode(NODE_IASGN,v,val,Qnil)
-#define NEW_CASGN(v,val) newnode(NODE_CASGN,v,val,Qnil)
+#define NEW_IASGN(v,val) newnode(NODE_IASGN,v,val,0)
+#define NEW_CASGN(v,val) newnode(NODE_CASGN,v,val,0)
#define NEW_OP_ASGN1(p,id,a) newnode(NODE_OP_ASGN1,p,id,a)
#define NEW_OP_ASGN2(r,i,val) newnode(NODE_OP_ASGN1,r,val,i)
-#define NEW_GVAR(v) newnode(NODE_GVAR,v,Qnil,rb_global_entry(v))
-#define NEW_LVAR(v) newnode(NODE_LVAR,v,Qnil,local_cnt(v))
-#define NEW_LVAR2(v) newnode(NODE_LVAR2,v,Qnil,local_cnt(v))
-#define NEW_IVAR(v) newnode(NODE_IVAR,v,Qnil,Qnil)
-#define NEW_CVAR(v) newnode(NODE_CVAR,v,Qnil,Qnil)
-#define NEW_LIT(l) newnode(NODE_LIT,l,Qnil,Qnil)
-#define NEW_STR(s) newnode(NODE_STR,s,Qnil,Qnil)
-#define NEW_STR2(s) newnode(NODE_STR2,s,Qnil,Qnil)
-#define NEW_XSTR(s) newnode(NODE_XSTR,s,Qnil,Qnil)
-#define NEW_XSTR2(s) newnode(NODE_XSTR2,s,Qnil,Qnil)
+#define NEW_GVAR(v) newnode(NODE_GVAR,v,0,rb_global_entry(v))
+#define NEW_LVAR(v) newnode(NODE_LVAR,v,0,local_cnt(v))
+#define NEW_LVAR2(v) newnode(NODE_LVAR2,v,0,0)
+#define NEW_IVAR(v) newnode(NODE_IVAR,v,0,0)
+#define NEW_CVAR(v) newnode(NODE_CVAR,v,0,cref_list)
+#define NEW_LIT(l) newnode(NODE_LIT,l,0,0)
+#define NEW_STR(s) newnode(NODE_STR,s,0,0)
+#define NEW_STR2(s) newnode(NODE_STR2,s,0,0)
+#define NEW_XSTR(s) newnode(NODE_XSTR,s,0,0)
+#define NEW_XSTR2(s) newnode(NODE_XSTR2,s,0,0)
#define NEW_CALL(r,m,a) newnode(NODE_CALL,r,m,a)
-#define NEW_SUPER(a) newnode(NODE_SUPER,Qnil,Qnil,a)
-#define NEW_ZSUPER() newnode(NODE_ZSUPER,Qnil,Qnil,Qnil)
-#define NEW_ARGS(f,r) newnode(NODE_ARGS,Qnil,r,f)
-#define NEW_ALIAS(n,o) newnode(NODE_ALIAS,Qnil,n,o)
-#define NEW_UNDEF(i) newnode(NODE_UNDEF,Qnil,i,Qnil)
-#define NEW_CLASS(n,b,s) newnode(NODE_CLASS,n,NEW_SCOPE(b),s)
-#define NEW_MODULE(n,b) newnode(NODE_MODULE,n,NEW_SCOPE(b),Qnil)
-#define NEW_INC(m) newnode(NODE_INC,m,Qnil,Qnil)
+#define NEW_SUPER(a) newnode(NODE_SUPER,0,0,a)
+#define NEW_ZSUPER() newnode(NODE_ZSUPER,0,0,0)
+#define NEW_ARGS(f,r) newnode(NODE_ARGS,0,r,f)
+#define NEW_ALIAS(n,o) newnode(NODE_ALIAS,0,n,o)
+#define NEW_UNDEF(i) newnode(NODE_UNDEF,0,i,0)
+#define NEW_CLASS(n,b,s) newnode(NODE_CLASS,n,NEW_CBODY(b),s)
+#define NEW_MODULE(n,b) newnode(NODE_MODULE,n,NEW_CBODY(b),0)
+#define NEW_CREF0() (cref_list=newnode(NODE_CREF,the_class,0,0))
+#define NEW_CREF(b) (cref_list=newnode(NODE_CREF,0,0,cref_list))
+#define NEW_CBODY(b) (cref_list->nd_body=NEW_SCOPE(b),cref_list)
+#define NEW_INC(m) newnode(NODE_INC,m,0,0)
#define NEW_DOT3(b,e) newnode(NODE_DOT3,b,e,0)
-#define NEW_ATTRSET(a) newnode(NODE_ATTRSET,a,Qnil,Qnil)
-#define NEW_SELF() newnode(NODE_SELF,Qnil,Qnil,Qnil)
-#define NEW_NIL() newnode(NODE_NIL,Qnil,Qnil,Qnil)
+#define NEW_ATTRSET(a) newnode(NODE_ATTRSET,a,0,0)
+#define NEW_SELF() newnode(NODE_SELF,0,0,0)
+#define NEW_NIL() newnode(NODE_NIL,0,0,0)
NODE *newnode();
VALUE rb_method_booundp();