How to use the @aurelia/kernel.Reporter.error function in @aurelia/kernel

To help you get started, we’ve selected a few @aurelia/kernel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / aurelia / packages / jit / dist / index.es6.js View on Github external
getBindingCommand(syntax) {
        const name = syntax.command;
        if (name === null) {
            return null;
        }
        let result = this.commandLookup[name];
        if (result === void 0) {
            result = this.resources.create(BindingCommandResource, name);
            if (result == null) {
                // unknown binding command
                throw Reporter.error(0); // TODO: create error code
            }
            this.commandLookup[name] = result;
        }
        return result;
    }
}
github aurelia / aurelia / packages / runtime-html / dist / esnext / resources / binding-behaviors / update-trigger.js View on Github external
bind(flags, scope, binding, ...events) {
        if (events.length === 0) {
            throw Reporter.error(9);
        }
        if (binding.mode !== BindingMode.twoWay && binding.mode !== BindingMode.fromView) {
            throw Reporter.error(10);
        }
        this.persistentFlags = flags & 2080374799 /* persistentBindingFlags */;
        // ensure the binding's target observer has been set.
        const targetObserver = this.observerLocator.getObserver(this.persistentFlags | flags, binding.target, binding.targetProperty);
        if (!targetObserver.handler) {
            throw Reporter.error(10);
        }
        binding.targetObserver = targetObserver;
        // stash the original element subscribe function.
        targetObserver.originalHandler = binding.targetObserver.handler;
        // replace the element subscribe function with one that uses the correct events.
        targetObserver.handler = new EventSubscriber(binding.locator.get(IDOM), events);
    }
github aurelia / aurelia / packages / jit / dist / esnext / expression-parser.js View on Github external
function parseForOfStatement(state, result) {
    if ((result.$kind & 65536 /* IsForDeclaration */) === 0) {
        throw Reporter.error(106 /* InvalidForDeclaration */, { state });
    }
    if (state.currentToken !== 1051179 /* OfKeyword */) {
        throw Reporter.error(106 /* InvalidForDeclaration */, { state });
    }
    nextToken(state);
    const declaration = result;
    const statement = parse(state, 0 /* Reset */, 61 /* Variadic */, 0 /* None */);
    return new ForOfStatement(declaration, statement);
}
/**
github aurelia / aurelia / packages / runtime / dist / esnext / binding / ast.js View on Github external
iterate(flags, result, func) {
        switch (toStringTag.call(result)) {
            case '[object Array]': return $array(flags | 8388608 /* isOriginalArray */, result, func);
            case '[object Map]': return $map(flags | 8388608 /* isOriginalArray */, result, func);
            case '[object Set]': return $set(flags | 8388608 /* isOriginalArray */, result, func);
            case '[object Number]': return $number(flags | 8388608 /* isOriginalArray */, result, func);
            case '[object Null]': return;
            case '[object Undefined]': return;
            default: throw Reporter.error(0); // TODO: Set error code
        }
    }
    connect(flags, scope, binding, part) {
github aurelia / aurelia / packages / jit / dist / index.es6.js View on Github external
if (state.currentChar === 36 /* Dollar */) {
            if ((state.index + 1) < state.length && state.input.charCodeAt(state.index + 1) === 123 /* OpenBrace */) {
                state.index++;
                tail = false;
                break;
            }
            else {
                result += '$';
            }
        }
        else if (state.currentChar === 92 /* Backslash */) {
            result += String.fromCharCode(unescapeCode(nextChar(state)));
        }
        else {
            if (state.index >= state.length) {
                throw Reporter.error(109 /* UnterminatedTemplate */, { state });
            }
            result += String.fromCharCode(state.currentChar);
        }
    }
    nextChar(state);
    state.tokenValue = result;
    if (tail) {
        return 540713 /* TemplateTail */;
    }
    return 540714 /* TemplateContinuation */;
}
function scanTemplateTail(state) {
github aurelia / aurelia / packages / jit / dist / esnext / expression-parser.js View on Github external
* IsValidAssignmentTarget
         * 1,3,4,5,6,7 = false
         * 2 = true
         */
        primary: switch (state.currentToken) {
            case 3077 /* ParentScope */: // $parent
                state.assignable = false;
                do {
                    nextToken(state);
                    access++; // ancestor
                    if (consumeOpt(state, 16392 /* Dot */)) {
                        if (state.currentToken === 16392 /* Dot */) {
                            throw Reporter.error(102 /* DoubleDot */, { state });
                        }
                        else if (state.currentToken === 1572864 /* EOF */) {
                            throw Reporter.error(105 /* ExpectedIdentifier */, { state });
                        }
                    }
                    else if (state.currentToken & 524288 /* AccessScopeTerminal */) {
                        const ancestor = access & 511 /* Ancestor */;
                        result = ancestor === 0 ? $this : ancestor === 1 ? $parent : new AccessThisExpression(ancestor);
                        access = 512 /* This */;
                        break primary;
                    }
                    else {
                        throw Reporter.error(103 /* InvalidMemberExpression */, { state });
                    }
                } while (state.currentToken === 3077 /* ParentScope */);
            // falls through
            case 1024 /* Identifier */: // identifier
                if (bindingType & 512 /* IsIterator */) {
                    result = new BindingIdentifier(state.tokenValue);
github aurelia / aurelia / packages / jit / src / expression-parser.ts View on Github external
function scanTemplateTail(state: ParserState): Token {
  if (state.index >= state.length) {
    throw Reporter.error(SyntaxError.UnterminatedTemplate, { state });
  }
  state.index--;
  return scanTemplate(state);
}
github aurelia / aurelia / packages / runtime / src / binding / binding.ts View on Github external
this.sourceExpression.connect(flags, this.$scope, this);
        this.unobserve(false);
      }
      if (Tracer.enabled) { Tracer.leave(); }
      return;
    }

    if (flags & LifecycleFlags.updateSourceExpression) {
      if (newValue !== this.sourceExpression.evaluate(flags, this.$scope, this.locator)) {
        this.updateSource(newValue, flags);
      }
      if (Tracer.enabled) { Tracer.leave(); }
      return;
    }

    throw Reporter.error(15, LifecycleFlags[flags]);
  }
github aurelia / aurelia / packages / runtime / src / rendering-engine.ts View on Github external
parentContext: IRenderContext | null,
    componentType: ICustomElementType | null
  ): ITemplate {
    if (parentContext === null) {
      parentContext = this.container as ExposedContext;
    }

    if (definition.template !== null) {
      const renderContext = createRenderContext(dom, parentContext, definition.dependencies, componentType) as ExposedContext;

      if (definition.build.required) {
        const compilerName = definition.build.compiler || defaultCompilerName;
        const compiler = this.compilers[compilerName];

        if (compiler === undefined) {
          throw Reporter.error(20, compilerName);
        }

        definition = compiler.compile(dom, definition as ITemplateDefinition, new RuntimeCompilationResources(renderContext), ViewCompileFlags.surrogate);
      }

      return this.templateFactory.create(renderContext, definition);
    }

    return noViewTemplate;
  }
}
github aurelia / aurelia / packages / runtime / src / task-queue.ts View on Github external
private prepareMicroTaskStack(): string {
    throw Reporter.error(13);
  }