ejayimperial / google-caja

Automatically exported from code.google.com/p/google-caja
0 stars 0 forks source link

caja.def unrecognized #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
                function F(x) { this.x_ = x; }
                caja.def(F, Object, {});

What is the expected output? What do you see instead?

I expect the cajoler to recognize the special form caja.def(derived, base,
methods).  Instead I get

Constructors are not first class: Rule "varBadCtorLeak", Reference
  Identifier : F

Original issue reported on code.google.com by metaw...@gmail.com on 17 Jan 2008 at 12:01

GoogleCodeExporter commented 9 years ago
OK, it's not that caja.def is unrecognized, but Object is not a function in 
scope.

Original comment by metaw...@gmail.com on 17 Jan 2008 at 12:15

GoogleCodeExporter commented 9 years ago
The example input currently cajoles to

{
  ___.loadModule(function (___OUTERS___) {
      ___OUTERS___.F = ___.ctor(function F(x) {
          var t___ = this;
          (function () {
              var x___ = x;
              return t___.x__canSet___ ? (t___.x_ = x___) : ___.setProp(t___, 'x_',
x___);
            })();
        });
      caja.def(F, Object, {
        });
    });

Note that the reference to F inside caja.def is unqualified.

Original comment by mikesamuel@gmail.com on 9 Mar 2008 at 2:49

GoogleCodeExporter commented 9 years ago

Original comment by ihab.a...@gmail.com on 13 Mar 2008 at 10:46

GoogleCodeExporter commented 9 years ago
Fixed in r800

Original comment by ihab.a...@gmail.com on 20 Mar 2008 at 3:13