Skip to content

Commit

Permalink
Last base to go on off
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Jun 17, 2019
1 parent b06db74 commit bb1e687
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 73 deletions.
32 changes: 0 additions & 32 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,12 @@ sudo: required

matrix:
include :
- os: linux
compiler: gcc
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
- os: linux
compiler: g++-5
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- os: linux
compiler: g++-8
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
- os: linux
compiler: clang
# This build runs with ASan and we set `detect_odr_violation=0`
# to work around https://bugs.llvm.org/show_bug.cgi?id=37545.
env: AUTOTOOLS=no COVERAGE=no BUILD=static ASAN_OPTIONS=detect_odr_violation=0
- os: linux
compiler: clang
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
- os: osx
compiler: clang
env: AUTOTOOLS=no COVERAGE=no BUILD=shared
- os: osx
compiler: clang
env: AUTOTOOLS=no COVERAGE=no BUILD=static
- os: osx
compiler: clang
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared

script:
- ./script/ci-build-libsass
Expand Down
10 changes: 0 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,9 @@ environment:
ruby_version: 24-x64
TargetPath: sassc/bin/sassc.exe
matrix:
- Compiler: msvc
Config: Release
Platform: Win32
- Compiler: msvc
Config: Debug
Platform: Win32
- Compiler: msvc
Config: Release
Platform: Win64
- Compiler: mingw
Build: static
- Compiler: mingw
Build: shared

cache:
- C:\Ruby%ruby_version%\lib\ruby\gems
Expand Down
1 change: 1 addition & 0 deletions src/ast_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// __EXTENSIONS__ fix on Solaris.
#include "sass.hpp"
#include <algorithm>
#include <functional>
#include "util_string.hpp"

namespace Sass {
Expand Down
4 changes: 2 additions & 2 deletions src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,13 @@ namespace Sass {
// Make this an error once deprecation is over
for (SimpleSelectorObj simple : compound->elements()) {
// Pass every selector we ever see to extender (to make them findable for extend)
ctx.extender.addExtension(selector(), simple, e, mediaStack.back());
ctx.extender.addExtension(selector(), simple, mediaStack.back(), e->isOptional());
}

}
else {
// Pass every selector we ever see to extender (to make them findable for extend)
ctx.extender.addExtension(selector(), compound->first(), e, mediaStack.back());
ctx.extender.addExtension(selector(), compound->first(), mediaStack.back(), e->isOptional());
}

}
Expand Down
41 changes: 20 additions & 21 deletions src/extender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,17 @@ namespace Sass {
void Extender::addExtension(
SelectorListObj& extender,
SimpleSelectorObj& target,
// get get passed a pointer
ExtendRuleObj extend,
CssMediaRuleObj& mediaQueryContext)
CssMediaRuleObj& mediaQueryContext,
bool is_optional)
{

auto rules = selectors.find(target);
bool hasRule = rules != selectors.end();

ExtSelExtMapEntry newExtensions;

auto existingExtensions = extensionsByExtender.find(target);
bool hasExistingExtensions = existingExtensions != extensionsByExtender.end();
// ToDo: we check this here first and fetch the same? item again after the loop!?
bool hasExistingExtensions = extensionsByExtender.find(target) != extensionsByExtender.end();

ExtSelExtMapEntry& sources = extensions[target];

Expand All @@ -309,7 +308,7 @@ namespace Sass {
Extension state(complex);
// ToDo: fine-tune public API
state.target = target;
state.isOptional = extend->isOptional();
state.isOptional = is_optional;
state.mediaContext = mediaQueryContext;

if (sources.hasKey(complex)) {
Expand Down Expand Up @@ -349,14 +348,15 @@ namespace Sass {

ExtSelExtMap newExtensionsByTarget;
newExtensionsByTarget.insert(std::make_pair(target, newExtensions));
existingExtensions = extensionsByExtender.find(target);
// ToDo: do we really need to fetch again (see top on fn)
auto existingExtensions = extensionsByExtender.find(target);
if (existingExtensions != extensionsByExtender.end()) {
if (hasExistingExtensions && !existingExtensions->second.empty()) {
auto additionalExtensions =
/* auto additionalExtensions = */
extendExistingExtensions(existingExtensions->second, newExtensionsByTarget);
if (!additionalExtensions.empty()) {
mapCopyExts(newExtensionsByTarget, additionalExtensions);
}
// if (!additionalExtensions.empty()) {
// mapCopyExts(newExtensionsByTarget, additionalExtensions);
// }
}
}

Expand Down Expand Up @@ -412,30 +412,28 @@ namespace Sass {
// ##########################################################################
ExtSelExtMap Extender::extendExistingExtensions(
// Taking in a reference here makes MSVC debug stuck!?
const std::vector<Extension> oldExtensions,
const std::vector<Extension>& oldExtensions,
ExtSelExtMap& newExtensions)
{

ExtSelExtMap additionalExtensions;

for (Extension extension : oldExtensions) {
ExtSelExtMapEntry& sources = extensions[extension.target];
std::vector<ComplexSelectorObj> selectors;

selectors = extendComplex(
std::vector<ComplexSelectorObj> selectors(extendComplex(
extension.extender,
newExtensions,
extension.mediaContext
);
));

if (selectors.empty()) {
continue;
}

// ToDo: "catch" error from extend

bool first = false;
bool containsExtension = ObjEqualityFn(selectors.front(), extension.extender);
bool first = false, containsExtension =
ObjEqualityFn(selectors.front(), extension.extender);
for (const ComplexSelectorObj& complex : selectors) {
// If the output contains the original complex
// selector, there's no need to recreate it.
Expand All @@ -444,7 +442,8 @@ namespace Sass {
continue;
}

Extension withExtender = extension.withExtender(complex);
const Extension withExtender =
extension.withExtender(complex);
if (sources.hasKey(complex)) {
Extension source = sources.get(complex);
sources.insert(complex, mergeExtension(
Expand Down Expand Up @@ -529,7 +528,7 @@ namespace Sass {
// ##########################################################################
std::vector<ComplexSelectorObj> Extender::extendComplex(
// Taking in a reference here makes MSVC debug stuck!?
const ComplexSelectorObj complex,
const ComplexSelectorObj& complex,
const ExtSelExtMap& extensions,
const CssMediaRuleObj& mediaQueryContext)
{
Expand Down Expand Up @@ -658,7 +657,7 @@ namespace Sass {
// ##########################################################################
Extension Extender::extensionForCompound(
// Taking in a reference here makes MSVC debug stuck!?
const std::vector<SimpleSelectorObj> simples) const
const std::vector<SimpleSelectorObj>& simples) const
{
CompoundSelectorObj compound = SASS_MEMORY_NEW(CompoundSelector, ParserState("[ext]"));
compound->concat(simples);
Expand Down
11 changes: 5 additions & 6 deletions src/extender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,8 @@ namespace Sass {
void addExtension(
SelectorListObj& extender,
SimpleSelectorObj& target,
// gets passed by pointer
ExtendRuleObj extend,
CssMediaRuleObj& mediaQueryContext);
CssMediaRuleObj& mediaQueryContext,
bool is_optional = false);

// ##########################################################################
// The set of all simple selectors in style rules handled
Expand Down Expand Up @@ -275,7 +274,7 @@ namespace Sass {
// ##########################################################################
ExtSelExtMap extendExistingExtensions(
// Taking in a reference here makes MSVC debug stuck!?
const std::vector<Extension> extensions,
const std::vector<Extension>& extensions,
ExtSelExtMap& newExtensions);

// ##########################################################################
Expand All @@ -292,7 +291,7 @@ namespace Sass {
// ##########################################################################
std::vector<ComplexSelectorObj> extendComplex(
// Taking in a reference here makes MSVC debug stuck!?
const ComplexSelectorObj list,
const ComplexSelectorObj& list,
const ExtSelExtMap& extensions,
const CssMediaRuleObj& mediaQueryContext);

Expand All @@ -309,7 +308,7 @@ namespace Sass {
// ##########################################################################
Extension extensionForCompound(
// Taking in a reference here makes MSVC debug stuck!?
const std::vector<SimpleSelectorObj> simples) const;
const std::vector<SimpleSelectorObj>& simples) const;

// ##########################################################################
// Extends [compound] using [extensions], and returns the
Expand Down
2 changes: 1 addition & 1 deletion src/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Sass {
// ##########################################################################
// Static function to create a copy with a new extender
// ##########################################################################
Extension Extension::withExtender(ComplexSelectorObj newExtender)
Extension Extension::withExtender(ComplexSelectorObj newExtender) const
{
Extension extension(newExtender);
extension.specificity = specificity;
Expand Down
2 changes: 1 addition & 1 deletion src/extension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace Sass {
// compatible with the query context for this extender.
void assertCompatibleMediaContext(CssMediaRuleObj mediaContext, Backtraces& traces) const;

Extension withExtender(ComplexSelectorObj newExtender);
Extension withExtender(ComplexSelectorObj newExtender) const;

};

Expand Down

0 comments on commit bb1e687

Please sign in to comment.