Branch: Tag:

2002-05-05

2002-05-05 13:03:42 by Martin Stjernholm <mast@lysator.liu.se>

Added new keyword global to be able to access identifiers on the top level
of the compilation unit using global::foo. (Deactivated in 7.2 compatibility
mode, of course.)

Rev: src/language.yacc:1.276
Rev: src/lexer.h:1.36
Rev: src/testsuite.in:1.509

1: - test_true([["$Id: testsuite.in,v 1.508 2002/05/05 00:28:30 mast Exp $"]]); + test_true([["$Id: testsuite.in,v 1.509 2002/05/05 13:03:42 mast Exp $"]]);      cond([[all_constants()->_verify_internals]],   [[
2064:    class Y { inherit X:banan; void hopp() { banan::hej(); } }   ]])    + // Testing static resolving with :: +    test_program([[    class X {    int i = 17;
2141:    int a() {return X()->Y()->f() == "XAYBB";}   ]])    + // Testing global:: +  + test_equal([[ +  compile_string (#" +  string p = \"g\"; +  mixed f (string p) {return ({global::p, p});}")()->f ("l"); + ]], ({"g", "l"})) +  + test_eval_error([[ +  compile_string (#" +  string pp = \"g\"; +  mixed f (string p) {return global::p;}"); + ]]) +  + test_eval_error([[ +  compile_string (#" +  #pike 7.2 +  string p = \"g\"; +  mixed f (string p) {return global::p;}"); + ]]) +  + test_equal([[ +  compile_string (#" +  int x = 23; +  class A { +  constant x = 24; +  } +  inherit A; +  class X { +  int x = 32; +  mixed f (int x) {return ({global::x, global::A::x, X::x, x});} +  }")()->X()->f (33); + ]], ({23, 24, 32, 33})) +    // testing virtual overloading   test_any([[   class fnord