void QSParameterNode::check( QSCheckData * c ) { Q_ASSERT( c->inFunction() ); QSClass * cl = c->currentScope(); if (id == QString::fromLatin1("arguments")) { c->addError(this, QString::fromLatin1("Parameter 'arguments' is a predefined value in function '%1'. Use different parameter name.") .arg(cl->identifier())); return; } QSMember m; if( cl->member( 0, id, &m ) ) { c->addError( this, QString::fromLatin1( "Parameter '%1' already declared in function '%2'" ) .arg( id ) .arg( cl->identifier() ) ); return; } cl->addVariableMember( id, AttributeNone ); if( next ) next->check( c ); // create a member from id // add member to current scope // next.check(); }
void QSCatchNode::checkStatement( QSCheckData *c ) { checkIfGlobalAllowed( c ); QSClass *cl = c->currentScope(); index = cl->addVariableMember( ident, AttributeNone ); block->check( c ); }
void QSVarBindingNode::check( QSCheckData *c ) { var->check( c ); if ( assign ) assign->check( c ); if (!c->directLookupEnabled()) { c->addError( this, QString::fromLatin1( "QSA does not support declaring variables inside " "a 'with' block" )); return; } int attrs = c->lastAttributes(); QSClass * cl = c->currentScope(); QSMember m; if ( cl->member( 0, var->identifier(), &m ) ) { if( cl->asClass() ) { c->addError( this, QString::fromLatin1( "Variable '%1' has already been " "declared in class '%2'" ) .arg( var->identifier() ) .arg( cl->identifier() ) ); return; } m = QSMember( QSMember::Variable, 0, attrs ); cl->replaceMember( var->identifier(), &m ); idx = m.index(); } else { idx = cl->addVariableMember( var->identifier(), attrs ); } // store pointer to init node if this is a class member QSClassClass *clcl = cl->asClass(); if ( clcl ) { if( attrs & AttributeStatic ) clcl->addStaticInitializer( assign ); else clcl->addMemberInitializer( assign ); idx = -1; // Disable the variable binding node. } }