Skip to content

Commit 5923e62

Browse files
nschonnimgreter
authored andcommitted
Fix declarations that hide locals
1 parent 813ee18 commit 5923e62

File tree

11 files changed

+69
-69
lines changed

11 files changed

+69
-69
lines changed

src/ast.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,9 @@ namespace Sass {
403403
bool Selector_List::operator== (const Selector& rhs) const
404404
{
405405
// solve the double dispatch problem by using RTTI information via dynamic cast
406-
if (Selector_List_Ptr_Const ls = Cast<Selector_List>(&rhs)) { return *this == *ls; }
407-
else if (Complex_Selector_Ptr_Const ls = Cast<Complex_Selector>(&rhs)) { return *this == *ls; }
408-
else if (Compound_Selector_Ptr_Const ls = Cast<Compound_Selector>(&rhs)) { return *this == *ls; }
406+
if (Selector_List_Ptr_Const sl = Cast<Selector_List>(&rhs)) { return *this == *sl; }
407+
else if (Complex_Selector_Ptr_Const cpx = Cast<Complex_Selector>(&rhs)) { return *this == *cpx; }
408+
else if (Compound_Selector_Ptr_Const cpd = Cast<Compound_Selector>(&rhs)) { return *this == *cpd; }
409409
// no compare method
410410
return this == &rhs;
411411
}
@@ -830,9 +830,9 @@ namespace Sass {
830830

831831
for (size_t i = 0, iL = length(); i < iL; ++i)
832832
{
833-
Selector_Obj lhs = (*this)[i];
833+
Selector_Obj wlhs = (*this)[i];
834834
// very special case for wrapped matches selector
835-
if (Wrapped_Selector_Obj wrapped = Cast<Wrapped_Selector>(lhs)) {
835+
if (Wrapped_Selector_Obj wrapped = Cast<Wrapped_Selector>(wlhs)) {
836836
if (wrapped->name() == ":not") {
837837
if (Selector_List_Obj not_list = Cast<Selector_List>(wrapped->selector())) {
838838
if (not_list->is_superselector_of(rhs, wrapped->name())) return false;
@@ -841,7 +841,7 @@ namespace Sass {
841841
}
842842
}
843843
if (wrapped->name() == ":matches" || wrapped->name() == ":-moz-any") {
844-
lhs = wrapped->selector();
844+
wlhs = wrapped->selector();
845845
if (Selector_List_Obj list = Cast<Selector_List>(wrapped->selector())) {
846846
if (Compound_Selector_Obj comp = Cast<Compound_Selector>(rhs)) {
847847
if (!wrapping.empty() && wrapping != wrapped->name()) return false;
@@ -861,7 +861,7 @@ namespace Sass {
861861
}
862862
}
863863
// match from here on as strings
864-
lset.insert(lhs->to_string());
864+
lset.insert(wlhs->to_string());
865865
}
866866

867867
for (size_t n = 0, nL = rhs->length(); n < nL; ++n)
@@ -1118,15 +1118,15 @@ namespace Sass {
11181118
size_t i;
11191119
size_t L = h->length();
11201120
if (Cast<Element_Selector>(h->first())) {
1121-
if (Class_Selector_Ptr sq = Cast<Class_Selector>(rh->last())) {
1122-
Class_Selector_Ptr sqs = SASS_MEMORY_COPY(sq);
1121+
if (Class_Selector_Ptr cs = Cast<Class_Selector>(rh->last())) {
1122+
Class_Selector_Ptr sqs = SASS_MEMORY_COPY(cs);
11231123
sqs->name(sqs->name() + (*h)[0]->name());
11241124
sqs->pstate((*h)[0]->pstate());
11251125
(*rh)[rh->length()-1] = sqs;
11261126
rh->pstate(h->pstate());
11271127
for (i = 1; i < L; ++i) rh->append((*h)[i]);
1128-
} else if (Id_Selector_Ptr sq = Cast<Id_Selector>(rh->last())) {
1129-
Id_Selector_Ptr sqs = SASS_MEMORY_COPY(sq);
1128+
} else if (Id_Selector_Ptr is = Cast<Id_Selector>(rh->last())) {
1129+
Id_Selector_Ptr sqs = SASS_MEMORY_COPY(is);
11301130
sqs->name(sqs->name() + (*h)[0]->name());
11311131
sqs->pstate((*h)[0]->pstate());
11321132
(*rh)[rh->length()-1] = sqs;

src/bind.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ namespace Sass {
9595
env->local_frame()[p->name()] = arglist;
9696
Map_Obj argmap = Cast<Map>(a->value());
9797
for (auto key : argmap->keys()) {
98-
std::string name = unquote(Cast<String_Constant>(key)->value());
98+
std::string param = unquote(Cast<String_Constant>(key)->value());
9999
arglist->append(SASS_MEMORY_NEW(Argument,
100100
key->pstate(),
101101
argmap->at(key),
102-
"$" + name,
102+
"$" + param,
103103
false,
104104
false));
105105
}
@@ -205,14 +205,14 @@ namespace Sass {
205205
Map_Obj argmap = Cast<Map>(a->value());
206206

207207
for (auto key : argmap->keys()) {
208-
std::string name = "$" + unquote(Cast<String_Constant>(key)->value());
208+
std::string param = "$" + unquote(Cast<String_Constant>(key)->value());
209209

210-
if (!param_map.count(name)) {
210+
if (!param_map.count(param)) {
211211
std::stringstream msg;
212-
msg << callee << " has no parameter named " << name;
212+
msg << callee << " has no parameter named " << param;
213213
error(msg.str(), a->pstate());
214214
}
215-
env->local_frame()[name] = argmap->at(key);
215+
env->local_frame()[param] = argmap->at(key);
216216
}
217217
++ia;
218218
continue;

src/context.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,12 @@ namespace Sass {
416416
// need one correct import
417417
bool has_import = false;
418418
// process all custom importers (or custom headers)
419-
for (Sass_Importer_Entry& importer : importers) {
419+
for (Sass_Importer_Entry& importer_ent : importers) {
420420
// int priority = sass_importer_get_priority(importer);
421-
Sass_Importer_Fn fn = sass_importer_get_function(importer);
421+
Sass_Importer_Fn fn = sass_importer_get_function(importer_ent);
422422
// skip importer if it returns NULL
423423
if (Sass_Import_List includes =
424-
fn(load_path.c_str(), importer, c_compiler)
424+
fn(load_path.c_str(), importer_ent, c_compiler)
425425
) {
426426
// get c pointer copy to iterate over
427427
Sass_Import_List it_includes = includes;
@@ -436,15 +436,15 @@ namespace Sass {
436436
// create the importer struct
437437
Importer importer(uniq_path, ctx_path);
438438
// query data from the current include
439-
Sass_Import_Entry include = *it_includes;
440-
char* source = sass_import_take_source(include);
441-
char* srcmap = sass_import_take_srcmap(include);
442-
size_t line = sass_import_get_error_line(include);
443-
size_t column = sass_import_get_error_column(include);
444-
const char *abs_path = sass_import_get_abs_path(include);
439+
Sass_Import_Entry include_ent = *it_includes;
440+
char* source = sass_import_take_source(include_ent);
441+
char* srcmap = sass_import_take_srcmap(include_ent);
442+
size_t line = sass_import_get_error_line(include_ent);
443+
size_t column = sass_import_get_error_column(include_ent);
444+
const char *abs_path = sass_import_get_abs_path(include_ent);
445445
// handle error message passed back from custom importer
446446
// it may (or may not) override the line and column info
447-
if (const char* err_message = sass_import_get_error_message(include)) {
447+
if (const char* err_message = sass_import_get_error_message(include_ent)) {
448448
if (source || srcmap) register_resource({ importer, uniq_path }, { source, srcmap }, &pstate);
449449
if (line == std::string::npos && column == std::string::npos) error(err_message, pstate);
450450
else error(err_message, ParserState(ctx_path, source, Position(line, column)));

src/cssize.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ namespace Sass {
174174

175175
if (props->length())
176176
{
177-
Block_Obj bb = SASS_MEMORY_NEW(Block, rr->block()->pstate());
178-
bb->concat(props);
179-
rr->block(bb);
177+
Block_Obj pb = SASS_MEMORY_NEW(Block, rr->block()->pstate());
178+
pb->concat(props);
179+
rr->block(pb);
180180

181181
for (size_t i = 0, L = rules->length(); i < L; i++)
182182
{

src/eval.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ namespace Sass {
266266
list = Cast<List>(list);
267267
}
268268
for (size_t i = 0, L = list->length(); i < L; ++i) {
269-
Expression_Ptr e = list->at(i);
269+
Expression_Ptr item = list->at(i);
270270
// unwrap value if the expression is an argument
271-
if (Argument_Ptr arg = Cast<Argument>(e)) e = arg->value();
271+
if (Argument_Ptr arg = Cast<Argument>(item)) item = arg->value();
272272
// check if we got passed a list of args (investigate)
273-
if (List_Ptr scalars = Cast<List>(e)) {
273+
if (List_Ptr scalars = Cast<List>(item)) {
274274
if (variables.size() == 1) {
275275
Expression_Ptr var = scalars;
276276
env.set_local(variables[0], var);
@@ -285,7 +285,7 @@ namespace Sass {
285285
}
286286
} else {
287287
if (variables.size() > 0) {
288-
env.set_local(variables.at(0), e);
288+
env.set_local(variables.at(0), item);
289289
for (size_t j = 1, K = variables.size(); j < K; ++j) {
290290
// XXX: this is never hit via spec tests
291291
Expression_Ptr res = SASS_MEMORY_NEW(Null, expr->pstate());

src/expand.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,11 @@ namespace Sass {
515515
list = Cast<List>(list);
516516
}
517517
for (size_t i = 0, L = list->length(); i < L; ++i) {
518-
Expression_Obj e = list->at(i);
518+
Expression_Obj item = list->at(i);
519519
// unwrap value if the expression is an argument
520-
if (Argument_Obj arg = Cast<Argument>(e)) e = arg->value();
520+
if (Argument_Obj arg = Cast<Argument>(item)) item = arg->value();
521521
// check if we got passed a list of args (investigate)
522-
if (List_Obj scalars = Cast<List>(e)) {
522+
if (List_Obj scalars = Cast<List>(item)) {
523523
if (variables.size() == 1) {
524524
List_Obj var = scalars;
525525
// if (arglist) var = (*scalars)[0];
@@ -534,7 +534,7 @@ namespace Sass {
534534
}
535535
} else {
536536
if (variables.size() > 0) {
537-
env.set_local(variables.at(0), e);
537+
env.set_local(variables.at(0), item);
538538
for (size_t j = 1, K = variables.size(); j < K; ++j) {
539539
Expression_Obj res = SASS_MEMORY_NEW(Null, expr->pstate());
540540
env.set_local(variables[j], res);

src/functions.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,19 +1191,19 @@ namespace Sass {
11911191
Number_Ptr l = Cast<Number>(arg);
11921192
Boolean_Ptr b = Cast<Boolean>(arg);
11931193
if (l) {
1194-
double v = l->value();
1195-
if (v < 1) {
1194+
double lv = l->value();
1195+
if (lv < 1) {
11961196
stringstream err;
1197-
err << "$limit " << v << " must be greater than or equal to 1 for `random'";
1197+
err << "$limit " << lv << " must be greater than or equal to 1 for `random'";
11981198
error(err.str(), pstate);
11991199
}
1200-
bool eq_int = std::fabs(trunc(v) - v) < NUMBER_EPSILON;
1200+
bool eq_int = std::fabs(trunc(lv) - lv) < NUMBER_EPSILON;
12011201
if (!eq_int) {
12021202
stringstream err;
1203-
err << "Expected $limit to be an integer but got " << v << " for `random'";
1203+
err << "Expected $limit to be an integer but got " << lv << " for `random'";
12041204
error(err.str(), pstate);
12051205
}
1206-
std::uniform_real_distribution<> distributor(1, v + 1);
1206+
std::uniform_real_distribution<> distributor(1, lv + 1);
12071207
uint_fast32_t distributed = static_cast<uint_fast32_t>(distributor(rand));
12081208
return SASS_MEMORY_NEW(Number, pstate, (double)distributed);
12091209
}

src/parser.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,15 @@ namespace Sass {
325325
Function_Call_Obj result = SASS_MEMORY_NEW(Function_Call, pstate, "url", args);
326326

327327
if (lex< quoted_string >()) {
328-
Expression_Obj the_url = parse_string();
329-
args->append(SASS_MEMORY_NEW(Argument, the_url->pstate(), the_url));
328+
Expression_Obj quoted_url = parse_string();
329+
args->append(SASS_MEMORY_NEW(Argument, quoted_url->pstate(), quoted_url));
330330
}
331-
else if (String_Obj the_url = parse_url_function_argument()) {
332-
args->append(SASS_MEMORY_NEW(Argument, the_url->pstate(), the_url));
331+
else if (String_Obj string_url = parse_url_function_argument()) {
332+
args->append(SASS_MEMORY_NEW(Argument, string_url->pstate(), string_url));
333333
}
334334
else if (peek < skip_over_scopes < exactly < '(' >, exactly < ')' > > >(position)) {
335-
Expression_Obj the_url = parse_list(); // parse_interpolated_chunk(lexed);
336-
args->append(SASS_MEMORY_NEW(Argument, the_url->pstate(), the_url));
335+
Expression_Obj braced_url = parse_list(); // parse_interpolated_chunk(lexed);
336+
args->append(SASS_MEMORY_NEW(Argument, braced_url->pstate(), braced_url));
337337
}
338338
else {
339339
error("malformed URL", pstate);
@@ -1062,12 +1062,12 @@ namespace Sass {
10621062
if (peek_css< exactly<')'> >(position))
10631063
{ break; }
10641064

1065-
Expression_Obj key = parse_space_list();
1065+
key = parse_space_list();
10661066

10671067
if (!(lex< exactly<':'> >()))
10681068
{ css_error("Invalid CSS", " after ", ": expected \":\", was "); }
10691069

1070-
Expression_Obj value = parse_space_list();
1070+
value = parse_space_list();
10711071

10721072
map->append(key);
10731073
map->append(value);

src/remove_placeholders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ namespace Sass {
4444
if (cs->head()) {
4545
for (Simple_Selector_Obj& ss : cs->head()->elements()) {
4646
if (Wrapped_Selector_Ptr ws = Cast<Wrapped_Selector>(ss)) {
47-
if (Selector_List_Ptr sl = Cast<Selector_List>(ws->selector())) {
48-
Selector_List_Ptr clean = remove_placeholders(sl);
47+
if (Selector_List_Ptr wsl = Cast<Selector_List>(ws->selector())) {
48+
Selector_List_Ptr clean = remove_placeholders(wsl);
4949
// also clean superflous parent selectors
5050
// probably not really the correct place
5151
clean->remove_parent_selectors();

src/source_map.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,35 @@ namespace Sass {
2424

2525
json_append_member(json_srcmap, "version", json_mknumber(3));
2626

27-
const char *include = file.c_str();
28-
JsonNode *json_include = json_mkstring(include);
29-
json_append_member(json_srcmap, "file", json_include);
27+
const char *file_name = file.c_str();
28+
JsonNode *json_file_name = json_mkstring(file_name);
29+
json_append_member(json_srcmap, "file", json_file_name);
3030

3131
// pass-through sourceRoot option
3232
if (!ctx.source_map_root.empty()) {
3333
JsonNode* root = json_mkstring(ctx.source_map_root.c_str());
3434
json_append_member(json_srcmap, "sourceRoot", root);
3535
}
3636

37-
JsonNode *json_includes = json_mkarray();
37+
JsonNode *json_sources = json_mkarray();
3838
for (size_t i = 0; i < source_index.size(); ++i) {
39-
std::string include(links[source_index[i]]);
39+
std::string source(links[source_index[i]]);
4040
if (ctx.c_options.source_map_file_urls) {
41-
include = File::rel2abs(include);
41+
source = File::rel2abs(source);
4242
// check for windows abs path
43-
if (include[0] == '/') {
43+
if (source[0] == '/') {
4444
// ends up with three slashes
45-
include = "file://" + include;
45+
source = "file://" + source;
4646
} else {
4747
// needs an additional slash
48-
include = "file:///" + include;
48+
source = "file:///" + source;
4949
}
5050
}
51-
const char* inc = include.c_str();
52-
JsonNode *json_include = json_mkstring(inc);
53-
json_append_element(json_includes, json_include);
51+
const char* source_name = source.c_str();
52+
JsonNode *json_source_name = json_mkstring(source_name);
53+
json_append_element(json_sources, json_source_name);
5454
}
55-
json_append_member(json_srcmap, "sources", json_includes);
55+
json_append_member(json_srcmap, "sources", json_sources);
5656

5757
if (include_sources) {
5858
JsonNode *json_contents = json_mkarray();

0 commit comments

Comments
 (0)