1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* parse.y (aref_args): "*arg" should always be expanded by REXPAND.

* variable.c (fc_i): removed vast string allocation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-06-06 06:42:23 +00:00
parent dd90741112
commit 7c9c33e9ad
5 changed files with 81 additions and 54 deletions

View file

@ -1,3 +1,11 @@
Wed Jun 6 14:34:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (aref_args): "*arg" should always be expanded by REXPAND.
Tue Jun 5 23:58:43 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (fc_i): removed vast string allocation.
Tue Jun 5 16:45:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Jun 5 16:45:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* error.c (Init_Exception): NameError went under StandardError, * error.c (Init_Exception): NameError went under StandardError,

View file

@ -660,14 +660,8 @@ An end of a defun is found by moving forward from the beginning of one."
(cond (cond
((featurep 'font-lock) ((featurep 'font-lock)
(or (boundp 'font-lock-variable-name-face)
(setq font-lock-variable-name-face font-lock-type-face))
(setq ruby-font-lock-syntactic-keywords
(add-hook 'ruby-mode-hook
'(lambda ()
(make-local-variable 'font-lock-syntactic-keywords)
(setq font-lock-syntactic-keywords
'(("\\$\\([#\"'`$\\]\\)" 1 (1 . nil)) '(("\\$\\([#\"'`$\\]\\)" 1 (1 . nil))
("\\(#\\)[{$@]" 1 (1 . nil)) ("\\(#\\)[{$@]" 1 (1 . nil))
("\\(/\\)\\([^/\n]\\|\\/\\)*\\(/\\)" ("\\(/\\)\\([^/\n]\\|\\/\\)*\\(/\\)"
@ -675,9 +669,12 @@ An end of a defun is found by moving forward from the beginning of one."
(3 (7 . ?'))) (3 (7 . ?')))
("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil)) ("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil))
("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil)))) ("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil))))
(make-local-variable 'font-lock-defaults) (put major-mode 'font-lock-defaults
(setq font-lock-defaults '((ruby-font-lock-keywords) nil nil)) '((ruby-font-lock-keywords)
(setq font-lock-keywords ruby-font-lock-keywords))) nil nil nil
beginning-of-line
(font-lock-syntactic-keywords
. ruby-font-lock-syntactic-keywords)))
(defun ruby-font-lock-docs (limit) (defun ruby-font-lock-docs (limit)
(if (re-search-forward "^=begin\\(\\s \\|$\\)" limit t) (if (re-search-forward "^=begin\\(\\s \\|$\\)" limit t)

View file

@ -426,7 +426,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
} }
| lhs '=' mrhs_basic | lhs '=' mrhs_basic
{ {
$$ = node_assign($1, ret_args($3)); $$ = node_assign($1, $3);
} }
| mlhs '=' mrhs | mlhs '=' mrhs
{ {

View file

@ -36,6 +36,33 @@ struct fc_result {
struct fc_result *prev; struct fc_result *prev;
}; };
static VALUE
fc_path(fc, name)
struct fc_result *fc;
ID name;
{
VALUE path, tmp;
path = rb_str_new2(rb_id2name(name));
while (fc) {
if (fc->track == rb_cObject) break;
if (ROBJECT(fc->track)->iv_tbl &&
st_lookup(ROBJECT(fc->track)->iv_tbl, rb_intern("__classpath__"), &tmp)) {
tmp = rb_str_dup(tmp);
rb_str_cat2(tmp, "::");
rb_str_append(tmp, path);
return tmp;
}
tmp = rb_str_new2(rb_id2name(fc->name));
rb_str_cat2(tmp, "::");
rb_str_append(tmp, path);
path = tmp;
fc = fc->prev;
}
return path;
}
static int static int
fc_i(key, value, res) fc_i(key, value, res)
ID key; ID key;
@ -43,49 +70,44 @@ fc_i(key, value, res)
struct fc_result *res; struct fc_result *res;
{ {
VALUE path; VALUE path;
char *name;
if (!rb_is_const_id(key)) return ST_CONTINUE; if (!rb_is_const_id(key)) return ST_CONTINUE;
name = rb_id2name(key);
if (res->path) {
path = rb_str_dup(res->path);
rb_str_cat2(path, "::");
rb_str_cat2(path, name);
}
else {
path = rb_str_new2(name);
}
if (value == res->klass) { if (value == res->klass) {
res->name = key; res->path = fc_path(res, key);
res->path = path;
return ST_STOP; return ST_STOP;
} }
if (rb_obj_is_kind_of(value, rb_cModule)) { switch (TYPE(value)) {
case T_MODULE:
case T_CLASS:
if (!RCLASS(value)->iv_tbl) return ST_CONTINUE;
else {
struct fc_result arg; struct fc_result arg;
struct fc_result *list; struct fc_result *list;
if (!RCLASS(value)->iv_tbl) return ST_CONTINUE;
list = res; list = res;
while (list) { while (list) {
if (list->track == value) return ST_CONTINUE; if (list->track == value) return ST_CONTINUE;
list = list->prev; list = list->prev;
} }
arg.name = 0; arg.name = key;
arg.path = path; arg.path = 0;
arg.klass = res->klass; arg.klass = res->klass;
arg.track = value; arg.track = value;
arg.prev = res; arg.prev = res;
st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg); st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg);
if (arg.name) { if (arg.path) {
res->name = arg.name;
res->path = arg.path; res->path = arg.path;
return ST_STOP; return ST_STOP;
} }
} }
break;
default:
break;
}
return ST_CONTINUE; return ST_CONTINUE;
} }
@ -103,10 +125,10 @@ find_class_path(klass)
if (RCLASS(rb_cObject)->iv_tbl) { if (RCLASS(rb_cObject)->iv_tbl) {
st_foreach(RCLASS(rb_cObject)->iv_tbl, fc_i, &arg); st_foreach(RCLASS(rb_cObject)->iv_tbl, fc_i, &arg);
} }
if (arg.name == 0) { if (arg.path == 0) {
st_foreach(rb_class_tbl, fc_i, &arg); st_foreach(rb_class_tbl, fc_i, &arg);
} }
if (arg.name) { if (arg.path) {
st_insert(ROBJECT(klass)->iv_tbl,rb_intern("__classpath__"),arg.path); st_insert(ROBJECT(klass)->iv_tbl,rb_intern("__classpath__"),arg.path);
return arg.path; return arg.path;
} }

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.1" #define RUBY_VERSION "1.7.1"
#define RUBY_RELEASE_DATE "2001-06-05" #define RUBY_RELEASE_DATE "2001-06-06"
#define RUBY_VERSION_CODE 171 #define RUBY_VERSION_CODE 171
#define RUBY_RELEASE_CODE 20010605 #define RUBY_RELEASE_CODE 20010606