Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 05c37c4

Browse files
committed
Added another helper for better code readability
1 parent ac06724 commit 05c37c4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/auto/injector.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,24 @@ function createInjector(modulesToLoad) {
586586
return isArray(fn);
587587
}
588588

589+
function getAnnotatedFunction(fn){
590+
if(isInlineAnnotated(fn)){
591+
return fn[fn.length - 1]
592+
}
593+
else{
594+
return fn;
595+
}
596+
}
597+
589598
function instantiate(Type, locals) {
590599
var Constructor = function() {},
591-
instance, returnedValue;
600+
annotatedFunction,
601+
instance,
602+
returnedValue;
603+
604+
annotatedFunction = getAnnotatedFunction(Type);
592605

593-
Constructor.prototype = (isInlineAnnotated(Type) ? Type[Type.length - 1] : Type).prototype;
606+
Constructor.prototype = annotatedFunction.prototype;
594607
instance = new Constructor();
595608
returnedValue = invoke(Type, instance, locals);
596609

0 commit comments

Comments
 (0)