From c27aba4354c69c4a67fab587a59a8079cc9edc91 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 3 Nov 2011 21:14:04 -0700 Subject: refactor(api): remove type augmentation BREAK: - remove angular.[Object/Array/String/Function] - in templates [].$filter(predicate) and friends need to change to [] | filter:predicate --- src/service/parse.js | 27 ++------------------------- src/service/scope.js | 8 +++----- 2 files changed, 5 insertions(+), 30 deletions(-) (limited to 'src/service') diff --git a/src/service/parse.js b/src/service/parse.js index 36f6b715..432929b5 100644 --- a/src/service/parse.js +++ b/src/service/parse.js @@ -637,6 +637,7 @@ function setter(obj, path, setValue) { * @param {boolean=true} bindFnToScope * @returns value as accesbile by path */ +//TODO(misko): this function needs to be removed function getter(obj, path, bindFnToScope) { if (!path) return obj; var keys = path.split('.'); @@ -649,14 +650,6 @@ function getter(obj, path, bindFnToScope) { if (obj) { obj = (lastInstance = obj)[key]; } - if (isUndefined(obj) && key.charAt(0) == '$') { - var type = angularGlobal.typeOf(lastInstance); - type = angular[type.charAt(0).toUpperCase()+type.substring(1)]; - var fn = type ? type[[key.substring(1)]] : _undefined; - if (fn) { - return obj = bind(lastInstance, fn, lastInstance); - } - } } if (!bindFnToScope && isFunction(obj)) { return bind(lastInstance, obj); @@ -691,16 +684,6 @@ function getterFn(path) { ' fn.$unboundFn=s;\n' + ' s=fn;\n' + '}\n'; - if (key.charAt(1) == '$') { - // special code for super-imposed functions - var name = key.substr(2); - code += 'if(!s) {\n' + - ' t = angular.Global.typeOf(l);\n' + - ' fn = (angular[t.charAt(0).toUpperCase() + t.substring(1)]||{})["' + name + '"];\n' + - ' if (fn) ' + - 's = function(){ return fn.apply(l, [l].concat(Array.prototype.slice.call(arguments, 0))); };\n' + - '}\n'; - } }); code += 'return s;'; fn = Function('s', code); @@ -729,14 +712,8 @@ function $ParseProvider() { }]; } -function noFilters(){ - throw Error('Filters not supported!'); -} // This is a special access for JSON parser which bypasses the injector var parseJson = function(json) { - return parser(json, true, noFilters); + return parser(json, true); }; - -// TODO(misko): temporary hack, until we get rid of the type augmentation -var expressionCompile = new $ParseProvider().$get[1](noFilters); diff --git a/src/service/scope.js b/src/service/scope.js index ade2d82e..2f3efbd0 100644 --- a/src/service/scope.js +++ b/src/service/scope.js @@ -241,7 +241,7 @@ function $RootScopeProvider(){ array.unshift(watcher); return function() { - angularArray.remove(array, watcher); + arrayRemove(array, watcher); }; }, @@ -528,7 +528,7 @@ function $RootScopeProvider(){ namedListeners.push(listener); return function() { - angularArray.remove(namedListeners, listener); + arrayRemove(namedListeners, listener); }; }, @@ -641,9 +641,7 @@ function $RootScopeProvider(){ return scope; function compileToFn(exp, name) { - var fn = isString(exp) - ? expressionCompile(exp) - : exp; + var fn = $parse(exp); assertArgFn(fn, name); return fn; } -- cgit v1.2.3