nl_tokens: Namespace extension ------------------- Iterate over settings . injections doing each injection .
pl_tokens: function injectObjects ( dest , settings ) { var injections = settings . injections ; if ( ! isArray ( injections ) ) { error ( "Invalid injections array in inject settings" ) ; } var destDecls = dest . _declarations ; for ( var i = 0 , len = injections . length ; i < len ; i ++ ) { var injection = injections [ i ] ; if ( typeof injection !== "object" ) { error ( "Invalid injection [" + i + "] in inject settings" ) ; } var destName = injection . name ; if ( ! checkUnitName ( destName ) ) { error ( "Invalid injection name '" + destName + "' [" + i + "] in inject settings" ) ; } if ( injection . unit != null && injection . value !== undefined ) { error ( "Unit and value can't be used together [" + i + "] in inject settings" ) ; } if ( injection . <mask> != null ) { // Copy unit declaration. if ( ! ( settings . namespace instanceof Gumup ) ) { error ( "Invalid namespace in inject settings" ) ; } var srcName = injection . unit ; if ( ! checkUnitName ( srcName ) ) { error ( "Invalid unit name '" + srcName + "' [" + i + "] in inject settings" ) ; } var srcDecls = settings . namespace . _declarations ; if ( srcDecls [ srcName ] == null ) { error ( "Unresolvable unit declaration '" + srcName + "' [" + i + "] in inject settigs" ) ; } destDecls [ destName ] = srcDecls [ srcName ] ; } else if ( injection . value !== undefined ) { // Inject object as new declaration. destDecls [ destName ] = new Declaration ( ( function ( obj ) { return function ( ) { return obj ; } ; } ) ( injection . value ) ) ; } else { error ( "Invalid injection object [" + i + "] in inject settings" ) ; } } }