Branch: Tag:

2002-05-05

2002-05-05 16:31:08 by Martin Stjernholm <mast@lysator.liu.se>

Implemented global.Foo to be able to resolve the module Foo even when there
is a local identifier with that name.

Rev: src/language.yacc:1.277
Rev: src/program.c:1.423
Rev: src/program.h:1.157
Rev: src/testsuite.in:1.510

1: - test_true([["$Id: testsuite.in,v 1.509 2002/05/05 13:03:42 mast Exp $"]]); + test_true([["$Id: testsuite.in,v 1.510 2002/05/05 16:31:08 mast Exp $"]]);      cond([[all_constants()->_verify_internals]],   [[
2143:    int a() {return X()->Y()->f() == "XAYBB";}   ]])    - // Testing global:: + test_program([[ +  class A { +  string s = "A"; +  } +  inherit A; +  class X { +  constant s = "X"; +  mixed f (string s) {return s + X::s + A::s;} +  } +  int a() {return X()->f("L") == "LXA";} + ]])    -  + // Testing 'global::' +    test_equal([[    compile_string (#"    string p = \"g\";
2177:    }")()->X()->f (33);   ]], ({23, 24, 32, 33}))    + // Testing 'global.' +  + test_compile([[ +  mixed a() {return global.Parser.HTML;} + ]], 0); +  + test_compile_error([[ +  #pike 7.2 +  mixed a() {return global.Parser.HTML;} + ]], 0); +  + test_any([[ +  if (!programp (Parser.HTML)) error ("This test uses the existence of Parser.HTML.\n"); +  return compile_string (#" +  class Parser {constant HTML = 1;} +  mixed foo() {return programp (Parser.HTML);}")()->foo(); + ]], 0); +  + test_any([[ +  if (!programp (Parser.HTML)) error ("This test uses the existence of Parser.HTML.\n"); +  return compile_string (#" +  mixed foo() {return programp (Parser.HTML);} +  class Parser {constant HTML = 1;}")()->foo(); + ]], 0); +  + test_any([[ +  if (!programp (Parser.HTML)) error ("This test uses the existence of Parser.HTML.\n"); +  return compile_string (#" +  class Parser {constant HTML = 1;} +  mixed foo() {return programp (global.Parser.HTML);}")()->foo(); + ]], 1); +  + test_any([[ +  if (!programp (Parser.HTML)) error ("This test uses the existence of Parser.HTML.\n"); +  return compile_string (#" +  mixed foo() {return programp (global.Parser.HTML);} +  class Parser {constant HTML = 1;}")()->foo(); + ]], 1); +    // testing virtual overloading   test_any([[   class fnord