Skip to content

Commit

Permalink
Minor refactorig #186
Browse files Browse the repository at this point in the history
  • Loading branch information
meri committed Apr 15, 2014
1 parent 22cc81d commit 91f317f
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public MixinsSolver(ReferencesSolver parentSolver, AstNodesStack semiCompiledNod
this.defaultGuardHelper = new DefaultGuardHelper(problemsHandler);
}

private MixinCompilationResult resolveMixinReference(final IScope callerScope, final FullMixinDefinition referencedMixin, final IScope mixinWorkingScope, final ExpressionEvaluator expressionEvaluator) {
private MixinCompilationResult resolveMixinReference(final IScope callerScope, final FullMixinDefinition referencedMixin, final IScope mixinWorkingScope) {
final ExpressionEvaluator expressionEvaluator = new ExpressionEvaluator(mixinWorkingScope, problemsHandler, configuration);
final ReusableStructure mixin = referencedMixin.getMixin();

final IScope referencedMixinScope = mixinWorkingScope;
Expand Down Expand Up @@ -134,12 +135,10 @@ public void run() {
MixinsGuardsValidator guardsValidator = new MixinsGuardsValidator(mixinWorkingScope, problemsHandler, configuration);
GuardValue guardValue = guardsValidator.evaluateGuards(mixin);

// if none of them is true, then we do not need mixin no matter what
if (guardValue!=GuardValue.DO_NOT_USE) {
//OPTIMIZATION POSSIBLE: there is no need to compile mixins at this point, some of them are not going to be
//used and create snapshot operation is cheap now. It should be done later on.
ExpressionEvaluator expressionEvaluator = new ExpressionEvaluator(mixinWorkingScope, problemsHandler, configuration);
MixinCompilationResult compiled = resolveMixinReference(callerScope, fullMixin, mixinWorkingScope, expressionEvaluator);
MixinCompilationResult compiled = resolveMixinReference(callerScope, fullMixin, mixinWorkingScope);
//mark the mixin according to its default() function use
compiled.setGuardValue(guardValue);
//store the mixin as candidate
Expand Down

0 comments on commit 91f317f

Please sign in to comment.