From 79ade76bbeb6b61116a30b2b82041f44bc84177d Mon Sep 17 00:00:00 2001 From: Younes Ouadi Date: Tue, 10 Jun 2014 09:52:48 +0100 Subject: [PATCH] Review as per @briancavalier comments. --- lib/scope.js | 12 ++++++------ test/node/context-test.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/scope.js b/lib/scope.js index dcb02c6..9f3525b 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -12,7 +12,7 @@ define(function(require) { var when, defer, sequence, array, object, loader, Map, ComponentFactory, Lifecycle, Resolver, WireProxy, PluginRegistry, - undef, specUtils, DirectedGraph, importsGraph, cyclesTracker; + undef, specUtils, DirectedGraph, cyclesTracker; when = require('when'); sequence = require('when/sequence'); @@ -270,9 +270,9 @@ define(function(require) { var self = this; // instantiate the imports graph - importsGraph = new DirectedGraph(); + var importsGraph = new DirectedGraph(); - return processImports(self, spec).then(function(importedSpecs){ + return processImports(self, spec, importsGraph).then(function(importedSpecs){ // modules of importing spec overrides modules of imported spec. return processSpec(self, object.mixin(importedSpecs, spec)); }); @@ -483,7 +483,7 @@ define(function(require) { function noop() {} - function processImports(scope, spec, importingModuleId) { + function processImports(scope, spec, importsGraph, importingModuleId) { if ( ! spec || ! spec.$imports ) { return when({}); } @@ -500,14 +500,14 @@ define(function(require) { // go ahead with the import return when(scope.getModule(importedModuleId), function(importedSpec){ - return processImports(scope, importedSpec, importedModuleId).then(function(importedSpecs){ + return processImports(scope, importedSpec, importsGraph, importedModuleId).then(function(importedSpecs){ // modules of importing spec overrides modules of imported specs. importedSpecs = object.mixin(importedSpecs, importedSpec); // modules in the right overrides modules in the left currentImports = object.mixin(currentImports, importedSpecs); - return when(currentImports); + return currentImports; }); }); }, {}); diff --git a/test/node/context-test.js b/test/node/context-test.js index 2b474e4..b4d912e 100644 --- a/test/node/context-test.js +++ b/test/node/context-test.js @@ -167,7 +167,7 @@ buster.testCase('context', { ); }, ' / should not import circular import of three assemblies': function() { - return createContext('./fixtures/imports-test/circular-imports-assembly2-1').then( + return createContext('./fixtures/imports-test/circular-imports-assembly3-1').then( fail, function(context) { assert(true);