const AstRawString* name = is_simple
? pattern->AsVariableProxy()->raw_name()
: parser_->ast_value_factory()->empty_string();
+ VariableMode mode = is_simple ? VAR : TEMPORARY;
Variable* var =
- parameters->scope->DeclareParameter(name, VAR, is_rest, &is_duplicate);
+ parameters->scope->DeclareParameter(name, mode, is_rest, &is_duplicate);
parameters->AddParameter(var, is_simple ? nullptr : pattern);
if (is_duplicate) {
classifier->RecordDuplicateFormalParameterError(
bool is_rest, bool* is_duplicate) {
DCHECK(!already_resolved());
DCHECK(is_function_scope());
-
Variable* var;
- if (!name->IsEmpty()) {
+ if (mode == TEMPORARY) {
+ var = NewTemporary(name);
+ } else {
var = variables_.Declare(this, name, mode, Variable::NORMAL,
kCreatedInitialized);
// TODO(wingo): Avoid O(n^2) check.
*is_duplicate = IsDeclaredParameter(name);
- } else {
- var = new (zone())
- Variable(this, name, TEMPORARY, Variable::NORMAL, kCreatedInitialized);
}
if (is_rest) {
DCHECK_NULL(rest_parameter_);
if (var->IsContextSlot()) {
DCHECK(has_forced_context_allocation());
context_locals->Add(var, zone());
- } else {
- DCHECK(var->IsStackLocal());
+ } else if (var->IsStackLocal()) {
stack_locals->Add(var, zone());
+ } else {
+ DCHECK(var->IsParameter());
}
}
}
if (var->is_used() || !var->IsUnallocated()) {
Indent(indent, Variable::Mode2String(var->mode()));
PrintF(" ");
- PrintName(var->raw_name());
+ if (var->raw_name()->IsEmpty())
+ PrintF(".%p", var);
+ else
+ PrintName(var->raw_name());
PrintF("; // ");
PrintLocation(var);
bool comma = !var->IsUnallocated();
PrintF(" (");
for (int i = 0; i < params_.length(); i++) {
if (i > 0) PrintF(", ");
- PrintName(params_[i]->raw_name());
+ const AstRawString* name = params_[i]->raw_name();
+ if (name->IsEmpty())
+ PrintF(".%p", params_[i]);
+ else
+ PrintName(name);
}
PrintF(")");
}