Skip to content

Commit ecf6ba3

Browse files
committed
refactor: prefer const over var for constants
Closes angular#3818
1 parent b29b045 commit ecf6ba3

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

modules/angular2/src/core/change_detection/change_detection_jit_generator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ import {ChangeDetectionStrategy} from './constants';
2525
* `angular2.transform.template_compiler.change_detector_codegen` library. If you make updates
2626
* here, please make equivalent changes there.
2727
*/
28-
var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector";
29-
var UTIL = "ChangeDetectionUtil";
30-
var IS_CHANGED_LOCAL = "isChanged";
31-
var CHANGES_LOCAL = "changes";
28+
const ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector";
29+
const UTIL = "ChangeDetectionUtil";
30+
const IS_CHANGED_LOCAL = "isChanged";
31+
const CHANGES_LOCAL = "changes";
3232

3333
export class ChangeDetectorJITGenerator {
3434
_logic: CodegenLogicUtil;

modules/angular2/src/core/debug/debug_element_view_listener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {DebugElement} from './debug_element';
1010
const NG_ID_PROPERTY = 'ngid';
1111
const INSPECT_GLOBAL_NAME = 'ng.probe';
1212

13-
var NG_ID_SEPARATOR = '#';
13+
const NG_ID_SEPARATOR = '#';
1414

1515
// Need to keep the views in a global Map so that multiple angular apps are supported
1616
var _allIdsByView = new Map<AppView, number>();

modules/angular2/src/core/render/dom/events/event_manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {isBlank, BaseException, isPresent, StringWrapper} from 'angular2/src/cor
22
import {DOM} from 'angular2/src/core/dom/dom_adapter';
33
import {NgZone} from 'angular2/src/core/zone/ng_zone';
44

5-
var BUBBLE_SYMBOL = '^';
5+
const BUBBLE_SYMBOL = '^';
66

77
export class EventManager {
88
constructor(public _plugins: EventManagerPlugin[], public _zone: NgZone) {

modules/angular2/src/core/render/dom/view/proto_view_builder.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ class EventBuilder extends AstTransformer {
327327
}
328328
}
329329

330-
var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.');
331330
const ATTRIBUTE_PREFIX = 'attr';
332331
const CLASS_PREFIX = 'class';
333332
const STYLE_PREFIX = 'style';
@@ -379,7 +378,7 @@ function isValidElementPropertyBinding(schemaRegistry: ElementSchemaRegistry,
379378

380379
function createElementPropertyBinding(schemaRegistry: ElementSchemaRegistry, ast: ASTWithSource,
381380
propertyNameInTemplate: string): ElementPropertyBinding {
382-
var parts = StringWrapper.split(propertyNameInTemplate, PROPERTY_PARTS_SEPARATOR);
381+
var parts = propertyNameInTemplate.split('.');
383382
if (parts.length === 1) {
384383
var propName = schemaRegistry.getMappedPropName(parts[0]);
385384
return new ElementPropertyBinding(PropertyBindingType.PROPERTY, ast, propName);

modules/angular2/test/core/change_detection/change_detector_config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function _convertLocalsToVariableBindings(locals: Locals): any[] {
5959
return variableBindings;
6060
}
6161

62-
export var PROP_NAME = 'propName';
62+
export const PROP_NAME = 'propName';
6363

6464
/**
6565
* In this case, we expect `id` and `expression` to be the same string.

0 commit comments

Comments
 (0)