From 256b2dc9b7784af1bc8ffbb5fbf5c7dc8606f3f8 Mon Sep 17 00:00:00 2001 From: Richard Sentino Date: Thu, 27 Aug 2015 13:51:32 +1200 Subject: [PATCH] chore: remove ENUM_INDEX from facade The ENUM_INDEX utility was added to return the index of an enum consistently between Dart and TypeScript, so that the index could be used to look up the name of the enum. Since dart is no longer supported by Http, and since no other part of the framework is using this function, it has been removed. Closes #3843 --- modules/angular2/src/core/facade/lang.dart | 2 -- modules/angular2/src/core/facade/lang.ts | 4 ---- modules/angular2/src/http/backends/jsonp_backend.ts | 2 +- modules/angular2/src/http/backends/xhr_backend.ts | 4 ++-- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/angular2/src/core/facade/lang.dart b/modules/angular2/src/core/facade/lang.dart index 7c0a40c323..0a678e9474 100644 --- a/modules/angular2/src/core/facade/lang.dart +++ b/modules/angular2/src/core/facade/lang.dart @@ -13,8 +13,6 @@ class Math { static double random() => _random.nextDouble(); } -int ENUM_INDEX(value) => value.index; - class CONST { const CONST(); } diff --git a/modules/angular2/src/core/facade/lang.ts b/modules/angular2/src/core/facade/lang.ts index 222eb39bbe..878698eb45 100644 --- a/modules/angular2/src/core/facade/lang.ts +++ b/modules/angular2/src/core/facade/lang.ts @@ -53,10 +53,6 @@ _global.assert = function assert(condition) { } }; -export function ENUM_INDEX(value: number): number { - return value; -} - // This function is needed only to properly support Dart's const expressions // see https://github.com/angular/ts2dart/pull/151 for more info export function CONST_EXPR(expr: T): T { diff --git a/modules/angular2/src/http/backends/jsonp_backend.ts b/modules/angular2/src/http/backends/jsonp_backend.ts index 9ef2a8fa6c..aa7e657327 100644 --- a/modules/angular2/src/http/backends/jsonp_backend.ts +++ b/modules/angular2/src/http/backends/jsonp_backend.ts @@ -6,7 +6,7 @@ import {ResponseOptions, BaseResponseOptions} from '../base_response_options'; import {Injectable} from 'angular2/di'; import {BrowserJsonp} from './browser_jsonp'; import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; -import {StringWrapper, isPresent, ENUM_INDEX, makeTypeError} from 'angular2/src/core/facade/lang'; +import {StringWrapper, isPresent, makeTypeError} from 'angular2/src/core/facade/lang'; export class JSONPConnection implements Connection { readyState: ReadyStates; diff --git a/modules/angular2/src/http/backends/xhr_backend.ts b/modules/angular2/src/http/backends/xhr_backend.ts index 3722382474..70128e76c3 100644 --- a/modules/angular2/src/http/backends/xhr_backend.ts +++ b/modules/angular2/src/http/backends/xhr_backend.ts @@ -6,7 +6,7 @@ import {ResponseOptions, BaseResponseOptions} from '../base_response_options'; import {Injectable} from 'angular2/di'; import {BrowserXhr} from './browser_xhr'; import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; -import {isPresent, ENUM_INDEX} from 'angular2/src/core/facade/lang'; +import {isPresent} from 'angular2/src/core/facade/lang'; /** * Creates connections using `XMLHttpRequest`. Given a fully-qualified @@ -31,7 +31,7 @@ export class XHRConnection implements Connection { this.response = new EventEmitter(); this._xhr = browserXHR.build(); // TODO(jeffbcross): implement error listening/propagation - this._xhr.open(RequestMethods[ENUM_INDEX(req.method)], req.url); + this._xhr.open(RequestMethods[req.method], req.url); this._xhr.addEventListener('load', (_) => { // responseText is the old-school way of retrieving response (supported by IE8 & 9) // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)