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
This commit is contained in:
Richard Sentino 2015-08-27 13:51:32 +12:00 committed by Jeff Cross
parent 51285666d8
commit 256b2dc9b7
4 changed files with 3 additions and 9 deletions

View File

@ -13,8 +13,6 @@ class Math {
static double random() => _random.nextDouble();
}
int ENUM_INDEX(value) => value.index;
class CONST {
const CONST();
}

View File

@ -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<T>(expr: T): T {

View File

@ -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;

View File

@ -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)