From c96ab5fb8238991efc3e618f8719fa8a4a12cd96 Mon Sep 17 00:00:00 2001 From: vczh Date: Sun, 24 Oct 2021 00:26:11 -0700 Subject: [PATCH] Update import --- Import/GacUI.cpp | 281 ++++---- Import/GacUICompiler.cpp | 222 +++--- Import/GacUICompiler.h | 4 +- Import/GacUIReflection.cpp | 6 +- Import/GacUIWindows.cpp | 48 +- Import/Vlpp.h | 241 +++++-- Import/VlppOS.cpp | 12 +- Import/VlppParser.cpp | 246 +++---- Import/VlppReflection.cpp | 4 +- Import/VlppRegex.h | 22 +- Import/VlppWorkflowCompiler.cpp | 1180 ++++++++++++++----------------- Import/VlppWorkflowRuntime.cpp | 72 +- 12 files changed, 1172 insertions(+), 1166 deletions(-) diff --git a/Import/GacUI.cpp b/Import/GacUI.cpp index a8a1552e..b7952fe1 100644 --- a/Import/GacUI.cpp +++ b/Import/GacUI.cpp @@ -193,7 +193,7 @@ GuiApplication { composition->GetEventReceiver()->clipboardNotify.Execute(arguments); } - FOREACH(GuiGraphicsComposition*, subComposition, composition->Children()) + for (auto subComposition : composition->Children()) { InvokeClipboardNotify(subComposition, arguments); } @@ -467,7 +467,7 @@ GuiPluginManager auto name = plugin->GetName(); if (name != L"") { - FOREACH(Ptr, plugin, plugins) + for (auto plugin : plugins) { CHECK_ERROR(plugin->GetName() != name, L"GuiPluginManager::AddPlugin(Ptr)#Duplicated plugin name."); } @@ -483,13 +483,13 @@ GuiPluginManager SortedList loaded; Group loading; Dictionary> pluginsToLoad; - FOREACH(Ptr, plugin, plugins) + for (auto plugin : plugins) { auto name = plugin->GetName(); pluginsToLoad.Add(name, plugin); List dependencies; plugin->GetDependencies(dependencies); - FOREACH(WString, dependency, dependencies) + for (auto dependency : dependencies) { loading.Add(name, dependency); } @@ -499,7 +499,7 @@ GuiPluginManager { vint count = pluginsToLoad.Count(); { - FOREACH_INDEXER(WString, name, index, pluginsToLoad.Keys()) + for (auto [name, index] : indexed(pluginsToLoad.Keys())) { if (!loading.Keys().Contains(name)) { @@ -519,13 +519,13 @@ GuiPluginManager if (count == pluginsToLoad.Count()) { WString message; - FOREACH(Ptr, plugin, pluginsToLoad.Values()) + for (auto plugin : pluginsToLoad.Values()) { message += L"Cannot load plugin \"" + plugin->GetName() + L"\" because part of its dependencies are not ready:"; List dependencies; plugin->GetDependencies(dependencies); bool first = true; - FOREACH(WString, dependency, dependencies) + for (auto dependency : dependencies) { if (!loaded.Contains(dependency)) { @@ -543,7 +543,7 @@ GuiPluginManager { CHECK_ERROR(loaded, L"GuiPluginManager::AddPlugin(Ptr)#Load function has not been executed."); loaded=false; - FOREACH(Ptr, plugin, plugins) + for (auto plugin : plugins) { plugin->Unload(); } @@ -2094,7 +2094,7 @@ GuiTab } selectedPage = value; - FOREACH(GuiTabPage*, tabPage, tabPages) + for (auto tabPage : tabPages) { tabPage->SetVisible(tabPage == selectedPage); } @@ -5406,7 +5406,7 @@ DataProvider if (selectedFilters.Count() > 0) { auto andFilter = MakePtr(); - FOREACH(Ptr, filter, selectedFilters) + for (auto filter : selectedFilters) { andFilter->AddSubFilter(filter); } @@ -6464,7 +6464,7 @@ GuiBindableTreeView::ItemSourceNode itemChangedEventHandler = nullptr; } childrenVirtualList = nullptr; - FOREACH(Ptr, node, children) + for (auto node : children) { node->UnprepareChildren(); } @@ -6541,7 +6541,7 @@ GuiBindableTreeView::ItemSourceNode PrepareChildren(PrepareValueList(itemSource)); } vint count = 1; - FOREACH(Ptr, child, children) + for (auto child : children) { count += child->CalculateTotalVisibleNodes(); } @@ -7298,7 +7298,7 @@ DefaultDataGridItemTemplate void DefaultDataGridItemTemplate::OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) { - FOREACH(Ptr, visualizer, dataVisualizers) + for (auto visualizer : dataVisualizers) { visualizer->GetTemplate()->SetFont(GetFont()); } @@ -7310,7 +7310,7 @@ DefaultDataGridItemTemplate void DefaultDataGridItemTemplate::OnContextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) { - FOREACH(Ptr, visualizer, dataVisualizers) + for (auto visualizer : dataVisualizers) { visualizer->GetTemplate()->SetContext(GetContext()); } @@ -7322,7 +7322,7 @@ DefaultDataGridItemTemplate void DefaultDataGridItemTemplate::OnVisuallyEnabledChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) { - FOREACH(Ptr, visualizer, dataVisualizers) + for (auto visualizer : dataVisualizers) { visualizer->GetTemplate()->SetVisuallyEnabled(GetVisuallyEnabled()); } @@ -7338,7 +7338,7 @@ DefaultDataGridItemTemplate DefaultDataGridItemTemplate::~DefaultDataGridItemTemplate() { - FOREACH(Ptr, visualizer, dataVisualizers) + for (auto visualizer : dataVisualizers) { visualizer->NotifyDeletedTemplate(); } @@ -9716,7 +9716,7 @@ GuiListControl void GuiListControl::UpdateDisplayFont() { GuiControl::UpdateDisplayFont(); - FOREACH(ItemStyle*, style, visibleStyles.Keys()) + for (auto style : visibleStyles.Keys()) { style->SetFont(GetDisplayFont()); } @@ -9730,7 +9730,7 @@ GuiListControl void GuiListControl::OnVisuallyEnabledChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) { - FOREACH(ItemStyle*, style, visibleStyles.Keys()) + for (auto style : visibleStyles.Keys()) { style->SetVisuallyEnabled(GetVisuallyEnabled()); } @@ -9738,7 +9738,7 @@ GuiListControl void GuiListControl::OnContextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments) { - FOREACH(ItemStyle*, style, visibleStyles.Keys()) + for (auto style : visibleStyles.Keys()) { style->SetContext(GetContext()); } @@ -10037,7 +10037,7 @@ GuiSelectableListControl void GuiSelectableListControl::OnItemSelectionCleared() { - FOREACH(ItemStyle*, style, visibleStyles.Keys()) + for (auto style : visibleStyles.Keys()) { style->SetSelected(false); } @@ -10495,7 +10495,7 @@ ListViewColumnItemArranger::ColumnItemViewCallback void ListViewColumnItemArranger::ColumnItemViewCallback::OnColumnChanged() { arranger->RebuildColumns(); - FOREACH(ItemStyleRecord, style, arranger->visibleStyles) + for (auto style : arranger->visibleStyles) { if (auto callback = dynamic_cast(style.key)) { @@ -13703,7 +13703,7 @@ IGuiAnimationCoroutine } for (vint i = 0; i < groupAnimations.Count(); i++) { - FOREACH(Ptr, animation, groupAnimations.GetByIndex(i)) + for (auto animation : groupAnimations.GetByIndex(i)) { animation->Pause(); } @@ -13718,7 +13718,7 @@ IGuiAnimationCoroutine } for (vint i = 0; i < groupAnimations.Count(); i++) { - FOREACH(Ptr, animation, groupAnimations.GetByIndex(i)) + for (auto animation : groupAnimations.GetByIndex(i)) { animation->Resume(); } @@ -14151,7 +14151,7 @@ GuiCommonDatePickerLook void GuiCommonDatePickerLook::SetDateButtonTemplate(const TemplateProperty& value) { dateButtonTemplate = value; - FOREACH(GuiSelectableButton*, button, buttonDays) + for (auto button : buttonDays) { button->SetControlTemplate(value); } @@ -14232,7 +14232,7 @@ GuiCommonDatePickerLook listYears->SetFont(value); comboMonth->SetFont(value); listMonths->SetFont(value); - FOREACH(GuiSolidLabelElement*, label, From(labelDaysOfWeek).Concat(labelDays)) + for (auto label : From(labelDaysOfWeek).Concat(labelDays)) { label->SetFont(value); } @@ -14634,7 +14634,7 @@ GuiInstanceRootObject auto controlHost = GetControlHostForInstance(); if (UninstallTimerCallback(controlHost)) { - FOREACH(Ptr, animation, runningAnimations) + for (auto animation : runningAnimations) { animation->Pause(); } @@ -14643,7 +14643,7 @@ GuiInstanceRootObject if (controlHost) { InstallTimerCallback(controlHost); - FOREACH(Ptr, animation, runningAnimations) + for (auto animation : runningAnimations) { animation->Resume(); } @@ -14653,7 +14653,7 @@ GuiInstanceRootObject void GuiInstanceRootObject::StartPendingAnimations() { - FOREACH(Ptr, animation, pendingAnimations) + for (auto animation : pendingAnimations) { animation->Start(); } @@ -14677,11 +14677,11 @@ GuiInstanceRootObject { finalized = true; - FOREACH(Ptr, subscription, subscriptions) + for (auto subscription : subscriptions) { subscription->Close(); } - FOREACH(GuiComponent*, component, components) + for (auto component : components) { component->Detach(this); } @@ -14765,7 +14765,7 @@ GuiInstanceRootObject void GuiInstanceRootObject::UpdateSubscriptions() { - FOREACH(Ptr, subscription, subscriptions) + for (auto subscription : subscriptions) { subscription->Update(); } @@ -15354,7 +15354,7 @@ GuiDocumentCommonInterface { if (activeHyperlinks) { - FOREACH(Ptr, run, activeHyperlinks->hyperlinks) + for (auto run : activeHyperlinks->hyperlinks) { run->styleName = activate ? run->activeStyleName : run->normalStyleName; } @@ -15697,7 +15697,7 @@ GuiDocumentCommonInterface void GuiDocumentCommonInterface::OnStartRender() { - FOREACH(Ptr, item, documentItems.Values()) + for (auto item : documentItems.Values()) { item->visible = false; } @@ -15705,7 +15705,7 @@ GuiDocumentCommonInterface void GuiDocumentCommonInterface::OnFinishRender() { - FOREACH(Ptr, item, documentItems.Values()) + for (auto item : documentItems.Values()) { if (item->container->GetVisible() != item->visible) { @@ -17799,7 +17799,7 @@ GuiTextBoxAutoCompleteBase::TextListControlProvider void GuiTextBoxAutoCompleteBase::TextListControlProvider::SetSortedContent(const collections::List& items) { autoCompleteList->GetItems().Clear(); - FOREACH(AutoCompleteItem, item, items) + for (auto item : items) { autoCompleteList->GetItems().Add(new list::TextItem(item.text)); } @@ -18910,9 +18910,9 @@ GuiGrammarAutoComplete Ptr bag=table->GetTransitionBag(i, j); if(bag) { - FOREACH(Ptr, item, bag->transitionItems) + for (auto item : bag->transitionItems) { - FOREACH(ParsingTable::Instruction, ins, item->instructions) + for (auto ins : item->instructions) { if(ins.instructionType==ParsingTable::Instruction::LeftRecursiveReduce) { @@ -18974,7 +18974,7 @@ GuiGrammarAutoComplete RegexToken lastToken; lastToken.reading=0; - FOREACH(RegexToken, token, tokens) + for (auto token : tokens) { // we treat "class| Name" as editing the first token if(TextPos(token.rowEnd, token.columnEnd+1)>=pos) @@ -19035,7 +19035,7 @@ GuiGrammarAutoComplete ParsingTreeObject* obj = dynamic_cast(current); if (obj) { - FOREACH(WString, rule, obj->GetCreatorRules()) + for (auto rule : obj->GetCreatorRules()) { if (leftRecursiveRules.Contains(rule)) { @@ -19154,7 +19154,7 @@ GuiGrammarAutoComplete // initialize a TextLines with the latest modifiedCode text::TextLines lines(nullptr); lines.SetText(newContext.modifiedCode); - FOREACH(TextEditNotifyStruct, trace, usedTrace) + for (auto trace : usedTrace) { // apply a modification to lines TextPos start = trace.originalStart; @@ -19196,7 +19196,7 @@ GuiGrammarAutoComplete void GuiGrammarAutoComplete::DeleteFutures(collections::List& futures) { // delete all futures and clear the list - FOREACH(ParsingState::Future*, future, futures) + for (auto future : futures) { delete future; } @@ -19258,14 +19258,14 @@ GuiGrammarAutoComplete List possibilities; if (recoveryFutures.Count() > 0) { - FOREACH(ParsingState::Future*, future, recoveryFutures) + for (auto future : recoveryFutures) { state.Explore(tableTokenIndex, future, possibilities); } } else { - FOREACH(ParsingState::Future*, future, nonRecoveryFutures) + for (auto future : nonRecoveryFutures) { state.Explore(tableTokenIndex, future, possibilities); } @@ -19277,7 +19277,7 @@ GuiGrammarAutoComplete { ParsingState::Future* candidateFuture = possibilities[i]; bool duplicated = false; - FOREACH(ParsingState::Future*, future, selectedPossibilities) + for (auto future : selectedPossibilities) { if ( candidateFuture->currentState == future->currentState && @@ -19357,7 +19357,7 @@ GuiGrammarAutoComplete state.Explore(ParsingTable::NormalReduce, nonRecoveryFutures[i], nonRecoveryFutures); state.Explore(ParsingTable::LeftRecursiveReduce, nonRecoveryFutures[i], nonRecoveryFutures); } - FOREACH(ParsingState::Future*, future, nonRecoveryFutures) + for (auto future : nonRecoveryFutures) { vint count = state.GetTable()->GetTokenCount(); for (vint i = ParsingTable::UserTokenStart; i < count; i++) @@ -19367,7 +19367,7 @@ GuiGrammarAutoComplete } // get all possible tokens that marked using @AutoCompleteCandidate - FOREACH(ParsingState::Future*, future, possibilities) + for (auto future : possibilities) { if (!tableTokenIndices.Contains(future->selectedToken)) { @@ -19427,7 +19427,7 @@ GuiGrammarAutoComplete ParsingTreeBuilder builder; builder.Reset(); bool succeeded = true; - FOREACH(ParsingState::TransitionResult, transition, collector.GetTransitions()) + for (auto transition : collector.GetTransitions()) { if (!(succeeded = builder.Run(transition))) { @@ -19471,7 +19471,7 @@ GuiGrammarAutoComplete // collect all auto complete types { // collect all keywords that can be put into the auto complete list - FOREACH(vint, token, tableTokenIndices) + for (auto token : tableTokenIndices) { vint regexToken = token - ParsingTable::UserTokenStart; if (regexToken >= 0) @@ -19673,7 +19673,7 @@ GuiGrammarAutoComplete List itemValues; // copy all candidate keywords - FOREACH(vint, token, autoComplete->shownCandidates) + for (auto token : autoComplete->shownCandidates) { WString literal = parsingExecutor->GetTokenMetaData(token).unescapedRegexText; if (literal != L"" && !itemKeys.Contains(literal)) @@ -19688,7 +19688,7 @@ GuiGrammarAutoComplete // copy all candidate symbols if (autoComplete->acceptableSemanticIds) { - FOREACH(ParsingCandidateItem, item, autoComplete->candidateItems) + for (auto item : autoComplete->candidateItems) { if (autoComplete->acceptableSemanticIds->Contains(item.semanticId)) { @@ -19980,7 +19980,7 @@ GuiGrammarColorizer } } - FOREACH_INDEXER(WString, color, index, colorSettings.Keys()) + for (auto [color, index] : indexed(colorSettings.Keys())) { if(!tokenColors.Contains(color)) { @@ -20243,7 +20243,7 @@ RepeatingParsingExecutor if(node) { OnContextFinishedAsync(result); - FOREACH(ICallback*, callback, callbacks) + for (auto callback : callbacks) { callback->OnParsingFinishedAsync(result); } @@ -20305,14 +20305,14 @@ RepeatingParsingExecutor } } - FOREACH(Ptr, att, + for (auto att : From(tokenColorAtts.Values()) .Concat(tokenContextColorAtts.Values()) .Concat(fieldColorAtts.Values()) .Concat(fieldSemanticAtts.Values()) ) { - FOREACH(WString, argument, att->arguments) + for (auto argument : att->arguments) { if(!semanticIndexMap.Contains(argument)) { @@ -20322,7 +20322,7 @@ RepeatingParsingExecutor } vint index=0; - FOREACH(vint, tokenIndex, tokenIndexMap.Values()) + for (auto tokenIndex : tokenIndexMap.Values()) { TokenMetaData md; md.tableTokenIndex=tokenIndex+ParsingTable::UserTokenStart; @@ -20370,7 +20370,7 @@ RepeatingParsingExecutor if((index=fieldSemanticAtts.Keys().IndexOf(fieldDesc))!=-1) { md.semantics=new List; - FOREACH(WString, argument, fieldSemanticAtts.Values()[index]->arguments) + for (auto argument : fieldSemanticAtts.Values()[index]->arguments) { md.semantics->Add(semanticIndexMap.IndexOf(argument)); } @@ -21673,7 +21673,7 @@ GuiRibbonButtons void GuiRibbonButtons::AfterControlTemplateInstalled_(bool initialize) { - FOREACH(GuiControl*, button, buttons) + for (auto button : buttons) { SetButtonThemeName(responsiveView->GetCurrentView(), button); } @@ -21681,7 +21681,7 @@ GuiRibbonButtons void GuiRibbonButtons::OnBeforeSwitchingView(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments) { - FOREACH(GuiControl*, button, buttons) + for (auto button : buttons) { SetButtonThemeName(responsiveView->GetViews()[arguments.itemIndex], button); } @@ -22298,7 +22298,7 @@ list::GroupedDataSource { if (GetGroupEnabled()) { - FOREACH_INDEXER(Value, groupValue, index, GetLazyList(itemSource)) + for (auto [groupValue, index] : indexed(GetLazyList(itemSource))) { auto group = MakePtr(); group->name = titleProperty(groupValue); @@ -22833,7 +22833,7 @@ GuiBindableRibbonGalleryList { if (0 <= index && index < joinedItemSource.Count()) { - FOREACH_INDEXER(Ptr, group, groupIndex, groupedItemSource) + for (auto [group, groupIndex] : indexed(groupedItemSource)) { auto itemValues = group->GetItemValues(); vint itemCount = itemValues ? itemValues->GetCount() : 0; @@ -25866,7 +25866,7 @@ GuiFlowComposition if (GetMinSizeLimitation() == GuiGraphicsComposition::LimitToElementAndChildren) { auto clientSize = axis->VirtualSizeToRealSize(Size(0, minHeight)); - FOREACH(GuiFlowItemComposition*, item, flowItems) + for (auto item : flowItems) { auto itemSize = item->GetPreferredBounds().GetSize(); if (clientSize.x < itemSize.x) clientSize.x = itemSize.x; @@ -26528,7 +26528,7 @@ GuiResponsiveViewComposition { destructing = true; - FOREACH(GuiResponsiveCompositionBase*, view, views) + for (auto view : views) { if (view != currentView) { @@ -26536,7 +26536,7 @@ GuiResponsiveViewComposition } } - FOREACH(GuiControl*, shared, From(sharedControls).Except(usedSharedControls)) + for (auto shared : From(sharedControls).Except(usedSharedControls)) { SafeDeleteControl(shared); } @@ -26756,7 +26756,7 @@ GuiResponsiveStackComposition GuiResponsiveCompositionBase* selected = nullptr; vint size = 0; - FOREACH(GuiResponsiveCompositionBase*, child, availables) + for (auto child : availables) { if (!ignored.Contains(child)) { @@ -26916,7 +26916,7 @@ GuiResponsiveGroupComposition { DEFINE_AVAILABLE; vint level = currentLevel; - FOREACH(GuiResponsiveCompositionBase*, child, availables) + for (auto child : availables) { if (child->GetCurrentLevel() >= level) { @@ -26936,7 +26936,7 @@ GuiResponsiveGroupComposition { DEFINE_AVAILABLE; vint level = currentLevel; - FOREACH(GuiResponsiveCompositionBase*, child, availables) + for (auto child : availables) { while (child->GetCurrentLevel() <= level) { @@ -27236,7 +27236,7 @@ GuiSharedSizeRootComposition void GuiSharedSizeRootComposition::CollectSizes(collections::Dictionary& widths, collections::Dictionary& heights) { - FOREACH(GuiSharedSizeItemComposition*, item, childItems) + for (auto item : childItems) { auto group = item->GetGroup(); auto minSize = item->GetPreferredMinSize(); @@ -27258,7 +27258,7 @@ GuiSharedSizeRootComposition void GuiSharedSizeRootComposition::AlignSizes(collections::Dictionary& widths, collections::Dictionary& heights) { - FOREACH(GuiSharedSizeItemComposition*, item, childItems) + for (auto item : childItems) { auto group = item->GetGroup(); auto size = item->GetPreferredMinSize(); @@ -28435,7 +28435,7 @@ GuiTableComposition bool cellMinSizeModified = false; SortedList cells; - FOREACH(GuiCellComposition*, cell, cellCompositions) + for (auto cell : cellCompositions) { if (cell && !cells.Contains(cell)) { @@ -28969,7 +28969,7 @@ SetPropertiesVisitor void VisitContainer(DocumentContainerRun* run) { - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -32679,7 +32679,7 @@ GuiAltActionManager continue; } - FOREACH_INDEXER(IGuiAltAction*, action, index, values) + for (auto [action, index] : indexed(values)) { WString key = actions.Keys()[i]; if (numberLength > 0) @@ -32751,7 +32751,7 @@ GuiAltActionManager void GuiAltActionManager::ClearAltHost() { - FOREACH(GuiControl*, title, currentActiveAltTitles.Values()) + for (auto title : currentActiveAltTitles.Values()) { SafeDeleteControl(title); } @@ -32950,7 +32950,7 @@ GuiShortcutKeyManager bool GuiShortcutKeyManager::Execute(const NativeWindowKeyInfo& info) { bool executed=false; - FOREACH(Ptr, item, shortcutKeyItems) + for (auto item : shortcutKeyItems) { if(item->CanActivate(info)) { @@ -32964,7 +32964,7 @@ GuiShortcutKeyManager IGuiShortcutKeyItem* GuiShortcutKeyManager::CreateShortcut(bool ctrl, bool shift, bool alt, VKEY key) { - FOREACH(Ptr, item, shortcutKeyItems) + for (auto item : shortcutKeyItems) { if(item->CanActivate(ctrl, shift, alt, key)) { @@ -32978,7 +32978,7 @@ GuiShortcutKeyManager bool GuiShortcutKeyManager::DestroyShortcut(bool ctrl, bool shift, bool alt, VKEY key) { - FOREACH(Ptr, item, shortcutKeyItems) + for (auto item : shortcutKeyItems) { if(item->CanActivate(ctrl, shift, alt, key)) { @@ -32991,7 +32991,7 @@ GuiShortcutKeyManager IGuiShortcutKeyItem* GuiShortcutKeyManager::TryGetShortcut(bool ctrl, bool shift, bool alt, VKEY key) { - FOREACH(Ptr, item, shortcutKeyItems) + for (auto item : shortcutKeyItems) { if(item->CanActivate(ctrl, shift, alt, key)) { @@ -33416,7 +33416,7 @@ ExtractTextVisitor void VisitContainer(DocumentContainerRun* run) { - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -33592,7 +33592,7 @@ DocumentModel styles.Values()[indexDst]->styles = sp; } - FOREACH(Ptr, style, styles.Values()) + for (auto style : styles.Values()) { style->resolvedStyles = nullptr; } @@ -33741,7 +33741,7 @@ namespace vl virtual void VisitContainer(DocumentContainerRun* run) { - FOREACH(Ptr, childRun, run->runs) + for (auto childRun : run->runs) { childRun->Accept(this); } @@ -33822,7 +33822,7 @@ namespace vl void ModifyDocumentForClipboard(Ptr model) { ModifyDocumentForClipboardVisitor visitor; - FOREACH(Ptr, paragraph, model->paragraphs) + for (auto paragraph : model->paragraphs) { paragraph->Accept(&visitor); } @@ -33877,7 +33877,7 @@ namespace vl void SaveDocumentToClipboardStream(Ptr model, stream::IStream& clipboardStream) { CollectImageRunsVisitor visitor; - FOREACH(Ptr, paragraph, model->paragraphs) + for (auto paragraph : model->paragraphs) { paragraph->Accept(&visitor); } @@ -33900,7 +33900,7 @@ namespace vl vint32_t count = (vint32_t)visitor.imageRuns.Count(); writer << count; - FOREACH(Ptr, imageRun, visitor.imageRuns) + for (auto imageRun : visitor.imageRuns) { MemoryStream memoryStream; if (imageRun->image) @@ -33955,7 +33955,7 @@ namespace vl void VisitContainer(DocumentContainerRun* run) { - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -34160,7 +34160,7 @@ namespace vl StreamWriter writer(encoderStream); GenerateHtmlVisitor visitor(model.Obj(), writer); - FOREACH(Ptr, paragraph, model->paragraphs) + for (auto paragraph : model->paragraphs) { writer.WriteString(L"

alignment) @@ -34290,7 +34290,7 @@ namespace vl void VisitContainer(DocumentContainerRun* run) { - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -34394,7 +34394,7 @@ namespace vl StreamWriter writer(bodyStream); GenerateRtfVisitor visitor(model.Obj(), fontTable, colorTable, writer); - FOREACH(Ptr, paragraph, model->paragraphs) + for (auto paragraph : model->paragraphs) { if (paragraph->alignment) { @@ -34421,7 +34421,7 @@ namespace vl StreamWriter writer(encoderStream); writer.WriteString(L"{\\rtf1\\ansi\\deff0{\\fonttbl"); - FOREACH_INDEXER(WString, fontName, index, fontTable) + for (auto [fontName, index] : indexed(fontTable)) { writer.WriteString(L"{\\f"); writer.WriteString(itow(index)); @@ -34431,7 +34431,7 @@ namespace vl } writer.WriteString(L"}{\\colortbl"); - FOREACH_INDEXER(Color, color, index, colorTable) + for (auto [color, index] : indexed(colorTable)) { writer.WriteString(L";\\red"); writer.WriteString(itow(color.r)); @@ -34785,7 +34785,7 @@ Remove DocumentStylePropertiesRun if it is empty or contains no text run bool OnlyImageOrObject(DocumentContainerRun* run) { bool onlyImageOrObject = true; - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { if (!subRun.Cast() && !subRun.Cast()) { @@ -34834,7 +34834,7 @@ Remove DocumentStylePropertiesRun if it is empty or contains no text run CONTINUE_PROCESSING: if (From(run->runs).Cast().First(nullptr) != nullptr) { - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { if (auto styleRun = subRun.Cast()) { @@ -35199,7 +35199,7 @@ Clone the current run with its children else { Ptr containerRun = CopyRun(run).Cast(); - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); if (clonedRun) @@ -35380,7 +35380,7 @@ Search all used style names void VisitContainer(DocumentContainerRun* run) { - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -35481,7 +35481,7 @@ If a run decides that itself should be cut, then leftRun and rightRun contains n vint leftCount = 0; Ptr selectedRun; - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { RunRange range = runRanges[subRun.Obj()]; if (range.start, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -35714,7 +35714,7 @@ Get the hyperlink run that contains the specified position void VisitContainer(DocumentContainerRun* run) { Ptr selectedRun; - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { RunRange range = runRanges[subRun.Obj()]; if (range.start <= start && end <= range.end) @@ -35772,7 +35772,7 @@ Get the hyperlink run that contains the specified position } Ptr startRun, endRun; - FOREACH(Ptr, run, package->hyperlinks) + for (auto run : package->hyperlinks) { auto range = runRanges[run.Obj()]; if (package->start == -1 || range.start < package->start) @@ -35868,7 +35868,7 @@ Get all container runs that contain the specified position from top to bottom { locatedRuns.Add(run); Ptr selectedRun; - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { RunRange range = runRanges[subRun.Obj()]; if (position == range.start) @@ -36291,7 +36291,7 @@ Replace a style name with another one void VisitContainer(DocumentContainerRun* run) { - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -36752,7 +36752,7 @@ DocumentModel::EditRangeOperations // copy styles List styleNames; - FOREACH(Ptr, paragraph, newDocument->paragraphs) + for (auto paragraph : newDocument->paragraphs) { CollectStyleName(paragraph.Obj(), styleNames); } @@ -36921,11 +36921,11 @@ DocumentModel::EditRun // rename model's styles typedef Pair NamePair; - FOREACH(NamePair, name, From(oldNames).Pairwise(newNames)) + for (auto name : From(oldNames).Pairwise(newNames)) { model->RenameStyle(name.key, name.value); } - FOREACH(WString, name, newNames) + for (auto name : newNames) { if((name.Length()==0 || name[0]!=L'#') && !styles.Keys().Contains(name)) { @@ -37113,7 +37113,7 @@ DocumentModel::EditHyperlink auto package = GetHyperlink(paragraphIndex, begin, end); if (package->hyperlinks.Count() > 0) { - FOREACH(Ptr, run, package->hyperlinks) + for (auto run : package->hyperlinks) { run->reference = reference; run->normalStyleName = normalStyleName; @@ -37188,7 +37188,7 @@ DocumentModel::EditStyleName styles.Remove(oldStyleName); styles.Add(newStyleName, style); - FOREACH(Ptr, subStyle, styles.Values()) + for (auto subStyle : styles.Values()) { if(subStyle->parentStyleName==oldStyleName) { @@ -37196,7 +37196,7 @@ DocumentModel::EditStyleName } } - FOREACH(Ptr, paragraph, paragraphs) + for (auto paragraph : paragraphs) { ReplaceStyleName(paragraph.Obj(), oldStyleName, newStyleName); } @@ -37478,7 +37478,7 @@ document_operation_visitors::DeserializeNodeVisitor } } - FOREACH(Ptr, att, node->attributes) + for (auto att : node->attributes) { if (att->name.value == L"width") { @@ -37530,7 +37530,7 @@ document_operation_visitors::DeserializeNodeVisitor Ptr sp = new DocumentStyleProperties; run->style = sp; - FOREACH(Ptr, att, node->attributes) + for (auto att : node->attributes) { if (att->name.value == L"face") { @@ -37654,7 +37654,7 @@ document_operation_visitors::DeserializeNodeVisitor } else if (node->name.value == L"p") { - FOREACH(Ptr, sub, node->subNodes) + for (auto sub : node->subNodes) { sub->Accept(this); } @@ -37665,7 +37665,7 @@ document_operation_visitors::DeserializeNodeVisitor { errors.Add(GuiResourceError({ {resource},node->codeRange.start }, L"Unknown element in

: \"" + node->name.value + L"\".")); } - FOREACH(Ptr, sub, node->subNodes) + for (auto sub : node->subNodes) { sub->Accept(this); } @@ -37675,7 +37675,7 @@ document_operation_visitors::DeserializeNodeVisitor { Ptr oldContainer = container; container = createdContainer; - FOREACH(Ptr, subNode, subNodeContainer->subNodes) + for (auto subNode : subNodeContainer->subNodes) { subNode->Accept(this); } @@ -37704,7 +37704,7 @@ document_operation_visitors::DeserializeNodeVisitor Ptr sp=new DocumentStyleProperties; style->styles=sp; - FOREACH(Ptr, att, XmlGetElements(styleElement)) + for (auto att : XmlGetElements(styleElement)) { if(att->name.value==L"face") { @@ -37777,11 +37777,11 @@ DocumentModel Ptr model = new DocumentModel; if (xml->rootElement->name.value == L"Doc") { - FOREACH(Ptr, partElement, XmlGetElements(xml->rootElement)) + for (auto partElement : XmlGetElements(xml->rootElement)) { if (partElement->name.value == L"Styles") { - FOREACH(Ptr, styleElement, XmlGetElements(partElement)) + for (auto styleElement : XmlGetElements(partElement)) { if (styleElement->name.value == L"Style") { @@ -37826,7 +37826,7 @@ DocumentModel } else if (partElement->name.value == L"Content") { - FOREACH_INDEXER(Ptr, p, i, XmlGetElements(partElement)) + for (auto [p, i] : indexed(XmlGetElements(partElement))) { if (p->name.value == L"p") { @@ -37910,7 +37910,7 @@ document_operation_visitors::SerializeRunVisitor parent->subNodes.Add(replacedParent); Ptr oldParent = parent; parent = replacedParent; - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -37918,7 +37918,7 @@ document_operation_visitors::SerializeRunVisitor } else { - FOREACH(Ptr, subRun, run->runs) + for (auto subRun : run->runs) { subRun->Accept(this); } @@ -38155,7 +38155,7 @@ DocumentModel content->name.value=L"Content"; doc->subNodes.Add(content); - FOREACH(Ptr, p, paragraphs) + for (auto p : paragraphs) { SerializeRunVisitor visitor(content); p->Accept(&visitor); @@ -38654,7 +38654,7 @@ GuiResourceError offset.column = 0; } - FOREACH(Ptr, error, parsingErrors) + for (auto error : parsingErrors) { auto pos = error->codeRange.start; if (pos.row < 0 || pos.column < 0) @@ -38706,8 +38706,9 @@ GuiResourceError return result; }); - FOREACH_INDEXER(GuiResourceError, error, index, errors) + for (vint index = 0; index < errors.Count(); index++) { + auto& error = errors[index]; bool needHeader = index == 0; if (index > 0) { @@ -38804,7 +38805,7 @@ GuiResourceFolder { ClearItems(); ClearFolders(); - FOREACH(Ptr, element, XmlGetElements(folderXml)) + for (auto element : XmlGetElements(folderXml)) { WString name; if (Ptr nameAtt = XmlGetAttribute(element, L"name")) @@ -38978,7 +38979,7 @@ GuiResourceFolder void GuiResourceFolder::SaveResourceFolderToXml(Ptr xmlParent) { - FOREACH(Ptr, item, items.Values()) + for (auto item : items.Values()) { auto resolver = GetResourceResolverManager()->GetTypeResolver(item->GetTypeName()); if (resolver->XmlSerializable()) @@ -39034,7 +39035,7 @@ GuiResourceFolder } } - FOREACH(Ptr, folder, folders.Values()) + for (auto folder : folders.Values()) { auto attName = MakePtr(); attName->name.value = L"name"; @@ -39077,14 +39078,14 @@ GuiResourceFolder void GuiResourceFolder::CollectTypeNames(collections::List& typeNames) { if (importUri != L"") return; - FOREACH(Ptr, item, items.Values()) + for (auto item : items.Values()) { if (!typeNames.Contains(item->GetTypeName())) { typeNames.Add(item->GetTypeName()); } } - FOREACH(Ptr, folder, folders.Values()) + for (auto folder : folders.Values()) { folder->CollectTypeNames(typeNames); } @@ -39202,7 +39203,7 @@ GuiResourceFolder typedef Tuple, Ptr> ItemTuple; List itemTuples; - FOREACH(Ptr, item, items.Values()) + for (auto item : items.Values()) { auto resolver = GetResourceResolverManager()->GetTypeResolver(item->GetTypeName()); if (resolver->StreamSerializable()) @@ -39232,7 +39233,7 @@ GuiResourceFolder vint count = itemTuples.Count(); writer << count; - FOREACH(ItemTuple, item, itemTuples) + for (auto item : itemTuples) { vint typeName = item.f0; WString name = item.f1; @@ -39246,7 +39247,7 @@ GuiResourceFolder count = folders.Count(); writer << count; - FOREACH(Ptr, folder, folders.Values()) + for (auto folder : folders.Values()) { WString name = folder->GetName(); WString importUri = folder->GetImportUri(); @@ -39261,7 +39262,7 @@ GuiResourceFolder void GuiResourceFolder::PrecompileResourceFolder(GuiResourcePrecompileContext& context, IGuiResourcePrecompileCallback* callback, GuiResourceError::List& errors) { if (importUri != L"") return; - FOREACH(Ptr, item, items.Values()) + for (auto item : items.Values()) { auto typeResolver = GetResourceResolverManager()->GetTypeResolver(item->GetTypeName()); if (auto precompile = typeResolver->Precompile()) @@ -39277,7 +39278,7 @@ GuiResourceFolder } } - FOREACH(Ptr, folder, folders.Values()) + for (auto folder : folders.Values()) { folder->PrecompileResourceFolder(context, callback, errors); } @@ -39286,7 +39287,7 @@ GuiResourceFolder void GuiResourceFolder::InitializeResourceFolder(GuiResourceInitializeContext& context, GuiResourceError::List& errors) { if (importUri != L"") return; - FOREACH(Ptr, item, items.Values()) + for (auto item : items.Values()) { auto typeResolver = GetResourceResolverManager()->GetTypeResolver(item->GetTypeName()); if (auto initialize = typeResolver->Initialize()) @@ -39295,7 +39296,7 @@ GuiResourceFolder } } - FOREACH(Ptr, folder, folders.Values()) + for (auto folder : folders.Values()) { folder->InitializeResourceFolder(context, errors); } @@ -39528,7 +39529,7 @@ GuiResourceMetadata if (auto xmlDeps = XmlGetElement(xml->rootElement, L"Dependencies")) { - FOREACH(Ptr, xmlDep, XmlGetElements(xmlDeps, L"Resource")) + for (auto xmlDep : XmlGetElements(xmlDeps, L"Resource")) { auto attrDep = XmlGetAttribute(xmlDep, L"Name"); if (!attrDep) @@ -39561,7 +39562,7 @@ GuiResourceMetadata xmlDeps->name.value = L"Dependencies"; root->subNodes.Add(xmlDeps); - FOREACH(WString, dep, dependencies) + for (auto dep : dependencies) { auto xmlDep = MakePtr(); xmlDep->name.value = L"Resource"; @@ -39588,7 +39589,7 @@ GuiResource void GuiResource::ProcessDelayLoading(Ptr resource, DelayLoadingList& delayLoadings, GuiResourceError::List& errors) { - FOREACH(DelayLoading, delay, delayLoadings) + for (auto delay : delayLoadings) { WString type = delay.type; WString folder = delay.workingDirectory; @@ -39777,7 +39778,7 @@ GuiResource { callback->OnPerPass(i); } - FOREACH(WString, name, resolvers) + for (auto name : resolvers) { auto resolver = manager->GetTypeResolver(name); resolver->Precompile()->PerPassPrecompile(context, errors); @@ -40080,7 +40081,7 @@ IGuiResourceResolverManager vint GetMaxPrecompilePassIndex()override { vint maxPass = -1; - FOREACH(Ptr, resolver, typeResolvers.Values()) + for (auto resolver : typeResolvers.Values()) { if (auto precompile = resolver->Precompile()) { @@ -40097,7 +40098,7 @@ IGuiResourceResolverManager vint GetMaxInitializePassIndex()override { vint maxPass = -1; - FOREACH(Ptr, resolver, typeResolvers.Values()) + for (auto resolver : typeResolvers.Values()) { if (auto initialize = resolver->Initialize()) { @@ -40308,7 +40309,7 @@ IGuiInstanceResourceManager if (auto record = resource->GetValueByPath(L"Precompiled/ClassNameRecord").Cast()) { - FOREACH(WString, className, record->classNames) + for (auto className : record->classNames) { instanceResources.Add(className, resource); } @@ -40323,7 +40324,7 @@ IGuiInstanceResourceManager CopyFrom(prs, depToPendings.GetByIndex(index)); depToPendings.Remove(metadata->name); - FOREACH(Ptr, pr, prs) + for (auto pr : prs) { pr->dependencies.Remove(metadata->name); if (pr->dependencies.Count() == 0) @@ -40359,7 +40360,7 @@ IGuiInstanceResourceManager if (auto record = resource->GetValueByPath(L"Precompiled/ClassNameRecord").Cast()) { - FOREACH(WString, className, record->classNames) + for (auto className : record->classNames) { instanceResources.Remove(className); } @@ -40401,7 +40402,7 @@ IGuiInstanceResourceManager else { pendingResources.Add(pr); - FOREACH(WString, dep, pr->dependencies) + for (auto dep : pr->dependencies) { depToPendings.Add(dep, pr); } diff --git a/Import/GacUICompiler.cpp b/Import/GacUICompiler.cpp index a83c3eeb..a9a0babe 100644 --- a/Import/GacUICompiler.cpp +++ b/Import/GacUICompiler.cpp @@ -50,7 +50,7 @@ namespace vl if (compiled->assembly) { auto& codes = compiled->assembly->insAfterCodegen->moduleCodes; - FOREACH_INDEXER(WString, code, codeIndex, codes) + for (auto [code, codeIndex] : indexed(codes)) { text += L"================================(" + itow(codeIndex + 1) + L"/" + itow(codes.Count()) + L")================================\r\n"; text += code + L"\r\n"; @@ -58,7 +58,7 @@ namespace vl } else { - FOREACH_INDEXER(GuiInstanceCompiledWorkflow::ModuleRecord, moduleRecord, codeIndex, compiled->modules) + for (auto [moduleRecord, codeIndex] : indexed(compiled->modules)) { WString code = GenerateToStream([&](StreamWriter& writer) { @@ -89,14 +89,14 @@ namespace vl if (compiled->metadata->errors.Count() > 0) { - FOREACH(Ptr, error, compiled->metadata->errors) + for (auto error : compiled->metadata->errors) { errors.Add(GuiResourceError({ {resource} }, error->errorMessage)); } return nullptr; } - FOREACH_INDEXER(WString, fileName, index, output->cppFiles.Keys()) + for (auto [fileName, index] : indexed(output->cppFiles.Keys())) { WString code = output->cppFiles.Values()[index]; File file(cppFolder / fileName); @@ -395,7 +395,7 @@ GuiInstanceGradientAnimation::LoadFromXml if (auto targetsElement = XmlGetElement(xml->rootElement, L"Targets")) { - FOREACH(Ptr, targetElement, XmlGetElements(targetsElement, L"Target")) + for (auto targetElement : XmlGetElements(targetsElement, L"Target")) { Target target; @@ -486,7 +486,7 @@ GuiInstanceGradientAnimation::SaveToXml targetsElement->name.value = L"Targets"; gradientElement->subNodes.Add(targetsElement); - FOREACH(Target, target, targets) + for (auto target : targets) { auto targetElement = MakePtr(); targetElement->name.value = L"Target"; @@ -625,7 +625,7 @@ GuiInstanceGradientAnimation::EnumerateMembers void GuiInstanceGradientAnimation::EnumerateProperties(EnumerateMemberCallback callback, description::ITypeDescriptor* td) { - FOREACH(Target, target, targets) + for (auto target : targets) { auto propInfo = td->GetPropertyByName(target.name, true); EnumerateMembers(callback, [](auto x) {return x; }, propInfo, propInfo); @@ -806,7 +806,7 @@ GuiInstanceGradientAnimation::Compile } }; createIntVar(L"", interpolation, interpolationPosition); - FOREACH(Target, target, targets) + for (auto target : targets) { if (target.interpolation != L"") { @@ -816,7 +816,7 @@ GuiInstanceGradientAnimation::Compile List props; List> interpolations; - FOREACH(Target, target, targets) + for (auto target : targets) { if (auto propInfo = td->GetPropertyByName(target.name, true)) { @@ -1179,7 +1179,7 @@ GuiInstanceGradientAnimation::Compile block->statements.Add(declStat); }, td); - FOREACH(Target, target, targets) + for (auto target : targets) { auto refCurrent = MakePtr(); refCurrent->name.value = L"current"; @@ -1330,7 +1330,7 @@ GuiInstanceGradientAnimation::Compile block->statements.Add(varStat); } { - FOREACH(Target, target, targets) + for (auto target : targets) { auto refBegin = MakePtr(); refBegin->name.value = L"Begin"; @@ -1475,7 +1475,7 @@ GuiInstanceGradientAnimation::Compile propNames.Add(L"End"); propNames.Add(L"Current"); - FOREACH(WString, propName, propNames) + for (auto propName : propNames) { { auto newExpr = MakePtr(); @@ -1495,7 +1495,7 @@ GuiInstanceGradientAnimation::Compile block->statements.Add(exprStat); } - FOREACH(Target, target, targets) + for (auto target : targets) { auto refProp = MakePtr(); refProp->name.value = propName; @@ -2127,7 +2127,7 @@ GuiDefaultInstanceLoader { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { PropertyType propertyType = GetPropertyTypeCached(PropertyInfo(typeInfo, prop)); if (propertyType.f1) @@ -2179,7 +2179,7 @@ GuiDefaultInstanceLoader case GuiInstancePropertyInfo::SupportArray: { auto refArray = MakePtr(); - FOREACH(ArgumentInfo, item, arguments.GetByIndex(index)) + for (auto item : arguments.GetByIndex(index)) { auto argument = MakePtr(); argument->key = item.expression; @@ -2436,7 +2436,7 @@ GuiInstanceLoaderManager IGuiInstanceDeserializer* GetInstanceDeserializer(const IGuiInstanceLoader::PropertyInfo& propertyInfo, description::ITypeInfo* typeInfo)override { - FOREACH(Ptr, deserializer, deserializers) + for (auto deserializer : deserializers) { if (deserializer->CanDeserialize(propertyInfo, typeInfo)) { @@ -2475,7 +2475,7 @@ GuiInstanceLoaderManager typeInfos.Add(typeInfo->typeName, typeInfo); FillParentTypeInfos(typeInfo); - FOREACH(Ptr, derived, typeInfos.Values()) + for (auto derived : typeInfos.Values()) { if (derived->parentTypes.Contains(typeInfo->typeDescriptor)) { @@ -2561,7 +2561,7 @@ GuiInstanceLoaderManager void ClearReflectionCache()override { rootLoader->ClearReflectionCache(); - FOREACH(Ptr, info, typeInfos.Values()) + for (auto info : typeInfos.Values()) { info->loader->ClearReflectionCache(); } @@ -3140,7 +3140,7 @@ GuiTemplatePropertyDeserializer L"\" cannot be empty.")); } - FOREACH(WString, controlTemplateName, typeNames) + for (auto controlTemplateName : typeNames) { auto controlTemplateTd = description::GetTypeDescriptor(controlTemplateName); if (!controlTemplateTd) @@ -3197,7 +3197,7 @@ GuiTemplatePropertyDeserializer funcCreateTemplate->statement = block; ITypeDescriptor* stopControlTemplateTd = nullptr; - FOREACH(ITypeDescriptor*, controlTemplateTd, controlTemplateTds) + for (auto controlTemplateTd : controlTemplateTds) { if (!controlTemplateTd->CanConvertTo(expectedTemplateType->GetTypeDescriptor())) { @@ -3333,7 +3333,7 @@ GuiTemplatePropertyDeserializer { auto templateType = TypeInfoRetriver::CreateTypeInfo(); Ptr previousFactory; - FOREACH_INDEXER(ITypeDescriptor*, controlTemplateTd, index, controlTemplateTds) + for (auto [controlTemplateTd, index] : indexed(controlTemplateTds)) { List tds; tds.Add(controlTemplateTd); @@ -3797,7 +3797,7 @@ GuiDataProcessorDeserializer argumentNames.Add(L""); } - FOREACH(WString, name, argumentNames) + for (auto name : argumentNames) { auto argument = MakePtr(); argument->type = GetTypeFromTypeInfo(TypeInfoRetriver::CreateTypeInfo().Obj()); @@ -3823,7 +3823,7 @@ GuiDataProcessorDeserializer auto callExpr = MakePtr(); callExpr->function = inferExpr; - FOREACH_INDEXER(WString, name, index, argumentNames) + for (auto [name, index] : indexed(argumentNames)) { auto refExpr = MakePtr(); refExpr->name.value = name; @@ -3946,7 +3946,7 @@ namespace vl if (index != -1) { auto record = sp->nodePositions.Values()[index]; - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { Workflow_RecordScriptPosition(context, record.position, decl, record.availableAfter); } @@ -3960,7 +3960,7 @@ namespace vl if (index != -1) { auto record = sp->nodePositions.Values()[index]; - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { Workflow_RecordScriptPosition(context, record.position, decl, record.availableAfter); } @@ -4324,8 +4324,8 @@ Instance Type Resolver (Instance) L"\" should have the class name specified in the ref.Class attribute.")); } - FOREACH_INDEXER(Ptr, localized, index, - From(obj->localizeds).Where([](Ptr ls) {return ls->defaultStrings; }) + for (auto [localized, index] : + indexed(From(obj->localizeds).Where([](Ptr ls) {return ls->defaultStrings; })) ) { if (index > 0) @@ -4856,7 +4856,7 @@ GuiInstanceLocalizedStrings } SortedList existingLocales; - FOREACH(Ptr, xmlStrings, XmlGetElements(xml->rootElement)) + for (auto xmlStrings : XmlGetElements(xml->rootElement)) { if (xmlStrings->name.value != L"Strings") { @@ -4876,7 +4876,7 @@ GuiInstanceLocalizedStrings lss->tagPosition = { { resource },xmlStrings->name.codeRange.start }; SplitBySemicolon(attLocales->value.value, lss->locales); - FOREACH(WString, locale, lss->locales) + for (auto locale : lss->locales) { if (!existingLocales.Contains(locale)) { @@ -4888,7 +4888,7 @@ GuiInstanceLocalizedStrings } } - FOREACH(Ptr, xmlString, XmlGetElements(xmlStrings)) + for (auto xmlString : XmlGetElements(xmlStrings)) { if (xmlString->name.value != L"String") { @@ -4953,7 +4953,7 @@ GuiInstanceLocalizedStrings xml->attributes.Add(att); } - FOREACH(Ptr, lss, strings) + for (auto lss : strings) { auto xmlStrings = MakePtr(); xml->subNodes.Add(xmlStrings); @@ -4965,7 +4965,7 @@ GuiInstanceLocalizedStrings xmlStrings->attributes.Add(att); } - FOREACH(Ptr, lssi, lss->items.Values()) + for (auto lssi : lss->items.Values()) { auto xmlString = MakePtr(); xmlStrings->subNodes.Add(xmlString); @@ -5142,7 +5142,7 @@ GuiInstanceLocalizedStrings textDesc->texts.Add(reading); } - FOREACH_INDEXER(vint, i, index, From(textDesc->positions).OrderBy([](vint a, vint b) {return a - b; })) + for (auto [i, index] : indexed(From(textDesc->positions).OrderBy([](vint a, vint b) {return a - b; }))) { if (i != index) { @@ -5158,7 +5158,7 @@ GuiInstanceLocalizedStrings auto defaultStrings = GetDefaultStrings(); vint errorCount = errors.Count(); - FOREACH(Ptr, lss, strings) + for (auto lss : strings) { if (lss != defaultStrings) { @@ -5194,7 +5194,7 @@ GuiInstanceLocalizedStrings return; } - FOREACH(Ptr, lssi, defaultStrings->items.Values()) + for (auto lssi : defaultStrings->items.Values()) { if (auto textDesc = ParseLocalizedText(lssi->text, lssi->textPosition, errors)) { @@ -5207,13 +5207,13 @@ GuiInstanceLocalizedStrings } auto defaultLocalesName = defaultStrings->GetLocalesName(); - FOREACH(Ptr, lss, strings) + for (auto lss : strings) { if (lss != defaultStrings) { auto localesName = lss->GetLocalesName(); - FOREACH(Ptr, lssi, lss->items.Values()) + for (auto lssi : lss->items.Values()) { if (auto textDesc = ParseLocalizedText(lssi->text, lssi->textPosition, errors)) { @@ -5283,7 +5283,7 @@ GuiInstanceLocalizedStrings lsExpr->type = refPointer; } - FOREACH(Ptr, lss, ls->items.Values()) + for (auto lss : ls->items.Values()) { auto textDesc = textDescs[{ls, lss->name}]; auto func = GenerateFunction(textDesc, lss->name, WfClassMemberKind::Override); @@ -5472,7 +5472,7 @@ GuiInstanceLocalizedStrings lsInterface->constructorType = WfConstructorType::SharedPtr; auto defaultStrings = GetDefaultStrings(); - FOREACH(WString, functionName, defaultStrings->items.Keys()) + for (auto functionName : defaultStrings->items.Keys()) { auto func = GenerateFunction(textDescs[{defaultStrings, functionName}], functionName, WfClassMemberKind::Normal); lsInterface->declarations.Add(func); @@ -5557,12 +5557,12 @@ GuiInstanceLocalizedStrings func->statement = block; auto defaultStrings = GetDefaultStrings(); - FOREACH(Ptr, ls, strings) + for (auto ls : strings) { if (ls != defaultStrings) { auto listExpr = MakePtr(); - FOREACH(WString, locale, ls->locales) + for (auto locale : ls->locales) { auto strExpr = MakePtr(); strExpr->value.value = locale; @@ -5662,14 +5662,14 @@ GuiAttSetterRepr { GuiValueRepr::CloneBody(repr); - FOREACH_INDEXER(GlobalStringKey, name, index, setters.Keys()) + for (auto [name, index] : indexed(setters.Keys())) { auto src = setters.Values()[index]; auto dst = MakePtr(); dst->binding = src->binding; dst->attPosition = src->attPosition; - FOREACH(Ptr, value, src->values) + for (auto value : src->values) { dst->values.Add(value->Clone()); } @@ -5677,7 +5677,7 @@ GuiAttSetterRepr repr->setters.Add(name, dst); } - FOREACH_INDEXER(GlobalStringKey, name, index, eventHandlers.Keys()) + for (auto [name, index] : indexed(eventHandlers.Keys())) { auto src = eventHandlers.Values()[index]; auto dst = MakePtr(); @@ -5691,7 +5691,7 @@ GuiAttSetterRepr repr->eventHandlers.Add(name, dst); } - FOREACH_INDEXER(GlobalStringKey, name, index, environmentVariables.Keys()) + for (auto [name, index] : indexed(environmentVariables.Keys())) { auto src = environmentVariables.Values()[index]; auto dst = MakePtr(); @@ -5733,7 +5733,7 @@ GuiAttSetterRepr auto value = setters.Values()[i]; if (key == GlobalStringKey::Empty) { - FOREACH(Ptr, repr, value->values) + for (auto repr : value->values) { repr->FillXml(xml); } @@ -5755,7 +5755,7 @@ GuiAttSetterRepr xmlProp->name.value += L"-" + value->binding.ToString(); } - FOREACH(Ptr, repr, value->values) + for (auto repr : value->values) { if (!repr.Cast()) { @@ -5766,7 +5766,7 @@ GuiAttSetterRepr } else { - FOREACH(Ptr, repr, value->values) + for (auto repr : value->values) { if (auto textRepr = repr.Cast()) { @@ -5897,7 +5897,7 @@ GuiInstanceContext } // collect default attributes - FOREACH(Ptr, element, XmlGetElements(xml)) + for (auto element : XmlGetElements(xml)) { if(auto name = parser->Parse({ resource }, element->name.value, element->codeRange.start, errors)) { @@ -5933,7 +5933,7 @@ GuiInstanceContext } // collect values - FOREACH(Ptr, element, XmlGetElements(xml)) + for (auto element : XmlGetElements(xml)) { if(auto name = parser->Parse({ resource }, element->name.value, element->name.codeRange.start, errors)) { @@ -5980,7 +5980,7 @@ GuiInstanceContext if (auto parser = GetParserManager()->GetParser(L"INSTANCE-ELEMENT-NAME")) { // collect values - FOREACH(Ptr, element, XmlGetElements(xml)) + for (auto element : XmlGetElements(xml)) { if(auto name = parser->Parse({ resource }, element->name.value, element->name.codeRange.start, errors)) { @@ -6038,7 +6038,7 @@ GuiInstanceContext setter->tagPosition = { {resource},xml->codeRange.start }; // collect attributes as setters - FOREACH(Ptr, att, xml->attributes) + for (auto att : xml->attributes) { if(auto name = parser->Parse({ resource }, att->name.value, att->name.codeRange.start, errors)) { @@ -6131,7 +6131,7 @@ GuiInstanceContext ctor->typeNamespace = GlobalStringKey::Get(ctorName->namespaceName); ctor->typeName = GlobalStringKey::Get(ctorName->name); // collect attributes as setters - FOREACH(Ptr, att, xml->attributes) + for (auto att : xml->attributes) { if(auto attName = parser->Parse({ resource }, att->name.value, att->name.codeRange.start, errors)) { @@ -6210,7 +6210,7 @@ GuiInstanceContext L"presentation::theme::*"; namespaceAttributes.Add(att); } - FOREACH(Ptr, att, namespaceAttributes) + for (auto att : namespaceAttributes) { // check if the attribute defines a namespace WString attName = att->name.value; @@ -6247,7 +6247,7 @@ GuiInstanceContext // extract all patterns in the namespace, split the value by ';' List patterns; SplitBySemicolon(att->value.value, patterns); - FOREACH(WString, pattern, patterns) + for (auto pattern : patterns) { // add the pattern to the namespace Ptr ns = new GuiInstanceNamespace; @@ -6267,7 +6267,7 @@ GuiInstanceContext } // load instance - FOREACH(Ptr, element, XmlGetElements(xml->rootElement)) + for (auto element : XmlGetElements(xml->rootElement)) { if (element->name.value == L"ref.Parameter") { @@ -6391,7 +6391,7 @@ GuiInstanceContext } } - FOREACH(Ptr, parameter, parameters) + for (auto parameter : parameters) { auto xmlParameter = MakePtr(); xmlParameter->name.value = L"ref.Parameter"; @@ -6408,7 +6408,7 @@ GuiInstanceContext xmlParameter->attributes.Add(attClass); } - FOREACH(Ptr, localized, localizeds) + for (auto localized : localizeds) { auto xmlParameter = MakePtr(); xmlParameter->name.value = L"ref.LocalizedStrings"; @@ -6477,7 +6477,7 @@ GuiInstanceContext appliedStyles = true; List> styles; - FOREACH(WString, uri, stylePaths) + for (auto uri : stylePaths) { WString protocol, path; if (IsResourceUrl(uri, protocol, path)) @@ -6497,11 +6497,11 @@ GuiInstanceContext } } - FOREACH(Ptr, style, styles) + for (auto style : styles) { List> output; ExecuteQuery(style->query, this, output); - FOREACH(Ptr, ctor, output) + for (auto ctor : output) { ApplyStyle(style, ctor); } @@ -6532,18 +6532,18 @@ GuiInstanceStyle void Visit(GuiAttSetterRepr* repr)override { repr->fromStyle = true; - FOREACH(Ptr, value, repr->setters.Values()) + for (auto value : repr->setters.Values()) { - FOREACH(Ptr, subValue, value->values) + for (auto subValue : value->values) { subValue->Accept(this); } } - FOREACH(Ptr, value, repr->eventHandlers.Values()) + for (auto value : repr->eventHandlers.Values()) { value->fromStyle = true; } - FOREACH(Ptr, value, repr->environmentVariables.Values()) + for (auto value : repr->environmentVariables.Values()) { value->fromStyle = true; } @@ -6608,7 +6608,7 @@ GuiInstanceStyleContext auto context = MakePtr(); if (xml->rootElement->name.value == L"Styles") { - FOREACH(Ptr, styleElement, XmlGetElements(xml->rootElement)) + for (auto styleElement : XmlGetElements(xml->rootElement)) { if (styleElement->name.value == L"Style") { @@ -6635,7 +6635,7 @@ GuiInstanceStyleContext auto xmlStyles = MakePtr(); xmlStyles->name.value = L"Styles"; - FOREACH(Ptr, style, styles) + for (auto style : styles) { xmlStyles->subNodes.Add(style->SaveToXml()); } @@ -6831,7 +6831,7 @@ GuiCompositionInstanceLoader { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { const auto& values = arguments.GetByIndex(index); if (prop == GlobalStringKey::Empty) @@ -6989,7 +6989,7 @@ GuiTableCompositionInstanceLoader { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { if (prop == _Rows) { @@ -7118,7 +7118,7 @@ GuiCellCompositionInstanceLoader { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { if (prop == _Site) { @@ -7130,7 +7130,7 @@ GuiCellCompositionInstanceLoader if (auto ctorExpr = inferExpr->expression.Cast()) { auto st = description::GetTypeDescriptor()->GetSerializableType(); - FOREACH(Ptr, argument, ctorExpr->arguments) + for (auto argument : ctorExpr->arguments) { if (auto keyExpr = argument->key.Cast()) { @@ -7348,7 +7348,7 @@ GuiDocumentItemInstanceLoader { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { const auto& values = arguments.GetByIndex(index); if (prop == GlobalStringKey::Empty) @@ -7439,7 +7439,7 @@ GuiDocumentInstanceLoaderBase { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { const auto& values = arguments.GetByIndex(index); if (prop == GlobalStringKey::Empty) @@ -7651,7 +7651,7 @@ GuiTreeViewInstanceLoader { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { if (prop == _Nodes) { @@ -7827,7 +7827,7 @@ GuiTreeNodeInstanceLoader { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { if (prop == GlobalStringKey::Empty) { @@ -8059,7 +8059,7 @@ GuiControlInstanceLoader { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { const auto& values = arguments.GetByIndex(index); if (prop == GlobalStringKey::Empty) @@ -8513,7 +8513,7 @@ namespace vl { auto block = MakePtr(); - FOREACH_INDEXER(GlobalStringKey, prop, index, arguments.Keys()) + for (auto [prop, index] : indexed(arguments.Keys())) { const auto& values = arguments.GetByIndex(index); if (prop == GlobalStringKey::Empty) @@ -8894,10 +8894,10 @@ ExecuteQueryVisitor { if (setter) { - FOREACH_INDEXER(GlobalStringKey, attribute, index, setter->setters.Keys()) + for (auto [attribute, index] : indexed(setter->setters.Keys())) { auto setterValue = setter->setters.Values()[index]; - FOREACH(Ptr, value, setterValue->values) + for (auto value : setterValue->values) { if (auto ctor = value.Cast()) { @@ -8934,7 +8934,7 @@ ExecuteQueryVisitor auto inputExists = &input; if (inputExists) { - FOREACH(Ptr, setter, input) + for (auto setter : input) { Traverse(node, setter); } @@ -9004,7 +9004,7 @@ ApplyStyle void ApplyStyleInternal(Ptr src, Ptr dst) { - FOREACH_INDEXER(GlobalStringKey, attribute, srcIndex, src->setters.Keys()) + for (auto [attribute, srcIndex] : indexed(src->setters.Keys())) { auto srcValue = src->setters.Values()[srcIndex]; vint dstIndex = dst->setters.Keys().IndexOf(attribute); @@ -9029,7 +9029,7 @@ ApplyStyle } } - FOREACH_INDEXER(GlobalStringKey, eventName, srcIndex, src->eventHandlers.Keys()) + for (auto [eventName, srcIndex] : indexed(src->eventHandlers.Keys())) { if (!dst->eventHandlers.Keys().Contains(eventName)) { @@ -9038,7 +9038,7 @@ ApplyStyle } } - FOREACH_INDEXER(GlobalStringKey, varName, srcIndex, src->environmentVariables.Keys()) + for (auto [varName, srcIndex] : indexed(src->environmentVariables.Keys())) { if (!dst->environmentVariables.Keys().Contains(varName)) { @@ -9711,7 +9711,7 @@ FindInstanceLoadingSource if (index != -1) { Ptr namespaceInfo = context->namespaces.Values()[index]; - FOREACH(Ptr, ns, namespaceInfo->namespaces) + for (auto ns : namespaceInfo->namespaces) { auto fullName = GlobalStringKey::Get(ns->prefix + typeName + ns->postfix); if (auto nullable = callback(fullName)) @@ -9856,7 +9856,7 @@ WorkflowEventNamesVisitor void Visit(GuiAttSetterRepr* repr)override { - FOREACH_INDEXER(Ptr, setter, index, repr->setters.Values()) + for (auto [setter, index] : indexed(repr->setters.Values())) { auto loader = GetInstanceLoaderManager()->GetLoader(resolvedTypeInfo.typeName); List possibleInfos; @@ -9885,7 +9885,7 @@ WorkflowEventNamesVisitor } else { - FOREACH(Ptr, value, setter->values) + for (auto value : setter->values) { WorkflowEventNamesVisitor visitor(precompileContext, resolvingResult, possibleInfos, instanceClass, errors); value->Accept(&visitor); @@ -9894,7 +9894,7 @@ WorkflowEventNamesVisitor } } - FOREACH_INDEXER(Ptr, handler, index, repr->eventHandlers.Values()) + for (auto [handler, index] : indexed(repr->eventHandlers.Values())) { if (handler->binding == GlobalStringKey::Empty) { @@ -10281,7 +10281,7 @@ Workflow_GenerateInstanceClass call->type = CopyType(instanceClass->baseTypes[0]); baseTypeContext = baseTypeResourceItem->GetContent().Cast(); - FOREACH(Ptr, parameter, baseTypeContext->parameters) + for (auto parameter : baseTypeContext->parameters) { auto parameterTypeInfoTuple = getDefaultType(parameter->className.ToString()); auto expression = Workflow_ParseExpression( @@ -10332,7 +10332,7 @@ Workflow_GenerateInstanceClass // ref.LocalizedString (Property) /////////////////////////////////////////////////////////////// - FOREACH(Ptr, localized, context->localizeds) + for (auto localized : context->localizeds) { if (auto lsTd = GetTypeDescriptor(localized->className.ToString())) { @@ -10407,7 +10407,7 @@ Workflow_GenerateInstanceClass // ref.Parameter (Variable, Getter, CtorArgument) /////////////////////////////////////////////////////////////// - FOREACH(Ptr, parameter, context->parameters) + for (auto parameter : context->parameters) { auto parameterTypeInfoTuple = getDefaultType(parameter->className.ToString()); vint errorCount = errors.Count(); @@ -11080,7 +11080,7 @@ WorkflowReferenceNamesVisitor auto loader = GetInstanceLoaderManager()->GetLoader(resolvedTypeInfo.typeName); - FOREACH_INDEXER(Ptr, setter, index, repr->setters.Values()) + for (auto [setter, index] : indexed(repr->setters.Values())) { List possibleInfos; auto prop = repr->setters.Keys()[index]; @@ -11090,7 +11090,7 @@ WorkflowReferenceNamesVisitor { if (setter->binding == GlobalStringKey::Empty) { - FOREACH(Ptr, value, setter->values) + for (auto value : setter->values) { WorkflowReferenceNamesVisitor visitor(precompileContext, resolvingResult, possibleInfos, generatedNameCount, errors); value->Accept(&visitor); @@ -11196,7 +11196,7 @@ WorkflowReferenceNamesVisitor currentLoader = GetInstanceLoaderManager()->GetParentLoader(currentLoader); } } - FOREACH(GlobalStringKey, prop, From(requiredProps).Distinct()) + for (auto prop : From(requiredProps).Distinct()) { if (!properties.Keys().Contains(prop)) { @@ -11233,7 +11233,7 @@ WorkflowReferenceNamesVisitor if (pairProps.Count() > 0) { List missingProps; - FOREACH(GlobalStringKey, key, pairProps) + for (auto key : pairProps) { if (!properties.Contains(key, loader)) { @@ -11249,7 +11249,7 @@ WorkflowReferenceNamesVisitor + L"\" of type \"" + resolvedTypeInfo.typeName.ToString() + L"\", the following missing properties are required: "; - FOREACH_INDEXER(GlobalStringKey, key, index, missingProps) + for (auto [key, index] : indexed(missingProps)) { if (index > 0)error += L", "; error += L"\"" + key.ToString() + L"\""; @@ -11258,7 +11258,7 @@ WorkflowReferenceNamesVisitor errors.Add(GuiResourceError({ resolvingResult.resource }, repr->setters[prop]->attPosition, error)); } - FOREACH(GlobalStringKey, key, pairProps) + for (auto key : pairProps) { properties.Remove(key, loader); } @@ -11269,7 +11269,7 @@ WorkflowReferenceNamesVisitor } } - FOREACH(Ptr, handler, repr->eventHandlers.Values()) + for (auto handler : repr->eventHandlers.Values()) { if (handler->binding != GlobalStringKey::Empty) { @@ -11553,7 +11553,7 @@ WorkflowReferenceNamesVisitor IGuiInstanceLoader::TypeInfo Workflow_CollectReferences(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors) { - FOREACH(Ptr, parameter, resolvingResult.context->parameters) + for (auto parameter : resolvingResult.context->parameters) { auto type = GetTypeDescriptor(parameter->className.ToString()); if (!type) @@ -11739,7 +11739,7 @@ WorkflowGenerateBindingVisitor { WORKFLOW_ENVIRONMENT_VARIABLE_ADD - FOREACH_INDEXER(Ptr, setter, index, repr->setters.Values()) + for (auto [setter, index] : indexed(repr->setters.Values())) { auto propertyName = repr->setters.Keys()[index]; if (setter->binding != GlobalStringKey::Empty && setter->binding != GlobalStringKey::_Set) @@ -11752,14 +11752,14 @@ WorkflowGenerateBindingVisitor } else { - FOREACH(Ptr, value, setter->values) + for (auto value : setter->values) { value->Accept(this); } } } - FOREACH_INDEXER(Ptr, handler, index, repr->eventHandlers.Values()) + for (auto [handler, index] : indexed(repr->eventHandlers.Values())) { if (reprTypeInfo.typeInfo) { @@ -11787,7 +11787,7 @@ WorkflowGenerateBindingVisitor WorkflowGenerateBindingVisitor visitor(precompileContext, resolvingResult, statements, errors); resolvingResult.context->instance->Accept(&visitor); - FOREACH(Ptr, localized, resolvingResult.context->localizeds) + for (auto localized : resolvingResult.context->localizeds) { auto code = L"bind(" + localized->className.ToString() + L"::Get(presentation::controls::GuiApplication::GetApplication().Locale))"; if (auto bindExpr = Workflow_ParseExpression(precompileContext, { resolvingResult.resource }, code, localized->tagPosition, errors)) @@ -12010,11 +12010,11 @@ WorkflowGenerateCreatingVisitor vint errorCount = errors.Count(); IGuiInstanceLoader::ArgumentMap arguments; - FOREACH(GlobalStringKey, pairedProp, pairedProps) + for (auto pairedProp : pairedProps) { usedProps.Add(pairedProp, info.loader); auto pairedSetter = repr->setters[pairedProp]; - FOREACH(Ptr, pairedValue, pairedSetter->values) + for (auto pairedValue : pairedSetter->values) { auto pairedInfo = resolvingResult.propertyResolvings[pairedValue.Obj()]; if (pairedInfo.loader == info.loader) @@ -12031,7 +12031,7 @@ WorkflowGenerateCreatingVisitor else if (errorCount == errors.Count()) { WString propNames; - FOREACH_INDEXER(GlobalStringKey, pairedProp, propIndex, pairedProps) + for (auto [pairedProp, propIndex] : indexed(pairedProps)) { if (propIndex > 0)propNames += L", "; propNames += L"\"" + pairedProp.ToString() + L"\""; @@ -12061,7 +12061,7 @@ WorkflowGenerateCreatingVisitor WORKFLOW_ENVIRONMENT_VARIABLE_ADD Group usedProps; - FOREACH(GlobalStringKey, prop, From(repr->setters.Keys()).Reverse()) + for (auto prop : From(repr->setters.Keys()).Reverse()) { auto setter = repr->setters[prop]; IGuiInstanceLoader::PropertyInfo propInfo(reprTypeInfo, prop); @@ -12077,7 +12077,7 @@ WorkflowGenerateCreatingVisitor } else if (setter->binding == GlobalStringKey::Empty) { - FOREACH(Ptr, value, setter->values) + for (auto value : setter->values) { auto info = resolvingResult.propertyResolvings[value.Obj()]; if (info.info->usage == GuiInstancePropertyInfo::Property) @@ -12111,7 +12111,7 @@ WorkflowGenerateCreatingVisitor { WORKFLOW_ENVIRONMENT_VARIABLE_ADD - FOREACH_INDEXER(GlobalStringKey, prop, index, repr->setters.Keys()) + for (auto [prop, index] : indexed(repr->setters.Keys())) { auto setter = repr->setters.Values()[index]; auto propertyResolving = resolvingResult.propertyResolvings[setter->values[0].Obj()]; @@ -12119,7 +12119,7 @@ WorkflowGenerateCreatingVisitor if (setter->binding == GlobalStringKey::Empty) { - FOREACH(Ptr, value, setter->values) + for (auto value : setter->values) { auto argument = GetArgumentInfo(setter->attPosition, value.Obj()); if (argument.typeInfo && argument.expression) @@ -12212,7 +12212,7 @@ WorkflowGenerateCreatingVisitor } } - FOREACH(Ptr, parameter, resolvingResult.context->parameters) + for (auto parameter : resolvingResult.context->parameters) { auto refInstance = MakePtr(); refInstance->name.value = parameter->name.ToString(); @@ -12773,7 +12773,7 @@ Workflow_CreateModuleWithUsings if (index != -1) { auto nss = context->namespaces.Values()[index]; - FOREACH(Ptr, ns, nss->namespaces) + for (auto ns : nss->namespaces) { auto path = MakePtr(); module->paths.Add(path); diff --git a/Import/GacUICompiler.h b/Import/GacUICompiler.h index 5ab380b7..61d335b0 100644 --- a/Import/GacUICompiler.h +++ b/Import/GacUICompiler.h @@ -1091,14 +1091,14 @@ WorkflowCompiler (Compile) extern Ptr Workflow_GenerateInstanceClass(GuiResourcePrecompileContext& precompileContext, const WString& moduleName, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors, vint passIndex); #define WORKFLOW_ENVIRONMENT_VARIABLE_ADD\ - FOREACH_INDEXER(GlobalStringKey, envVar, index, repr->environmentVariables.Keys())\ + for (auto [envVar, index] : indexed(repr->environmentVariables.Keys()))\ {\ auto value = repr->environmentVariables.Values()[index];\ resolvingResult.envVars.Add(envVar, value);\ }\ #define WORKFLOW_ENVIRONMENT_VARIABLE_REMOVE\ - FOREACH_INDEXER(GlobalStringKey, envVar, index, repr->environmentVariables.Keys())\ + for (auto [envVar, index] : indexed(repr->environmentVariables.Keys()))\ {\ auto value = repr->environmentVariables.Values()[index];\ resolvingResult.envVars.Remove(envVar, value.Obj());\ diff --git a/Import/GacUIReflection.cpp b/Import/GacUIReflection.cpp index 295da009..74bac742 100644 --- a/Import/GacUIReflection.cpp +++ b/Import/GacUIReflection.cpp @@ -133,15 +133,15 @@ Compiled Workflow Type Resolver (Workflow) WfAssemblyLoadErrors loadErrors; if (!compiled->Initialize(true, loadErrors)) { - FOREACH(WString, loadError, loadErrors.duplicatedTypes) + for (auto loadError : loadErrors.duplicatedTypes) { errors.Add({ {resource},L"Failed to add an existing type: " + loadError }); } - FOREACH(WString, loadError, loadErrors.unresolvedTypes) + for (auto loadError : loadErrors.unresolvedTypes) { errors.Add({ {resource},L"Unable to resolve type: " + loadError }); } - FOREACH(WString, loadError, loadErrors.unresolvedMembers) + for (auto loadError : loadErrors.unresolvedMembers) { errors.Add({ {resource},L"Unable to resolve member: " + loadError }); } diff --git a/Import/GacUIWindows.cpp b/Import/GacUIWindows.cpp index fa5c15fb..0052cff6 100644 --- a/Import/GacUIWindows.cpp +++ b/Import/GacUIWindows.cpp @@ -496,7 +496,7 @@ WindowsDirect2DParagraph (Initialization) ~WindowsDirect2DParagraph() { CloseCaret(); - FOREACH(Color, color, usedColors) + for (auto color : usedColors) { renderTarget->DestroyDirect2DBrush(color); } @@ -5925,7 +5925,7 @@ UniscribeLine ClearUniscribeData(); vint current=0; List fragmentStarts; - FOREACH(Ptr, fragment, documentFragments) + for (auto fragment : documentFragments) { fragmentStarts.Add(current); lineText+=fragment->text; @@ -6009,7 +6009,7 @@ UniscribeLine bool skip=false; { vint elementCurrent=0; - FOREACH(Ptr, elementFragment, documentFragments) + for (auto elementFragment : documentFragments) { vint elementLength=elementFragment->text.Length(); if(elementFragment->inlineObjectProperties) @@ -6106,7 +6106,7 @@ UniscribeLine } else { - FOREACH(Ptr, run, scriptRuns) + for (auto run : scriptRuns) { run->fragmentBounds.Clear(); } @@ -6286,9 +6286,9 @@ UniscribeLine vint minY=top; vint maxX=0; vint maxY=top; - FOREACH(Ptr, run, scriptRuns) + for (auto run : scriptRuns) { - FOREACH(UniscribeRun::RunFragmentBounds, fragmentBounds, run->fragmentBounds) + for (auto fragmentBounds : run->fragmentBounds) { Rect bounds=fragmentBounds.bounds; if(minX>bounds.Left()) minX=bounds.Left(); @@ -6304,7 +6304,7 @@ UniscribeLine void UniscribeLine::Render(UniscribeRun::IRendererCallback* callback, vint offsetX, vint offsetY, bool renderBackground) { - FOREACH(Ptr, run, scriptRuns) + for (auto run : scriptRuns) { for(vint i=0;ifragmentBounds.Count();i++) { @@ -6335,7 +6335,7 @@ UniscribeParagraph (Initialization) void UniscribeParagraph::ClearUniscribeData() { - FOREACH(Ptr, fragment, documentFragments) + for (auto fragment : documentFragments) { GetWindowsGDIResourceManager()->DestroyGdiFont(fragment->fontStyle); fragment->fontObject=0; @@ -6351,7 +6351,7 @@ UniscribeParagraph (Initialization) built=true; ClearUniscribeData(); Dictionary> fonts; - FOREACH(Ptr, fragment, documentFragments) + for (auto fragment : documentFragments) { if(!fragment->fontObject) { @@ -6371,7 +6371,7 @@ UniscribeParagraph (Initialization) { Regex regexLine(L"\r\n"); Ptr line; - FOREACH(Ptr, fragment, documentFragments) + for (auto fragment : documentFragments) { if(fragment->inlineObjectProperties) { @@ -6415,13 +6415,13 @@ UniscribeParagraph (Initialization) } } - FOREACH(Ptr, line, lines) + for (auto line : lines) { line->BuildUniscribeData(dc); } vint lineStart=0; - FOREACH(Ptr, line, lines) + for (auto line : lines) { line->startFromParagraph=lineStart; lineStart+=line->lineText.Length()+2; @@ -6440,7 +6440,7 @@ UniscribeParagraph (Initialization) paragraphAlignment=alignment; vint cy=0; - FOREACH(Ptr, line, lines) + for (auto line : lines) { line->Layout(availableWidth, alignment, cy, cy); } @@ -6450,7 +6450,7 @@ UniscribeParagraph (Initialization) vint minY=0; vint maxX=0; vint maxY=0; - FOREACH(Ptr, line, lines) + for (auto line : lines) { Rect bounds=line->bounds; if(minX>bounds.Left()) minX=bounds.Left(); @@ -6460,9 +6460,9 @@ UniscribeParagraph (Initialization) } vint offsetY=0; - FOREACH(Ptr, line, lines) + for (auto line : lines) { - FOREACH(Ptr, fragment, line->documentFragments) + for (auto fragment : line->documentFragments) { vint size=fragment->fontStyle.size/3; if(size>offsetY) @@ -6477,7 +6477,7 @@ UniscribeParagraph (Initialization) void UniscribeParagraph::Render(UniscribeRun::IRendererCallback* callback, bool renderBackground) { auto offset = callback->GetParagraphOffset(); - FOREACH(Ptr, line, lines) + for (auto line : lines) { line->Render(callback, offset.x, offset.y, renderBackground); } @@ -9076,7 +9076,7 @@ WindowsForm auto flag = flagDisposed; bool skip = false; { - FOREACH(Ptr, handler, messageHandlers) + for (auto handler : messageHandlers) { handler->BeforeHandle(hwnd, uMsg, wParam, lParam, skip); CHECK_DISPOSED; @@ -9090,7 +9090,7 @@ WindowsForm CHECK_DISPOSED; if (GetWindowsFormFromHandle(hwnd)) { - FOREACH(Ptr, handler, messageHandlers) + for (auto handler : messageHandlers) { handler->AfterHandle(hwnd, uMsg, wParam, lParam, skip, result); CHECK_DISPOSED; @@ -9826,7 +9826,7 @@ WindowsController { if (rootWindowOnly) { - FOREACH(WindowsForm*, window, windows.Values()) + for (auto window : windows.Values()) { if (window->GetWindowMode() == INativeWindow::Normal) { @@ -9870,7 +9870,7 @@ WindowsController { if (hwnd == mainWindowHandle && uMsg == WM_DESTROY) { - FOREACH(WindowsForm*, window, windows.Values()) + for (auto window : windows.Values()) { if (window->IsVisible()) { @@ -9886,7 +9886,7 @@ WindowsController return window->GetWindowMode() == INativeWindow::Normal; }) ); - FOREACH(WindowsForm*, window, normalWindows) + for (auto window : normalWindows) { DestroyNativeWindow(window); } @@ -13071,7 +13071,7 @@ WindowsAsyncService } } - FOREACH(TaskItem, item, items) + for (auto item : items) { item.proc(); if(item.semaphore) @@ -13079,7 +13079,7 @@ WindowsAsyncService item.semaphore->Release(); } } - FOREACH(Ptr, item, executableDelayItems) + for (auto item : executableDelayItems) { if(item->executeInMainThread) { diff --git a/Import/Vlpp.h b/Import/Vlpp.h index 97019be1..34a5a1b1 100644 --- a/Import/Vlpp.h +++ b/Import/Vlpp.h @@ -2466,7 +2466,8 @@ Interfaces ///

/// An enumerable interface representing all types that provide multiple values in order. - /// range-based for-loop is not supported on enumerable yet, current we have "FOREACH" and "FOREACH_INDEXER" for iterating values. + /// range-based for-loop is available on enumerable yet. + /// by applying the indexed function on the collection, a tuple of value and index is returned, structured binding could apply. /// functions work for all enumerable implementation. /// provides high-level operations for enumerables, you can create a lazy list by calling on any enumerables. /// @@ -2482,17 +2483,17 @@ Interfaces /// CopyFrom(ys, xs); /// /// // print ys - /// FOREACH(vint, y, ys) + /// for (auto y : ys) /// Console::Write(itow(y) + L" "); /// Console::WriteLine(L""); /// /// // print ys, added by the position - /// FOREACH_INDEXER(vint, y, i, ys) + /// for (auto [y, i] : indexed(ys)) /// Console::Write(itow(y + i) + L" "); /// Console::WriteLine(L""); /// /// // print all odd numbers in ys - /// FOREACH(vint, y, From(ys).Where([](int a){return a % 2 == 1;})) + /// for (auto y : From(ys).Where([](int a){return a % 2 == 1;})) /// Console::Write(itow(y) + L" "); /// Console::WriteLine(L""); /// } @@ -2509,7 +2510,7 @@ Interfaces /// /// /// In most of the cases, you do not need to call this function. - /// "FOREACH", "FOREACH_INDEXER", and do all the jobs for you. + /// "for (auto x : xs);", "for (auto [x, i] : indexed(xs));", and do all the jobs for you. /// /// The enumerator. virtual IEnumerator* CreateEnumerator()const=0; @@ -4694,75 +4695,148 @@ namespace vl { namespace collections { - -/*********************************************************************** -ForEachIterator -***********************************************************************/ - - template - class ForEachIterator : public Object + struct RangeBasedForLoopEnding { - public: - virtual bool Next(T& variable)const=0; - - operator bool()const - { - return true; - } }; /*********************************************************************** -ForEachIterator for IEnumerable +Range-Based For-Loop Iterator ***********************************************************************/ template - class EnumerableForEachIterator : public ForEachIterator + struct RangeBasedForLoopIterator { - protected: - Ptr> enumerator; + private: + IEnumerator* iterator; + public: - EnumerableForEachIterator(const IEnumerable& enumerable) - :enumerator(enumerable.CreateEnumerator()) + RangeBasedForLoopIterator(const IEnumerable& enumerable) + : iterator(enumerable.CreateEnumerator()) { + operator++(); } - EnumerableForEachIterator(const EnumerableForEachIterator& enumerableIterator) - :enumerator(enumerableIterator.enumerator) + ~RangeBasedForLoopIterator() { + if (iterator) delete iterator; } - bool Next(T& variable)const + void operator++() { - if(enumerator->Next()) + if (!iterator->Next()) { - variable=enumerator->Current(); - return true; - } - else - { - return false; + delete iterator; + iterator = nullptr; } } + + const T& operator*() const + { + return iterator->Current(); + } + + bool operator==(RangeBasedForLoopEnding) const + { + return iterator == nullptr; + } }; template - EnumerableForEachIterator CreateForEachIterator(const IEnumerable& enumerable) + RangeBasedForLoopIterator begin(const IEnumerable& enumerable) { - return enumerable; + return { enumerable }; + } + + template + RangeBasedForLoopEnding end(const IEnumerable& enumerable) + { + return {}; } /*********************************************************************** -FOREACH and FOREACH_INDEXER +Range-Based For-Loop Iterator with Index ***********************************************************************/ -#define FOREACH(TYPE, VARIABLE, COLLECTION)\ - SCOPE_VARIABLE(const ::vl::collections::ForEachIterator&, __foreach_iterator__, ::vl::collections::CreateForEachIterator(COLLECTION))\ - for(TYPE VARIABLE;__foreach_iterator__.Next(VARIABLE);) + template + struct RangeBasedForLoopIteratorWithIndex + { + struct Tuple + { + const T& value; + vint index; -#define FOREACH_INDEXER(TYPE, VARIABLE, INDEXER, COLLECTION)\ - SCOPE_VARIABLE(const ::vl::collections::ForEachIterator&, __foreach_iterator__, ::vl::collections::CreateForEachIterator(COLLECTION))\ - SCOPE_VARIABLE(vint, INDEXER, 0)\ - for(TYPE VARIABLE;__foreach_iterator__.Next(VARIABLE);INDEXER++) + Tuple(const T& _value, vint _index) + : value(_value) + , index(_index) + { + } + }; + private: + IEnumerator* iterator; + vint index; + + public: + RangeBasedForLoopIteratorWithIndex(const IEnumerable& enumerable) + : iterator(enumerable.CreateEnumerator()) + , index(-1) + { + operator++(); + } + + ~RangeBasedForLoopIteratorWithIndex() + { + if (iterator) delete iterator; + } + + void operator++() + { + if (!iterator->Next()) + { + delete iterator; + iterator = nullptr; + } + index++; + } + + Tuple operator*() const + { + return { iterator->Current(),index }; + } + + bool operator==(RangeBasedForLoopEnding) const + { + return iterator == nullptr; + } + }; + + template + struct EnumerableWithIndex + { + const IEnumerable& enumerable; + + EnumerableWithIndex(const IEnumerable& _enumerable) + : enumerable(_enumerable) + { + } + }; + + template + EnumerableWithIndex indexed(const IEnumerable& enumerable) + { + return { enumerable }; + } + + template + RangeBasedForLoopIteratorWithIndex begin(const EnumerableWithIndex& enumerable) + { + return { enumerable.enumerable }; + } + + template + RangeBasedForLoopEnding end(const EnumerableWithIndex& enumerable) + { + return {}; + } } } @@ -7003,8 +7077,8 @@ Functions: From(array) => [T] Range(start, count) => [vint] - FOREACH(X, a, XList) - FOREACH_INDEXER(X, a, index, XList) + for (auto x : xs); + for (auto [x, i] : indexed(xs)); ***********************************************************************/ #ifndef VCZH_COLLECTIONS_OPERATION @@ -7079,9 +7153,9 @@ Quick Sort /// Returns zero when two arguments equal. /// template - void Sort(T* items, vint length, const Func& orderer) + void Sort(T* items, vint length, const Func& orderer) { - SortLambda>(items, length, orderer); + SortLambda>(items, length, orderer); } /*********************************************************************** @@ -7175,7 +7249,7 @@ LazyList /// { /// vint xs[] = {1, 2, 3, 4, 5}; /// auto ys = From(xs).Select([](vint x){ return x * 2; }); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> template @@ -7193,7 +7267,7 @@ LazyList /// { /// vint xs[] = {1, 2, 3, 4, 5}; /// auto ys = From(xs).Where([](vint x){ return x % 2 == 0; }); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> template @@ -7246,7 +7320,7 @@ LazyList /// { /// vint xs[] = {1, 2, 3, 4, 5}; /// auto ys = From(xs).OrderBy([](vint x, vint y){ return x - y; }); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> template @@ -7319,9 +7393,9 @@ LazyList template I Aggregate(I init, F f)const { - FOREACH(T, t, *this) + for (auto& t : *this) { - init=f(init, t); + init = f(init, t); } return init; } @@ -7482,7 +7556,7 @@ LazyList /// vint xs[] = {1, 2, 3, 4, 5}; /// vint ys[] = {6, 7, 8, 9, 10}; /// auto zs = From(xs).Concat(From(ys)); - /// FOREACH(vint, z, zs) Console::Write(itow(z) + L" "); + /// for (auto z : zs) Console::Write(itow(z) + L" "); /// } /// ]]> LazyList Concat(const IEnumerable& remains)const @@ -7498,7 +7572,7 @@ LazyList /// { /// vint xs[] = {1, 2, 3, 4, 5}; /// auto ys = From(xs).Take(3); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> LazyList Take(vint count)const @@ -7514,7 +7588,7 @@ LazyList /// { /// vint xs[] = {1, 2, 3, 4, 5}; /// auto ys = From(xs).Skip(3); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> LazyList Skip(vint count)const @@ -7530,7 +7604,7 @@ LazyList /// { /// vint xs[] = {1, 2, 3, 4, 5}; /// auto ys = From(xs).Repeat(3); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> LazyList Repeat(vint count)const @@ -7545,7 +7619,7 @@ LazyList /// { /// vint xs[] = {1, 2, 2, 3, 3, 3, 4, 4, 5}; /// auto ys = From(xs).Distinct(); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> LazyList Distinct()const @@ -7560,7 +7634,7 @@ LazyList /// { /// vint xs[] = {1, 2, 3, 4, 5}; /// auto ys = From(xs).Reverse(); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> LazyList Reverse()const @@ -7583,7 +7657,7 @@ LazyList /// vint xs[] = {1, 2, 3, 4, 5, 6, 7}; /// vint ys[] = {60, 70, 80, 90, 100}; /// auto zs = From(xs).Pairwise(From(ys)).Select([](Pair p){ return p.key + p.value; }); - /// FOREACH(vint, z, zs) Console::Write(itow(z) + L" "); + /// for (auto z : zs) Console::Write(itow(z) + L" "); /// } /// ]]> template @@ -7601,7 +7675,7 @@ LazyList /// vint xs[] = {1, 2, 3, 4, 5}; /// vint ys[] = {3, 4, 5, 6, 7}; /// auto zs = From(xs).Intersect(From(ys)); - /// FOREACH(vint, z, zs) Console::Write(itow(z) + L" "); + /// for (auto z : zs) Console::Write(itow(z) + L" "); /// } /// ]]> LazyList Intersect(const IEnumerable& remains)const @@ -7618,7 +7692,7 @@ LazyList /// vint xs[] = {1, 2, 3, 4, 5}; /// vint ys[] = {3, 4, 5, 6, 7}; /// auto zs = From(xs).Except(From(ys)); - /// FOREACH(vint, z, zs) Console::Write(itow(z) + L" "); + /// for (auto z : zs) Console::Write(itow(z) + L" "); /// } /// ]]> LazyList Except(const IEnumerable& remains)const @@ -7635,7 +7709,7 @@ LazyList /// vint xs[] = {1, 2, 3, 4, 5}; /// vint ys[] = {3, 4, 5, 6, 7}; /// auto zs = From(xs).Union(From(ys)); - /// FOREACH(vint, z, zs) Console::Write(itow(z) + L" "); + /// for (auto z : zs) Console::Write(itow(z) + L" "); /// } /// ]]> LazyList Union(const IEnumerable& remains)const @@ -7691,7 +7765,7 @@ LazyList /// vint factors[] = {1, 10, 100}; /// return From(factors).Select([=](vint f){ return f * x; }).Evaluate(true); /// }); - /// FOREACH(vint, y, ys) Console::Write(itow(y) + L" "); + /// for (auto y : ys) Console::Write(itow(y) + L" "); /// } /// ]]> template @@ -7717,10 +7791,10 @@ LazyList /// vint xs[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; /// auto ys = From(xs).GroupBy([](vint x){ return x % 3; }); /// using TY = Pair>; - /// FOREACH(TY, y, ys) + /// for (auto y : ys) /// { /// Console::Write(itow(y.key) + L":"); - /// FOREACH(vint, z, y.value) Console::Write(L" " + itow(z)); + /// for (auto z : y.value) Console::Write(L" " + itow(z)); /// Console::WriteLine(L""); /// } /// } @@ -7805,6 +7879,39 @@ LazyList { return FromArray(items); } + +/*********************************************************************** +Range-Based For-Loop Iterator with Index for LazyList +***********************************************************************/ + + template + struct LazyListWithIndex + { + LazyList lazyList; + + LazyListWithIndex(const LazyList& _lazyList) + : lazyList(_lazyList) + { + } + }; + + template + LazyListWithIndex indexed(const LazyList& lazyList) + { + return { lazyList }; + } + + template + RangeBasedForLoopIteratorWithIndex begin(const LazyListWithIndex& enumerable) + { + return { enumerable.lazyList }; + } + + template + RangeBasedForLoopEnding end(const LazyListWithIndex& enumerable) + { + return {}; + } } } diff --git a/Import/VlppOS.cpp b/Import/VlppOS.cpp index 495d51d1..c71bf848 100644 --- a/Import/VlppOS.cpp +++ b/Import/VlppOS.cpp @@ -553,7 +553,7 @@ File { EncoderStream encoderStream(fileStream, *encoder); StreamWriter writer(encoderStream); - FOREACH(WString, line, lines) + for (auto line : lines) { writer.WriteLine(line); } @@ -805,14 +805,14 @@ Folder { List folders; GetFolders(folders); - FOREACH(Folder, folder, folders) + for (auto folder : folders) { if (!folder.Delete(true)) return false; } List files; GetFiles(files); - FOREACH(File, file, files) + for (auto file : files) { if (!file.Delete()) return false; } @@ -1121,7 +1121,7 @@ Utilities { // concatincate response body vint totalSize = 0; - FOREACH(BufferPair, p, availableBuffers) + for (auto p : availableBuffers) { totalSize += p.length; } @@ -1131,7 +1131,7 @@ Utilities char* utf8 = new char[totalSize]; { char* temp = utf8; - FOREACH(BufferPair, p, availableBuffers) + for (auto p : availableBuffers) { memcpy(temp, p.buffer, p.length); temp += p.length; @@ -1140,7 +1140,7 @@ Utilities memcpy(&response.body[0], utf8, totalSize); delete[] utf8; } - FOREACH(BufferPair, p, availableBuffers) + for (auto p : availableBuffers) { delete[] p.buffer; } diff --git a/Import/VlppParser.cpp b/Import/VlppParser.cpp index 84e4a737..b9d5cc92 100644 --- a/Import/VlppParser.cpp +++ b/Import/VlppParser.cpp @@ -240,7 +240,7 @@ ParsingAutoRecoverParser processingFutureIndex++; if(previous.future && previous.future->currentState==-1) continue; - FOREACH(vint, currentTableTokenIndex, prioritizedTokens) + for (auto currentTableTokenIndex : prioritizedTokens) { vint newInsertedTokenCount = previous.insertedTokenCount; if (currentTableTokenIndex != ParsingTable::NormalReduce && currentTableTokenIndex != ParsingTable::LeftRecursiveReduce) @@ -321,7 +321,7 @@ ParsingAutoRecoverParser ParsingAutoRecoverParser::~ParsingAutoRecoverParser() { - FOREACH(RecoverFuture, future, recoverFutures) + for (auto future : recoverFutures) { delete future.future; } @@ -727,7 +727,7 @@ ParsingAmbiguousParser vint resolvableFutureLevels=SearchPathForOneStep(state, futures, resultBegin, resultEnd, errors); BuildDecisions(state, futures, resultBegin, resultEnd, resolvableFutureLevels, errors); - FOREACH(ParsingState::Future*, future, futures) + for (auto future : futures) { delete future; } @@ -811,7 +811,7 @@ ParsingAutoRecoverAmbiguousParser { // try to see if the target token is reached List recoveryFutures; - FOREACH(ParsingState::Future*, future, consumedTokenFutures) + for (auto future : consumedTokenFutures) { if (future->selectedToken == currentTokenIndex) { @@ -825,7 +825,7 @@ ParsingAutoRecoverAmbiguousParser // finally reached the expected currentTokenIndex // move these previous futures to the end // then the original parser algorith, will use these previous futures to reach the currentTokenIndex in the next step - FOREACH(ParsingState::Future*, future, recoveryFutures) + for (auto future : recoveryFutures) { futures.Remove(future); futures.Add(future); @@ -834,7 +834,7 @@ ParsingAutoRecoverAmbiguousParser end = futures.Count(); // delete all futures in consumedTokenFutures - FOREACH(ParsingState::Future*, future, consumedTokenFutures) + for (auto future : consumedTokenFutures) { delete future; } @@ -1683,11 +1683,11 @@ PrepareSymbols if(classType) { PrepareSymbolsTypeDefinitionVisitor visitor(manager, classType, errors); - FOREACH(Ptr, subType, node->subTypes) + for (auto subType : node->subTypes) { subType->Accept(&visitor); } - FOREACH(Ptr, member, node->members) + for (auto member : node->members) { member->Accept(&visitor); } @@ -1719,7 +1719,7 @@ PrepareSymbols if(enumType) { PrepareSymbolsTypeDefinitionVisitor visitor(manager, enumType, errors); - FOREACH(Ptr, member, node->members) + for (auto member : node->members) { member->Accept(&visitor); } @@ -1736,13 +1736,13 @@ PrepareSymbols { { PrepareSymbolsTypeDefinitionVisitor visitor(manager, manager->GetGlobal(), errors); - FOREACH(Ptr, typeDefinition, definition->types) + for (auto typeDefinition : definition->types) { typeDefinition->Accept(&visitor); } } - FOREACH(Ptr, token, definition->tokens) + for (auto token : definition->tokens) { if(manager->GetGlobal()->GetSubSymbolByName(token->name)) { @@ -1762,7 +1762,7 @@ PrepareSymbols } } - FOREACH(Ptr, rule, definition->rules) + for (auto rule : definition->rules) { if(manager->GetGlobal()->GetSubSymbolByName(rule->name)) { @@ -1838,7 +1838,7 @@ ValidateRuleStructure case ParsingSymbol::TokenDef: { bool discard=false; - FOREACH(Ptr, token, definition->tokens) + for (auto token : definition->tokens) { if(token->name==symbol->GetName()) { @@ -1962,7 +1962,7 @@ ValidateRuleStructure void ValidateRuleStructure(Ptr definition, Ptr rule, ParsingSymbolManager* manager, collections::List>& errors) { - FOREACH(Ptr, grammar, rule->grammars) + for (auto grammar : rule->grammars) { ValidateRuleStructureVisitor visitor(definition, manager, rule.Obj(), errors); grammar->Accept(&visitor); @@ -2004,7 +2004,7 @@ ResolveRuleSymbols WString ToString() { WString result; - FOREACH(Ptr, fragment, fragments) + for (auto fragment : fragments) { if(!fragment->epsilon) { @@ -2074,7 +2074,7 @@ ResolveRuleSymbols void BuildPath(List>& paths) { - FOREACH(GrammarPathFragment*, fragment, currentFragmentEnds) + for (auto fragment : currentFragmentEnds) { Ptr path=new GrammarPath; paths.Add(path); @@ -2299,7 +2299,7 @@ ResolveRuleSymbols { ParsingSymbol* ruleType=manager->GetGlobal()->GetSubSymbolByName(rule->name)->GetDescriptorSymbol(); - FOREACH(Ptr, grammar, rule->grammars) + for (auto grammar : rule->grammars) { List> paths; { @@ -2308,12 +2308,12 @@ ResolveRuleSymbols visitor.BuildPath(paths); } - FOREACH(Ptr, path, paths) + for (auto path : paths) { path->pathType=ruleType; vint createdTypeCount=0; vint transitionCount=0; - FOREACH(Ptr, fragment, path->fragments) + for (auto fragment : path->fragments) { if(fragment->createdType) { @@ -2341,9 +2341,9 @@ ResolveRuleSymbols } ResolveAssignerGrammarVisitor::GrammarPathMap grammarPathMap; - FOREACH(Ptr, path, paths) + for (auto path : paths) { - FOREACH(Ptr, fragment, path->fragments) + for (auto fragment : path->fragments) { ParsingDefinitionGrammar* grammar=fragment->grammar; Ptr container; @@ -2362,7 +2362,7 @@ ResolveRuleSymbols } ResolveAssignerGrammarVisitor visitor(manager, errors, grammarPathMap); - FOREACH(ParsingDefinitionGrammar*, grammar, grammarPathMap.Keys()) + for (auto grammar : grammarPathMap.Keys()) { grammar->Accept(&visitor); } @@ -2418,7 +2418,7 @@ ResolveSymbols ParsingSymbol* classType=manager->CacheGetClassType(node.Obj()); if(classType) { - FOREACH(Ptr, subType, node->subTypes) + for (auto subType : node->subTypes) { ResolveTypeSymbols(subType, manager, classType, errors); } @@ -2428,12 +2428,12 @@ ResolveSymbols void ResolveSymbols(Ptr definition, ParsingSymbolManager* manager, collections::List>& errors) { - FOREACH(Ptr, type, definition->types) + for (auto type : definition->types) { ResolveTypeSymbols(type, manager, manager->GetGlobal(), errors); } - FOREACH(Ptr, rule, definition->rules) + for (auto rule : definition->rules) { vint errorCount=errors.Count(); ValidateRuleStructure(definition, rule, manager, errors); @@ -2802,7 +2802,7 @@ CreateNondeterministicPDAFromEpsilonPDA::closure_searching // closure searching function void SearchClosureInternal(ClosureItem::SearchResult(*closurePredicate)(Transition*), List& transitionPath, Transition* transition, State* state, List& closure) { - FOREACH(Transition*, singleTransitionPath, transitionPath) + for (auto singleTransitionPath : transitionPath) { if(singleTransitionPath->source==state && closurePredicate(singleTransitionPath)!=ClosureItem::Blocked) { @@ -2818,7 +2818,7 @@ CreateNondeterministicPDAFromEpsilonPDA::closure_searching { case ClosureItem::Continue: { - FOREACH(Transition*, newTransition, state->transitions) + for (auto newTransition : state->transitions) { if(!transitionPath.Contains(newTransition)) { @@ -2884,7 +2884,7 @@ RemoveEpsilonTransitions // search for epsilon closure List closure; SearchClosure(&EpsilonClosure, currentOldState, closure); - FOREACH(ClosureItem, closureItem, closure) + for (auto closureItem : closure) { Transition* oldTransition=closureItem.transitions->Get(closureItem.transitions->Count()-1); if(!closureItem.cycle || oldTransition->transitionType!=Transition::Epsilon) @@ -2895,7 +2895,7 @@ RemoveEpsilonTransitions // keep a epsilon transition that without the last "TokenFinish" State* newEndState=GetMappedState(automaton, oldTransition->source, scanningStates, oldNewStateMap); Transition* transition=automaton->Epsilon(currentNewState, newEndState); - FOREACH(Transition*, pathTransition, *closureItem.transitions.Obj()) + for (auto pathTransition : *closureItem.transitions.Obj()) { if(pathTransition==oldTransition) break; CopyFrom(transition->actions, pathTransition->actions, true); @@ -2906,7 +2906,7 @@ RemoveEpsilonTransitions // build compacted non-epsilon transition to the target state of the path State* newEndState=GetMappedState(automaton, oldTransition->target, scanningStates, oldNewStateMap); Transition* transition=automaton->CopyTransition(currentNewState, newEndState, oldTransition); - FOREACH(Transition*, pathTransition, *closureItem.transitions.Obj()) + for (auto pathTransition : *closureItem.transitions.Obj()) { CopyFrom(transition->actions, pathTransition->actions, true); } @@ -3074,7 +3074,7 @@ CreateRuleEpsilonPDA ruleInfo->startState=automaton->RuleStartState(rule.Obj()); automaton->TokenBegin(ruleInfo->rootRuleStartState, ruleInfo->startState); - FOREACH(Ptr, grammar, rule->grammars) + for (auto grammar : rule->grammars) { State* grammarStartState=automaton->StartState(rule.Obj(), grammar.Obj(), grammar.Obj()); State* grammarEndState=automaton->EndState(rule.Obj(), grammar.Obj(), grammar.Obj()); @@ -3094,7 +3094,7 @@ CreateEpsilonPDA Ptr CreateEpsilonPDA(Ptr definition, ParsingSymbolManager* manager) { Ptr automaton=new Automaton(manager); - FOREACH(Ptr, rule, definition->rules) + for (auto rule : definition->rules) { CreateRuleEpsilonPDA(automaton, rule, manager); } @@ -3227,9 +3227,9 @@ CreateLookAhead // check if there are non-stable look aheads in two transitions points to the same state // in such situation means that the two transition cannot always be determined using look aheads - FOREACH(Ptr, lai1, la1) + for (auto lai1 : la1) { - FOREACH(Ptr, lai2, la2) + for (auto lai2 : la2) { if (lai1->state == lai2->state) { @@ -3277,7 +3277,7 @@ CollectAttribute void CollectAttributeInfo(Ptr att, List>& atts) { - FOREACH(Ptr, datt, atts) + for (auto datt : atts) { Ptr tatt=new ParsingTable::AttributeInfo(datt->name); CopyFrom(tatt->arguments, datt->arguments); @@ -3359,7 +3359,7 @@ GenerateTable // find all class types CollectType(manager->GetGlobal(), types); - FOREACH(ParsingSymbol*, type, types) + for (auto type : types) { Ptr typeAtt = new ParsingTable::AttributeInfoList; ParsingSymbol* parent = type; @@ -3397,13 +3397,13 @@ GenerateTable } // find all class fields - FOREACH(ParsingSymbol*, type, orderedChildTypeKeys) + for (auto type : orderedChildTypeKeys) { List& children = *childTypeValues[type].Obj(); ParsingDefinitionClassDefinition* classDef = manager->CacheGetClassDefinition(type); List fieldAtts; - FOREACH_INDEXER(Ptr, field, index, classDef->members) + for (auto [field, index] : indexed(classDef->members)) { if (field->attributes.Count() > 0) { @@ -3416,10 +3416,10 @@ GenerateTable } } - FOREACH(ParsingSymbol*, child, children) + for (auto child : children) { WString type = GetTypeFullName(child); - FOREACH_INDEXER(Ptr, field, index, classDef->members) + for (auto [field, index] : indexed(classDef->members)) { treeFieldAtts.Add(Pair(type, field->name), fieldAtts[index]); } @@ -3437,7 +3437,7 @@ GenerateTable Dictionary tokenAtts; Dictionary ruleAtts; - FOREACH(Ptr, token, definition->tokens) + for (auto token : definition->tokens) { if (token->attributes.Count() > 0) { @@ -3465,7 +3465,7 @@ GenerateTable /*********************************************************************** find all rules ***********************************************************************/ - FOREACH(Ptr, rule, definition->rules) + for (auto rule : definition->rules) { if (rule->attributes.Count() > 0) { @@ -3486,7 +3486,7 @@ GenerateTable { vint currentState = 0; List scanningStates; - FOREACH(Ptr, ruleInfo, jointPDA->ruleInfos) + for (auto ruleInfo : jointPDA->ruleInfos) { if (!scanningStates.Contains(ruleInfo->rootRuleStartState)) { @@ -3498,7 +3498,7 @@ GenerateTable State* state = scanningStates[currentState++]; stateIds.Add(state); - FOREACH(Transition*, transition, state->transitions) + for (auto transition : state->transitions) { if (!scanningStates.Contains(transition->target)) { @@ -3512,7 +3512,7 @@ GenerateTable // there will be some states that is used in shift and reduce but it is not a reachable state // so the state table will record all state - FOREACH(Ptr, state, jointPDA->states) + for (auto state : jointPDA->states) { if (!stateIds.Contains(state.Obj())) { @@ -3526,7 +3526,7 @@ GenerateTable /*********************************************************************** fill attribute infos ***********************************************************************/ - FOREACH_INDEXER(Ptr, att, index, atts) + for (auto [att, index] : indexed(atts)) { table->SetAttributeInfo(index, att); } @@ -3535,7 +3535,7 @@ GenerateTable fill tree type infos ***********************************************************************/ typedef Pair TreeTypeAttsPair; - FOREACH_INDEXER(TreeTypeAttsPair, type, index, typeAtts) + for (auto [type, index] : indexed(typeAtts)) { table->SetTreeTypeInfo(index, ParsingTable::TreeTypeInfo(type.key, type.value)); } @@ -3544,7 +3544,7 @@ GenerateTable fill tree field infos ***********************************************************************/ typedef Pair, vint> TreeFieldAttsPair; - FOREACH_INDEXER(TreeFieldAttsPair, field, index, treeFieldAtts) + for (auto [field, index] : indexed(treeFieldAtts)) { table->SetTreeFieldInfo(index, ParsingTable::TreeFieldInfo(field.key.key, field.key.value, field.value)); } @@ -3552,7 +3552,7 @@ GenerateTable /*********************************************************************** fill token infos ***********************************************************************/ - FOREACH(ParsingSymbol*, symbol, tokenIds.Keys()) + for (auto symbol : tokenIds.Keys()) { ParsingTable::TokenInfo info; info.name = symbol->GetName(); @@ -3563,7 +3563,7 @@ GenerateTable table->SetTokenInfo(id, info); } - FOREACH_INDEXER(WString, name, i, discardTokens) + for (auto [name, i] : indexed(discardTokens)) { ParsingSymbol* symbol = jointPDA->symbolManager->GetGlobal()->GetSubSymbolByName(name); @@ -3577,7 +3577,7 @@ GenerateTable /*********************************************************************** fill rule infos ***********************************************************************/ - FOREACH_INDEXER(ParsingDefinitionRuleDefinition*, rule, i, jointPDA->orderedRulesDefs) + for (auto [rule, i] : indexed(jointPDA->orderedRulesDefs)) { Ptr pdaRuleInfo = jointPDA->ruleDefToInfoMap[rule]; ParsingTable::RuleInfo info; @@ -3603,7 +3603,7 @@ GenerateTable /*********************************************************************** fill state infos ***********************************************************************/ - FOREACH_INDEXER(State*, state, i, stateIds) + for (auto [state, i] : indexed(stateIds)) { ParsingTable::StateInfo info; info.ruleName = state->ownerRule->name; @@ -3615,12 +3615,12 @@ GenerateTable /*********************************************************************** fill transition table ***********************************************************************/ - FOREACH_INDEXER(State*, state, stateIndex, stateIds) + for (auto [state, stateIndex] : indexed(stateIds)) { // if this state is not necessary, stop building the table if (stateIndex >= availableStateCount) break; - FOREACH(Transition*, transition, state->transitions) + for (auto transition : state->transitions) { vint tokenIndex = -1; switch (transition->transitionType) @@ -3655,7 +3655,7 @@ GenerateTable item->targetState = stateIds.IndexOf(transition->target); bag->transitionItems.Add(item); - FOREACH(Ptr, action, transition->actions) + for (auto action : transition->actions) { ParsingTable::Instruction ins; switch (action->actionType) @@ -3842,7 +3842,7 @@ CreateJointPDAFromNondeterministicPDA // build rule info data Dictionary ruleMap; Dictionary oldNewStateMap; - FOREACH(ParsingDefinitionRuleDefinition*, rule, nondeterministicPDA->orderedRulesDefs) + for (auto rule : nondeterministicPDA->orderedRulesDefs) { // build new rule info Ptr ruleInfo=nondeterministicPDA->ruleDefToInfoMap[rule]; @@ -3863,7 +3863,7 @@ CreateJointPDAFromNondeterministicPDA newRuleInfo->startState->stateExpression=ruleInfo->startState->stateExpression; } - FOREACH(Ptr, oldState, nondeterministicPDA->states) + for (auto oldState : nondeterministicPDA->states) { if((oldState->inputs.Count()>0 || oldState->transitions.Count()>0) && !oldNewStateMap.Keys().Contains(oldState.Obj())) { @@ -3874,13 +3874,13 @@ CreateJointPDAFromNondeterministicPDA } // create transitions - FOREACH(ParsingDefinitionRuleDefinition*, rule, nondeterministicPDA->orderedRulesDefs) + for (auto rule : nondeterministicPDA->orderedRulesDefs) { Ptr ruleInfo=nondeterministicPDA->ruleDefToInfoMap[rule]; Ptr newRuleInfo=automaton->ruleDefToInfoMap[rule]; // complete new rule info - FOREACH(State*, endState, ruleInfo->endStates) + for (auto endState : ruleInfo->endStates) { newRuleInfo->endStates.Add(oldNewStateMap[endState]); } @@ -3894,7 +3894,7 @@ CreateJointPDAFromNondeterministicPDA { State* currentOldState=scanningStates[currentStateIndex++]; State* currentNewState=oldNewStateMap[currentOldState]; - FOREACH(Transition*, oldTransition, currentOldState->transitions) + for (auto oldTransition : currentOldState->transitions) { State* oldSource=oldTransition->source; State* oldTarget=oldTransition->target; @@ -3922,7 +3922,7 @@ CreateJointPDAFromNondeterministicPDA shiftTransition->actions.Add(action); } - FOREACH(State*, oldEndState, oldRuleInfo->endStates) + for (auto oldEndState : oldRuleInfo->endStates) { Transition* reduceTransition=automaton->NormalReduce(oldNewStateMap[oldEndState], newTarget); Ptr action=new Action; @@ -3961,7 +3961,7 @@ CompactJointPDA void CompactJointPDA(Ptr jointPDA) { - FOREACH(Ptr, state, jointPDA->states) + for (auto state : jointPDA->states) { State* currentState=state.Obj(); @@ -3969,7 +3969,7 @@ CompactJointPDA List closure; SearchClosure(&ShiftReduceCompactClosure, currentState, closure); - FOREACH(ClosureItem, closureItem, closure) + for (auto closureItem : closure) { Transition* lastTransition=closureItem.transitions->Get(closureItem.transitions->Count()-1); Transition::StackOperationType stackOperationType=Transition::None; @@ -3979,9 +3979,9 @@ CompactJointPDA { bool containsShift=false; bool containsReduce=false; - FOREACH(Transition*, pathTransition, *closureItem.transitions.Obj()) + for (auto pathTransition : *closureItem.transitions.Obj()) { - FOREACH(Ptr, action, pathTransition->actions) + for (auto action : pathTransition->actions) { if(action->actionType==Action::Shift) containsShift=true; if(action->actionType==Action::Reduce) containsReduce=true; @@ -4029,7 +4029,7 @@ CompactJointPDA // there will be , or // but there will not be something like // so we can append stackPattern safely - FOREACH(Transition*, pathTransition, *closureItem.transitions.Obj()) + for (auto pathTransition : *closureItem.transitions.Obj()) { CopyFrom(transition->actions, pathTransition->actions, true); } @@ -4057,7 +4057,7 @@ MarkLeftRecursiveInJointPDA vint errorCount=errors.Count(); // record all left recursive shifts and delete all left recursive epsilon transition SortedList> leftRecursiveShifts; - FOREACH(Ptr, state, jointPDA->states) + for (auto state : jointPDA->states) { for(vint i=state->transitions.Count()-1;i>=0;i--) { @@ -4065,7 +4065,7 @@ MarkLeftRecursiveInJointPDA if(transition->stackOperationType==Transition::LeftRecursive) { Ptr shiftAction; - FOREACH(Ptr, action, transition->actions) + for (auto action : transition->actions) { if(action->actionType==Action::Shift) { @@ -4097,9 +4097,9 @@ MarkLeftRecursiveInJointPDA // change all reduce actions whose (shiftReduceSource, shiftReduceTarget) is recorded in leftRecursiveShifts to left-recursive-reduce // when a reduce is converted to a left-recursive-reduce, the corresponding state in stackPattern should be removed // so this will keep count(Reduce) == count(stackPattern) - FOREACH(Ptr, state, jointPDA->states) + for (auto state : jointPDA->states) { - FOREACH(Transition*, transition, state->transitions) + for (auto transition : state->transitions) { for(vint i=transition->actions.Count()-1;i>=0;i--) { @@ -4135,13 +4135,13 @@ MarkLeftRecursiveInJointPDA } // delete complicated transitions - FOREACH(Ptr, state, jointPDA->states) + for (auto state : jointPDA->states) { while(true) { bool deleted=false; - FOREACH(Transition*, t1, state->transitions) - FOREACH(Transition*, t2, state->transitions) + for (auto t1 : state->transitions) + for (auto t2 : state->transitions) if(t1!=t2) { if(Transition::IsEquivalent(t1, t2, true)) @@ -4266,7 +4266,7 @@ RearrangeState { if(!stateContentSorted.Contains(state)) { - FOREACH(Transition*, transition, state->transitions) + for (auto transition : state->transitions) { CopyFrom(transition->actions, From(transition->actions).OrderBy(&CompareActionForRearranging)); } @@ -4298,7 +4298,7 @@ MoveActionsForMergingState } // copy all movable actions - FOREACH(Transition*, t, transition->source->inputs) + for (auto t : transition->source->inputs) { CopyFrom(t->actions, movableActions, true); } @@ -4362,7 +4362,7 @@ MergeState2ToState1Because(Transitions|Input) { Transition* t2=state2->inputs[i]; bool add=true; - FOREACH(Transition*, t1, state1->inputs) + for (auto t1 : state1->inputs) { if(Transition::IsEquivalent(t1, t2, false) && t1->source==t2->source) { @@ -4391,7 +4391,7 @@ MergeState2ToState1Because(Transitions|Input) { Transition* t2=state2->transitions[i]; bool add=true; - FOREACH(Transition*, t1, state1->transitions) + for (auto t1 : state1->transitions) { if(Transition::IsEquivalent(t1, t2, false) && t1->target==t2->target) { @@ -4482,7 +4482,7 @@ CreateNondeterministicPDAFromEpsilonPDA Ptr CreateNondeterministicPDAFromEpsilonPDA(Ptr epsilonPDA) { Ptr automaton=new Automaton(epsilonPDA->symbolManager); - FOREACH(ParsingDefinitionRuleDefinition*, rule, epsilonPDA->orderedRulesDefs) + for (auto rule : epsilonPDA->orderedRulesDefs) { // build new rule info Ptr ruleInfo=epsilonPDA->ruleDefToInfoMap[rule]; @@ -4521,7 +4521,7 @@ CreateNondeterministicPDAFromEpsilonPDA newRuleInfo->startState=newRuleInfo->rootRuleStartState->transitions[0]->target; // record end states - FOREACH(State*, state, newStates) + for (auto state : newStates) { if(state->endState) { @@ -6310,13 +6310,13 @@ Logger (ParsingDefinitionGrammar) void Log(Ptr definition, TextWriter& writer) { - FOREACH(Ptr, type, definition->types) + for (auto type : definition->types) { Log(type.Obj(), L"", writer); writer.WriteLine(L""); } - FOREACH(Ptr, token, definition->tokens) + for (auto token : definition->tokens) { if(token->discard) { @@ -6334,7 +6334,7 @@ Logger (ParsingDefinitionGrammar) } writer.WriteLine(L""); - FOREACH(Ptr, rule, definition->rules) + for (auto rule : definition->rules) { writer.WriteString(L"rule "); Log(rule->type.Obj(), writer); @@ -6343,7 +6343,7 @@ Logger (ParsingDefinitionGrammar) LogAttributeList(rule.Obj(), writer); writer.WriteLine(L""); - FOREACH(Ptr, grammar, rule->grammars) + for (auto grammar : rule->grammars) { writer.WriteString(L" = "); Log(grammar.Obj(), writer); @@ -6385,7 +6385,7 @@ Logger (Automaton) void Log(Ptr automaton, stream::TextWriter& writer) { - FOREACH(Ptr, ruleInfo, automaton->ruleInfos) + for (auto ruleInfo : automaton->ruleInfos) { writer.WriteString(L"Root Rule Start: "); writer.WriteLine(ruleInfo->rootRuleStartState->stateName); @@ -6396,7 +6396,7 @@ Logger (Automaton) writer.WriteString(L"Rule Start: "); writer.WriteLine(ruleInfo->startState->stateName); - FOREACH(State*, endState, ruleInfo->endStates) + for (auto endState : ruleInfo->endStates) { writer.WriteString(L"Rule End: "); writer.WriteLine(endState->stateName); @@ -6406,7 +6406,7 @@ Logger (Automaton) } List states; - FOREACH(Ptr, ruleInfo, automaton->ruleInfos) + for (auto ruleInfo : automaton->ruleInfos) { vint currentState=states.Count(); states.Add(ruleInfo->rootRuleStartState); @@ -6425,7 +6425,7 @@ Logger (Automaton) } writer.WriteLine(state->stateName); - FOREACH(Transition*, transition, state->transitions) + for (auto transition : state->transitions) { if(!states.Contains(transition->target)) { @@ -6472,7 +6472,7 @@ Logger (Automaton) } writer.WriteLine(transition->target->stateName); - FOREACH(Ptr, action, transition->actions) + for (auto action : transition->actions) { switch(action->actionType) { @@ -6538,7 +6538,7 @@ Logger (ParsingTable) if(attributeIndex!=-1) { Ptr atts=table->GetAttributeInfo(attributeIndex); - FOREACH(Ptr, att, atts->attributes) + for (auto att : atts->attributes) { writer.WriteString(prefix); writer.WriteString(L"@"); @@ -6586,21 +6586,21 @@ Logger (ParsingTable) if(bag) { WString content; - FOREACH(Ptr, item, bag->transitionItems) + for (auto item : bag->transitionItems) { if(content!=L"") content+=L"\r\n"; content+=itow(item->targetState); - FOREACH_INDEXER(vint, state, index, item->stackPattern) + for (auto [state, index] : indexed(item->stackPattern)) { content+=(index==0?L" : ":L", "); content+=itow(state); } content+=L"\r\n"; - FOREACH(Ptr, lookAhead, item->lookAheads) + for (auto lookAhead : item->lookAheads) { content+=L" "; - FOREACH_INDEXER(vint, token, index, lookAhead->tokens) + for (auto [token, index] : indexed(lookAhead->tokens)) { content+=(index==0?L"> ":L", "); content+=itow(token); @@ -6609,7 +6609,7 @@ Logger (ParsingTable) } content+=L" "; - FOREACH(ParsingTable::Instruction, ins, item->instructions) + for (auto ins : item->instructions) { switch(ins.instructionType) { @@ -7187,10 +7187,10 @@ ParsingState if(item->lookAheads.Count()>0 && lookAheadTokens) { passLookAheadTest=false; - FOREACH(Ptr, info, item->lookAheads) + for (auto info : item->lookAheads) { vint index=0; - FOREACH(vint, token, *lookAheadTokens) + for (auto token : *lookAheadTokens) { if(info->tokens[index]!=token) { @@ -7669,7 +7669,7 @@ ParsingTreeBuilder { Ptr ambiguousNode=new ParsingTreeObject(result.ambiguityNodeType, operationTarget->GetCodeRange()); Ptr items=new ParsingTreeArray(L"", operationTarget->GetCodeRange()); - FOREACH(Ptr, node, ambiguityNodes) + for (auto node : ambiguityNodes) { items->AddItem(node); } @@ -8120,7 +8120,7 @@ ParsingTable::LookAheadInfo { if(Ptr bag=table->GetTransitionBag(state, i)) { - FOREACH(Ptr, item, bag->transitionItems) + for (auto item : bag->transitionItems) { if (i == ParsingTable::NormalReduce || i == ParsingTable::LeftRecursiveReduce) { @@ -8165,7 +8165,7 @@ ParsingTable::TransitionItem { bool hasReduce=false; bool hasLrReduce=false; - FOREACH(ParsingTable::Instruction, ins, t->instructions) + for (auto ins : t->instructions) { switch(ins.instructionType) { @@ -8453,11 +8453,11 @@ ParsingTable void ParsingTable::Initialize() { List tokens; - FOREACH(TokenInfo, info, From(tokenInfos).Skip(UserTokenStart)) + for (auto info : From(tokenInfos).Skip(UserTokenStart)) { tokens.Add(info.regex); } - FOREACH(TokenInfo, info, discardTokenInfos) + for (auto info : discardTokenInfos) { tokens.Add(info.regex); } @@ -8474,7 +8474,7 @@ ParsingTable lexer = new RegexLexer(tokens, {}); ruleMap.Clear(); - FOREACH_INDEXER(RuleInfo, rule, index, ruleInfos) + for (auto [rule, index] : indexed(ruleInfos)) { ruleMap.Add(rule.name, index); } @@ -8485,13 +8485,13 @@ ParsingTable } treeTypeInfoMap.Clear(); - FOREACH_INDEXER(TreeTypeInfo, info, index, treeTypeInfos) + for (auto [info, index] : indexed(treeTypeInfos)) { treeTypeInfoMap.Add(info.type, index); } treeFieldInfoMap.Clear(); - FOREACH_INDEXER(TreeFieldInfo, info, index, treeFieldInfos) + for (auto [info, index] : indexed(treeFieldInfos)) { Pair key(info.type, info.field); treeFieldInfoMap.Add(key, index); @@ -8592,7 +8592,7 @@ ParsingTreeNode::TraversalVisitor { case TraverseDirection::ByTextPosition: { - FOREACH(Ptr, node, node->GetSubNodes()) + for (auto node : node->GetSubNodes()) { node->Accept(this); } @@ -8600,7 +8600,7 @@ ParsingTreeNode::TraversalVisitor break; case TraverseDirection::ByStorePosition: { - FOREACH(Ptr, node, node->GetMembers().Values()) + for (auto node : node->GetMembers().Values()) { node->Accept(this); } @@ -8617,7 +8617,7 @@ ParsingTreeNode::TraversalVisitor { case TraverseDirection::ByTextPosition: { - FOREACH(Ptr, node, node->GetSubNodes()) + for (auto node : node->GetSubNodes()) { node->Accept(this); } @@ -8625,7 +8625,7 @@ ParsingTreeNode::TraversalVisitor break; case TraverseDirection::ByStorePosition: { - FOREACH(Ptr, node, node->GetItems()) + for (auto node : node->GetItems()) { node->Accept(this); } @@ -8688,14 +8688,14 @@ ParsingTreeNode auto subNodesExists = &subNodes; if(subNodesExists) { - FOREACH(Ptr, node, subNodes) + for (auto node : subNodes) { node->InitializeQueryCache(); } //if (codeRange.start.IsInvalid() || codeRange.start.IsInvalid()) { - FOREACH(Ptr, subNode, subNodes) + for (auto subNode : subNodes) { const auto& subRange = subNode->codeRange; const auto& min = !subRange.start.IsInvalid() ? subRange.start : subRange.end; @@ -9077,11 +9077,11 @@ ParsingTreeArray bool ParsingTreeArray::Clear() { - FOREACH(Ptr, node, items) + for (auto node : items) { if(!BeforeRemoveChild(node)) return false; } - FOREACH(Ptr, node, items) + for (auto node : items) { AfterRemoveChild(node); } @@ -9170,7 +9170,7 @@ ParsingMultiplePrintNodeRecorder void ParsingMultiplePrintNodeRecorder::Record(ParsingTreeCustomBase* node, const ParsingTextRange& range) { - FOREACH(Ptr, recorder, recorders) + for (auto recorder : recorders) { recorder->Record(node, range); } @@ -9376,7 +9376,7 @@ JsonPrintVisitor void Visit(JsonArray* node) { writer.WriteChar(L'['); - FOREACH_INDEXER(Ptr, item, i, node->items) + for (auto [item, i] : indexed(node->items)) { if(i>0) writer.WriteChar(L','); item->Accept(this); @@ -9395,7 +9395,7 @@ JsonPrintVisitor void Visit(JsonObject* node) { writer.WriteChar(L'{'); - FOREACH_INDEXER(Ptr, field, i, node->fields) + for (auto [field, i] : indexed(node->fields)) { if(i>0) writer.WriteChar(L','); field->Accept(this); @@ -10239,7 +10239,7 @@ XmlPrintVisitor { writer.WriteChar(L'<'); writer.WriteString(node->name.value); - FOREACH(Ptr, att, node->attributes) + for (auto att : node->attributes) { writer.WriteChar(L' '); att->Accept(this); @@ -10251,7 +10251,7 @@ XmlPrintVisitor else { writer.WriteChar(L'>'); - FOREACH(Ptr, subNode, node->subNodes) + for (auto subNode : node->subNodes) { subNode->Accept(this); } @@ -10265,7 +10265,7 @@ XmlPrintVisitor { writer.WriteString(L"name.value); - FOREACH(Ptr, att, node->attributes) + for (auto att : node->attributes) { writer.WriteChar(L' '); att->Accept(this); @@ -10275,7 +10275,7 @@ XmlPrintVisitor void Visit(XmlDocument* node) { - FOREACH(Ptr, prolog, node->prologs) + for (auto prolog : node->prologs) { prolog->Accept(this); } @@ -10385,7 +10385,7 @@ API void XmlPrintContent(Ptr element, stream::TextWriter& writer) { XmlPrintVisitor visitor(writer); - FOREACH(Ptr, node, element->subNodes) + for (auto node : element->subNodes) { node->Accept(&visitor); } @@ -10430,7 +10430,7 @@ Linq To Xml Ptr XmlGetAttribute(XmlElement* element, const WString& name) { - FOREACH(Ptr, att, element->attributes) + for (auto att : element->attributes) { if(att->name.value==name) { @@ -10442,7 +10442,7 @@ Linq To Xml Ptr XmlGetElement(XmlElement* element, const WString& name) { - FOREACH(Ptr, node, element->subNodes) + for (auto node : element->subNodes) { Ptr subElement=node.Cast(); if(subElement && subElement->name.value==name) @@ -10469,7 +10469,7 @@ Linq To Xml WString XmlGetValue(XmlElement* element) { WString result; - FOREACH(Ptr, node, element->subNodes) + for (auto node : element->subNodes) { if(Ptr text=node.Cast()) { diff --git a/Import/VlppReflection.cpp b/Import/VlppReflection.cpp index ee2f91e9..891bf655 100644 --- a/Import/VlppReflection.cpp +++ b/Import/VlppReflection.cpp @@ -1385,7 +1385,7 @@ GenericTypeInfo WString GenericTypeInfo::GetTypeFriendlyName() { WString result = elementType->GetTypeFriendlyName() + L"<"; - FOREACH_INDEXER(Ptr, type, i, genericArguments) + for (auto [type, i] : indexed(genericArguments)) { if (i>0) result += L", "; result += type->GetTypeFriendlyName(); @@ -3988,7 +3988,7 @@ MetaonlyTypeInfo default:; } WString result = elementType->GetTypeFriendlyName() + L"<"; - FOREACH_INDEXER(Ptr, type, i, genericArguments) + for (auto [type, i] : indexed(genericArguments)) { if (i > 0) result += L", "; result += type->GetTypeFriendlyName(); diff --git a/Import/VlppRegex.h b/Import/VlppRegex.h index 47cf41b9..bb159a09 100644 --- a/Import/VlppRegex.h +++ b/Import/VlppRegex.h @@ -94,7 +94,7 @@ Data Structure /// { /// Regex regex(L"^/.*?((?C/S+)(/.*?))+$"); /// auto match = regex.MatchHead(L"C++ and C# are my favorite programing languages"); - /// FOREACH(RegexString, capture, match->Captures()) + /// for (auto capture : match->Captures()) /// { /// Console::WriteLine(capture.Value()); /// } @@ -108,7 +108,7 @@ Data Structure /// { /// Regex regex(L"^/.*?((C/S+)(/.*?))+$"); /// auto match = regex.MatchHead(L"C++ and C# are my favorite programing languages"); - /// FOREACH(RegexString, capture, match->Groups().Get(L"lang")) + /// for (auto capture : match->Groups().Get(L"lang")) /// { /// Console::WriteLine(capture.Value()); /// } @@ -278,7 +278,7 @@ Regex /// Regex regex(L"C/S+"); /// RegexMatch::List matches; /// regex.Search(L"C++ and C# are my favorite programing languages", matches); - /// FOREACH(Ptr, match, matches) + /// for (auto match : matches) /// { /// Console::WriteLine(match->Result().Value()); /// } @@ -295,7 +295,7 @@ Regex /// Regex regex(L"C/S+"); /// RegexMatch::List matches; /// regex.Split(L"C++ and C# are my favorite programing languages", false, matches); - /// FOREACH(Ptr, match, matches) + /// for (auto match : matches) /// { /// Console::WriteLine(match->Result().Value()); /// } @@ -312,7 +312,7 @@ Regex /// Regex regex(L"C/S+"); /// RegexMatch::List matches; /// regex.Cut(L"C++ and C# are my favorite programing languages", false, matches); - /// FOREACH(Ptr, match, matches) + /// for (auto match : matches) /// { /// Console::WriteLine(match->Result().Value()); /// } @@ -567,7 +567,7 @@ Tokenizer /// RegexLexerColorizer colorizer = lexer.Colorize(); /// /// void* lastInterTokenState = nullptr; - /// FOREACH_INDEXER(const wchar_t*, line, index, From(lines)) + /// for (auto [line, index] : indexed(From(lines))) /// { /// Console::WriteLine(L"Begin line " + itow(index)); /// argument.processingText = line; @@ -625,7 +625,7 @@ Tokenizer /// WString input = L"I have 2 books."; /// auto tokenResult = lexer.Parse(input); /// - /// FOREACH(RegexToken, token, tokenResult) + /// for (auto token : tokenResult) /// { /// // input must be in a variable /// // because token.reading points to a position from input.Buffer(); @@ -668,7 +668,7 @@ Tokenizer /// List filtered; /// tokenResult.ReadToEnd(filtered, [](vint token) { return token < 0 || token == 2; }); /// - /// FOREACH(RegexToken, token, tokenResult) + /// for (auto token : tokenResult) /// { /// // input must be in a variable /// // because token.reading points to a position from input.Buffer(); @@ -825,7 +825,7 @@ Tokenizer /// RegexLexerWalker walker = lexer.Walk(); /// /// WString tests[] = { L".", L"2", L"2.", L"2.5", L"2.5." }; - /// FOREACH(WString, test, From(tests)) + /// for (auto test : From(tests)) /// { /// if (walker.IsClosedToken(test.Buffer(), test.Length())) /// { @@ -875,7 +875,7 @@ Tokenizer /// RegexLexerWalker walker = lexer.Walk(); /// /// WString tests[] = { L".", L"2", L"2.", L"2.5", L"2.5." }; - /// FOREACH(WString, test, From(tests)) + /// for (auto test : From(tests)) /// { /// if (walker.IsClosedToken(test)) /// { @@ -934,7 +934,7 @@ Tokenizer /// RegexLexer lexer(tokenDefs, proc); /// RegexLexerColorizer colorizer = lexer.Colorize(); /// - /// FOREACH_INDEXER(const wchar_t*, line, index, From(lines)) + /// /// for (auto [line, index] : indexed(From(lines))) /// { /// Console::WriteLine(L"Begin line " + itow(index)); /// argument.processingText = line; diff --git a/Import/VlppWorkflowCompiler.cpp b/Import/VlppWorkflowCompiler.cpp index 5ca97285..124ebe4a 100644 --- a/Import/VlppWorkflowCompiler.cpp +++ b/Import/VlppWorkflowCompiler.cpp @@ -42,7 +42,7 @@ CheckBaseClass void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -55,7 +55,7 @@ CheckBaseClass void Visit(WfNamespaceDeclaration* node)override { - FOREACH(Ptr, decl, node->declarations) + for (auto decl : node->declarations) { decl->Accept(this); } @@ -166,7 +166,7 @@ CheckBaseClass } } - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { memberDecl->Accept(this); } @@ -175,9 +175,9 @@ CheckBaseClass void Execute(vint _step) { step = _step; - FOREACH(Ptr, module, manager->GetModules()) + for (auto module : manager->GetModules()) { - FOREACH(Ptr, declaration, module->declarations) + for (auto declaration : module->declarations) { declaration->Accept(this); } @@ -452,7 +452,7 @@ WfLexicalScopeName void WfLexicalScopeName::RemoveNonTypeDescriptorNames(WfLexicalScopeManager* manager) { - FOREACH(Ptr, name, children.Values()) + for (auto name : children.Values()) { name->RemoveNonTypeDescriptorNames(manager); } @@ -787,7 +787,7 @@ WfLexicalScopeManager }while (0) EXIT_IF_ERRORS_EXIST; - FOREACH(Ptr, module, modules) + for (auto module : modules) { ContextFreeModuleDesugar(this, module); ValidateModuleStructure(this, module); @@ -795,7 +795,7 @@ WfLexicalScopeManager EXIT_IF_ERRORS_EXIST; BuildGlobalNameFromModules(this); - FOREACH(Ptr, module, modules) + for (auto module : modules) { BuildScopeForModule(this, module); } @@ -803,7 +803,7 @@ WfLexicalScopeManager CheckScopes_DuplicatedSymbol(this); EXIT_IF_ERRORS_EXIST; - FOREACH(Ptr, module, modules) + for (auto module : modules) { CompleteScopeForModule(this, module); } @@ -811,7 +811,7 @@ WfLexicalScopeManager CheckScopes_CycleDependency(this); EXIT_IF_ERRORS_EXIST; - FOREACH(Ptr, module, modules) + for (auto module : modules) { EXECUTE_CALLBACK(OnValidateModule(module)); ValidateModuleSemantic(this, module); @@ -974,7 +974,7 @@ WfLexicalScopeManager { if (scope->ownerNode.Cast()) { - FOREACH(Ptr, symbol, scope->symbols.GetByIndex(index)) + for (auto symbol : scope->symbols.GetByIndex(index)) { if (symbol->creatorNode.Cast()) { @@ -1000,7 +1000,7 @@ WfLexicalScopeManager } else { - FOREACH(Ptr, symbol, scope->symbols.GetByIndex(index)) + for (auto symbol : scope->symbols.GetByIndex(index)) { auto result = ResolveExpressionResult::Symbol(symbol); if (!results.Contains(result)) @@ -1056,13 +1056,13 @@ WfLexicalScopeManager if (auto module = scope->ownerNode.Cast()) { - FOREACH(Ptr, path, module->paths) + for (auto path : module->paths) { auto scopeName = globalName; - FOREACH(Ptr, item, path->items) + for (auto item : path->items) { WString fragmentName; - FOREACH(Ptr, fragment, item->fragments) + for (auto fragment : item->fragments) { fragmentName += UsingPathToNameVisitor::Execute(fragment, name); } @@ -1184,7 +1184,7 @@ BuildGlobalNameFromModules } AddCustomType(manager, scopeName, declaration, td); - FOREACH(Ptr, memberDecl, declaration->declarations) + for (auto memberDecl : declaration->declarations) { BuildClassMemberVisitor visitor(manager, scopeName, declaration, td); memberDecl->Accept(&visitor); @@ -1289,7 +1289,7 @@ BuildGlobalNameFromModules void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -1302,13 +1302,13 @@ BuildGlobalNameFromModules void Visit(WfStateMachineDeclaration* node)override { - FOREACH(Ptr, input, node->inputs) + for (auto input : node->inputs) { auto info = MakePtr(); td->AddMember(input->name.value, info); manager->stateInputMethods.Add(input, info); - FOREACH(Ptr, argument, input->arguments) + for (auto argument : input->arguments) { auto info = MakePtr(td.Obj(), L"name.value + L">" + argument->name.value); td->AddMember(info); @@ -1316,9 +1316,9 @@ BuildGlobalNameFromModules } } - FOREACH(Ptr, state, node->states) + for (auto state : node->states) { - FOREACH(Ptr, argument, state->arguments) + for (auto argument : state->arguments) { auto info = MakePtr(td.Obj(), L"name.value + L">" + argument->name.value); td->AddMember(info); @@ -1351,7 +1351,7 @@ BuildGlobalNameFromModules void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -1365,7 +1365,7 @@ BuildGlobalNameFromModules void Visit(WfNamespaceDeclaration* node)override { manager->namespaceNames.Add(node, scopeName); - FOREACH(Ptr, subDecl, node->declarations) + for (auto subDecl : node->declarations) { BuildNameForDeclaration(manager, scopeName, subDecl.Obj()); } @@ -1400,9 +1400,9 @@ BuildGlobalNameFromModules void BuildGlobalNameFromModules(WfLexicalScopeManager* manager) { - FOREACH(Ptr, module, manager->GetModules()) + for (auto module : manager->GetModules()) { - FOREACH(Ptr, decl, module->declarations) + for (auto decl : module->declarations) { BuildNameForDeclaration(manager, manager->globalName, decl.Obj()); } @@ -1505,7 +1505,7 @@ BuildScopeForDeclaration void Visit(Ptr scope, List>& attributes) { - FOREACH(Ptr, attribute, attributes) + for (auto attribute : attributes) { if (attribute->value) { @@ -1522,7 +1522,7 @@ BuildScopeForDeclaration parentScope->symbols.Add(symbol->name, symbol); resultScope = new WfLexicalScope(parentScope); - FOREACH(Ptr, declaration, node->declarations) + for (auto declaration : node->declarations) { BuildScopeForDeclaration(manager, resultScope, declaration, node); } @@ -1571,7 +1571,7 @@ BuildScopeForDeclaration { Ptr type = new WfFunctionType; type->result = node->returnType; - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { type->arguments.Add(argument->type); } @@ -1582,7 +1582,7 @@ BuildScopeForDeclaration if (node->statement) { - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { Ptr argumentSymbol = new WfLexicalSymbol(resultScope.Obj()); argumentSymbol->name = argument->name.value; @@ -1629,7 +1629,7 @@ BuildScopeForDeclaration { resultScope = new WfLexicalScope(parentScope); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { Ptr argumentSymbol = new WfLexicalSymbol(resultScope.Obj()); argumentSymbol->name = argument->name.value; @@ -1638,9 +1638,9 @@ BuildScopeForDeclaration resultScope->symbols.Add(argumentSymbol->name, argumentSymbol); } - FOREACH(Ptr, call, node->baseConstructorCalls) + for (auto call : node->baseConstructorCalls) { - FOREACH(Ptr, argument, call->arguments) + for (auto argument : call->arguments) { BuildScopeForExpression(manager, resultScope, argument); } @@ -1682,7 +1682,7 @@ BuildScopeForDeclaration auto td = manager->declarationTypes[node]; resultScope = new WfLexicalScope(parentScope); resultScope->typeOfThisExpr = td.Obj(); - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { BuildScopeForDeclaration(manager, resultScope, memberDecl, node); } @@ -1695,7 +1695,7 @@ BuildScopeForDeclaration symbol->creatorNode = node; parentScope->symbols.Add(symbol->name, symbol); - FOREACH(Ptr, item, node->items) + for (auto item : node->items) { Visit(parentScope, item->attributes); } @@ -1708,7 +1708,7 @@ BuildScopeForDeclaration symbol->creatorNode = node; parentScope->symbols.Add(symbol->name, symbol); - FOREACH(Ptr, member, node->members) + for (auto member : node->members) { Visit(parentScope, member->attributes); } @@ -1716,7 +1716,7 @@ BuildScopeForDeclaration void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { Execute(manager, parentScope, source, decl); } @@ -1729,7 +1729,7 @@ BuildScopeForDeclaration void Visit(WfStateMachineDeclaration* node)override { - FOREACH(Ptr, input, node->inputs) + for (auto input : node->inputs) { Ptr stateSymbol = new WfLexicalSymbol(parentScope.Obj()); stateSymbol->name = input->name.value; @@ -1737,7 +1737,7 @@ BuildScopeForDeclaration parentScope->symbols.Add(stateSymbol->name, stateSymbol); } - FOREACH(Ptr, state, node->states) + for (auto state : node->states) { Ptr stateSymbol = new WfLexicalSymbol(parentScope.Obj()); stateSymbol->name = state->name.value; @@ -1756,7 +1756,7 @@ BuildScopeForDeclaration stateScope->ownerNode = state; manager->nodeScopes.Add(state.Obj(), stateScope); - FOREACH(Ptr, argument, state->arguments) + for (auto argument : state->arguments) { Ptr argumentSymbol = new WfLexicalSymbol(stateScope.Obj()); argumentSymbol->name = argument->name.value; @@ -1903,7 +1903,7 @@ BuildScopeForStatement { resultScope = new WfLexicalScope(parentScope); - FOREACH(Ptr, statement, node->statements) + for (auto statement : node->statements) { BuildScopeForStatement(manager, resultScope, statement); } @@ -1931,7 +1931,7 @@ BuildScopeForStatement void Visit(WfSwitchStatement* node)override { BuildScopeForExpression(manager, parentScope, node->expression); - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { BuildScopeForExpression(manager, parentScope, switchCase->expression); BuildScopeForStatement(manager, parentScope, switchCase->statement); @@ -1996,7 +1996,7 @@ BuildScopeForStatement parentScope->symbols.Add(symbol->name, symbol); } - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { BuildScopeForExpression(manager, parentScope, argument); } @@ -2011,13 +2011,13 @@ BuildScopeForStatement { resultScope = new WfLexicalScope(parentScope); - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { auto caseScope = MakePtr(resultScope); caseScope->ownerNode = switchCase; manager->nodeScopes.Add(switchCase.Obj(), caseScope); - FOREACH(Ptr, argument, switchCase->arguments) + for (auto argument : switchCase->arguments) { Ptr symbol = new WfLexicalSymbol(caseScope.Obj()); symbol->name = argument->name.value; @@ -2031,7 +2031,7 @@ BuildScopeForStatement void Visit(WfStateInvokeStatement* node)override { - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { BuildScopeForExpression(manager, parentScope, argument); } @@ -2105,7 +2105,7 @@ BuildScopeForExpression config->thisAccessable = false; config->parentThisAccessable = true; - FOREACH(vint, name, names) + for (auto name : names) { Ptr symbol = new WfLexicalSymbol(resultScope.Obj()); symbol->name = L"$" + itow(name); @@ -2156,7 +2156,7 @@ BuildScopeForExpression void Visit(WfLetExpression* node)override { resultScope = new WfLexicalScope(parentScope); - FOREACH(Ptr, variable, node->variables) + for (auto variable : node->variables) { Ptr symbol = new WfLexicalSymbol(resultScope.Obj()); symbol->name = variable->name.value; @@ -2189,7 +2189,7 @@ BuildScopeForExpression void Visit(WfConstructorExpression* node)override { - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { BuildScopeForExpression(manager, parentScope, argument->key); if (argument->value) @@ -2244,7 +2244,7 @@ BuildScopeForExpression if (node->observeType == WfObserveType::SimpleObserve) { BuildScopeForExpression(manager, parentScope, node->expression); - FOREACH(Ptr, event, node->events) + for (auto event : node->events) { BuildScopeForExpression(manager, parentScope, event); } @@ -2260,7 +2260,7 @@ BuildScopeForExpression } BuildScopeForExpression(manager, resultScope, node->expression); - FOREACH(Ptr, event, node->events) + for (auto event : node->events) { BuildScopeForExpression(manager, resultScope, event); } @@ -2270,7 +2270,7 @@ BuildScopeForExpression void Visit(WfCallExpression* node)override { BuildScopeForExpression(manager, parentScope, node->function); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { BuildScopeForExpression(manager, parentScope, argument); } @@ -2284,7 +2284,7 @@ BuildScopeForExpression void Visit(WfNewClassExpression* node)override { - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { BuildScopeForExpression(manager, parentScope, argument); } @@ -2305,7 +2305,7 @@ BuildScopeForExpression void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -2328,7 +2328,7 @@ BuildScopeForExpression manager->CreateLambdaCapture(node, capture); CreateLambdaCaptureVisitor visitor(manager, capture); - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { memberDecl->Accept(&visitor); BuildScopeForDeclaration(manager, resultScope, memberDecl, node); @@ -2416,7 +2416,7 @@ BuildScope scope->ownerNode = module; manager->nodeScopes.Add(module.Obj(), scope); - FOREACH(Ptr, declaration, module->declarations) + for (auto declaration : module->declarations) { BuildScopeForDeclaration(manager, scope, declaration, module.Obj()); } @@ -2460,7 +2460,7 @@ CheckScopes_DuplicatedSymbol bool CheckScopes_DuplicatedSymbol(WfLexicalScopeManager* manager) { vint errorCount = manager->errors.Count(); - FOREACH(Ptr, scope, manager->nodeScopes.Values()) + for (auto scope : manager->nodeScopes.Values()) { if (!manager->checkedScopes_DuplicatedSymbol.Contains(scope.Obj())) { @@ -2475,7 +2475,7 @@ CheckScopes_DuplicatedSymbol { if (symbols.Count() > 1) { - FOREACH(Ptr, symbol, From(symbols)) + for (auto symbol : From(symbols)) { if (auto decl = symbol->creatorNode.Cast()) { @@ -2557,7 +2557,7 @@ CheckScopes_SymbolType bool CheckScopes_SymbolType(WfLexicalScopeManager* manager) { vint errorCount = manager->errors.Count(); - FOREACH(Ptr, scope, manager->nodeScopes.Values()) + for (auto scope : manager->nodeScopes.Values()) { if (!manager->checkedScopes_SymbolType.Contains(scope.Obj())) { @@ -2565,7 +2565,7 @@ CheckScopes_SymbolType for (vint i = 0; i < scope->symbols.Count(); i++) { - FOREACH(Ptr, symbol, scope->symbols.GetByIndex(i)) + for (auto symbol : scope->symbols.GetByIndex(i)) { if (symbol->type) { @@ -2635,7 +2635,7 @@ CompleteScopeForClassMember auto scope = manager->nodeScopes[node]; auto info = manager->declarationMemberInfos[node].Cast(); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { if (auto typeInfo = CreateTypeInfoFromType(scope.Obj(), argument->type)) { @@ -2669,7 +2669,7 @@ CompleteScopeForClassMember voidType->name = WfPredefinedTypeName::Void; type->result = voidType; } - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { type->arguments.Add(argument); } @@ -2707,7 +2707,7 @@ CompleteScopeForClassMember auto scope = manager->nodeScopes[node]; auto info = manager->declarationMemberInfos[node].Cast(); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { if (auto typeInfo = CreateTypeInfoFromType(scope.Obj(), argument->type)) { @@ -2738,7 +2738,7 @@ CompleteScopeForClassMember void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -2752,12 +2752,12 @@ CompleteScopeForClassMember void Visit(WfStateMachineDeclaration* node)override { auto scope = manager->nodeScopes[node]; - FOREACH(Ptr, input, node->inputs) + for (auto input : node->inputs) { auto method = manager->stateInputMethods[input.Obj()]; method->SetReturn(TypeInfoRetriver::CreateTypeInfo()); - FOREACH(Ptr, argument, input->arguments) + for (auto argument : input->arguments) { if (auto typeInfo = CreateTypeInfoFromType(scope.Obj(), argument->type)) { @@ -2769,9 +2769,9 @@ CompleteScopeForClassMember } } - FOREACH(Ptr, state, node->states) + for (auto state : node->states) { - FOREACH(Ptr, argument, state->arguments) + for (auto argument : state->arguments) { if (auto typeInfo = CreateTypeInfoFromType(scope.Obj(), argument->type)) { @@ -2814,7 +2814,7 @@ CompleteScopeForDeclaration void Visit(WfNamespaceDeclaration* node)override { - FOREACH(Ptr, decl, node->declarations) + for (auto decl : node->declarations) { CompleteScopeForDeclaration(manager, decl); } @@ -2851,7 +2851,7 @@ CompleteScopeForDeclaration if (node->baseTypes.Count() > 0) { - FOREACH(Ptr, baseType, node->baseTypes) + for (auto baseType : node->baseTypes) { if (auto scopeName = GetScopeNameFromReferenceType(scope->parentScope.Obj(), baseType)) { @@ -2897,7 +2897,7 @@ CompleteScopeForDeclaration } } - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { CompleteScopeForClassMember(manager, td, node, memberDecl); } @@ -2907,7 +2907,7 @@ CompleteScopeForDeclaration { auto td = manager->declarationTypes[node].Cast(); Dictionary items; - FOREACH(Ptr, item, node->items) + for (auto item : node->items) { vuint64_t value = 0; switch (item->kind) @@ -2916,7 +2916,7 @@ CompleteScopeForDeclaration TypedValueSerializerProvider::Deserialize(item->number.value, value); break; case WfEnumItemKind::Intersection: - FOREACH(Ptr, itemInt, item->intersections) + for (auto itemInt : item->intersections) { value |= items[itemInt->name.value]; } @@ -2931,7 +2931,7 @@ CompleteScopeForDeclaration { auto scope = manager->nodeScopes[node]; auto td = manager->declarationTypes[node].Cast(); - FOREACH(Ptr, member, node->members) + for (auto member : node->members) { if (auto typeInfo = CreateTypeInfoFromType(scope.Obj(), member->type)) { @@ -2944,7 +2944,7 @@ CompleteScopeForDeclaration void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -2953,7 +2953,7 @@ CompleteScopeForDeclaration void Visit(WfVirtualCseDeclaration* node)override { node->Accept((WfVirtualCseDeclaration::IVisitor*)this); - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -2986,7 +2986,7 @@ CompleteScope void CompleteScopeForModule(WfLexicalScopeManager* manager, Ptr module) { - FOREACH(Ptr, declaration, module->declarations) + for (auto declaration : module->declarations) { CompleteScopeForDeclaration(manager, declaration); } @@ -3196,7 +3196,7 @@ ContextFreeModuleDesugar } SetCodeRange(expression, { formatPos,formatPos,node->codeRange.codeIndex }, true); } - FOREACH(Ptr, originalError, errors) + for (auto originalError : errors) { auto error = WfErrors::WrongFormatStringSyntax(node); error->errorMessage += L" (" + originalError->errorMessage + L")"; @@ -3216,7 +3216,7 @@ ContextFreeModuleDesugar if (expressions.Count() > 0) { Ptr current = expressions[0]; - FOREACH(Ptr, expression, From(expressions).Skip(1)) + for (auto expression : From(expressions).Skip(1)) { Ptr binary = new WfBinaryExpression; binary->codeRange = node->codeRange; @@ -3427,7 +3427,7 @@ ContextFreeModuleDesugar } } - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { auto classMember = MakePtr(); decl->classMember = classMember; @@ -3803,7 +3803,7 @@ WfErrors Ptr WfErrors::CannotPickOverloadedFunctions(parsing::ParsingTreeCustomBase* node, collections::List& results) { WString description; - FOREACH_INDEXER(ResolveExpressionResult, result, index, results) + for (auto [result, index] : indexed(results)) { description += L"\r\n\t"; description += result.GetFriendlyName(); @@ -3982,7 +3982,7 @@ WfErrors Ptr WfErrors::CoProviderNotExists(WfCoProviderStatement* node, collections::List& candidates) { WString description; - FOREACH(WString, candidate, candidates) + for (auto candidate : candidates) { description += L"\r\n\t"; description += candidate; @@ -4030,7 +4030,7 @@ WfErrors else { WString description; - FOREACH(ITypeInfo*, type, types) + for (auto type : types) { description += L"\r\n\t"; description += type->GetTypeFriendlyName(); @@ -4163,7 +4163,7 @@ WfErrors Ptr WfErrors::CannotPickOverloadedInterfaceMethods(WfExpression* node, collections::List& results) { WString description; - FOREACH(ResolveExpressionResult, result, results) + for (auto result : results) { description += L"\r\n\t"; description += result.GetFriendlyName(); @@ -4239,7 +4239,7 @@ WfErrors Ptr WfErrors::StructRecursivelyIncludeItself(WfStructDeclaration* node, collections::List& tds) { WString description; - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { description += L"\r\n\t"; description += td->GetTypeName(); @@ -4300,7 +4300,7 @@ WfErrors Ptr WfErrors::TooManyTargets(parsing::ParsingTreeCustomBase* node, collections::List& results, const WString& name) { WString description; - FOREACH_INDEXER(ResolveExpressionResult, result, index, results) + for (auto [result, index] : indexed(results)) { description += L"\r\n\t"; description += result.GetFriendlyName(); @@ -4427,7 +4427,7 @@ WfErrors Ptr WfErrors::ClassRecursiveInheritance(WfClassDeclaration* node, collections::List& tds) { WString description; - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { description += L"\r\n\t"; description += td->GetTypeName(); @@ -4438,7 +4438,7 @@ WfErrors Ptr WfErrors::InterfaceRecursiveInheritance(WfClassDeclaration* node, collections::List& tds) { WString description; - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { description += L"\r\n\t"; description += td->GetTypeName(); @@ -4474,7 +4474,7 @@ WfErrors Ptr WfErrors::CppUnableToDecideClassOrder(WfClassDeclaration* node, collections::List& tds) { WString description; - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { description += L"\r\n\t"; description += td->GetTypeName(); @@ -4485,7 +4485,7 @@ WfErrors Ptr WfErrors::CppUnableToSeparateCustomFile(WfClassDeclaration* node, collections::List& tds) { WString description; - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { description += L"\r\n\t"; description += td->GetTypeName(); @@ -4566,7 +4566,7 @@ Copy(Type|Expression|Statement|Declaration) void Dispatch(WfVirtualCfeDeclaration* node)override { expanded = true; - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { Execute(decls, decl); } @@ -4575,7 +4575,7 @@ Copy(Type|Expression|Statement|Declaration) void Dispatch(WfVirtualCseDeclaration* node)override { expanded = true; - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { Execute(decls, decl); } @@ -4600,7 +4600,7 @@ Copy(Type|Expression|Statement|Declaration) CopyFrom(copied, decls); decls.Clear(); - FOREACH(Ptr, decl, copied) + for (auto decl : copied) { CopyDeclarationWithExpandVirtualVisitor::Execute(decls, decl); } @@ -4813,7 +4813,7 @@ CreateBindContext vint index = context.exprCauses.Keys().IndexOf(parent); if (index != -1) { - FOREACH(WfExpression*, observe, context.exprCauses.GetByIndex(index)) + for (auto observe : context.exprCauses.GetByIndex(index)) { context.observeAffects.Add(observe, expr); context.observeCauses.Add(expr, observe); @@ -4834,7 +4834,7 @@ CreateBindContext vint index = context.exprCauses.Keys().IndexOf(depended); if (index != -1) { - FOREACH(WfExpression*, observe, context.exprCauses.GetByIndex(index)) + for (auto observe : context.exprCauses.GetByIndex(index)) { context.exprCauses.Add(expr, observe); context.exprAffects.Add(observe, expr); @@ -4962,7 +4962,7 @@ CreateBindContext void Visit(WfLetExpression* node)override { - FOREACH(Ptr, var, node->variables) + for (auto var : node->variables) { DirectDepend(node, var->value.Obj()); } @@ -4993,7 +4993,7 @@ CreateBindContext auto result = manager->expressionResolvings[node]; bool isStruct = (result.type->GetTypeDescriptor()->GetTypeDescriptorFlags() == TypeDescriptorFlags::Struct); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { if (!isStruct) { @@ -5045,7 +5045,7 @@ CreateBindContext Call(node->parent.Obj()); ObservableDepend(node, node->parent.Obj()); Call(node->expression.Obj()); - FOREACH(Ptr, eventExpr, node->events) + for (auto eventExpr : node->events) { auto result = manager->expressionResolvings[eventExpr.Obj()]; context.observeEvents.Add(node, result.eventInfo); @@ -5056,7 +5056,7 @@ CreateBindContext void Visit(WfCallExpression* node)override { DirectDepend(node, node->function.Obj()); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { DirectDepend(node, argument.Obj()); } @@ -5069,7 +5069,7 @@ CreateBindContext void Visit(WfNewClassExpression* node)override { - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { DirectDepend(node, argument.Obj()); } @@ -5148,7 +5148,7 @@ ExpandObserveExpression void Visit(WfLetExpression* node)override { auto letExpr = MakePtr(); - FOREACH(Ptr, var, node->variables) + for (auto var : node->variables) { if (context.GetCachedExpressionIndexRecursively(var->value.Obj(), false) == -1) { @@ -5385,7 +5385,7 @@ CreateBindAttachStatement void CreateBindAttachStatement(Ptr block, WfLexicalScopeManager* manager, WfExpression* observe, BindContext& context, BindCallbackInfo& info) { - FOREACH(CallbackInfo, callbackInfo, info.observeCallbackInfos[observe]) + for (auto callbackInfo : info.observeCallbackInfos[observe]) { auto attach = MakePtr(); attach->event = ExpandObserveEvent(manager, observe, callbackInfo.eventIndex, context); @@ -5416,7 +5416,7 @@ CreateBindDetachStatement void CreateBindDetachStatement(Ptr block, WfLexicalScopeManager* manager, WfExpression* observe, BindContext& context, BindCallbackInfo& info) { - FOREACH(CallbackInfo, callbackInfo, info.observeCallbackInfos[observe]) + for (auto callbackInfo : info.observeCallbackInfos[observe]) { auto testNull = MakePtr(); testNull->expression = CreateReference(callbackInfo.handlerName); @@ -5541,7 +5541,7 @@ IValueSubscription::Open }) ); - FOREACH(WfExpression*, observe, context.orderedObserves) + for (auto observe : context.orderedObserves) { if (freeObserves.Contains(observe)) { @@ -5554,7 +5554,7 @@ IValueSubscription::Open } } - FOREACH(WfExpression*, observe, freeObserves) + for (auto observe : freeObserves) { observes.Remove(observe); } @@ -5562,7 +5562,7 @@ IValueSubscription::Open } } { - FOREACH(WfExpression*, observe, context.orderedObserves) + for (auto observe : context.orderedObserves) { CreateBindAttachStatement(ifBlock, manager, observe, context, info); } @@ -5694,7 +5694,7 @@ IValueSubscription::Close stat->expression = assign; ifBlock->statements.Add(stat); } - FOREACH(WfExpression*, observe, context.orderedObserves) + for (auto observe : context.orderedObserves) { CreateBindDetachStatement(ifBlock, manager, observe, context, info); } @@ -5777,7 +5777,7 @@ ExpandBindExpression }); }; - FOREACH_INDEXER(WfExpression*, parent, index, context.cachedExprs) + for (auto [parent, index] : indexed(context.cachedExprs)) { WString cacheName = context.GetCacheVariableName(index); { @@ -5786,10 +5786,10 @@ ExpandBindExpression } } - FOREACH_INDEXER(WfExpression*, observe, observeIndex, context.orderedObserves) + for (auto [observe, observeIndex] : indexed(context.orderedObserves)) { const auto& events = context.observeEvents[observe]; - FOREACH_INDEXER(IEventInfo*, ev, eventIndex, events) + for (auto [ev, eventIndex] : indexed(events)) { WString handlerName = L"" + itow(observeIndex) + L"_" + itow(eventIndex); { @@ -5844,9 +5844,9 @@ ExpandBindExpression newSubscription->declarations.Add(AssignNormalMember(func)); } - FOREACH(WfExpression*, observe, context.orderedObserves) + for (auto observe : context.orderedObserves) { - FOREACH(CallbackInfo, callbackInfo, bcInfo.observeCallbackInfos[observe]) + for (auto callbackInfo : bcInfo.observeCallbackInfos[observe]) { auto func = MakePtr(); func->name.value = callbackInfo.callbackName; @@ -5874,7 +5874,7 @@ ExpandBindExpression vint dependencyIndex = context.observeAffects.Keys().IndexOf(current); if (dependencyIndex != -1) { - FOREACH(WfExpression*, affectedObserve, context.observeAffects.GetByIndex(dependencyIndex)) + for (auto affectedObserve : context.observeAffects.GetByIndex(dependencyIndex)) { if (affectedObserve && !affected.Contains(affectedObserve)) { @@ -5885,13 +5885,13 @@ ExpandBindExpression } affected.Remove(observe); - FOREACH(WfExpression*, affectedObserve, From(affected).Reverse()) + for (auto affectedObserve : From(affected).Reverse()) { CreateBindDetachStatement(block, manager, affectedObserve, context, bcInfo); } { SortedList assignedParents; - FOREACH(WfExpression*, affectedObserve, affected) + for (auto affectedObserve : affected) { auto parent = context.GetCachedExpressionIndexRecursively(context.observeParents[affectedObserve], true); if (!assignedParents.Contains(parent)) @@ -5901,7 +5901,7 @@ ExpandBindExpression } } } - FOREACH(WfExpression*, affectedObserve, affected) + for (auto affectedObserve : affected) { CreateBindAttachStatement(block, manager, affectedObserve, context, bcInfo); } @@ -6201,7 +6201,7 @@ FindCoroutineAwaredStatements void Visit(WfBlockStatement* node)override { bool result = false; - FOREACH(Ptr, stat, node->statements) + for (auto stat : node->statements) { bool a = Call(stat); result |= a; @@ -6283,7 +6283,7 @@ FindCoroutineAwaredVariables void Visit(WfBlockStatement* node)override { FindCoroutineAwaredVariableVisitor visitor(awaredVariables); - FOREACH(Ptr, stat, node->statements) + for (auto stat : node->statements) { stat->Accept(&visitor); } @@ -6318,7 +6318,7 @@ FindCoroutineReferenceRenaming } }; - FOREACH(WfVariableStatement*, stat, awaredVariables) + for (auto stat : awaredVariables) { auto scope = manager->nodeScopes[stat]; auto symbol = scope->symbols[stat->variable->name.value][0]; @@ -6326,7 +6326,7 @@ FindCoroutineReferenceRenaming referenceRenaming.Add(symbol.Obj(), name); } - FOREACH(WfStatement*, stat, awaredStatements) + for (auto stat : awaredStatements) { if (auto tryStat = dynamic_cast(stat)) { @@ -6873,7 +6873,7 @@ GenerateFlowChart resultHead = flowChart->EnsureAppendStatement(headNode, catchNode); resultLast = resultHead; - FOREACH_INDEXER(Ptr, stat, index, node->statements) + for (auto [stat, index] : indexed(node->statements)) { auto pair = Execute(resultLast, catchNode, scopeContext, stat); resultLast = pair.value; @@ -6892,7 +6892,7 @@ GenerateFlowChart blockContext.enterNode = resultHead; blockContext.leaveNode = blockEnd; - FOREACH_INDEXER(Ptr, stat, index, node->statements) + for (auto [stat, index] : indexed(node->statements)) { auto pair = Execute(resultLast, catchNode, &blockContext, stat); resultLast = pair.value; @@ -7012,7 +7012,7 @@ RemoveUnnecessaryNodes const auto& keys = enterCounts.Keys(); auto& values = const_cast::ValueContainer&>(enterCounts.Values()); - FOREACH(Ptr, node, flowChart->nodes) + for (auto node : flowChart->nodes) { enterCounts.Add(node.Obj(), 0); } @@ -7027,12 +7027,12 @@ RemoveUnnecessaryNodes } }; - FOREACH(Ptr, node, flowChart->nodes) + for (auto node : flowChart->nodes) { Inc(node->destination); Inc(node->exceptionDestination); Inc(node->pauseDestination); - FOREACH(Ptr, branch, node->branches) + for (auto branch : node->branches) { Inc(branch->destination); } @@ -7046,7 +7046,7 @@ RemoveUnnecessaryNodes SortedList mergableNodes; List> keepingNodes; - FOREACH(Ptr, node, flowChart->nodes) + for (auto node : flowChart->nodes) { bool mergable = false; @@ -7073,7 +7073,7 @@ RemoveUnnecessaryNodes } Dictionary merging; - FOREACH(FlowChartNode*, node, mergableNodes) + for (auto node : mergableNodes) { auto current = node; while (mergableNodes.Contains(current)) @@ -7107,14 +7107,14 @@ RemoveUnnecessaryNodes if (index != -1) DESTINATION = merging.Values()[index];\ }\ - FOREACH(Ptr, node, flowChart->nodes) + for (auto node : flowChart->nodes) { if (!mergableNodes.Contains(node.Obj())) { MERGE_FLOW_CHART_NODE(node->destination); MERGE_FLOW_CHART_NODE(node->exceptionDestination); MERGE_FLOW_CHART_NODE(node->pauseDestination); - FOREACH(Ptr, branch, node->branches) + for (auto branch : node->branches) { MERGE_FLOW_CHART_NODE(branch->destination); } @@ -7139,7 +7139,7 @@ RemoveUnnecessaryNodes { RemoveUnnecessaryNodesPass(flowChart); - FOREACH(Ptr, node, flowChart->nodes) + for (auto node : flowChart->nodes) { if (node->pauseDestination && node->statements.Count() > 0 && node->statements[node->statements.Count() - 1].Cast()) { @@ -7149,9 +7149,9 @@ RemoveUnnecessaryNodes Dictionary enterCounts; CalculateEnterCounts(flowChart, enterCounts); - FOREACH(Ptr, node, flowChart->nodes) + for (auto node : flowChart->nodes) { - FOREACH(Ptr, branch, node->branches) + for (auto branch : node->branches) { if (enterCounts[branch->destination] == 1) { @@ -7314,7 +7314,7 @@ ExpandFlowChartNode } bool exited = false; - FOREACH(Ptr, stat, flowChartNode->statements) + for (auto stat : flowChartNode->statements) { if (stat.Cast()) { @@ -7347,7 +7347,7 @@ ExpandFlowChartNode } } - FOREACH(Ptr, branch, flowChartNode->branches) + for (auto branch : flowChartNode->branches) { Ptr trueBlock; @@ -7414,7 +7414,7 @@ ExpandNewCoroutineExpression Dictionary referenceRenaming; FindCoroutineAwaredStatements(node->statement, awaredStatements); - FOREACH(WfStatement*, stat, awaredStatements) + for (auto stat : awaredStatements) { FindCoroutineAwaredVariables(stat, awaredVariables); } @@ -7444,12 +7444,11 @@ ExpandNewCoroutineExpression // Coroutine Awared Variables ///////////////////////////////////////////////////////////////////////////// - FOREACH(WfLexicalSymbol*, symbol, - From(referenceRenaming.Keys()) - .OrderBy([&](WfLexicalSymbol* a, WfLexicalSymbol* b) - { - return WString::Compare(referenceRenaming[a], referenceRenaming[b]); - })) + for (auto symbol : From(referenceRenaming.Keys()) + .OrderBy([&](WfLexicalSymbol* a, WfLexicalSymbol* b) + { + return WString::Compare(referenceRenaming[a], referenceRenaming[b]); + })) { auto varDecl = MakePtr(); newExpr->declarations.Add(varDecl); @@ -7718,7 +7717,7 @@ ExpandNewCoroutineExpression return nodeOrders.IndexOf(p1.key) - nodeOrders.IndexOf(p2.key); }); - FOREACH(GroupPair, group, nodeByCatches) + for (auto group : nodeByCatches) { auto catchNode = group.key; if (!catchNode) continue; @@ -7726,7 +7725,7 @@ ExpandNewCoroutineExpression Ptr condition; { List> conditionRanges; - FOREACH(FlowChartNode*, flowChartNode, group.value) + for (auto flowChartNode : group.value) { vint state = nodeOrders.IndexOf(flowChartNode); if (conditionRanges.Count() == 0) @@ -7885,7 +7884,7 @@ ExpandNewCoroutineExpression return nodeOrders.IndexOf(p1.key) - nodeOrders.IndexOf(p2.key); }); - FOREACH(GroupPair, group, nodeByCatches) + for (auto group : nodeByCatches) { auto catchNode = group.key; auto groupBlock = whileBlock; @@ -7894,7 +7893,7 @@ ExpandNewCoroutineExpression groupBlock = ExpandExceptionDestination(catchNode, referenceRenaming, nodeOrders, whileBlock); } - FOREACH(FlowChartNode*, flowChartNode, group.value) + for (auto flowChartNode : group.value) { ///////////////////////////////////////////////////////////////////////////// // if ( == THE_CURRENT_STATE) { ... } @@ -8177,13 +8176,13 @@ ExpandStateMachineStatementVisitor } block->statements.Add(switchStat); - FOREACH(Ptr, stateSwitchCase, node->caseBranches) + for (auto stateSwitchCase : node->caseBranches) { Ptr input; Ptr caseBlock; GenerateStateSwitchCase(stateSwitchCase->name.value, smcScope, switchStat, input, caseBlock); - FOREACH_INDEXER(Ptr, argument, index, stateSwitchCase->arguments) + for (auto [argument, index] : indexed(stateSwitchCase->arguments)) { auto refThis = MakePtr(); refThis->name.value = L"stateMachineObject"; @@ -8212,7 +8211,7 @@ ExpandStateMachineStatementVisitor From(node->caseBranches) .Select([](Ptr switchCase) {return switchCase->name.value; }) ); - FOREACH(WString, inputName, invalidInputs) + for (auto inputName : invalidInputs) { Ptr input; Ptr caseBlock; @@ -8284,7 +8283,7 @@ ExpandStateMachineStatementVisitor auto block = MakePtr(); - FOREACH_INDEXER(Ptr, argument, index, stateDecl->arguments) + for (auto [argument, index] : indexed(stateDecl->arguments)) { auto refThis = MakePtr(); refThis->name.value = L"stateMachineObject"; @@ -8370,11 +8369,11 @@ ExpandStateMachine { auto& smInfo = manager->stateMachineInfos[node]; - FOREACH(Ptr, input, node->inputs) + for (auto input : node->inputs) { smInfo->inputIds.Add(input->name.value, smInfo->inputIds.Count()); - FOREACH(Ptr, argument, input->arguments) + for (auto argument : input->arguments) { // var NAME = ; auto fieldInfo = manager->stateInputArguments[argument.Obj()]; @@ -8399,14 +8398,14 @@ ExpandStateMachine } smInfo->stateIds.Add(L"", 0); - FOREACH(Ptr, state, node->states) + for (auto state : node->states) { if (state->name.value != L"") { smInfo->stateIds.Add(state->name.value, smInfo->stateIds.Count()); } - FOREACH(Ptr, argument, state->arguments) + for (auto argument : state->arguments) { // var NAME = ; auto fieldInfo = manager->stateDeclArguments[argument.Obj()]; @@ -8430,7 +8429,7 @@ ExpandStateMachine } } - FOREACH(Ptr, input, node->inputs) + for (auto input : node->inputs) { auto methodInfo = manager->stateInputMethods[input.Obj()]; @@ -8439,7 +8438,7 @@ ExpandStateMachine funcDecl->anonymity = WfFunctionAnonymity::Named; funcDecl->name.value = methodInfo->GetName(); funcDecl->returnType = GetTypeFromTypeInfo(methodInfo->GetReturn()); - FOREACH_INDEXER(Ptr, argument, index, input->arguments) + for (auto [argument, index] : indexed(input->arguments)) { auto funcArgument = MakePtr(); funcArgument->name.value = argument->name.value; @@ -8541,7 +8540,7 @@ ExpandStateMachine exprStat->expression = assignExpr; block->statements.Add(exprStat); } - FOREACH_INDEXER(Ptr, argument, index, input->arguments) + for (auto [argument, index] : indexed(input->arguments)) { // this.NAME = NAME; auto refField = MakePtr(); @@ -8733,7 +8732,7 @@ ExpandStateMachine switchStat->expression = refCurrentState; whileBlock->statements.Add(switchStat); - FOREACH(Ptr, state, node->states) + for (auto state : node->states) { auto switchCase = MakePtr(); switchStat->caseBranches.Add(switchCase); @@ -8745,7 +8744,7 @@ ExpandStateMachine auto caseBlock = MakePtr(); switchCase->statement = caseBlock; - FOREACH(Ptr, argument, state->arguments) + for (auto argument : state->arguments) { auto refThis = MakePtr(); refThis->name.value = L"stateMachineObject"; @@ -8841,7 +8840,7 @@ ExpandSwitchStatement Ptr rootIfStat; auto tailIfStat = &rootIfStat; - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { auto ifStat = MakePtr(); *tailIfStat = ifStat; @@ -9249,7 +9248,7 @@ ExpandCoProviderStatement auto callExpr = MakePtr(); callExpr->function = funcExpr; callExpr->arguments.Add(refImpl); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { callExpr->arguments.Add(CreateField(argument)); } @@ -9361,7 +9360,7 @@ ExpandCoProviderStatement { auto block = MakePtr(); - FOREACH(Ptr, statement, node->statements) + for (auto statement : node->statements) { statement = SearchUntilNonVirtualStatement(statement); @@ -9587,7 +9586,7 @@ IsExpressionDependOnExpectedType(Expression) bool unresolvableField = false; auto scope = manager->nodeScopes[node].Obj(); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { if (argument->value) { @@ -9852,7 +9851,7 @@ GetExpressionFromTypeDescriptor GetTypeFragments(typeDescriptor, fragments); Ptr parentExpr; - FOREACH(WString, fragment, fragments) + for (auto fragment : fragments) { if (!parentExpr) { @@ -9925,7 +9924,7 @@ GetTypeFromTypeInfo GetTypeFragments(typeInfo->GetTypeDescriptor(), fragments); Ptr parentType; - FOREACH(WString, fragment, fragments) + for (auto fragment : fragments) { if (!parentType) { @@ -10486,7 +10485,7 @@ CreateTypeInfoFromType auto enumerableTypeInfo = MakePtr(description::GetTypeDescriptor(), TypeInfoHint::Normal); auto genericTypeInfo = MakePtr(enumerableTypeInfo); genericTypeInfo->AddGenericArgument(returnType); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { if (Ptr argumentType = Call(argument.Obj(), true)) { @@ -10980,7 +10979,7 @@ ValidateScopeName void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -11000,12 +10999,12 @@ ValidateScopeName void ValidateScopeName(WfLexicalScopeManager* manager, Ptr name) { ValidateScopeNameDeclarationVisitor visitor(manager, name); - FOREACH(Ptr, declaration, name->declarations) + for (auto declaration : name->declarations) { declaration->Accept(&visitor); } - FOREACH(Ptr, child, name->children.Values()) + for (auto child : name->children.Values()) { ValidateScopeName(manager, child); } @@ -11080,7 +11079,7 @@ Helper Functions List resolvables; List> types; - FOREACH(Ptr, argument, arguments) + for (auto argument : arguments) { if (!argument || IsExpressionDependOnExpectedType(manager, argument)) { @@ -11234,7 +11233,7 @@ ValidateSemantic void ValidateModuleSemantic(WfLexicalScopeManager* manager, Ptr module) { - FOREACH(Ptr, declaration, module->declarations) + for (auto declaration : module->declarations) { ValidateDeclarationSemantic(manager, declaration); } @@ -11362,7 +11361,7 @@ GetExpressionTypes if (results.Count() == 0) { - FOREACH(Ptr, type, failedTypes) + for (auto type : failedTypes) { manager->errors.Add(WfErrors::ExpressionCannotImplicitlyConvertToType(expression.Obj(), type.Obj(), expectedType.Obj())); } @@ -11581,7 +11580,7 @@ ValidateSemantic(ClassMember) } } - FOREACH(Ptr, call, node->baseConstructorCalls) + for (auto call : node->baseConstructorCalls) { if (auto scopeName = GetScopeNameFromReferenceType(classScope, call->type)) { @@ -11699,7 +11698,7 @@ ValidateSemantic(Declaration) void Visit(List>& attributes) { - FOREACH(Ptr, attribute, attributes) + for (auto attribute : attributes) { auto key = Pair(attribute->category.value, attribute->name.value); vint index = manager->attributes.Keys().IndexOf(key); @@ -11724,7 +11723,7 @@ ValidateSemantic(Declaration) void Visit(WfNamespaceDeclaration* node)override { - FOREACH(Ptr, declaration, node->declarations) + for (auto declaration : node->declarations) { ValidateDeclarationSemantic(manager, declaration); } @@ -11736,7 +11735,7 @@ ValidateSemantic(Declaration) { ValidateStatementSemantic(manager, node->statement); } - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { Visit(argument->attributes); } @@ -11776,7 +11775,7 @@ ValidateSemantic(Declaration) if (node->kind == WfClassKind::Interface) { - FOREACH(Ptr, baseType, node->baseTypes) + for (auto baseType : node->baseTypes) { auto scopeName = GetScopeNameFromReferenceType(scope->parentScope.Obj(), baseType); auto baseTd = scopeName->typeDescriptor; @@ -11806,7 +11805,7 @@ ValidateSemantic(Declaration) } } - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { ValidateClassMemberSemantic(manager, td, node, memberDecl); } @@ -11814,7 +11813,7 @@ ValidateSemantic(Declaration) void Visit(WfEnumDeclaration* node)override { - FOREACH(Ptr, item, node->items) + for (auto item : node->items) { Visit(item->attributes); } @@ -11824,7 +11823,7 @@ ValidateSemantic(Declaration) { auto scope = manager->nodeScopes[node]; auto td = manager->declarationTypes[node].Cast(); - FOREACH(Ptr, member, node->members) + for (auto member : node->members) { auto memberTd = td->GetPropertyByName(member->name.value, false)->GetReturn()->GetTypeDescriptor(); if ((memberTd->GetTypeDescriptorFlags() & TypeDescriptorFlags::ReferenceType) != TypeDescriptorFlags::Undefined) @@ -11833,7 +11832,7 @@ ValidateSemantic(Declaration) } } - FOREACH(Ptr, member, node->members) + for (auto member : node->members) { Visit(member->attributes); } @@ -11841,7 +11840,7 @@ ValidateSemantic(Declaration) void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { ValidateDeclarationSemantic(manager, decl); } @@ -11858,7 +11857,7 @@ ValidateSemantic(Declaration) ExpandVirtualDeclarationVisitor visitor(manager); node->Accept(&visitor); - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { SetCodeRange(decl, node->codeRange); } @@ -11869,11 +11868,11 @@ ValidateSemantic(Declaration) parentScope = parentScope->parentScope; } - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { ContextFreeDeclarationDesugar(manager, decl); } - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { BuildScopeForDeclaration(manager, parentScope, decl, manager->declaractionScopeSources[node]); } @@ -11886,7 +11885,7 @@ ValidateSemantic(Declaration) } } - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { ValidateDeclarationSemantic(manager, decl); } @@ -11896,7 +11895,7 @@ ValidateSemantic(Declaration) { bool foundDefaultState = false; - FOREACH(Ptr, state, node->states) + for (auto state : node->states) { if (state->name.value == L"") { @@ -12229,7 +12228,7 @@ ValidateSemantic(Expression) { if (nameResults.Count() > 0) { - FOREACH(ResolveExpressionResult, result, nameResults) + for (auto result : nameResults) { manager->errors.Add(WfErrors::ExpressionCannotResolveType(node, result.symbol)); } @@ -12265,7 +12264,7 @@ ValidateSemantic(Expression) } ResolveName(node, node->name.value); - FOREACH(ResolveExpressionResult, result, results) + for (auto result : results) { ITypeDescriptor* td = nullptr; if (result.methodInfo) @@ -12377,7 +12376,7 @@ ValidateSemantic(Expression) } Ptr resultType = type->GetGenericArgument(0); - FOREACH_INDEXER(Ptr, symbol, index, parameterSymbols) + for (auto [symbol, index] : indexed(parameterSymbols)) { symbol->typeInfo = type->GetGenericArgument(index + 1); symbol->type = GetTypeFromTypeInfo(symbol->typeInfo.Obj()); @@ -12440,7 +12439,7 @@ ValidateSemantic(Expression) if (results.Count() > 0) { - FOREACH(ResolveExpressionResult, result, results) + for (auto result : results) { if (result.methodInfo) { @@ -12949,7 +12948,7 @@ ValidateSemantic(Expression) { auto scope = manager->nodeScopes[node].Obj(); - FOREACH(Ptr, variable, node->variables) + for (auto variable : node->variables) { auto symbol = scope->symbols[variable->name.value][0]; symbol->typeInfo = GetExpressionType(manager, variable->value, 0); @@ -13113,7 +13112,7 @@ ValidateSemantic(Expression) if (expectedType && expectedType->GetTypeDescriptor()->GetTypeDescriptorFlags() == TypeDescriptorFlags::Struct) { SortedList fields; - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { if (!argument->value) { @@ -13198,7 +13197,7 @@ ValidateSemantic(Expression) bool map = node->arguments[0]->value; Ptr keyType, valueType; - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { { Ptr newKeyType = GetExpressionType(manager, argument->key, expectedKeyType); @@ -13400,7 +13399,7 @@ ValidateSemantic(Expression) } else { - FOREACH(Ptr, eventExpr, node->events) + for (auto eventExpr : node->events) { auto ref = eventExpr.Cast(); IEventInfo* info = td->GetEventByName(ref->name.value, true); @@ -13423,7 +13422,7 @@ ValidateSemantic(Expression) symbol->type = GetTypeFromTypeInfo(parentType.Obj()); observeeType = GetExpressionType(manager, node->expression, 0); - FOREACH(Ptr, eventExpr, node->events) + for (auto eventExpr : node->events) { GetExpressionEventInfo(manager, eventExpr); } @@ -13458,7 +13457,7 @@ ValidateSemantic(Expression) auto classType = MakePtr(description::GetTypeDescriptor(), TypeInfoHint::Normal); auto genericType = MakePtr(classType); genericType->AddGenericArgument(CreateTypeInfoFromType(scope, node->function->returnType)); - FOREACH(Ptr, argument, node->function->arguments) + for (auto argument : node->function->arguments) { genericType->AddGenericArgument(scope->symbols[argument->name.value][0]->typeInfo); } @@ -13494,7 +13493,7 @@ ValidateSemantic(Expression) void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -13528,7 +13527,7 @@ ValidateSemantic(Expression) void Execute(WfNewInterfaceExpression* node) { - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { memberDecl->Accept(this); ValidateDeclarationSemantic(manager, memberDecl); @@ -13635,7 +13634,7 @@ ValidateSemantic(Expression) if (declVisitor.lastFunction) { - FOREACH(Ptr, func, declVisitor.overrideFunctions) + for (auto func : declVisitor.overrideFunctions) { implementMethods.Add(func->name.value, func); } @@ -13687,14 +13686,14 @@ ValidateSemantic(Expression) auto discardFirst = [=](const WString& key, const List& methods) { - FOREACH(IMethodInfo*, method, methods) + for (auto method : methods) { manager->errors.Add(WfErrors::InterfaceMethodNotImplemented(node, method)); } }; auto discardSecond = [=](const WString& key, const List>& methods) { - FOREACH(Ptr, decl, methods) + for (auto decl : methods) { Ptr declType = GetFunctionDeclarationType(scope, decl); manager->errors.Add(WfErrors::InterfaceMethodNotFound(decl.Obj(), type.Obj(), declType.Obj())); @@ -13711,13 +13710,13 @@ ValidateSemantic(Expression) Group typedInterfaceMethods; Group> typedImplementMethods; - FOREACH(IMethodInfo*, method, interfaces) + for (auto method : interfaces) { Ptr methodType = CreateTypeInfoFromMethodInfo(method); typedInterfaceMethods.Add(methodType->GetTypeFriendlyName(), method); } - FOREACH(Ptr, decl, implements) + for (auto decl : implements) { Ptr methodType = GetFunctionDeclarationType(scope, decl); typedImplementMethods.Add(methodType->GetTypeFriendlyName(), decl); @@ -13733,7 +13732,7 @@ ValidateSemantic(Expression) if (interfaces.Count() > 1) { List functions; - FOREACH(IMethodInfo*, method, interfaces) + for (auto method : interfaces) { functions.Add(ResolveExpressionResult::Constructor(method)); manager->errors.Add(WfErrors::CannotPickOverloadedInterfaceMethods(node, functions)); @@ -14046,7 +14045,7 @@ IsConstantExpression auto result = manager->expressionResolvings[node]; bool isStruct = (result.type->GetTypeDescriptor()->GetTypeDescriptorFlags() == TypeDescriptorFlags::Struct); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { if (argument->key && !isStruct) { @@ -14099,7 +14098,7 @@ ValidateSemantic if (result.scopeName && result.scopeName->declarations.Count() > 0) { List replaces; - FOREACH(Ptr, decl, result.scopeName->declarations) + for (auto decl : result.scopeName->declarations) { vint index = manager->nodeScopes.Keys().IndexOf(decl.Obj()); if (index == -1) continue; @@ -14111,7 +14110,7 @@ ValidateSemantic index = scope->symbols.Keys().IndexOf(decl->name.value); if (index == -1) continue; - FOREACH(Ptr, symbol, scope->symbols.GetByIndex(index)) + for (auto symbol : scope->symbols.GetByIndex(index)) { if (symbol->creatorNode == decl && symbol->typeInfo) { @@ -14123,7 +14122,7 @@ ValidateSemantic if (replaces.Count() > 0) { results.RemoveAt(i); - FOREACH_INDEXER(ResolveExpressionResult, replaceResult, index, replaces) + for (auto [replaceResult, index] : indexed(replaces)) { results.Insert(i + index, replaceResult); } @@ -14368,7 +14367,7 @@ ValidateSemantic(Statement) void Visit(WfBlockStatement* node)override { - FOREACH(Ptr, statement, node->statements) + for (auto statement : node->statements) { ValidateStatementSemantic(manager, statement); } @@ -14448,7 +14447,7 @@ ValidateSemantic(Statement) void Visit(WfSwitchStatement* node)override { Ptr type = GetExpressionType(manager, node->expression, 0); - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { Ptr caseType; if (IsExpressionDependOnExpectedType(manager, switchCase->expression)) @@ -14738,7 +14737,7 @@ ValidateSemantic(Statement) } List functions; - FOREACH(IMethodGroupInfo*, group, groups) + for (auto group : groups) { vint count = group->GetMethodCount(); for (vint i = 0; i < count; i++) @@ -14774,7 +14773,7 @@ ValidateSemantic(Statement) auto symbol = scope->symbols[node->varName.value][0]; List types; - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { vint index = manager->expressionResolvings.Keys().IndexOf(argument.Obj()); if (index != -1) @@ -14829,7 +14828,7 @@ ValidateSemantic(Statement) auto smcScope = manager->nodeScopes[node]->FindFunctionScope()->parentScope.Obj(); CHECK_ERROR(smcScope->ownerNode.Cast(), L"ValidateSemanticStatementVisitor::Visit(WfStateSwitchStatement*)#ValidateStatementStructure should check state machine statements' location."); - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { auto caseScope = manager->nodeScopes[switchCase.Obj()].Obj(); Ptr inputSymbol; @@ -14854,7 +14853,7 @@ ValidateSemantic(Statement) } else { - FOREACH_INDEXER(Ptr, argument, index, switchCase->arguments) + for (auto [argument, index] : indexed(switchCase->arguments)) { auto argumentSymbol = caseScope->symbols[argument->name.value][0]; argumentSymbol->typeInfo = CopyTypeInfo(inputMethod->GetParameter(index)->GetType()); @@ -14894,7 +14893,7 @@ ValidateSemantic(Statement) else { auto stateScope = manager->nodeScopes[stateDecl.Obj()]; - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { auto typeInfo = stateScope->symbols[stateDecl->arguments[index]->name.value][0]->typeInfo; GetExpressionType(manager, argument, typeInfo); @@ -14955,12 +14954,12 @@ ValidateStructure void ValidateModuleStructure(WfLexicalScopeManager* manager, Ptr module) { - FOREACH(Ptr, path, module->paths) + for (auto path : module->paths) { - FOREACH_INDEXER(Ptr, item, index, path->items) + for (auto [item, index] : indexed(path->items)) { vint counter = 0; - FOREACH(Ptr, fragment, item->fragments) + for (auto fragment : item->fragments) { if (fragment.Cast()) { @@ -15125,7 +15124,7 @@ ValidateStructure(Declaration) ValidateTypeStructure(manager, node->returnType, ValidateTypeStragety::ReturnType); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { ValidateTypeStructure(manager, argument->type); } @@ -15178,7 +15177,7 @@ ValidateStructure(Declaration) break; } - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { ValidateTypeStructure(manager, argument); } @@ -15217,7 +15216,7 @@ ValidateStructure(Declaration) void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { Execute(decl); } @@ -15289,7 +15288,7 @@ ValidateStructure(Declaration) ValidateTypeStructure(manager, node->type); FindPropertyRelatedDeclVisitor visitor(manager, classDecl, node); - FOREACH(Ptr, memberDecl, classDecl->declarations) + for (auto memberDecl : classDecl->declarations) { visitor.Execute(memberDecl); } @@ -15338,10 +15337,10 @@ ValidateStructure(Declaration) manager->errors.Add(WfErrors::WrongDeclaration(node)); } - FOREACH(Ptr, call, node->baseConstructorCalls) + for (auto call : node->baseConstructorCalls) { ValidateTypeStructure(manager, call->type, ValidateTypeStragety::BaseType, classDecl); - FOREACH(Ptr, argument, call->arguments) + for (auto argument : call->arguments) { ValidateStructureContext context; ValidateExpressionStructure(manager, &context, argument); @@ -15395,7 +15394,7 @@ ValidateStructure(Declaration) void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -15429,7 +15428,7 @@ ValidateStructure(Declaration) void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -15482,7 +15481,7 @@ ValidateStructure(Declaration) } { FindCtorVisitor visitor; - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { memberDecl->Accept(&visitor); } @@ -15508,7 +15507,7 @@ ValidateStructure(Declaration) break; } - FOREACH(Ptr, type, node->baseTypes) + for (auto type : node->baseTypes) { ValidateTypeStructure(manager, type, ValidateTypeStragety::BaseType, node); } @@ -15516,7 +15515,7 @@ ValidateStructure(Declaration) { TooManyDtorVisitor visitor(manager, node); bool hasStateMachine = false; - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { if (auto smDecl = memberDecl.Cast()) { @@ -15557,7 +15556,7 @@ ValidateStructure(Declaration) vuint64_t current = 0; bool reportedNotConsecutive = false; SortedList discoveredItems; - FOREACH(Ptr, item, node->items) + for (auto item : node->items) { switch (item->kind) { @@ -15590,7 +15589,7 @@ ValidateStructure(Declaration) } break; case WfEnumItemKind::Intersection: - FOREACH(Ptr, enumInt, item->intersections) + for (auto enumInt : item->intersections) { if (!discoveredItems.Contains(enumInt->name.value)) { @@ -15631,7 +15630,7 @@ ValidateStructure(Declaration) } SortedList discoveredItems; - FOREACH(Ptr, member, node->members) + for (auto member : node->members) { if (discoveredItems.Contains(member->name.value)) { @@ -15647,7 +15646,7 @@ ValidateStructure(Declaration) void Visit(WfVirtualCfeDeclaration* node)override { node->Accept(static_cast(this)); - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -15725,7 +15724,7 @@ ValidateStructure(Declaration) { if (classDecl) { - FOREACH(Ptr, state, node->states) + for (auto state : node->states) { ValidateStructureContext context; context.currentStateDeclaration = state.Obj(); @@ -15857,7 +15856,7 @@ ValidateStructure(Expression) void Visit(WfLetExpression* node)override { - FOREACH(Ptr, variable, node->variables) + for (auto variable : node->variables) { ValidateExpressionStructure(manager, context, variable->value); } @@ -15887,7 +15886,7 @@ ValidateStructure(Expression) { vint listElementCount = 0; vint mapElementCount = 0; - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { ValidateExpressionStructure(manager, context, argument->key); if (argument->value) @@ -15975,7 +15974,7 @@ ValidateStructure(Expression) { manager->errors.Add(WfErrors::WrongSimpleObserveExpression(node->expression.Obj())); } - FOREACH(Ptr, event, node->events) + for (auto event : node->events) { if (!event.Cast()) { @@ -16024,7 +16023,7 @@ ValidateStructure(Expression) void Visit(WfNewInterfaceExpression* node)override { ValidateTypeStructure(manager, node->type); - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { ValidateDeclarationStructure(manager, memberDecl, nullptr, node); } @@ -16256,7 +16255,7 @@ ValidateStructure(Statement) void Visit(WfSwitchStatement* node)override { ValidateExpressionStructure(manager, context, node->expression); - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { ValidateExpressionStructure(manager, context, switchCase->expression); ValidateStatementStructure(manager, context, switchCase->statement); @@ -16324,7 +16323,7 @@ ValidateStructure(Statement) manager->errors.Add(WfErrors::WrongStateSwitchStatement(node)); } - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { ValidateStatementStructure(manager, context, switchCase->statement); } @@ -16337,7 +16336,7 @@ ValidateStructure(Statement) manager->errors.Add(WfErrors::WrongStateInvokeStatement(node)); } - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { ValidateExpressionStructure(manager, context, argument); } @@ -16614,7 +16613,7 @@ ValidateStructure(Type) } ValidateTypeStructure(manager, node->result, ValidateTypeStragety::ReturnType); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { ValidateTypeStructure(manager, argument); } @@ -17154,7 +17153,7 @@ WfCppConfig::GenerateGlobalDep vint index = classDecls.Keys().IndexOf(parent.Obj()); if (index == -1) return; - FOREACH(Ptr, subDecl, classDecls.GetByIndex(index)) + for (auto subDecl : classDecls.GetByIndex(index)) { ExpandClassDeclGroup(subDecl, globalDep); } @@ -17191,7 +17190,7 @@ WfCppConfig::GenerateGlobalDep auto stringKey = manager->declarationTypes[parent.Obj()]->GetTypeName(); ASSIGN_INDEX_KEY(, indexKey, stringKey); } - FOREACH(vint, subDecl, directChildren.Concat(indirectChildren)) + for (auto subDecl : directChildren.Concat(indirectChildren)) { globalDep.expandedClassDecls.Add(indexKey, subDecl); } @@ -17199,7 +17198,7 @@ WfCppConfig::GenerateGlobalDep void WfCppConfig::GenerateClassDependencies(GlobalDep& globalDep) { - FOREACH_INDEXER(ITypeDescriptor*, td, tdIndex, globalDep.allTds.Values()) + for (auto [td, tdIndex] : indexed(globalDep.allTds.Values())) { vint count = td->GetBaseTypeDescriptorCount(); for (vint i = 0; i < count; i++) @@ -17216,7 +17215,7 @@ WfCppConfig::GenerateGlobalDep void WfCppConfig::GenerateGlobalDep(GlobalDep& globalDep) { - FOREACH_INDEXER(ITypeDescriptor*, td, index, tdDecls.Keys()) + for (auto [td, index] : indexed(tdDecls.Keys())) { if (tdDecls.Values()[index].Cast()) { @@ -17235,12 +17234,12 @@ WfCppConfig::GenerateClassLevelDep void WfCppConfig::CollectExpandedDepGroup(vint parentIndexKey, GlobalDep& globalDep, ClassLevelDep& classLevelDep) { const auto& items = globalDep.expandedClassDecls[parentIndexKey]; - FOREACH(vint, subDecl, items) + for (auto subDecl : items) { vint index = globalDep.dependencies.Keys().IndexOf(subDecl); if (index != -1) { - FOREACH(vint, dep, globalDep.dependencies.GetByIndex(index)) + for (auto dep : globalDep.dependencies.GetByIndex(index)) { if (items.Contains(dep)) { @@ -17258,7 +17257,7 @@ WfCppConfig::GenerateClassLevelDep vint index = globalDep.expandedClassDecls.Keys().IndexOf(subDeclIndexKey); if (index != -1) { - FOREACH(vint, expandDecl, globalDep.expandedClassDecls.GetByIndex(index)) + for (auto expandDecl : globalDep.expandedClassDecls.GetByIndex(index)) { classLevelDep.subClass.Add(expandDecl, subDeclIndexKey); } @@ -17279,7 +17278,7 @@ WfCppConfig::GenerateClassLevelDep // find all direct and indirect internal classes // copy their dependencies, and generate sub classes by grouping them using the second level of classes CollectExpandedDepGroup(classLevelDep.parentIndexKey, globalDep, classLevelDep); - FOREACH(Ptr, subDecl, classDecls.Get(parent.Obj())) + for (auto subDecl : classDecls.Get(parent.Obj())) { auto subDeclStringKey = manager->declarationTypes[subDecl.Obj()]->GetTypeName(); ASSIGN_INDEX_KEY(auto, subDeclIndexKey, subDeclStringKey); @@ -17388,7 +17387,7 @@ WfCppConfig::Collect WString key = customFilesClasses.Keys()[i]; if (key != L"") { - FOREACH(Ptr, decl, customFilesClasses.GetByIndex(i)) + for (auto decl : customFilesClasses.GetByIndex(i)) { auto stringKey = manager->declarationTypes[decl.Obj()]->GetTypeName(); ASSIGN_INDEX_KEY(auto, indexKey, stringKey); @@ -17593,7 +17592,7 @@ WfCppConfig::Collect auto addToHeaders = [&](const List>& decls, vint headerIndex) { - FOREACH(Ptr, decl, decls) + for (auto decl : decls) { auto stringKey = manager->declarationTypes[decl.Obj()]->GetTypeName(); ASSIGN_INDEX_KEY(auto, indexKey, stringKey); @@ -17603,7 +17602,7 @@ WfCppConfig::Collect auto calculateIncludes = [&](const List>& decls, SortedList& includes) { - FOREACH(Ptr, decl, decls) + for (auto decl : decls) { auto stringKey = manager->declarationTypes[decl.Obj()]->GetTypeName(); ASSIGN_INDEX_KEY(auto, indexKey, stringKey); @@ -17859,7 +17858,7 @@ WfGenerateClassMemberDeclVisitor void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -17867,7 +17866,7 @@ WfGenerateClassMemberDeclVisitor void Visit(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -17931,7 +17930,7 @@ WfGenerateClassMemberDeclVisitor void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -17939,7 +17938,7 @@ WfGenerateClassMemberDeclVisitor void Dispatch(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -18034,7 +18033,7 @@ WfGenerateClassMemberImplVisitor auto methodInfo = dynamic_cast(config->manager->declarationMemberInfos[node].Obj()); List arguments; - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { arguments.Add(config->ConvertName(argument->name.value)); } @@ -18044,7 +18043,7 @@ WfGenerateClassMemberImplVisitor writer.WriteLine(L""); vint callIndex = 0; - FOREACH(Ptr, call, node->baseConstructorCalls) + for (auto call : node->baseConstructorCalls) { auto callType = CreateTypeInfoFromType(scope, call->type, false); auto callCtor = config->manager->baseConstructorCallResolvings[{node, callType->GetTypeDescriptor()}].value; @@ -18061,7 +18060,7 @@ WfGenerateClassMemberImplVisitor writer.WriteString(config->ConvertType(callType->GetTypeDescriptor())); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, argumentIndex, call->arguments) + for (auto [argument, argumentIndex] : indexed(call->arguments)) { if (argumentIndex) writer.WriteString(L", "); GenerateExpression(config, writer, argument, callCtor->GetParameter(argumentIndex)->GetType()); @@ -18072,7 +18071,7 @@ WfGenerateClassMemberImplVisitor if (classDef) { WfGenerateClassMemberInitVisitor visitor(config, writer, prefix, callIndex); - FOREACH(Ptr, member, classDef->declarations) + for (auto member : classDef->declarations) { member->Accept(&visitor); } @@ -18120,7 +18119,7 @@ WfGenerateClassMemberImplVisitor void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -18128,7 +18127,7 @@ WfGenerateClassMemberImplVisitor void Visit(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -18320,7 +18319,7 @@ WfCppConfig::CollectClosureInfo void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -18328,7 +18327,7 @@ WfCppConfig::CollectClosureInfo void Dispatch(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -18337,7 +18336,7 @@ WfCppConfig::CollectClosureInfo void Execute(WfNewInterfaceExpression* node) { capture = config->manager->lambdaCaptures[node]; - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { memberDecl->Accept(this); } @@ -18443,19 +18442,19 @@ WfCppConfig::Collect void WfCppConfig::Collect() { - FOREACH(Ptr, module, manager->GetModules()) + for (auto module : manager->GetModules()) { CollectModule(this, module); } - FOREACH(Ptr, lambda, lambdaExprs.Keys()) + for (auto lambda : lambdaExprs.Keys()) { auto closureInfo = CollectClosureInfo(lambda); closureInfo->lambdaClassName = lambdaExprs[lambda.Obj()]; closureInfos.Add(lambda, closureInfo); } - FOREACH(Ptr, classExpr, classExprs.Keys()) + for (auto classExpr : classExprs.Keys()) { auto closureInfo = CollectClosureInfo(classExpr); closureInfo->lambdaClassName = classExprs[classExpr.Obj()]; @@ -18918,7 +18917,7 @@ WfGenerateExpressionVisitor { List> matches; config->regexTemplate.Cut(templateValue, false, matches); - FOREACH(Ptr, match, matches) + for (auto match : matches) { WString item = match->Result().Value(); if (match->Success()) @@ -18941,7 +18940,7 @@ WfGenerateExpressionVisitor { if (auto closureInfo = GetClosureInfo(node)) { - FOREACH_INDEXER(ITypeDescriptor*, thisType, index, closureInfo->thisTypes) + for (auto [thisType, index] : indexed(closureInfo->thisTypes)) { if (thisType->CanConvertTo(td)) { @@ -19015,7 +19014,7 @@ WfGenerateExpressionVisitor writer.WriteString(closureInfo->lambdaClassName); writer.WriteString(L"("); - FOREACH_INDEXER(WString, symbolName, index, closureInfo->symbols.Keys()) + for (auto [symbolName, index] : indexed(closureInfo->symbols.Keys())) { if (index > 0) { @@ -19024,7 +19023,7 @@ WfGenerateExpressionVisitor writer.WriteString(config->ConvertName(symbol->name)); } - FOREACH_INDEXER(ITypeDescriptor*, thisType, index, closureInfo->thisTypes) + for (auto [thisType, index] : indexed(closureInfo->thisTypes)) { if (index > 0 || closureInfo->symbols.Count() > 0) { @@ -19439,7 +19438,7 @@ WfGenerateExpressionVisitor { vint index = 0; - FOREACH(Ptr, symbol, From(closureInfo->symbols.Values()).Union(closureInfo->ctorArgumentSymbols.Values())) + for (auto symbol : From(closureInfo->symbols.Values()).Union(closureInfo->ctorArgumentSymbols.Values())) { if (index++ > 0) { @@ -19448,7 +19447,7 @@ WfGenerateExpressionVisitor VisitSymbol(node, symbol, true); } - FOREACH(ITypeDescriptor*, thisType, closureInfo->thisTypes) + for (auto thisType : closureInfo->thisTypes) { if (index++ > 0) { @@ -20026,7 +20025,7 @@ WfGenerateExpressionVisitor { auto scope = config->manager->nodeScopes[node]; writer.WriteString(L"[&]("); - FOREACH_INDEXER(Ptr, letVar, index, node->variables) + for (auto [letVar, index] : indexed(node->variables)) { if (index > 0) { @@ -20038,7 +20037,7 @@ WfGenerateExpressionVisitor writer.WriteString(L"){ return "); Call(node->expression); writer.WriteString(L"; }("); - FOREACH_INDEXER(Ptr, letVar, index, node->variables) + for (auto [letVar, index] : indexed(node->variables)) { if (index > 0) { @@ -20155,7 +20154,7 @@ WfGenerateExpressionVisitor auto elementType = result.type->GetElementType()->GetGenericArgument(0); writer.WriteString(L"(::vl::__vwsn::CreateList()"); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { writer.WriteString(L".Add("); Call(argument->key); @@ -20169,7 +20168,7 @@ WfGenerateExpressionVisitor auto elementType = result.type->GetElementType()->GetGenericArgument(0); writer.WriteString(L"(::vl::__vwsn::CreateObservableList()"); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { writer.WriteString(L".Add("); Call(argument->key); @@ -20184,7 +20183,7 @@ WfGenerateExpressionVisitor auto valueType = result.type->GetElementType()->GetGenericArgument(1); writer.WriteString(L"(::vl::__vwsn::CreateDictionary()"); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { writer.WriteString(L".Add("); Call(argument->key); @@ -20201,7 +20200,7 @@ WfGenerateExpressionVisitor writer.WriteString(config->ConvertType(td)); writer.WriteString(L" __vwsn_temp__;"); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { writer.WriteString(L" __vwsn_temp__."); writer.WriteString(argument->key.Cast()->name.value); @@ -20788,12 +20787,12 @@ namespace vl writer.WriteLine(assemblyNamespace); writer.WriteLine(L"{"); - FOREACH(Ptr, expr, reversedLambdaExprs.Values()) + for (auto expr : reversedLambdaExprs.Values()) { WriteHeader_ClosurePreDecl(writer, expr); } - FOREACH(Ptr, expr, reversedClassExprs.Values()) + for (auto expr : reversedClassExprs.Values()) { WriteHeader_ClosurePreDecl(writer, expr); } @@ -20810,7 +20809,7 @@ namespace vl WriteHeader_MainHeaderEnums(writer, nss); if (enumDecls.Keys().Contains(nullptr)) { - FOREACH(Ptr, decl, enumDecls[nullptr]) + for (auto decl : enumDecls[nullptr]) { WriteHeader_Enum(writer, decl, nss, false); } @@ -20823,7 +20822,7 @@ namespace vl WriteHeader_MainHeaderStructs(writer, nss); if (structDecls.Keys().Contains(nullptr)) { - FOREACH(Ptr, decl, structDecls[nullptr]) + for (auto decl : structDecls[nullptr]) { WriteHeader_Struct(writer, decl, nss, false); } @@ -20833,7 +20832,7 @@ namespace vl if (classDecls.Keys().Contains(nullptr)) { - FOREACH(Ptr, decl, classDecls[nullptr]) + for (auto decl : classDecls[nullptr]) { WriteHeader_ClassPreDecl(writer, decl, nss); } @@ -20843,7 +20842,7 @@ namespace vl vint index = headerFilesClasses.Keys().IndexOf(0); if (index != -1) { - FOREACH(Ptr, decl, headerFilesClasses.GetByIndex(index)) + for (auto decl : headerFilesClasses.GetByIndex(index)) { WriteHeader_Class(writer, decl, nss); writer.WriteLine(L""); @@ -20852,7 +20851,7 @@ namespace vl } else { - FOREACH(Ptr, decl, classDecls[nullptr]) + for (auto decl : classDecls[nullptr]) { WriteHeader_Class(writer, decl, nss); writer.WriteLine(L""); @@ -20878,7 +20877,7 @@ namespace vl vint index = headerFilesClasses.Keys().IndexOf(fileIndex); if (index != -1) { - FOREACH(Ptr, decl, headerFilesClasses.GetByIndex(index)) + for (auto decl : headerFilesClasses.GetByIndex(index)) { WriteHeader_Class(writer, decl, nss); writer.WriteLine(L""); @@ -20910,7 +20909,7 @@ namespace vl vint index = customFilesClasses.Keys().IndexOf(L""); if (index != -1) { - FOREACH(Ptr, decl, customFilesClasses.GetByIndex(index)) + for (auto decl : customFilesClasses.GetByIndex(index)) { WriteCpp_Class(writer, decl, nss); } @@ -20918,7 +20917,7 @@ namespace vl } else { - FOREACH(Ptr, decl, classDecls[nullptr]) + for (auto decl : classDecls[nullptr]) { WriteCpp_Class(writer, decl, nss); } @@ -20939,7 +20938,7 @@ namespace vl writer.WriteLine(L""); List nss; - FOREACH(Ptr, decl, customFilesClasses.Get(fileName)) + for (auto decl : customFilesClasses.Get(fileName)) { WriteHeader_Class(writer, decl, nss); writer.WriteLine(L""); @@ -20969,7 +20968,7 @@ namespace vl List nss; - FOREACH(Ptr, decl, customFilesClasses.Get(fileName)) + for (auto decl : customFilesClasses.Get(fileName)) { WriteCpp_Class(writer, decl, nss); } @@ -21063,7 +21062,7 @@ GenerateCppFiles } else { - FOREACH(WString, include, input->reflectionIncludes) + for (auto include : input->reflectionIncludes) { writer.WriteLine(L"/* CodePack:ConditionOff(VCZH_DEBUG_NO_REFLECTION, " + include + L") */"); writer.WriteLine(L"#include \"" + include + L"\""); @@ -21080,7 +21079,7 @@ GenerateCppFiles if (index != -1) { const auto& headers = config.headerIncludes.GetByIndex(index); - FOREACH(vint, header, headers) + for (auto header : headers) { if (header == 0) { @@ -21105,7 +21104,7 @@ GenerateCppFiles writer.WriteLine(L"#ifndef " + input->headerGuardPrefix + wupper(input->defaultFileName)); writer.WriteLine(L"#define " + input->headerGuardPrefix + wupper(input->defaultFileName)); writer.WriteLine(L""); - FOREACH(WString, include, input->normalIncludes) + for (auto include : input->normalIncludes) { writer.WriteLine(L"#include \"" + include + L"\""); } @@ -21151,7 +21150,7 @@ GenerateCppFiles if (input->reflectionIncludes.Count() > 0) { writer.WriteLine(L"#ifndef VCZH_DEBUG_NO_REFLECTION"); - FOREACH(WString, include, input->reflectionIncludes) + for (auto include : input->reflectionIncludes) { writer.WriteLine(L"#include \"" + include + L"\""); } @@ -21181,14 +21180,14 @@ GenerateCppFiles writer.WriteLine(L""); writer.WriteLine(L"#include \"" + input->defaultFileName + L".h\""); - FOREACH(WString, fileName, config.customFilesClasses.Keys()) + for (auto fileName : config.customFilesClasses.Keys()) { if (fileName != L"") { writer.WriteLine(L"#include \"" + fileName + L".h\""); } } - FOREACH(vint, fileIndex, config.headerFilesClasses.Keys()) + for (auto fileIndex : config.headerFilesClasses.Keys()) { if (fileIndex != 0) { @@ -21281,7 +21280,7 @@ GenerateCppFiles { WriteHeader(input, output, config, multiFile, reflection, writer); })); - FOREACH(vint, fileIndex, config.headerFilesClasses.Keys()) + for (auto fileIndex : config.headerFilesClasses.Keys()) { if (fileIndex != 0) { @@ -21317,7 +21316,7 @@ GenerateCppFiles WriteIncludesHeader(input, output, config, multiFile, reflection, writer); })); - FOREACH(WString, fileName, config.customFilesClasses.Keys()) + for (auto fileName : config.customFilesClasses.Keys()) { if (fileName != L"") { @@ -21579,7 +21578,7 @@ namespace vl prefix += L"\t"; } - FOREACH(Ptr, statement, node->statements) + for (auto statement : node->statements) { statement = SearchUntilNonVirtualStatement(statement); @@ -21713,7 +21712,7 @@ namespace vl void Dispatch(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -21721,7 +21720,7 @@ namespace vl void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -21791,7 +21790,7 @@ namespace vl List> unprocessed; unprocessed.Add(decl); - FOREACH(Ptr, attribute, attributeEvaluator->GetAttributes(decl->attributes, L"cpp", L"Friend")) + for (auto attribute : attributeEvaluator->GetAttributes(decl->attributes, L"cpp", L"Friend")) { auto attValue = attributeEvaluator->GetAttributeValue(attribute); CHECK_ERROR(attValue.type == runtime::WfInsType::Unknown && attValue.typeDescriptor != nullptr, L"Unexpected value in attribute: @cpp.Friend."); @@ -21846,14 +21845,14 @@ namespace vl closureInfos[closure.Obj()]->lambdaClassName; }) ); - FOREACH(WString, closureName, closureNames) + for (auto closureName : closureNames) { writer.WriteLine(prefix + L"\tfriend " + closureName + L";"); } } WriteHeader_Class_FindClassDeclVisitor visitor(unprocessed); - FOREACH(Ptr, memberDecl, current->declarations) + for (auto memberDecl : current->declarations) { memberDecl->Accept(&visitor); } @@ -21877,7 +21876,7 @@ namespace vl accessor = PUBLIC; writer.WriteLine(prefix + L"public:"); } - FOREACH(Ptr, decl, enumDecls.GetByIndex(index)) + for (auto decl : enumDecls.GetByIndex(index)) { WriteHeader_Enum(writer, decl, ConvertName(decl->name.value), prefix + L"\t", false); writer.WriteLine(L""); @@ -21894,7 +21893,7 @@ namespace vl accessor = PUBLIC; writer.WriteLine(prefix + L"public:"); } - FOREACH(Ptr, decl, structDecls.GetByIndex(index)) + for (auto decl : structDecls.GetByIndex(index)) { WriteHeader_Struct(writer, decl, ConvertName(decl->name.value), prefix + L"\t", false); writer.WriteLine(L""); @@ -21911,19 +21910,19 @@ namespace vl accessor = PUBLIC; writer.WriteLine(prefix + L"public:"); } - FOREACH(Ptr, decl, classDecls.GetByIndex(index)) + for (auto decl : classDecls.GetByIndex(index)) { WriteHeader_ClassPreDecl(writer, decl, ConvertName(decl->name.value), prefix + L"\t"); } writer.WriteLine(L""); - FOREACH(Ptr, decl, classDecls.GetByIndex(index)) + for (auto decl : classDecls.GetByIndex(index)) { WriteHeader_Class(writer, decl, ConvertName(decl->name.value), prefix + L"\t"); } } } - FOREACH(Ptr, memberDecl, decl->declarations) + for (auto memberDecl : decl->declarations) { vint memberAccessor = PUBLIC; if (attributeEvaluator->GetAttribute(memberDecl->attributes, L"cpp", L"Private")) @@ -22000,7 +21999,7 @@ namespace vl writer.WriteLine(L"***********************************************************************/"); writer.WriteLine(L""); - FOREACH(Ptr, memberDecl, current->declarations) + for (auto memberDecl : current->declarations) { if (WriteCpp_ClassMember(writer, current, memberDecl, nss)) { @@ -22038,7 +22037,7 @@ namespace vl { writer.WriteLine(prefix + L"enum class " + name + L" : vl::vuint64_t"); writer.WriteLine(prefix + L"{"); - FOREACH(Ptr, item, decl->items) + for (auto item : decl->items) { switch (item->kind) { @@ -22047,7 +22046,7 @@ namespace vl break; case WfEnumItemKind::Intersection: writer.WriteString(prefix + L"\t" + ConvertName(item->name.value) + L" = "); - FOREACH_INDEXER(Ptr, enumInt, index, item->intersections) + for (auto [enumInt, index] : indexed(item->intersections)) { if (index > 0) { @@ -22124,7 +22123,7 @@ namespace vl CopyFrom(allEnums, Range(0, enumDecls.Count()).SelectMany([&](vint index) {return From(enumDecls.GetByIndex(index)); })); SortDeclsByName(allEnums); - FOREACH(Ptr, decl, allEnums) + for (auto decl : allEnums) { WriteHeader_Enum(writer, decl, nss, true); writer.WriteLine(L""); @@ -22339,7 +22338,7 @@ namespace vl if (varDecls.Count() > 0) { writer.WriteLine(L""); - FOREACH(Ptr, decl, varDecls) + for (auto decl : varDecls) { auto scope = manager->nodeScopes[decl.Obj()].Obj(); auto symbol = scope->symbols[decl->name.value][0]; @@ -22357,7 +22356,7 @@ namespace vl if (funcDecls.Count() > 0) { writer.WriteLine(L""); - FOREACH(Ptr, decl, funcDecls) + for (auto decl : funcDecls) { writer.WriteString(L"\t\t"); WriteFunctionHeader(writer, decl, ConvertName(decl->name.value), true); @@ -22375,13 +22374,13 @@ namespace vl writer.WriteLine(L"Closures"); writer.WriteLine(L"***********************************************************************/"); - FOREACH(Ptr, expr, reversedLambdaExprs.Values()) + for (auto expr : reversedLambdaExprs.Values()) { writer.WriteLine(L""); WriteHeader_LambdaExprDecl(writer, expr); } - FOREACH(Ptr, expr, reversedClassExprs.Values()) + for (auto expr : reversedClassExprs.Values()) { writer.WriteLine(L""); WriteHeader_ClassExprDecl(writer, expr); @@ -22409,7 +22408,7 @@ namespace vl if (varDecls.Count() > 0) { writer.WriteLine(L""); - FOREACH(Ptr, decl, varDecls) + for (auto decl : varDecls) { auto scope = manager->nodeScopes[decl.Obj()].Obj(); auto symbol = scope->symbols[decl->name.value][0]; @@ -22426,7 +22425,7 @@ namespace vl if (varDecls.Count() > 0) { writer.WriteLine(L""); - FOREACH(Ptr, decl, varDecls) + for (auto decl : varDecls) { auto scope = manager->nodeScopes[decl.Obj()].Obj(); auto symbol = scope->symbols[decl->name.value][0]; @@ -22465,7 +22464,7 @@ namespace vl writer.WriteLine(L"Global Functions"); writer.WriteLine(L"***********************************************************************/"); - FOREACH(Ptr, decl, funcDecls) + for (auto decl : funcDecls) { writer.WriteLine(L""); writer.WriteString(L"\t"); @@ -22487,7 +22486,7 @@ namespace vl writer.WriteLine(L"Closures"); writer.WriteLine(L"***********************************************************************/"); - FOREACH(Ptr, expr, reversedLambdaExprs.Values()) + for (auto expr : reversedLambdaExprs.Values()) { writer.WriteLine(L""); writer.WriteLine(L"\t//-------------------------------------------------------------------"); @@ -22498,7 +22497,7 @@ namespace vl if (reversedClassExprs.Count() > 0) { writer.WriteLine(L""); - FOREACH(Ptr, expr, reversedClassExprs.Values()) + for (auto expr : reversedClassExprs.Values()) { writer.WriteLine(L"\t//-------------------------------------------------------------------"); writer.WriteLine(L""); @@ -22611,7 +22610,7 @@ WfCppConfig::WriteCpp writer.WriteLine(L";"); writer.WriteLine(L""); - FOREACH(Ptr, memberDecl, lambda->declarations) + for (auto memberDecl : lambda->declarations) { GenerateClassMemberDecl(this, writer, name, memberDecl, L"\t\t", true); } @@ -22622,7 +22621,7 @@ WfCppConfig::WriteCpp { auto info = closureInfos[closure.Obj()]; - FOREACH(Ptr, symbol, info->symbols.Values()) + for (auto symbol : info->symbols.Values()) { writer.WriteString(L"\t\t"); writer.WriteString(ConvertType(symbol->typeInfo.Obj())); @@ -22631,7 +22630,7 @@ WfCppConfig::WriteCpp writer.WriteLine(L";"); } - FOREACH_INDEXER(ITypeDescriptor*, thisType, index, info->thisTypes) + for (auto [thisType, index] : indexed(info->thisTypes)) { auto typeInfo = MakePtr(MakePtr(thisType, TypeInfoHint::Normal)); @@ -22654,7 +22653,7 @@ WfCppConfig::WriteCpp vint argumentIndex = 0; - FOREACH_INDEXER(Ptr, symbol, index, From(info->symbols.Values()).Concat(info->ctorArgumentSymbols.Values())) + for (auto [symbol, index] : indexed(From(info->symbols.Values()).Concat(info->ctorArgumentSymbols.Values()))) { if (argumentIndex++ > 0) { @@ -22665,7 +22664,7 @@ WfCppConfig::WriteCpp writer.WriteString(ConvertName(symbol->name)); } - FOREACH_INDEXER(ITypeDescriptor*, thisType, index, info->thisTypes) + for (auto [thisType, index] : indexed(info->thisTypes)) { auto typeInfo = MakePtr(MakePtr(thisType, TypeInfoHint::Normal)); @@ -22684,7 +22683,7 @@ WfCppConfig::WriteCpp { auto info = closureInfos[closure.Obj()]; - FOREACH_INDEXER(Ptr, symbol, index, info->symbols.Values()) + for (auto [symbol, index] : indexed(info->symbols.Values())) { if (index > 0) { @@ -22700,7 +22699,7 @@ WfCppConfig::WriteCpp writer.WriteLine(L")"); } - FOREACH_INDEXER(ITypeDescriptor*, thisType, index, info->thisTypes) + for (auto [thisType, index] : indexed(info->thisTypes)) { if (index > 0 || info->symbols.Count() > 0) { @@ -22771,7 +22770,7 @@ WfCppConfig::WriteCpp void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -22779,7 +22778,7 @@ WfCppConfig::WriteCpp void Dispatch(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -22813,7 +22812,7 @@ WfCppConfig::WriteCpp { WriteCpp_ClassExprImpl_InitFieldVisitor visitor(this, writer); - FOREACH(Ptr, memberDecl, lambda->declarations) + for (auto memberDecl : lambda->declarations) { memberDecl->Accept(&visitor); } @@ -22823,7 +22822,7 @@ WfCppConfig::WriteCpp writer.WriteLine(L""); WString classFullName = L"::" + assemblyNamespace + L"::" + name; - FOREACH(Ptr, memberDecl, lambda->declarations) + for (auto memberDecl : lambda->declarations) { if (GenerateClassMemberImpl(this, writer, nullptr, name, name, classFullName, memberDecl, L"\t")) { @@ -22882,7 +22881,7 @@ namespace vl writer.WriteLine(L"\t\t{"); writer.WriteLine(L"#ifndef VCZH_DEBUG_NO_REFLECTION"); - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { writer.WriteString(L"\t\t\tDECL_TYPE_INFO("); writer.WriteString(ConvertType(td)); @@ -22923,7 +22922,7 @@ namespace vl { writer.WriteLine(L""); writer.WriteLine(L"#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA"); - FOREACH(ITypeDescriptor*, td, tdInterfaces) + for (auto td : tdInterfaces) { List baseTds; CopyFrom( @@ -22944,7 +22943,7 @@ namespace vl { writer.WriteString(L"\t\t\tBEGIN_INTERFACE_PROXY_SHAREDPTR("); writer.WriteString(ConvertType(td)); - FOREACH(ITypeDescriptor*, baseTd, baseTds) + for (auto baseTd : baseTds) { writer.WriteString(L", "); writer.WriteString(ConvertType(baseTd)); @@ -23041,7 +23040,7 @@ namespace vl writer.WriteLine(L"\t\t{"); writer.WriteLine(L"#ifndef VCZH_DEBUG_NO_REFLECTION"); - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { writer.WriteString(L"\t\t\tIMPL_CPP_TYPE_INFO("); WString type = ConvertType(td); @@ -23056,7 +23055,7 @@ namespace vl writer.WriteLine(L"#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA"); writer.WriteLine(L"#define _ ,"); - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { switch (td->GetTypeDescriptorFlags()) { @@ -23320,7 +23319,7 @@ namespace vl writer.WriteLine(L"\t\t\t\tvoid Load(ITypeManager* manager)"); writer.WriteLine(L"\t\t\t\t{"); - FOREACH(ITypeDescriptor*, td, tds) + for (auto td : tds) { writer.WriteString(L"\t\t\t\t\tADD_TYPE_INFO("); writer.WriteString(ConvertType(td)); @@ -23379,7 +23378,7 @@ namespace vl auto td = manager->declarationTypes[decl.Obj()].Obj(); writer.WriteLine(prefix + L"struct " + name); writer.WriteLine(prefix + L"{"); - FOREACH(Ptr, member, decl->members) + for (auto member : decl->members) { auto prop = td->GetPropertyByName(member->name.value, false); auto defaultValue = DefaultValue(prop->GetReturn()); @@ -23424,7 +23423,7 @@ namespace vl writer.WriteString(prefix); writer.WriteLine(L"{"); - FOREACH(Ptr, member, decl->members) + for (auto member : decl->members) { writer.WriteString(prefix); writer.WriteString(L"\tif (a."); @@ -23475,7 +23474,7 @@ namespace vl SortDeclsByName(allStructs); Group, Ptr> depGroup; - FOREACH(Ptr, decl, allStructs) + for (auto decl : allStructs) { auto td = manager->declarationTypes[decl.Obj()].Obj(); vint count = td->GetPropertyCount(); @@ -23942,7 +23941,7 @@ MergeCpp if (userContentsFull.Count() > 0) { writer.WriteLine(L"// UNUSED_USER_CONTENT:"); - FOREACH(WString, content, userContentsFull.Values()) + for (auto content : userContentsFull.Values()) { writer.WriteString(content); } @@ -24314,7 +24313,7 @@ GenerateAssembly assembly->insAfterCodegen = new WfInstructionDebugInfo; WfCodegenContext context(assembly, manager); - FOREACH_INDEXER(Ptr, module, index, manager->GetModules()) + for (auto [module, index] : indexed(manager->GetModules())) { auto codeBeforeCodegen = manager->GetModuleCodes()[index]; @@ -24342,7 +24341,7 @@ GenerateAssembly if (manager->declarationTypes.Count() > 0) { assembly->typeImpl = new WfTypeImpl; - FOREACH(Ptr, td, manager->declarationTypes.Values()) + for (auto td : manager->declarationTypes.Values()) { if (auto tdClass = td.Cast()) { @@ -24363,9 +24362,9 @@ GenerateAssembly } } - FOREACH(Ptr, module, manager->GetModules()) + for (auto module : manager->GetModules()) { - FOREACH(Ptr, decl, module->declarations) + for (auto decl : module->declarations) { GenerateGlobalDeclarationMetadata(context, decl); } @@ -24382,9 +24381,9 @@ GenerateAssembly context.functionContext = functionContext; meta->firstInstruction = assembly->instructions.Count(); - FOREACH(Ptr, module, manager->GetModules()) + for (auto module : manager->GetModules()) { - FOREACH(Ptr, decl, module->declarations) + for (auto decl : module->declarations) { GenerateInitializeInstructions(context, decl); } @@ -24401,10 +24400,10 @@ GenerateAssembly GenerateClosureInstructions(context, functionContext); } - FOREACH(Ptr, module, manager->GetModules()) + for (auto module : manager->GetModules()) { EXECUTE_CALLBACK(OnGenerateCode(module)); - FOREACH(Ptr, decl, module->declarations) + for (auto decl : module->declarations) { GenerateDeclarationInstructions(context, decl); } @@ -24427,7 +24426,7 @@ Compile Ptr Compile(Ptr table, analyzer::WfLexicalScopeManager* manager, collections::List& moduleCodes, collections::List>& errors) { manager->Clear(true, true); - FOREACH(WString, code, moduleCodes) + for (auto code : moduleCodes) { manager->AddModule(code); } @@ -24494,7 +24493,7 @@ GenerateInstructions(Initialize) void Visit(WfNamespaceDeclaration* node)override { - FOREACH(Ptr, decl, node->declarations) + for (auto decl : node->declarations) { GenerateInitializeInstructions(context, decl); } @@ -24543,7 +24542,7 @@ GenerateInstructions(Initialize) void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -24551,7 +24550,7 @@ GenerateInstructions(Initialize) void Visit(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -24574,11 +24573,11 @@ GenerateInstructions(Declaration) functionContext->function = meta; context.functionContext = functionContext; { - FOREACH_INDEXER(Ptr, argumentSymbol, index, argumentSymbols) + for (auto [argumentSymbol, index] : indexed(argumentSymbols)) { functionContext->arguments.Add(argumentSymbol.Obj(), index); } - FOREACH_INDEXER(Ptr, capturedSymbol, index, capturedSymbols) + for (auto [capturedSymbol, index] : indexed(capturedSymbols)) { functionContext->capturedVariables.Add(capturedSymbol.Obj(), index); } @@ -24629,7 +24628,7 @@ GenerateInstructions(Declaration) { List> argumentSymbols, capturedSymbols; { - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { auto symbol = scope->symbols[argument->name.value][0]; argumentSymbols.Add(symbol); @@ -24639,7 +24638,7 @@ GenerateInstructions(Declaration) if (index != -1) { auto capture = context.manager->lambdaCaptures.Values()[index]; - FOREACH(Ptr, symbol, capture->symbols) + for (auto symbol : capture->symbols) { capturedSymbols.Add(symbol); } @@ -24703,7 +24702,7 @@ GenerateInstructions(Declaration) void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -24711,7 +24710,7 @@ GenerateInstructions(Declaration) void Dispatch(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -24736,7 +24735,7 @@ GenerateInstructions(Declaration) auto scope = context.manager->nodeScopes[node].Obj(); { - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { auto symbol = scope->symbols[argument->name.value][0]; functionContext->arguments.Add(symbol.Obj(), index); @@ -24753,7 +24752,7 @@ GenerateInstructions(Declaration) auto ctor = context.manager->baseConstructorCallResolvings[{node, baseTd}]; if (ctor.key) { - FOREACH(Ptr, argument, ctor.key->arguments) + for (auto argument : ctor.key->arguments) { GenerateExpressionInstructions(context, argument); } @@ -24771,7 +24770,7 @@ GenerateInstructions(Declaration) { InitializeFieldVisitor visitor(context); - FOREACH(Ptr, memberDecl, classDecl->declarations) + for (auto memberDecl : classDecl->declarations) { memberDecl->Accept(&visitor); } @@ -24818,7 +24817,7 @@ GenerateInstructions(Declaration) void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -24826,7 +24825,7 @@ GenerateInstructions(Declaration) void Visit(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -24845,7 +24844,7 @@ GenerateInstructions(Declaration) void Visit(WfNamespaceDeclaration* node)override { - FOREACH(Ptr, decl, node->declarations) + for (auto decl : node->declarations) { GenerateDeclarationInstructions(context, decl); } @@ -24881,7 +24880,7 @@ GenerateInstructions(Declaration) void Visit(WfClassDeclaration* node)override { - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { GenerateClassMemberInstructionsVisitor visitor(context, node); memberDecl->Accept(&visitor); @@ -24898,7 +24897,7 @@ GenerateInstructions(Declaration) void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -24906,7 +24905,7 @@ GenerateInstructions(Declaration) void Visit(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -24953,13 +24952,13 @@ GenerateInstructions(Closure) ); auto meta = context.assembly->functions[functionIndex]; - FOREACH(Ptr, symbol, argumentSymbols) + for (auto symbol : argumentSymbols) { meta->argumentNames.Add(symbol->name); } { auto capture = context.manager->lambdaCaptures.Get(node); - FOREACH(Ptr, symbol, capture->symbols) + for (auto symbol : capture->symbols) { meta->capturedVariableNames.Add(L"" + symbol->name); capturedSymbols.Add(symbol); @@ -25286,7 +25285,7 @@ GenerateInstructions(Expression) }); auto capture = context.manager->lambdaCaptures.Get(node); - FOREACH(Ptr, symbol, capture->symbols) + for (auto symbol : capture->symbols) { GenerateLoadSymbolInstructions(context, symbol.Obj(), node); } @@ -25648,7 +25647,7 @@ GenerateInstructions(Expression) auto scope = context.manager->nodeScopes[node].Obj(); Array variableIndices(node->variables.Count()); auto function = context.functionContext->function; - FOREACH_INDEXER(Ptr, var, index, node->variables) + for (auto [var, index] : indexed(node->variables)) { auto symbol = scope->symbols[var->name.value][0]; vint variableIndex = function->argumentNames.Count() + function->localVariableNames.Add(L"" + var->name.value); @@ -25659,7 +25658,7 @@ GenerateInstructions(Expression) INSTRUCTION(Ins::StoreLocalVar(variableIndex)); } GenerateExpressionInstructions(context, node->expression); - FOREACH_INDEXER(Ptr, var, index, node->variables) + for (auto [var, index] : indexed(node->variables)) { INSTRUCTION(Ins::LoadValue({})); INSTRUCTION(Ins::StoreLocalVar(variableIndices[index])); @@ -25794,7 +25793,7 @@ GenerateInstructions(Expression) auto td = result.type->GetTypeDescriptor(); INSTRUCTION(Ins::CreateStruct(Value::BoxedValue, td)); - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { auto prop = td->GetPropertyByName(argument->key.Cast()->name.value, true); GenerateExpressionInstructions(context, argument->value, CopyTypeInfo(prop->GetReturn())); @@ -25806,7 +25805,7 @@ GenerateInstructions(Expression) || result.type->GetTypeDescriptor() == description::GetTypeDescriptor()) { Ptr keyType = CopyTypeInfo(result.type->GetElementType()->GetGenericArgument(0)); - FOREACH(Ptr, argument, From(node->arguments).Reverse()) + for (auto argument : From(node->arguments).Reverse()) { GenerateExpressionInstructions(context, argument->key, keyType); } @@ -25815,7 +25814,7 @@ GenerateInstructions(Expression) else if (result.type->GetTypeDescriptor() == description::GetTypeDescriptor()) { Ptr keyType = CopyTypeInfo(result.type->GetElementType()->GetGenericArgument(0)); - FOREACH(Ptr, argument, From(node->arguments).Reverse()) + for (auto argument : From(node->arguments).Reverse()) { GenerateExpressionInstructions(context, argument->key, keyType); } @@ -25825,7 +25824,7 @@ GenerateInstructions(Expression) { Ptr keyType = CopyTypeInfo(result.type->GetElementType()->GetGenericArgument(0)); Ptr valueType = CopyTypeInfo(result.type->GetElementType()->GetGenericArgument(1)); - FOREACH(Ptr, argument, From(node->arguments).Reverse()) + for (auto argument : From(node->arguments).Reverse()) { GenerateExpressionInstructions(context, argument->key, keyType); GenerateExpressionInstructions(context, argument->value, valueType); @@ -25939,7 +25938,7 @@ GenerateInstructions(Expression) void Visit(WfCallExpression* node)override { - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { GenerateExpressionInstructions(context, argument); } @@ -26016,7 +26015,7 @@ GenerateInstructions(Expression) else { auto capture = context.manager->lambdaCaptures.Get(node); - FOREACH(Ptr, symbol, capture->symbols) + for (auto symbol : capture->symbols) { GenerateLoadSymbolInstructions(context, symbol.Obj(), node); } @@ -26054,7 +26053,7 @@ GenerateInstructions(Expression) void Dispatch(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -26089,7 +26088,7 @@ GenerateInstructions(Expression) void Execute(WfNewInterfaceExpression* node) { - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { memberDecl->Accept(this); } @@ -26105,7 +26104,7 @@ GenerateInstructions(Expression) void Visit(WfNewClassExpression* node)override { auto result = context.manager->expressionResolvings[node]; - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { GenerateExpressionInstructions(context, argument); } @@ -26137,7 +26136,7 @@ GenerateInstructions(Expression) INSTRUCTION(Ins::LoadValue({})); INSTRUCTION(Ins::CreateClosureContext(capture->symbols.Count() + thisCount + 1)); - FOREACH(Ptr, func, declVisitor.closureFunctions) + for (auto func : declVisitor.closureFunctions) { WfCodegenLambdaContext lc; lc.functionDeclaration = func.Obj(); @@ -26151,7 +26150,7 @@ GenerateInstructions(Expression) context.closureFunctions.Add(symbol.Obj(), functionIndex); } - FOREACH(Ptr, func, declVisitor.overrideFunctions) + for (auto func : declVisitor.overrideFunctions) { auto methodInfo = context.manager->interfaceMethodImpls[func.Obj()]; INSTRUCTION(Ins::LoadMethodInfo(methodInfo)); @@ -26235,7 +26234,7 @@ GenerateGlobalDeclarationMetadata void GenerateFunctionDeclarationMetadata(WfCodegenContext& context, WfFunctionDeclaration* node, Ptr meta) { - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { meta->argumentNames.Add(argument->name.value); } @@ -26244,7 +26243,7 @@ GenerateGlobalDeclarationMetadata if (index != -1) { auto capture = context.manager->lambdaCaptures.Values()[index]; - FOREACH(Ptr, symbol, capture->symbols) + for (auto symbol : capture->symbols) { meta->capturedVariableNames.Add(L"" + symbol->name); } @@ -26315,7 +26314,7 @@ GenerateGlobalDeclarationMetadata { auto meta = MakePtr(); meta->name = namePrefix + L"#ctor"; - FOREACH(Ptr, argument, node->arguments) + for (auto argument : node->arguments) { meta->argumentNames.Add(argument->name.value); } @@ -26358,7 +26357,7 @@ GenerateGlobalDeclarationMetadata void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -26366,7 +26365,7 @@ GenerateGlobalDeclarationMetadata void Visit(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -26387,7 +26386,7 @@ GenerateGlobalDeclarationMetadata void Visit(WfNamespaceDeclaration* node)override { - FOREACH(Ptr, decl, node->declarations) + for (auto decl : node->declarations) { GenerateGlobalDeclarationMetadata(context, decl, namePrefix + node->name.value + L"::"); } @@ -26434,7 +26433,7 @@ GenerateGlobalDeclarationMetadata void Visit(WfClassDeclaration* node)override { - FOREACH(Ptr, memberDecl, node->declarations) + for (auto memberDecl : node->declarations) { GenerateGlobalClassMemberMetadataVisitor visitor(context, namePrefix + node->name.value + L"::", node); memberDecl->Accept(&visitor); @@ -26451,7 +26450,7 @@ GenerateGlobalDeclarationMetadata void Visit(WfVirtualCfeDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -26459,7 +26458,7 @@ GenerateGlobalDeclarationMetadata void Visit(WfVirtualCseDeclaration* node)override { - FOREACH(Ptr, decl, node->expandedDeclarations) + for (auto decl : node->expandedDeclarations) { decl->Accept(this); } @@ -26665,11 +26664,11 @@ GenerateInstructions(Statement) INSTRUCTION(Ins::Jump(loopLabelIndex)); breakLabelIndex = context.assembly->instructions.Count(); - FOREACH(vint, index, loopContext->continueInstructions) + for (auto index : loopContext->continueInstructions) { FILL_LABEL_TO_INS(index, continueLabelIndex); } - FOREACH(vint, index, loopContext->breakInstructions) + for (auto index : loopContext->breakInstructions) { FILL_LABEL_TO_INS(index, breakLabelIndex); } @@ -26779,7 +26778,7 @@ GenerateInstructions(Statement) blockContext = context.functionContext->PushScopeContext(WfCodegenScopeType::Block, node->endLabel.value); } - FOREACH(Ptr, statement, node->statements) + for (auto statement : node->statements) { GenerateStatementInstructions(context, statement); } @@ -26787,7 +26786,7 @@ GenerateInstructions(Statement) if (blockContext) { vint breakLabelIndex = context.assembly->instructions.Count(); - FOREACH(vint, index, blockContext->breakInstructions) + for (auto index : blockContext->breakInstructions) { FILL_LABEL_TO_INS(index, breakLabelIndex); } @@ -26868,7 +26867,7 @@ Unescaping Functions void SetDefaultClassMember(vl::collections::List>& value, const vl::collections::List& tokens) { - FOREACH(Ptr, decl, value) + for (auto decl : value) { if (!decl->classMember) { @@ -27092,7 +27091,7 @@ Print (Type) writer.BeforePrint(node); writer.WriteString(L"(func "); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, type, index, node->arguments) + for (auto [type, index] : indexed(node->arguments)) { if (index > 0) { @@ -27349,7 +27348,7 @@ Print (Expression) { writer.BeforePrint(node); writer.WriteString(L"let "); - FOREACH_INDEXER(Ptr, var, index, node->variables) + for (auto [var, index] : indexed(node->variables)) { if (index > 0) { @@ -27433,7 +27432,7 @@ Print (Expression) { writer.BeforePrint(node); writer.WriteString(L"{"); - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { if (index > 0) { @@ -27575,7 +27574,7 @@ Print (Expression) if (node->events.Count() > 0) { writer.WriteString(L" on "); - FOREACH_INDEXER(Ptr, argument, index, node->events) + for (auto [argument, index] : indexed(node->events)) { if (index > 0) { @@ -27593,7 +27592,7 @@ Print (Expression) writer.BeforePrint(node); WfPrint(node->function, indent, writer); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { if (index > 0) { @@ -27620,7 +27619,7 @@ Print (Expression) writer.WriteString(L")"); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { if (index > 0) { @@ -27643,7 +27642,7 @@ Print (Expression) writer.WriteLine(L""); writer.WriteString(indent); writer.WriteLine(L"{"); - FOREACH_INDEXER(Ptr, decl, index, node->declarations) + for (auto [decl, index] : indexed(node->declarations)) { if (index > 0) { @@ -27921,7 +27920,7 @@ Print (Statement) { writer.BeforePrint(node); writer.WriteLine(L"{"); - FOREACH(Ptr, statement, node->statements) + for (auto statement : node->statements) { writer.WriteString(indent + L" "); WfPrint(statement, indent + L" ", writer); @@ -27987,7 +27986,7 @@ Print (Statement) writer.WriteString(indent); writer.WriteLine(L"{"); - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { writer.BeforePrint(switchCase.Obj()); writer.WriteString(indent); @@ -28083,7 +28082,7 @@ Print (Statement) } writer.WriteString(node->opName.value); - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { writer.WriteString(index == 0 ? L" " : L", "); WfPrint(argument, indent, writer); @@ -28124,14 +28123,14 @@ Print (Statement) writer.WriteString(indent); writer.WriteLine(L"{"); - FOREACH(Ptr, switchCase, node->caseBranches) + for (auto switchCase : node->caseBranches) { writer.BeforePrint(switchCase.Obj()); writer.WriteString(indent); writer.WriteString(L" case "); writer.WriteString(switchCase->name.value); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, index, switchCase->arguments) + for (auto [argument, index] : indexed(switchCase->arguments)) { if (index != 0) writer.WriteString(L", "); writer.BeforePrint(argument.Obj()); @@ -28167,7 +28166,7 @@ Print (Statement) writer.WriteString(node->name.value); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { if (index != 0) writer.WriteString(L", "); WfPrint(argument, indent, writer); @@ -28202,7 +28201,7 @@ Print (Declaration) writer.WriteLine(L"namespace " + node->name.value); writer.WriteString(indent); writer.WriteLine(L"{"); - FOREACH_INDEXER(Ptr, decl, index, node->declarations) + for (auto [decl, index] : indexed(node->declarations)) { if (index != 0) { @@ -28233,14 +28232,14 @@ Print (Declaration) } writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { if (index > 0) { writer.WriteString(L", "); } writer.BeforePrint(argument.Obj()); - FOREACH(Ptr, attribute, argument->attributes) + for (auto attribute : argument->attributes) { WfPrint(attribute, indent, writer); writer.WriteString(L" "); @@ -28291,7 +28290,7 @@ Print (Declaration) writer.WriteString(L"event "); writer.WriteString(node->name.value); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, type, index, node->arguments) + for (auto [type, index] : indexed(node->arguments)) { if (index != 0) { @@ -28342,7 +28341,7 @@ Print (Declaration) } writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, index, node->arguments) + for (auto [argument, index] : indexed(node->arguments)) { if (index > 0) { @@ -28355,7 +28354,7 @@ Print (Declaration) writer.AfterPrint(argument.Obj()); } writer.WriteString(L")"); - FOREACH_INDEXER(Ptr, call, callIndex, node->baseConstructorCalls) + for (auto [call, callIndex] : indexed(node->baseConstructorCalls)) { writer.WriteLine(L""); writer.WriteString(indent + L" "); @@ -28370,7 +28369,7 @@ Print (Declaration) writer.BeforePrint(call.Obj()); WfPrint(call->type, indent + L" ", writer); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, argumentIndex, call->arguments) + for (auto [argument, argumentIndex] : indexed(call->arguments)) { if (argumentIndex != 0) { @@ -28436,7 +28435,7 @@ Print (Declaration) break; } - FOREACH_INDEXER(Ptr, type, index, node->baseTypes) + for (auto [type, index] : indexed(node->baseTypes)) { if (index == 0) { @@ -28452,7 +28451,7 @@ Print (Declaration) writer.WriteLine(L""); writer.WriteLine(indent + L"{"); - FOREACH_INDEXER(Ptr, decl, index, node->declarations) + for (auto [decl, index] : indexed(node->declarations)) { if (index > 0) { @@ -28486,10 +28485,10 @@ Print (Declaration) writer.WriteLine(indent + L"{"); auto newIndent = indent + L" "; - FOREACH(Ptr, item, node->items) + for (auto item : node->items) { writer.BeforePrint(item.Obj()); - FOREACH(Ptr, attribute, item->attributes) + for (auto attribute : item->attributes) { writer.WriteString(newIndent); WfPrint(attribute, newIndent, writer); @@ -28504,7 +28503,7 @@ Print (Declaration) writer.WriteString(item->number.value); break; case WfEnumItemKind::Intersection: - FOREACH_INDEXER(Ptr, itemInt, index, item->intersections) + for (auto [itemInt, index] : indexed(item->intersections)) { if (index != 0)writer.WriteString(L" | "); writer.WriteString(itemInt->name.value); @@ -28529,10 +28528,10 @@ Print (Declaration) writer.WriteLine(indent + L"{"); auto newIndent = indent + L" "; - FOREACH(Ptr, member, node->members) + for (auto member : node->members) { writer.BeforePrint(member.Obj()); - FOREACH(Ptr, attribute, member->attributes) + for (auto attribute : member->attributes) { writer.WriteString(newIndent); WfPrint(attribute, newIndent, writer); @@ -28552,7 +28551,7 @@ Print (Declaration) void PrintExpandedDeclarations(List>& decls) { - FOREACH_INDEXER(Ptr, decl, index, decls) + for (auto [decl, index] : indexed(decls)) { if (index > 0) { @@ -28661,7 +28660,7 @@ Print (Declaration) writer.WriteLine(L"$state_machine"); writer.WriteLine(indent + L"{"); - FOREACH_INDEXER(Ptr, input, index, node->inputs) + for (auto [input, index] : indexed(node->inputs)) { if (index != 0) writer.WriteLine(L""); @@ -28669,7 +28668,7 @@ Print (Declaration) writer.WriteString(indent + L" $state_input "); writer.WriteString(input->name.value); writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, index, input->arguments) + for (auto [argument, index] : indexed(input->arguments)) { if (index > 0) { @@ -28685,7 +28684,7 @@ Print (Declaration) writer.AfterPrint(input.Obj()); } - FOREACH_INDEXER(Ptr, state, index, node->states) + for (auto [state, index] : indexed(node->states)) { if (index != 0 || node->inputs.Count() > 0) writer.WriteLine(L""); @@ -28700,7 +28699,7 @@ Print (Declaration) writer.WriteString(state->name.value); } writer.WriteString(L"("); - FOREACH_INDEXER(Ptr, argument, index, state->arguments) + for (auto [argument, index] : indexed(state->arguments)) { if (index > 0) { @@ -28764,7 +28763,7 @@ Print (Module) void WfPrint(Ptr node, const WString& indent, parsing::ParsingWriter& writer) { - FOREACH(Ptr, attribute, node->attributes) + for (auto attribute : node->attributes) { WfPrint(attribute, indent, writer); writer.WriteLine(L""); @@ -28807,17 +28806,17 @@ Print (Module) CHECK_FAIL(L"Internal error: Unknown value."); } - FOREACH(Ptr, path, node->paths) + for (auto path : node->paths) { writer.WriteString(indent); writer.WriteString(L"using "); - FOREACH_INDEXER(Ptr, item, index, path->items) + for (auto [item, index] : indexed(path->items)) { if (index > 0) { writer.WriteString(L"::"); } - FOREACH(Ptr, fragment, item->fragments) + for (auto fragment : item->fragments) { if (auto name = fragment.Cast()) { @@ -28832,7 +28831,7 @@ Print (Module) writer.WriteLine(L";"); } - FOREACH(Ptr, decl, node->declarations) + for (auto decl : node->declarations) { writer.WriteLine(L""); writer.WriteString(indent); @@ -30979,8 +30978,7 @@ TypeVisitor void TypeVisitor::CopyFields(WfFunctionType* from, WfFunctionType* to) { to->result = CreateField(from->result); - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -31185,8 +31183,7 @@ ExpressionVisitor void ExpressionVisitor::CopyFields(WfLetExpression* from, WfLetExpression* to) { - FOREACH(vl::Ptr, listItem, from->variables) - { + for (auto listItem : from->variables) { to->variables.Add(CreateField(listItem)); } to->expression = CreateField(from->expression); @@ -31229,8 +31226,7 @@ ExpressionVisitor void ExpressionVisitor::CopyFields(WfConstructorExpression* from, WfConstructorExpression* to) { - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -31300,8 +31296,7 @@ ExpressionVisitor to->name.tokenIndex = from->name.tokenIndex; to->name.value = from->name.value; to->expression = CreateField(from->expression); - FOREACH(vl::Ptr, listItem, from->events) - { + for (auto listItem : from->events) { to->events.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -31310,8 +31305,7 @@ ExpressionVisitor void ExpressionVisitor::CopyFields(WfCallExpression* from, WfCallExpression* to) { to->function = CreateField(from->function); - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -31326,8 +31320,7 @@ ExpressionVisitor void ExpressionVisitor::CopyFields(WfFunctionDeclaration* from, WfFunctionDeclaration* to) { to->anonymity = from->anonymity; - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } to->returnType = CreateField(from->returnType); @@ -31337,8 +31330,7 @@ ExpressionVisitor void ExpressionVisitor::CopyFields(WfDeclaration* from, WfDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -31368,8 +31360,7 @@ ExpressionVisitor void ExpressionVisitor::CopyFields(WfFunctionArgument* from, WfFunctionArgument* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -31382,8 +31373,7 @@ ExpressionVisitor void ExpressionVisitor::CopyFields(WfNewClassExpression* from, WfNewClassExpression* to) { to->type = CreateField(from->type); - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -31392,8 +31382,7 @@ ExpressionVisitor void ExpressionVisitor::CopyFields(WfNewInterfaceExpression* from, WfNewInterfaceExpression* to) { to->type = CreateField(from->type); - FOREACH(vl::Ptr, listItem, from->declarations) - { + for (auto listItem : from->declarations) { to->declarations.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -31742,8 +31731,7 @@ StatementVisitor void StatementVisitor::CopyFields(WfBlockStatement* from, WfBlockStatement* to) { - FOREACH(vl::Ptr, listItem, from->statements) - { + for (auto listItem : from->statements) { to->statements.Add(CreateField(listItem)); } to->endLabel.codeRange = from->endLabel.codeRange; @@ -31775,8 +31763,7 @@ StatementVisitor void StatementVisitor::CopyFields(WfDeclaration* from, WfDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -31945,8 +31932,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfNamespaceDeclaration* from, WfNamespaceDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->declarations) - { + for (auto listItem : from->declarations) { to->declarations.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -31954,8 +31940,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfDeclaration* from, WfDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -31986,8 +31971,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfFunctionDeclaration* from, WfFunctionDeclaration* to) { to->anonymity = from->anonymity; - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } to->returnType = CreateField(from->returnType); @@ -31997,8 +31981,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfFunctionArgument* from, WfFunctionArgument* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -32017,8 +32000,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfEventDeclaration* from, WfEventDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32042,12 +32024,10 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfConstructorDeclaration* from, WfConstructorDeclaration* to) { to->constructorType = from->constructorType; - FOREACH(vl::Ptr, listItem, from->baseConstructorCalls) - { + for (auto listItem : from->baseConstructorCalls) { to->baseConstructorCalls.Add(CreateField(listItem)); } - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } to->statement = CreateField(from->statement); @@ -32057,8 +32037,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfBaseConstructorCall* from, WfBaseConstructorCall* to) { to->type = CreateField(from->type); - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } to->codeRange = from->codeRange; @@ -32074,12 +32053,10 @@ DeclarationVisitor { to->kind = from->kind; to->constructorType = from->constructorType; - FOREACH(vl::Ptr, listItem, from->baseTypes) - { + for (auto listItem : from->baseTypes) { to->baseTypes.Add(CreateField(listItem)); } - FOREACH(vl::Ptr, listItem, from->declarations) - { + for (auto listItem : from->declarations) { to->declarations.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32088,8 +32065,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfEnumDeclaration* from, WfEnumDeclaration* to) { to->kind = from->kind; - FOREACH(vl::Ptr, listItem, from->items) - { + for (auto listItem : from->items) { to->items.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32097,8 +32073,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfEnumItem* from, WfEnumItem* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -32108,8 +32083,7 @@ DeclarationVisitor to->number.codeRange = from->number.codeRange; to->number.tokenIndex = from->number.tokenIndex; to->number.value = from->number.value; - FOREACH(vl::Ptr, listItem, from->intersections) - { + for (auto listItem : from->intersections) { to->intersections.Add(CreateField(listItem)); } to->codeRange = from->codeRange; @@ -32125,8 +32099,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfStructDeclaration* from, WfStructDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->members) - { + for (auto listItem : from->members) { to->members.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32134,8 +32107,7 @@ DeclarationVisitor void DeclarationVisitor::CopyFields(WfStructMember* from, WfStructMember* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -32302,8 +32274,7 @@ VirtualCfeDeclarationVisitor void VirtualCfeDeclarationVisitor::CopyFields(WfVirtualCfeDeclaration* from, WfVirtualCfeDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->expandedDeclarations) - { + for (auto listItem : from->expandedDeclarations) { to->expandedDeclarations.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32311,8 +32282,7 @@ VirtualCfeDeclarationVisitor void VirtualCfeDeclarationVisitor::CopyFields(WfDeclaration* from, WfDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -32389,12 +32359,10 @@ VirtualCseDeclarationVisitor void VirtualCseDeclarationVisitor::CopyFields(WfStateMachineDeclaration* from, WfStateMachineDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->inputs) - { + for (auto listItem : from->inputs) { to->inputs.Add(CreateField(listItem)); } - FOREACH(vl::Ptr, listItem, from->states) - { + for (auto listItem : from->states) { to->states.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32402,8 +32370,7 @@ VirtualCseDeclarationVisitor void VirtualCseDeclarationVisitor::CopyFields(WfVirtualCseDeclaration* from, WfVirtualCseDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->expandedDeclarations) - { + for (auto listItem : from->expandedDeclarations) { to->expandedDeclarations.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32411,8 +32378,7 @@ VirtualCseDeclarationVisitor void VirtualCseDeclarationVisitor::CopyFields(WfDeclaration* from, WfDeclaration* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -32445,8 +32411,7 @@ VirtualCseDeclarationVisitor to->name.codeRange = from->name.codeRange; to->name.tokenIndex = from->name.tokenIndex; to->name.value = from->name.value; - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } to->codeRange = from->codeRange; @@ -32454,8 +32419,7 @@ VirtualCseDeclarationVisitor void VirtualCseDeclarationVisitor::CopyFields(WfFunctionArgument* from, WfFunctionArgument* to) { - FOREACH(vl::Ptr, listItem, from->attributes) - { + for (auto listItem : from->attributes) { to->attributes.Add(CreateField(listItem)); } to->name.codeRange = from->name.codeRange; @@ -32470,8 +32434,7 @@ VirtualCseDeclarationVisitor to->name.codeRange = from->name.codeRange; to->name.tokenIndex = from->name.tokenIndex; to->name.value = from->name.value; - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } to->statement = CreateField(from->statement); @@ -32560,8 +32523,7 @@ VirtualCseStatementVisitor void VirtualCseStatementVisitor::CopyFields(WfSwitchStatement* from, WfSwitchStatement* to) { to->expression = CreateField(from->expression); - FOREACH(vl::Ptr, listItem, from->caseBranches) - { + for (auto listItem : from->caseBranches) { to->caseBranches.Add(CreateField(listItem)); } to->defaultBranch = CreateField(from->defaultBranch); @@ -32647,8 +32609,7 @@ CoroutineStatementVisitor to->opName.codeRange = from->opName.codeRange; to->opName.tokenIndex = from->opName.tokenIndex; to->opName.value = from->opName.value; - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32679,8 +32640,7 @@ StateMachineStatementVisitor void StateMachineStatementVisitor::CopyFields(WfStateSwitchStatement* from, WfStateSwitchStatement* to) { to->type = from->type; - FOREACH(vl::Ptr, listItem, from->caseBranches) - { + for (auto listItem : from->caseBranches) { to->caseBranches.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32701,8 +32661,7 @@ StateMachineStatementVisitor to->name.codeRange = from->name.codeRange; to->name.tokenIndex = from->name.tokenIndex; to->name.value = from->name.value; - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } to->statement = CreateField(from->statement); @@ -32723,8 +32682,7 @@ StateMachineStatementVisitor to->name.codeRange = from->name.codeRange; to->name.tokenIndex = from->name.tokenIndex; to->name.value = from->name.value; - FOREACH(vl::Ptr, listItem, from->arguments) - { + for (auto listItem : from->arguments) { to->arguments.Add(CreateField(listItem)); } CopyFields(static_cast(from), static_cast(to)); @@ -32948,12 +32906,10 @@ ModuleVisitor to->name.codeRange = from->name.codeRange; to->name.tokenIndex = from->name.tokenIndex; to->name.value = from->name.value; - FOREACH(vl::Ptr, listItem, from->paths) - { + for (auto listItem : from->paths) { to->paths.Add(CreateField(listItem)); } - FOREACH(vl::Ptr, listItem, from->declarations) - { + for (auto listItem : from->declarations) { to->declarations.Add(CreateField(listItem)); } to->codeRange = from->codeRange; @@ -32961,8 +32917,7 @@ ModuleVisitor void ModuleVisitor::CopyFields(WfModuleUsingPath* from, WfModuleUsingPath* to) { - FOREACH(vl::Ptr, listItem, from->items) - { + for (auto listItem : from->items) { to->items.Add(CreateField(listItem)); } to->codeRange = from->codeRange; @@ -32970,8 +32925,7 @@ ModuleVisitor void ModuleVisitor::CopyFields(WfModuleUsingItem* from, WfModuleUsingItem* to) { - FOREACH(vl::Ptr, listItem, from->fragments) - { + for (auto listItem : from->fragments) { to->fragments.Add(CreateField(listItem)); } to->codeRange = from->codeRange; @@ -37911,8 +37865,7 @@ TypeVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); VisitField(node->result.Obj()); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } } @@ -38118,14 +38071,12 @@ ExpressionVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } VisitField(node->returnType.Obj()); VisitField(node->statement.Obj()); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38154,8 +38105,7 @@ ExpressionVisitor if (!node) return; Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38274,8 +38224,7 @@ ExpressionVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->variables) - { + for (auto listItem : node->variables) { VisitField(listItem.Obj()); } VisitField(node->expression.Obj()); @@ -38314,8 +38263,7 @@ ExpressionVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } } @@ -38389,8 +38337,7 @@ ExpressionVisitor VisitField(node->parent.Obj()); Traverse(node->name); VisitField(node->expression.Obj()); - FOREACH(vl::Ptr, listItem, node->events) - { + for (auto listItem : node->events) { VisitField(listItem.Obj()); } } @@ -38401,8 +38348,7 @@ ExpressionVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); VisitField(node->function.Obj()); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } } @@ -38421,8 +38367,7 @@ ExpressionVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); VisitField(node->type.Obj()); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } } @@ -38433,8 +38378,7 @@ ExpressionVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); VisitField(node->type.Obj()); - FOREACH(vl::Ptr, listItem, node->declarations) - { + for (auto listItem : node->declarations) { VisitField(listItem.Obj()); } } @@ -38541,8 +38485,7 @@ StatementVisitor Traverse(static_cast(node)); VisitField(node->type.Obj()); VisitField(node->expression.Obj()); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38643,8 +38586,7 @@ StatementVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->statements) - { + for (auto listItem : node->statements) { VisitField(listItem.Obj()); } Traverse(node->endLabel); @@ -38799,8 +38741,7 @@ DeclarationVisitor if (!node) return; Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38813,8 +38754,7 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); VisitField(node->type.Obj()); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } } @@ -38824,14 +38764,12 @@ DeclarationVisitor if (!node) return; Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); Traverse(node->number); - FOREACH(vl::Ptr, listItem, node->intersections) - { + for (auto listItem : node->intersections) { VisitField(listItem.Obj()); } } @@ -38849,8 +38787,7 @@ DeclarationVisitor if (!node) return; Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38864,12 +38801,10 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->declarations) - { + for (auto listItem : node->declarations) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38881,14 +38816,12 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } VisitField(node->returnType.Obj()); VisitField(node->statement.Obj()); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38902,8 +38835,7 @@ DeclarationVisitor Traverse(static_cast(node)); VisitField(node->type.Obj()); VisitField(node->expression.Obj()); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38915,12 +38847,10 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38936,8 +38866,7 @@ DeclarationVisitor Traverse(node->getter); Traverse(node->setter); Traverse(node->valueChangedEvent); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38949,17 +38878,14 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->baseConstructorCalls) - { + for (auto listItem : node->baseConstructorCalls) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } VisitField(node->statement.Obj()); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38972,8 +38898,7 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); VisitField(node->statement.Obj()); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -38985,16 +38910,13 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->baseTypes) - { + for (auto listItem : node->baseTypes) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->declarations) - { + for (auto listItem : node->declarations) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -39006,12 +38928,10 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->items) - { + for (auto listItem : node->items) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -39023,12 +38943,10 @@ DeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->members) - { + for (auto listItem : node->members) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -39112,12 +39030,10 @@ VirtualCfeDeclarationVisitor Traverse(static_cast(node)); VisitField(node->type.Obj()); VisitField(node->expression.Obj()); - FOREACH(vl::Ptr, listItem, node->expandedDeclarations) - { + for (auto listItem : node->expandedDeclarations) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -39132,12 +39048,10 @@ VirtualCfeDeclarationVisitor Traverse(static_cast(node)); VisitField(node->baseType.Obj()); VisitField(node->elementType.Obj()); - FOREACH(vl::Ptr, listItem, node->expandedDeclarations) - { + for (auto listItem : node->expandedDeclarations) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -39215,8 +39129,7 @@ VirtualCseDeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(node->name); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } } @@ -39226,8 +39139,7 @@ VirtualCseDeclarationVisitor if (!node) return; Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -39240,8 +39152,7 @@ VirtualCseDeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(node->name); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } VisitField(node->statement.Obj()); @@ -39255,20 +39166,16 @@ VirtualCseDeclarationVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->inputs) - { + for (auto listItem : node->inputs) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->states) - { + for (auto listItem : node->states) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->expandedDeclarations) - { + for (auto listItem : node->expandedDeclarations) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->attributes) - { + for (auto listItem : node->attributes) { VisitField(listItem.Obj()); } Traverse(node->name); @@ -39345,8 +39252,7 @@ VirtualCseStatementVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); VisitField(node->expression.Obj()); - FOREACH(vl::Ptr, listItem, node->caseBranches) - { + for (auto listItem : node->caseBranches) { VisitField(listItem.Obj()); } VisitField(node->defaultBranch.Obj()); @@ -39413,8 +39319,7 @@ CoroutineStatementVisitor Traverse(static_cast(node)); Traverse(node->varName); Traverse(node->opName); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } } @@ -39465,8 +39370,7 @@ StateMachineStatementVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(node->name); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } VisitField(node->statement.Obj()); @@ -39488,8 +39392,7 @@ StateMachineStatementVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->caseBranches) - { + for (auto listItem : node->caseBranches) { VisitField(listItem.Obj()); } } @@ -39501,8 +39404,7 @@ StateMachineStatementVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(node->name); - FOREACH(vl::Ptr, listItem, node->arguments) - { + for (auto listItem : node->arguments) { VisitField(listItem.Obj()); } } @@ -39693,12 +39595,10 @@ ModuleVisitor Traverse(static_cast(node)); Traverse(static_cast(node)); Traverse(node->name); - FOREACH(vl::Ptr, listItem, node->paths) - { + for (auto listItem : node->paths) { VisitField(listItem.Obj()); } - FOREACH(vl::Ptr, listItem, node->declarations) - { + for (auto listItem : node->declarations) { VisitField(listItem.Obj()); } } @@ -39732,8 +39632,7 @@ ModuleVisitor if (!node) return; Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->items) - { + for (auto listItem : node->items) { VisitField(listItem.Obj()); } } @@ -39743,8 +39642,7 @@ ModuleVisitor if (!node) return; Traverse(static_cast(node)); Traverse(static_cast(node)); - FOREACH(vl::Ptr, listItem, node->fragments) - { + for (auto listItem : node->fragments) { VisitField(listItem.Obj()); } } diff --git a/Import/VlppWorkflowRuntime.cpp b/Import/VlppWorkflowRuntime.cpp index 218fc00e..2c9d14e4 100644 --- a/Import/VlppWorkflowRuntime.cpp +++ b/Import/VlppWorkflowRuntime.cpp @@ -56,7 +56,7 @@ WfRuntimeCallStackInfo if (!context) { Dictionary map; - FOREACH_INDEXER(WString, name, index, names) + for (auto [name, index] : indexed(names)) { map.Add(name, context->variables[index]); } @@ -660,19 +660,19 @@ namespace vl void Initialize(WfWriterContextPrepare& prepare) { - FOREACH_INDEXER(ITypeDescriptor*, td, index, prepare.tds) + for (auto [td, index] : indexed(prepare.tds)) { tdIndex.Add(td, index); } - FOREACH_INDEXER(IMethodInfo*, mi, index, prepare.mis) + for (auto [mi, index] : indexed(prepare.mis)) { miIndex.Add(mi, index); } - FOREACH_INDEXER(IPropertyInfo*, pi, index, prepare.pis) + for (auto [pi, index] : indexed(prepare.pis)) { piIndex.Add(pi, index); } - FOREACH_INDEXER(IEventInfo*, ei, index, prepare.eis) + for (auto [ei, index] : indexed(prepare.eis)) { eiIndex.Add(ei, index); } @@ -806,19 +806,19 @@ Serialization (CollectMetadata) static void CollectMetadata(WfTypeImpl* typeImpl, WfWriterContextPrepare& prepare) { - FOREACH(Ptr, td, typeImpl->classes) + for (auto td : typeImpl->classes) { CollectTd(td.Obj(), prepare); } - FOREACH(Ptr, td, typeImpl->interfaces) + for (auto td : typeImpl->interfaces) { CollectTd(td.Obj(), prepare); } - FOREACH(Ptr, td, typeImpl->structs) + for (auto td : typeImpl->structs) { CollectTd(td.Obj(), prepare); } - FOREACH(Ptr, td, typeImpl->enums) + for (auto td : typeImpl->enums) { CollectTd(td.Obj(), prepare); } @@ -869,15 +869,15 @@ Serialization (CollectMetadata) } } - FOREACH(IMethodInfo*, mi, prepare.mis) + for (auto mi : prepare.mis) { CollectTd(mi, prepare); } - FOREACH(IPropertyInfo*, pi, prepare.pis) + for (auto pi : prepare.pis) { CollectTd(pi, prepare); } - FOREACH(IEventInfo*, ei, prepare.eis) + for (auto ei : prepare.eis) { CollectTd(ei, prepare); } @@ -1858,19 +1858,19 @@ Serialization (TypeImpl) static void IO(WfReader& reader, WfTypeImpl& value) { // fill types - FOREACH(Ptr, td, value.classes) + for (auto td : value.classes) { IOClass(reader, td.Obj()); } - FOREACH(Ptr, td, value.interfaces) + for (auto td : value.interfaces) { IOInterface(reader, td.Obj()); } - FOREACH(Ptr, td, value.structs) + for (auto td : value.structs) { IOStruct(reader, td.Obj()); } - FOREACH(Ptr, td, value.enums) + for (auto td : value.enums) { IOEnum(reader, td.Obj()); } @@ -1879,19 +1879,19 @@ Serialization (TypeImpl) static void IO(WfWriter& writer, WfTypeImpl& value) { // fill types - FOREACH(Ptr, td, value.classes) + for (auto td : value.classes) { IOClass(writer, td.Obj()); } - FOREACH(Ptr, td, value.interfaces) + for (auto td : value.interfaces) { IOInterface(writer, td.Obj()); } - FOREACH(Ptr, td, value.structs) + for (auto td : value.structs) { IOStruct(writer, td.Obj()); } - FOREACH(Ptr, td, value.enums) + for (auto td : value.enums) { IOEnum(writer, td.Obj()); } @@ -2215,7 +2215,7 @@ Serialization (Assembly) vint piCount = prepare.pis.Count(); vint eiCount = prepare.eis.Count(); writer << tdCount << miCount << piCount << eiCount; - FOREACH(ITypeDescriptor*, td, prepare.tds) + for (auto td : prepare.tds) { writer << td; } @@ -2226,15 +2226,15 @@ Serialization (Assembly) GetGlobalTypeManager()->AddTypeLoader(value.typeImpl); } - FOREACH(IMethodInfo*, mi, prepare.mis) + for (auto mi : prepare.mis) { writer << mi; } - FOREACH(IPropertyInfo*, pi, prepare.pis) + for (auto pi : prepare.pis) { writer << pi; } - FOREACH(IEventInfo*, ei, prepare.eis) + for (auto ei : prepare.eis) { writer << ei; } @@ -4988,7 +4988,7 @@ WfEvent if (index != -1) { auto& values = record->handlers.GetByIndex(index); - FOREACH(Ptr, handler, values) + for (auto handler : values) { handler->proxy->Invoke(arguments); } @@ -5570,7 +5570,7 @@ WfInterfaceInstance arguments[0] = Value::From(_proxy); #ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA InitializeAggregation(baseCtors.Count()); - FOREACH_INDEXER(IMethodInfo*, ctor, index, baseCtors) + for (auto [ctor, index] : indexed(baseCtors)) { Ptr ptr; { @@ -5616,11 +5616,11 @@ WfTypeImpl } globalContext = _globalContext; - FOREACH(Ptr, td, classes) + for (auto td : classes) { td->SetGlobalContext(globalContext); } - FOREACH(Ptr, td, interfaces) + for (auto td : interfaces) { td->SetGlobalContext(globalContext); } @@ -5637,7 +5637,7 @@ WfTypeImpl void WfTypeImpl::Load(reflection::description::ITypeManager* manager) { - FOREACH(Ptr, td, classes) + for (auto td : classes) { if (td->GetBaseTypeDescriptorCount() == 0) { @@ -5645,7 +5645,7 @@ WfTypeImpl } manager->SetTypeDescriptor(td->GetTypeName(), td); } - FOREACH(Ptr, td, interfaces) + for (auto td : interfaces) { if (td->GetBaseTypeDescriptorCount() == 0) { @@ -5653,11 +5653,11 @@ WfTypeImpl } manager->SetTypeDescriptor(td->GetTypeName(), td); } - FOREACH(Ptr, td, structs) + for (auto td : structs) { manager->SetTypeDescriptor(td->GetTypeName(), td); } - FOREACH(Ptr, td, enums) + for (auto td : enums) { manager->SetTypeDescriptor(td->GetTypeName(), td); } @@ -5665,19 +5665,19 @@ WfTypeImpl void WfTypeImpl::Unload(reflection::description::ITypeManager* manager) { - FOREACH(Ptr, td, classes) + for (auto td : classes) { manager->SetTypeDescriptor(td->GetTypeName(), nullptr); } - FOREACH(Ptr, td, interfaces) + for (auto td : interfaces) { manager->SetTypeDescriptor(td->GetTypeName(), nullptr); } - FOREACH(Ptr, td, structs) + for (auto td : structs) { manager->SetTypeDescriptor(td->GetTypeName(), nullptr); } - FOREACH(Ptr, td, enums) + for (auto td : enums) { manager->SetTypeDescriptor(td->GetTypeName(), nullptr); }