Lines Matching refs:cref
269 function handle_autoload(cref, name) { argument
270 if (!cref.$$autoload[name].loaded) {
271 cref.$$autoload[name].loaded = true;
273 Opal.Kernel.$require(cref.$$autoload[name].path);
275 cref.$$autoload[name].exception = e;
278 cref.$$autoload[name].required = true;
279 if (cref.$$const[name] != null) {
280 cref.$$autoload[name].success = true;
281 return cref.$$const[name];
283 } else if (cref.$$autoload[name].loaded && !cref.$$autoload[name].required) {
284 if (cref.$$autoload[name].exception) { throw cref.$$autoload[name].exception; }
301 function const_get_name(cref, name) { argument
302 if (cref) {
303 if (cref.$$const[name] != null) { return cref.$$const[name]; }
304 if (cref.$$autoload && cref.$$autoload[name]) {
305 return handle_autoload(cref, name);
329 function const_lookup_ancestors(cref, name) { argument
332 if (cref == null) return;
334 ancestors = $ancestors(cref);
347 function const_lookup_Object(cref, name) { argument
348 if (cref == null || cref.$$is_module) {
354 function const_missing(cref, name) { argument
355 return (cref || _Object).$const_missing(name);
359 Opal.const_get_local = function(cref, name, skip_missing) { argument
362 if (cref == null) return;
364 if (cref === '::') cref = _Object;
366 if (!cref.$$is_module && !cref.$$is_class) {
367 $raise(Opal.TypeError, cref.toString() + " is not a class/module");
370 result = const_get_name(cref, name);
371 return result != null || skip_missing ? result : const_missing(cref, name);
376 Opal.const_get_qualified = function(cref, name, skip_missing) { argument
381 result = const_get_name(_Object, cref);
384 return Opal.const_get_qualified(_Object, cref, skip_missing);
387 if (cref == null) return;
389 if (cref === '::') cref = _Object;
391 if (!cref.$$is_module && !cref.$$is_class) {
392 $raise(Opal.TypeError, cref.toString() + " is not a class/module");
395 if ((cache = cref.$$const_cache) == null) {
396 $prop(cref, '$$const_cache', Object.create(null));
397 cache = cref.$$const_cache;
402 ((result = const_get_name(cref, name)) != null) ||
403 ((result = const_lookup_ancestors(cref, name)) != null);
409 return result != null || skip_missing ? result : const_missing(cref, name);
418 var cref = nesting[0], result, current_version = Opal.const_cache_version, cache, cached;
427 ((result = const_get_name(cref, name)) != null) ||
429 ((result = const_lookup_ancestors(cref, name)) != null) ||
430 ((result = const_lookup_Object(cref, name)) != null);
437 return result != null || skip_missing ? result : const_missing(cref, name);
442 function $const_set(cref, name, value) { argument
445 if (cref == null || cref === '::') cref = _Object;
449 if (value.$$base_module == null) value.$$base_module = cref;
452 cref.$$const = (cref.$$const || Object.create(null));
454 if (name in cref.$$const || ("$$autoload" in cref && name in cref.$$autoload)) {
458 cref.$$const[name] = value;
463 cref.$$ = cref.$$const;
468 if (cref === _Object) Opal[name] = value;
471 $prop(cref, name, value);
473 if (new_const && cref.$const_added && !cref.$const_added.$$pristine) {
474 cref.$const_added(name);
484 Opal.constants = function(cref, inherit) { argument
487 var module, modules = [cref], i, ii, constants = {}, constant;
489 if (inherit) modules = modules.concat($ancestors(cref));
490 …if (inherit && cref.$$is_module) modules = modules.concat([Opal.Object]).concat($ancestors(Opal.Ob…
496 if (cref !== _Object && module == _Object) break;
512 Opal.const_remove = function(cref, name) { argument
515 if (cref.$$const[name] != null) {
516 var old = cref.$$const[name];
517 delete cref.$$const[name];
521 if (cref.$$autoload && cref.$$autoload[name]) {
522 delete cref.$$autoload[name];
526 $raise(Opal.NameError, "constant "+cref+"::"+cref.$name()+" not defined");