refactor(di): use boolean instead of bool

This commit is contained in:
vsavkin 2014-10-10 14:07:59 -04:00
parent 92b2559109
commit b71cd9f380
8 changed files with 15 additions and 16 deletions

View File

@ -1,7 +1,7 @@
import {describe, it, expect} from 'test_lib/test_lib';
import {Scanner, Token} from 'change_detection/parser/scanner';
import {List, ListWrapper} from "facade/collection";
import {StringWrapper} from "facade/lang";
import {StringWrapper, int} from "facade/lang";
function lex(text:string):List {
var scanner:Scanner = new Scanner(text);

View File

@ -49,7 +49,7 @@ export class ProtoElementInjector {
queryKeyId1:int;
textNodes:List<int>;
hasProperties:bool;
hasProperties:boolean;
events:Map<string, Expression>;
elementInjector:ElementInjector;

View File

@ -5,7 +5,7 @@ import {Record} from 'change_detection/record';
import {Module} from 'di/di';
import {ProtoElementInjector, ElementInjector} from './element_injector';
import {SetterFn} from 'change_detection/facade';
import {FIELD, IMPLEMENTS} from 'facade/lang';
import {FIELD, IMPLEMENTS, int} from 'facade/lang';
import {List} from 'facade/collection';
/***
@ -61,7 +61,7 @@ export class ProtoView {
module:Module,
protoElementInjector:List<ProtoElementInjector>,
protoWatchGroup:ProtoWatchGroup,
useRootElement:bool)
useRootElement:boolean)
{
this._template = template;
this._module = module;

View File

@ -32,7 +32,7 @@ export function main() {
spanPI.hasProperties = true;
var protoElementInjector:List<ProtoElementInjector> = [sectionPI, divPI, spanPI];
var protoWatchGroup:ProtoWatchGroup = null;
var hasSingleRoot:bool = false;
var hasSingleRoot:boolean = false;
var pv = new ProtoView(template, module, protoElementInjector, protoWatchGroup, hasSingleRoot);
var view:View = pv.instantiate();
var section:Element = template.content.firstChild;

View File

@ -1,4 +1,4 @@
import {FIELD, Type, bool, isBlank} from 'facade/lang';
import {FIELD, Type, isBlank} from 'facade/lang';
import {List, MapWrapper, ListWrapper} from 'facade/collection';
import {reflector} from './reflector';
import {Key} from './key';
@ -7,7 +7,7 @@ export class Dependency {
@FIELD('final key:Key')
@FIELD('final asFuture:bool')
@FIELD('final lazy:bool')
constructor(key:Key, asFuture:bool, lazy:bool) {
constructor(key:Key, asFuture:boolean, lazy:boolean) {
this.key = key;
this.asFuture = asFuture;
this.lazy = lazy;
@ -15,7 +15,7 @@ export class Dependency {
}
export class Binding {
constructor(key:Key, factory:Function, dependencies:List, providedAsFuture:bool) {
constructor(key:Key, factory:Function, dependencies:List, providedAsFuture:boolean) {
this.key = key;
this.factory = factory;
this.dependencies = dependencies;

View File

@ -2,7 +2,7 @@ import {Map, List, MapWrapper, ListWrapper} from 'facade/collection';
import {Binding, BindingBuilder, bind} from './binding';
import {ProviderError, NoProviderError, InvalidBindingError,
AsyncBindingError, CyclicDependencyError, InstantiationError} from './exceptions';
import {Type, isPresent, isBlank, bool} from 'facade/lang';
import {Type, isPresent, isBlank} from 'facade/lang';
import {Future, FutureWrapper} from 'facade/async';
import {Key} from './key';
@ -13,7 +13,7 @@ class _Waiting {
this.future = future;
}
}
function _isWaiting(obj):bool {
function _isWaiting(obj):boolean {
return obj instanceof _Waiting;
}
@ -52,7 +52,7 @@ export class Injector {
return ListWrapper.createFixedSize(Key.numberOfKeys() + 1);
}
_getByKey(key:Key, returnFuture:bool, returnLazy:bool) {
_getByKey(key:Key, returnFuture:boolean, returnLazy:boolean) {
if (returnLazy) {
return () => this._getByKey(key, returnFuture, false);
}
@ -71,7 +71,7 @@ export class Injector {
throw new NoProviderError(key);
}
_resolveDependencies(key:Key, binding:Binding, forceAsync:bool):List {
_resolveDependencies(key:Key, binding:Binding, forceAsync:boolean):List {
try {
var getDependency = d => this._getByKey(d.key, forceAsync || d.asFuture, d.lazy);
return ListWrapper.map(binding.dependencies, getDependency);

View File

@ -1,5 +1,5 @@
import {MapWrapper} from 'facade/collection';
import {FIELD, int, bool} from 'facade/lang';
import {FIELD, int} from 'facade/lang';
var _allKeys = {};
var _id:int = 0;

View File

@ -11,11 +11,11 @@ export class ABSTRACT {}
export class IMPLEMENTS {}
export function isPresent(obj):bool{
export function isPresent(obj):boolean {
return obj != undefined && obj != null;
}
export function isBlank(obj):bool{
export function isBlank(obj):boolean {
return obj == undefined || obj == null;
}
@ -104,7 +104,6 @@ export class NumberWrapper {
}
export function int() {};
export var bool = $traceurRuntime.type.boolean;
int.assert = function(value) {
return value == null || typeof value == 'number' && value === Math.floor(value);
}