From e932d09908a12bb0f7201c28f84c0d7bc1f3dd90 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 7 Aug 2017 13:02:50 -0700 Subject: [PATCH] Avoid aggregate initialization syntax in places where C++11 doesn't allow it --- src/compiler/build_tables/build_parse_table.cc | 17 ++++++++--------- .../build_tables/parse_item_set_builder.cc | 9 +++++---- src/compiler/rules/metadata.cc | 3 ++- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/compiler/build_tables/build_parse_table.cc b/src/compiler/build_tables/build_parse_table.cc index 81a1a7cc..ed731fe6 100644 --- a/src/compiler/build_tables/build_parse_table.cc +++ b/src/compiler/build_tables/build_parse_table.cc @@ -73,15 +73,14 @@ class ParseTableBuilder { Symbol start_symbol = grammar.variables.empty() ? Symbol::terminal(0) : Symbol::non_terminal(0); - Production start_production{ - vector(1, ProductionStep{ - start_symbol, - 0, - rules::AssociativityNone, - rules::Alias{} - }), - 0 - }; + + Production start_production; + start_production.steps.push_back({ + start_symbol, + 0, + rules::AssociativityNone, + rules::Alias{} + }); add_parse_state({}, ParseItemSet{{ { diff --git a/src/compiler/build_tables/parse_item_set_builder.cc b/src/compiler/build_tables/parse_item_set_builder.cc index 2ccb22ef..4705dfb9 100644 --- a/src/compiler/build_tables/parse_item_set_builder.cc +++ b/src/compiler/build_tables/parse_item_set_builder.cc @@ -208,16 +208,17 @@ const vector &ParseItemSetBuilder::inline_production(const ParseItem auto end = item.production->steps.end(); auto step = begin + item.step_index; - Production production{ - vector(begin, step), - item.production->dynamic_precedence - }; + Production production; + production.steps.assign(begin, step); + production.dynamic_precedence = item.production->dynamic_precedence; + for (auto &step : *production_to_insert) { production.steps.push_back(step); if (!inlined_step.alias.value.empty()) { production.steps.back().alias = inlined_step.alias; } } + production.back().precedence = inlined_step.precedence; production.back().associativity = inlined_step.associativity; production.steps.insert( diff --git a/src/compiler/rules/metadata.cc b/src/compiler/rules/metadata.cc index a602b0f6..95822c5e 100644 --- a/src/compiler/rules/metadata.cc +++ b/src/compiler/rules/metadata.cc @@ -93,7 +93,8 @@ Metadata Metadata::main_token(const Rule &rule) { Metadata Metadata::alias(string &&value, bool is_named, const Rule &rule) { MetadataParams params; - params.alias = {move(value), is_named}; + params.alias.value = move(value); + params.alias.is_named = is_named; return Metadata{rule, params}; }