~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to src/toplevel.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-11-17 19:32:52 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20131117193252-tkrpclguqqebqa35
Tags: 0.2.0+dfsg-3
testsuite-i386.patch: loosen the numerical precision for yet another test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
            if (mb->owner == m || mb->imported) {
234
234
                m = (jl_module_t*)mb->value;
235
235
                if (m == NULL || !jl_is_module(m))
236
 
                    jl_errorf("invalid module path");
 
236
                    jl_errorf("invalid module path (%s does not name a module)", var->name);
237
237
                break;
238
238
            }
239
239
        }
240
240
        if (m == jl_main_module) {
241
 
            if (!retrying) {
 
241
            if (!retrying && i==1) { // (i==1) => no require() for relative imports
242
242
                if (require_func == NULL && jl_base_module != NULL)
243
243
                    require_func = jl_get_global(jl_base_module, jl_symbol("require"));
244
244
                if (require_func != NULL) {
250
250
                }
251
251
            }
252
252
        }
253
 
        jl_errorf("in module path: %s not defined", var->name);
 
253
        if (retrying && require_func) {
 
254
            JL_PRINTF(JL_STDERR, "Warning: requiring \"%s\" did not define a corresponding module.\n", var->name);
 
255
            return NULL;
 
256
        }
 
257
        else {
 
258
            jl_errorf("in module path: %s not defined", var->name);
 
259
        }
254
260
    }
255
261
 
256
262
    for(; i < jl_array_len(args)-1; i++) {
301
307
    // handle import, using, importall, export toplevel-only forms
302
308
    if (ex->head == importall_sym) {
303
309
        jl_module_t *m = eval_import_path(ex->args);
 
310
        if (m==NULL) return jl_nothing;
304
311
        jl_sym_t *name = (jl_sym_t*)jl_cellref(ex->args, jl_array_len(ex->args)-1);
305
312
        assert(jl_is_symbol(name));
306
313
        m = (jl_module_t*)jl_eval_global_var(m, name);
312
319
 
313
320
    if (ex->head == using_sym) {
314
321
        jl_module_t *m = eval_import_path(ex->args);
 
322
        if (m==NULL) return jl_nothing;
315
323
        jl_sym_t *name = (jl_sym_t*)jl_cellref(ex->args, jl_array_len(ex->args)-1);
316
324
        assert(jl_is_symbol(name));
317
325
        jl_module_t *u = (jl_module_t*)jl_eval_global_var(m, name);
326
334
 
327
335
    if (ex->head == import_sym) {
328
336
        jl_module_t *m = eval_import_path(ex->args);
 
337
        if (m==NULL) return jl_nothing;
329
338
        jl_sym_t *name = (jl_sym_t*)jl_cellref(ex->args, jl_array_len(ex->args)-1);
330
339
        assert(jl_is_symbol(name));
331
340
        jl_module_import(jl_current_module, m, name);
542
551
void print_func_loc(JL_STREAM *s, jl_lambda_info_t *li);
543
552
 
544
553
jl_value_t *jl_method_def(jl_sym_t *name, jl_value_t **bp, jl_binding_t *bnd,
545
 
                          jl_tuple_t *argtypes, jl_function_t *f, jl_tuple_t *t)
 
554
                          jl_tuple_t *argtypes, jl_function_t *f)
546
555
{
 
556
    // argtypes is a tuple ((types...), (typevars...))
 
557
    jl_tuple_t *t = (jl_tuple_t*)jl_t1(argtypes);
 
558
    argtypes = (jl_tuple_t*)jl_t0(argtypes);
547
559
    jl_value_t *gf;
548
560
    if (bnd) {
549
561
        //jl_declare_constant(bnd);