refactor: prefer const over var for constants

Closes #3818
This commit is contained in:
Victor Berchet 2015-08-25 11:22:21 -07:00
parent b29b045d78
commit ecf6ba3974
5 changed files with 8 additions and 9 deletions

View File

@ -25,10 +25,10 @@ import {ChangeDetectionStrategy} from './constants';
* `angular2.transform.template_compiler.change_detector_codegen` library. If you make updates
* here, please make equivalent changes there.
*/
var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector";
var UTIL = "ChangeDetectionUtil";
var IS_CHANGED_LOCAL = "isChanged";
var CHANGES_LOCAL = "changes";
const ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector";
const UTIL = "ChangeDetectionUtil";
const IS_CHANGED_LOCAL = "isChanged";
const CHANGES_LOCAL = "changes";
export class ChangeDetectorJITGenerator {
_logic: CodegenLogicUtil;

View File

@ -10,7 +10,7 @@ import {DebugElement} from './debug_element';
const NG_ID_PROPERTY = 'ngid';
const INSPECT_GLOBAL_NAME = 'ng.probe';
var NG_ID_SEPARATOR = '#';
const NG_ID_SEPARATOR = '#';
// Need to keep the views in a global Map so that multiple angular apps are supported
var _allIdsByView = new Map<AppView, number>();

View File

@ -2,7 +2,7 @@ import {isBlank, BaseException, isPresent, StringWrapper} from 'angular2/src/cor
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
var BUBBLE_SYMBOL = '^';
const BUBBLE_SYMBOL = '^';
export class EventManager {
constructor(public _plugins: EventManagerPlugin[], public _zone: NgZone) {

View File

@ -327,7 +327,6 @@ class EventBuilder extends AstTransformer {
}
}
var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.');
const ATTRIBUTE_PREFIX = 'attr';
const CLASS_PREFIX = 'class';
const STYLE_PREFIX = 'style';
@ -379,7 +378,7 @@ function isValidElementPropertyBinding(schemaRegistry: ElementSchemaRegistry,
function createElementPropertyBinding(schemaRegistry: ElementSchemaRegistry, ast: ASTWithSource,
propertyNameInTemplate: string): ElementPropertyBinding {
var parts = StringWrapper.split(propertyNameInTemplate, PROPERTY_PARTS_SEPARATOR);
var parts = propertyNameInTemplate.split('.');
if (parts.length === 1) {
var propName = schemaRegistry.getMappedPropName(parts[0]);
return new ElementPropertyBinding(PropertyBindingType.PROPERTY, ast, propName);

View File

@ -59,7 +59,7 @@ function _convertLocalsToVariableBindings(locals: Locals): any[] {
return variableBindings;
}
export var PROP_NAME = 'propName';
export const PROP_NAME = 'propName';
/**
* In this case, we expect `id` and `expression` to be the same string.