Skip to content

Commit

Permalink
Proposal: fix for Parser returning empty imports
Browse files Browse the repository at this point in the history
The fix is quite naive and has not been tested. It works with compiler but it hasn't been tried with web handler.
  • Loading branch information
gthx authored and Tigraine committed Aug 29, 2010
1 parent e8a1104 commit 89222a8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dotless.Compiler/Program.cs
Expand Up @@ -100,6 +100,7 @@ private static IEnumerable<string> CompileImpl(ILessEngine engine, string inputF
files.Add(inputFilePath);
foreach (var file in engine.GetImports())
files.Add(Path.Combine(directoryPath, Path.ChangeExtension(file, "less")));
engine.ResetImports();
return files;
}
catch (IOException)
Expand Down
5 changes: 5 additions & 0 deletions src/dotless.Core/Engine/CacheDecorator.cs
Expand Up @@ -54,5 +54,10 @@ public IEnumerable<string> GetImports()
{
return Underlying.GetImports();
}

public void ResetImports()
{
Underlying.ResetImports();
}
}
}
1 change: 1 addition & 0 deletions src/dotless.Core/Engine/ILessEngine.cs
Expand Up @@ -5,6 +5,7 @@ namespace dotless.Core
public interface ILessEngine
{
string TransformToCss(string source, string fileName);
void ResetImports();
IEnumerable<string> GetImports();
}
}
6 changes: 6 additions & 0 deletions src/dotless.Core/Engine/LessEngine.cs
Expand Up @@ -54,5 +54,11 @@ public IEnumerable<string> GetImports()
{
return Parser.Importer.Imports.Distinct();
}

public void ResetImports()
{
Parser.Importer.Imports.Clear();
}

}
}
5 changes: 5 additions & 0 deletions src/dotless.Core/Engine/ParameterDecorator.cs
Expand Up @@ -31,5 +31,10 @@ public IEnumerable<string> GetImports()
{
return Underlying.GetImports();
}

public void ResetImports()
{
Underlying.ResetImports();
}
}
}
2 changes: 1 addition & 1 deletion src/dotless.Core/Parser/Parser.cs
Expand Up @@ -86,7 +86,7 @@ public Parser(int optimization, IStylizer stylizer, Importer importer)

public Ruleset Parse(string input, string fileName)
{
Importer.Imports = new List<string>();
Tokenizer.SetupInput(input);
ParsingException parsingException = null;
Ruleset root = null;

Expand Down

0 comments on commit 89222a8

Please sign in to comment.