Skip to content

Commit 256b2dc

Browse files
Richard Sentinojeffbcross
authored andcommitted
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 angular#3843
1 parent 5128566 commit 256b2dc

4 files changed

Lines changed: 3 additions & 9 deletions

File tree

modules/angular2/src/core/facade/lang.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ class Math {
1313
static double random() => _random.nextDouble();
1414
}
1515

16-
int ENUM_INDEX(value) => value.index;
17-
1816
class CONST {
1917
const CONST();
2018
}

modules/angular2/src/core/facade/lang.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ _global.assert = function assert(condition) {
5353
}
5454
};
5555

56-
export function ENUM_INDEX(value: number): number {
57-
return value;
58-
}
59-
6056
// This function is needed only to properly support Dart's const expressions
6157
// see https://github.com/angular/ts2dart/pull/151 for more info
6258
export function CONST_EXPR<T>(expr: T): T {

modules/angular2/src/http/backends/jsonp_backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {ResponseOptions, BaseResponseOptions} from '../base_response_options';
66
import {Injectable} from 'angular2/di';
77
import {BrowserJsonp} from './browser_jsonp';
88
import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async';
9-
import {StringWrapper, isPresent, ENUM_INDEX, makeTypeError} from 'angular2/src/core/facade/lang';
9+
import {StringWrapper, isPresent, makeTypeError} from 'angular2/src/core/facade/lang';
1010

1111
export class JSONPConnection implements Connection {
1212
readyState: ReadyStates;

modules/angular2/src/http/backends/xhr_backend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {ResponseOptions, BaseResponseOptions} from '../base_response_options';
66
import {Injectable} from 'angular2/di';
77
import {BrowserXhr} from './browser_xhr';
88
import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async';
9-
import {isPresent, ENUM_INDEX} from 'angular2/src/core/facade/lang';
9+
import {isPresent} from 'angular2/src/core/facade/lang';
1010

1111
/**
1212
* Creates connections using `XMLHttpRequest`. Given a fully-qualified
@@ -31,7 +31,7 @@ export class XHRConnection implements Connection {
3131
this.response = new EventEmitter();
3232
this._xhr = browserXHR.build();
3333
// TODO(jeffbcross): implement error listening/propagation
34-
this._xhr.open(RequestMethods[ENUM_INDEX(req.method)], req.url);
34+
this._xhr.open(RequestMethods[req.method], req.url);
3535
this._xhr.addEventListener('load', (_) => {
3636
// responseText is the old-school way of retrieving response (supported by IE8 & 9)
3737
// response/responseType properties were introduced in XHR Level2 spec (supported by IE10)

0 commit comments

Comments
 (0)