11'use strict' ;
22
3+ var CONTAINER_SERVICE_NAME = '@container' ;
4+
35/**
46 * @param {* } value
57 * @constructor
@@ -36,6 +38,19 @@ FunctionArgument.prototype._isParameterReference = function _isParameterReferenc
3638 return variableReferenceRegex . test ( argumentValue ) ;
3739} ;
3840
41+ /**
42+ * @param {* } argumentValue
43+ * @return {boolean }
44+ * @private
45+ */
46+ FunctionArgument . prototype . _isContainerReference = function _isContainerReference ( argumentValue ) {
47+ if ( ! this . _isString ( argumentValue ) ) {
48+ return false ;
49+ }
50+
51+ return argumentValue === CONTAINER_SERVICE_NAME ;
52+ } ;
53+
3954/**
4055 * @param {* } argumentValue
4156 * @return {boolean }
@@ -59,6 +74,8 @@ FunctionArgument.prototype._isServiceReference = function _isServiceReference(ar
5974FunctionArgument . prototype . _detectType = function _detectType ( argumentValue ) {
6075 if ( this . _isParameterReference ( argumentValue ) ) {
6176 return FunctionArgument . TYPE_PARAMETER_REFERENCE ;
77+ } else if ( this . _isContainerReference ( argumentValue ) ) {
78+ return FunctionArgument . TYPE_CONTAINER_REFERENCE ;
6279 } else if ( this . _isServiceReference ( argumentValue ) ) {
6380 return FunctionArgument . TYPE_SERVICE_REFERENCE ;
6481 }
@@ -123,7 +140,9 @@ FunctionArgument.prototype.isParameterReference = function isParameterReference(
123140 * @return {* }
124141 */
125142FunctionArgument . prototype . resolve = function resolve ( container ) {
126- if ( FunctionArgument . TYPE_PARAMETER_REFERENCE === this . type ) {
143+ if ( FunctionArgument . TYPE_CONTAINER_REFERENCE === this . type ) {
144+ return container ;
145+ } else if ( FunctionArgument . TYPE_PARAMETER_REFERENCE === this . type ) {
127146 return container . getParameter ( this . _extractReferencedParameterName ( this . name ) ) ;
128147 } else if ( FunctionArgument . TYPE_SERVICE_REFERENCE === this . type ) {
129148 return container . getService ( this . _extractReferencedServiceName ( this . name ) ) ;
@@ -132,6 +151,7 @@ FunctionArgument.prototype.resolve = function resolve(container) {
132151 return this . name ;
133152} ;
134153
154+ FunctionArgument . TYPE_CONTAINER_REFERENCE = 'container-reference' ;
135155FunctionArgument . TYPE_PARAMETER_REFERENCE = 'parameter-reference' ;
136156FunctionArgument . TYPE_SERVICE_REFERENCE = 'service-reference' ;
137157FunctionArgument . TYPE_VALUE = 'simple-value' ;
0 commit comments