本文整理汇总了TypeScript中@aurelia/kernel.Reporter类的典型用法代码示例。如果您正苦于以下问题:TypeScript Reporter类的具体用法?TypeScript Reporter怎么用?TypeScript Reporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Reporter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: get
public static get(scope: IScope, name: string, ancestor: number, flags: LifecycleFlags): IBindingContext | IOverrideContext | IBinding {
if (Tracer.enabled) { Tracer.enter('BindingContext', 'get', slice.call(arguments)); }
if (scope === undefined) {
throw Reporter.error(RuntimeError.UndefinedScope);
}
if (scope === null) {
throw Reporter.error(RuntimeError.NullScope);
}
let overrideContext = scope.overrideContext;
if (ancestor > 0) {
// jump up the required number of ancestor contexts (eg $parent.$parent requires two jumps)
while (ancestor > 0) {
if (overrideContext.parentOverrideContext === null) {
if (Tracer.enabled) { Tracer.leave(); }
return undefined;
}
ancestor--;
overrideContext = overrideContext.parentOverrideContext;
}
if (Tracer.enabled) { Tracer.leave(); }
return name in overrideContext ? overrideContext : overrideContext.bindingContext;
}
// traverse the context and it's ancestors, searching for a context that has the name.
while (overrideContext && !(name in overrideContext) && !(overrideContext.bindingContext && name in overrideContext.bindingContext)) {
overrideContext = overrideContext.parentOverrideContext;
}
if (overrideContext) {
if (Tracer.enabled) { Tracer.leave(); }
// we located a context with the property. return it.
return name in overrideContext ? overrideContext : overrideContext.bindingContext;
}
// the name wasn't found. see if parent scope traversal is allowed and if so, try that
if ((flags & LifecycleFlags.allowParentScopeTraversal) && scope.parentScope !== null) {
const result = this.get(scope.parentScope, name, ancestor, flags
// unset the flag; only allow one level of scope boundary traversal
& ~LifecycleFlags.allowParentScopeTraversal
// tell the scope to return null if the name could not be found
| LifecycleFlags.isTraversingParentScope);
if (result !== null) {
if (Tracer.enabled) { Tracer.leave(); }
return result;
}
}
// still nothing found. return the root binding context (or null
// if this is a parent scope traversal, to ensure we fall back to the
// correct level)
if (flags & LifecycleFlags.isTraversingParentScope) {
if (Tracer.enabled) { Tracer.leave(); }
return null;
}
if (Tracer.enabled) { Tracer.leave(); }
return scope.bindingContext || scope.overrideContext;
}
开发者ID:aurelia,项目名称:aurelia,代码行数:59,代码来源:binding-context.ts
示例2: createProperty
public createProperty(obj: IObservable, propertyName: string): DirtyCheckProperty {
if (DirtyCheckSettings.throw) {
throw Reporter.error(800); // TODO: create/organize error code
}
if (DirtyCheckSettings.warn) {
Reporter.write(801);
}
return new DirtyCheckProperty(this, obj, propertyName);
}
开发者ID:aurelia,项目名称:aurelia,代码行数:9,代码来源:dirty-checker.ts
示例3: validatePrototype
function validatePrototype(handler: IAttributePatternHandler, patternDefs: AttributePatternDefinition[]): void {
for (const def of patternDefs) {
// note: we're intentionally not throwing here
if (!(def.pattern in handler)) {
Reporter.write(401, def); // TODO: organize error codes
} else if (typeof handler[def.pattern] !== 'function') {
Reporter.write(402, def); // TODO: organize error codes
}
}
}
开发者ID:aurelia,项目名称:aurelia,代码行数:10,代码来源:attribute-pattern.ts
示例4: parseForOfStatement
function parseForOfStatement(state: ParserState, result: BindingIdentifierOrPattern): ForOfStatement {
if ((result.$kind & ExpressionKind.IsForDeclaration) === 0) {
throw Reporter.error(SyntaxError.InvalidForDeclaration, { state });
}
if (state.currentToken !== Token.OfKeyword) {
throw Reporter.error(SyntaxError.InvalidForDeclaration, { state });
}
nextToken(state);
const declaration = result;
const statement = parse(state, Access.Reset, Precedence.Variadic, BindingType.None);
return new ForOfStatement(declaration, statement as IsBindingBehavior);
}
开发者ID:aurelia,项目名称:aurelia,代码行数:12,代码来源:expression-parser.ts
示例5: createComputedObserver
export function createComputedObserver(
flags: LifecycleFlags,
observerLocator: IObserverLocator,
dirtyChecker: IDirtyChecker,
lifecycle: ILifecycle,
instance: IObservable & { constructor: IObservable & ComputedLookup },
propertyName: string,
descriptor: PropertyDescriptor): IBindingTargetObserver {
if (descriptor.configurable === false) {
return dirtyChecker.createProperty(instance, propertyName);
}
if (descriptor.get) {
const overrides = instance.constructor.computed && instance.constructor.computed[propertyName] || computedOverrideDefaults;
if (descriptor.set) {
if (overrides.volatile) {
return new GetterObserver(flags, overrides, instance, propertyName, descriptor, observerLocator, lifecycle);
}
return new CustomSetterObserver(instance, propertyName, descriptor);
}
return new GetterObserver(flags, overrides, instance, propertyName, descriptor, observerLocator, lifecycle);
}
throw Reporter.error(18, propertyName);
}
开发者ID:aurelia,项目名称:aurelia,代码行数:26,代码来源:computed-observer.ts
示例6: detaching
public detaching(flags: LifecycleFlags): void {
Reporter.write(10000, 'DETACHING viewport', this.name);
if (this.content.component) {
this.content.removeComponent(this.element, this.options.stateful);
}
this.enabled = false;
}
开发者ID:aurelia,项目名称:aurelia,代码行数:7,代码来源:viewport.ts
示例7: attaching
public attaching(flags: LifecycleFlags): void {
Reporter.write(10000, 'ATTACHING viewport', this.name, this.content, this.nextContent);
this.enabled = true;
if (this.content.component) {
this.content.addComponent(this.element);
}
}
开发者ID:aurelia,项目名称:aurelia,代码行数:7,代码来源:viewport.ts
示例8: scanString
function scanString(state: ParserState): Token {
const quote = state.currentChar;
nextChar(state); // Skip initial quote.
let unescaped = 0;
const buffer = new Array<string>();
let marker = state.index;
while (state.currentChar !== quote) {
if (state.currentChar === Char.Backslash) {
buffer.push(state.input.slice(marker, state.index));
nextChar(state);
unescaped = unescapeCode(state.currentChar);
nextChar(state);
buffer.push(String.fromCharCode(unescaped));
marker = state.index;
} else if (state.index >= state.length) {
throw Reporter.error(SyntaxError.UnterminatedQuote, { state });
} else {
nextChar(state);
}
}
const last = state.input.slice(marker, state.index);
nextChar(state); // Skip terminating quote.
// Compute the unescaped string value.
buffer.push(last);
const unescapedStr = buffer.join('');
state.tokenValue = unescapedStr;
return Token.StringLiteral;
}
开发者ID:aurelia,项目名称:aurelia,代码行数:33,代码来源:expression-parser.ts
示例9: scanTemplate
function scanTemplate(state: ParserState): Token {
let tail = true;
let result = '';
while (nextChar(state) !== Char.Backtick) {
if (state.currentChar === Char.Dollar) {
if ((state.index + 1) < state.length && state.input.charCodeAt(state.index + 1) === Char.OpenBrace) {
state.index++;
tail = false;
break;
} else {
result += '$';
}
} else if (state.currentChar === Char.Backslash) {
result += String.fromCharCode(unescapeCode(nextChar(state)));
} else {
if (state.index >= state.length) {
throw Reporter.error(SyntaxError.UnterminatedTemplate, { state });
}
result += String.fromCharCode(state.currentChar);
}
}
nextChar(state);
state.tokenValue = result;
if (tail) {
return Token.TemplateTail;
}
return Token.TemplateContinuation;
}
开发者ID:aurelia,项目名称:aurelia,代码行数:30,代码来源:expression-parser.ts
示例10: scanTemplateTail
function scanTemplateTail(state: ParserState): Token {
if (state.index >= state.length) {
throw Reporter.error(SyntaxError.UnterminatedTemplate, { state });
}
state.index--;
return scanTemplate(state);
}
开发者ID:aurelia,项目名称:aurelia,代码行数:7,代码来源:expression-parser.ts
注:本文中的@aurelia/kernel.Reporter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论