Source Code (Use browser search to find items of interest.)

Class Index

kdelibs'VarDeclNode (./kdelibs/kjs/nodes.h:441)

  class VarDeclNode : public Node {
  public:
    VarDeclNode(const UString *id, AssignExprNode *in);
    KJSO *evaluate();
  private:
    UString ident;
    AssignExprNode *init;
  };


kdelibs'VarDeclNode::evaluate() (./kdelibs/kjs/nodes.cpp:672)

KJSO *VarDeclNode::evaluate()
{
  KJSO *variable = Context::current()->variableObject();

  // TODO: coded with help of 10.1.3. Correct ?
  if (!variable->hasProperty(ident)) {
    Ptr val, tmp;
    if (init) {
      tmp = init->evaluate();
      val = tmp->getValue();
    } else
      val = KJSO::newUndefined();
    variable->put(ident, val);
  }
  // TODO: I added this return to make it compile (Stephan)
  return 0L;
}

// ECMA 12.2

kdelibs'VarDeclNode::VarDeclNode() (./kdelibs/kjs/nodes.cpp:1107)

VarDeclNode::VarDeclNode(const UString *id, AssignExprNode *in)
    : ident(*id), init(in) { }