How to use the @aurelia/runtime.AccessScope function in @aurelia/runtime

To help you get started, we’ve selected a few @aurelia/runtime 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 / __tests__ / runtime / ast.spec.ts View on Github external
...SimpleEqualityList
  ];

  // This forms the group Precedence.LogicalAND
  const SimpleLogicalANDList: [string, Binary][] = [
    [`$36&&$37`, new Binary('&&', new AccessScope('$36'), new AccessScope('$37'))]
  ];

  // This forms the group Precedence.LogicalOR
  const SimpleLogicalORList: [string, Binary][] = [
    [`$38||$39`, new Binary('||', new AccessScope('$38'), new AccessScope('$39'))]
  ];

  // This forms the group Precedence.Conditional
  const SimpleConditionalList: [string, Conditional][] = [
    [`a?b:c`, new Conditional(new AccessScope('a'), new AccessScope('b'), new AccessScope('c'))]
  ];

  // This forms the group Precedence.Assign
  const SimpleAssignList: [string, Assign][] = [
    [`a=b`, new Assign(new AccessScope('a'), new AccessScope('b'))]
  ];

  // This forms the group Precedence.Variadic
  const SimpleValueConverterList: [string, ValueConverter][] = [
    [`a|b`, new ValueConverter(new AccessScope('a'), 'b', [])],
    [`a|b:c`, new ValueConverter(new AccessScope('a'), 'b', [new AccessScope('c')])],
    [`a|b:c:d`, new ValueConverter(new AccessScope('a'), 'b', [new AccessScope('c'), new AccessScope('d')])]
  ];

  const SimpleBindingBehaviorList: [string, BindingBehavior][] = [
    [`a&b`, new BindingBehavior(new AccessScope('a'), 'b', [])],
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
[`$18>$19`, new Binary('>', new AccessScope('$18'), new AccessScope('$19'))],
    [`$20<=$21`, new Binary('<=', new AccessScope('$20'), new AccessScope('$21'))],
    [`$22>=$23`, new Binary('>=', new AccessScope('$22'), new AccessScope('$23'))],
    [`$24 in $25`, new Binary('in', new AccessScope('$24'), new AccessScope('$25'))],
    [`$26 instanceof $27`, new Binary('instanceof', new AccessScope('$26'), new AccessScope('$27'))]
  ];
  const SimpleIsRelationalList: [string, IsBinary][] = [
    ...SimpleIsAdditiveList,
    ...SimpleRelationalList
  ];

  // This forms the group Precedence.Equality
  const SimpleEqualityList: [string, Binary][] = [
    [`$28==$29`, new Binary('==', new AccessScope('$28'), new AccessScope('$29'))],
    [`$30!=$31`, new Binary('!=', new AccessScope('$30'), new AccessScope('$31'))],
    [`$32===$33`, new Binary('===', new AccessScope('$32'), new AccessScope('$33'))],
    [`$34!==$35`, new Binary('!==', new AccessScope('$34'), new AccessScope('$35'))]
  ];
  const SimpleIsEqualityList: [string, IsBinary][] = [
    ...SimpleIsRelationalList,
    ...SimpleEqualityList
  ];

  // This forms the group Precedence.LogicalAND
  const SimpleLogicalANDList: [string, Binary][] = [
    [`$36&&$37`, new Binary('&&', new AccessScope('$36'), new AccessScope('$37'))]
  ];

  // This forms the group Precedence.LogicalOR
  const SimpleLogicalORList: [string, Binary][] = [
    [`$38||$39`, new Binary('||', new AccessScope('$38'), new AccessScope('$39'))]
  ];
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
];

  // This forms the group Precedence.Additive
  const SimpleAdditiveList: [string, Binary][] = [
    [`$12+$13`, new Binary('+', new AccessScope('$12'), new AccessScope('$13'))],
    [`$14-$15`, new Binary('-', new AccessScope('$14'), new AccessScope('$15'))]
  ];
  const SimpleIsAdditiveList: [string, IsBinary][] = [
    ...SimpleIsMultiplicativeList,
    ...SimpleAdditiveList
  ];

  // This forms the group Precedence.Relational
  const SimpleRelationalList: [string, Binary][] = [
    [`$16<$17`, new Binary('<', new AccessScope('$16'), new AccessScope('$17'))],
    [`$18>$19`, new Binary('>', new AccessScope('$18'), new AccessScope('$19'))],
    [`$20<=$21`, new Binary('<=', new AccessScope('$20'), new AccessScope('$21'))],
    [`$22>=$23`, new Binary('>=', new AccessScope('$22'), new AccessScope('$23'))],
    [`$24 in $25`, new Binary('in', new AccessScope('$24'), new AccessScope('$25'))],
    [`$26 instanceof $27`, new Binary('instanceof', new AccessScope('$26'), new AccessScope('$27'))]
  ];
  const SimpleIsRelationalList: [string, IsBinary][] = [
    ...SimpleIsAdditiveList,
    ...SimpleRelationalList
  ];

  // This forms the group Precedence.Equality
  const SimpleEqualityList: [string, Binary][] = [
    [`$28==$29`, new Binary('==', new AccessScope('$28'), new AccessScope('$29'))],
    [`$30!=$31`, new Binary('!=', new AccessScope('$30'), new AccessScope('$31'))],
    [`$32===$33`, new Binary('===', new AccessScope('$32'), new AccessScope('$33'))],
    [`$34!==$35`, new Binary('!==', new AccessScope('$34'), new AccessScope('$35'))]
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
[`$20<=$21`, new Binary('<=', new AccessScope('$20'), new AccessScope('$21'))],
    [`$22>=$23`, new Binary('>=', new AccessScope('$22'), new AccessScope('$23'))],
    [`$24 in $25`, new Binary('in', new AccessScope('$24'), new AccessScope('$25'))],
    [`$26 instanceof $27`, new Binary('instanceof', new AccessScope('$26'), new AccessScope('$27'))]
  ];
  const SimpleIsRelationalList: [string, IsBinary][] = [
    ...SimpleIsAdditiveList,
    ...SimpleRelationalList
  ];

  // This forms the group Precedence.Equality
  const SimpleEqualityList: [string, Binary][] = [
    [`$28==$29`, new Binary('==', new AccessScope('$28'), new AccessScope('$29'))],
    [`$30!=$31`, new Binary('!=', new AccessScope('$30'), new AccessScope('$31'))],
    [`$32===$33`, new Binary('===', new AccessScope('$32'), new AccessScope('$33'))],
    [`$34!==$35`, new Binary('!==', new AccessScope('$34'), new AccessScope('$35'))]
  ];
  const SimpleIsEqualityList: [string, IsBinary][] = [
    ...SimpleIsRelationalList,
    ...SimpleEqualityList
  ];

  // This forms the group Precedence.LogicalAND
  const SimpleLogicalANDList: [string, Binary][] = [
    [`$36&&$37`, new Binary('&&', new AccessScope('$36'), new AccessScope('$37'))]
  ];

  // This forms the group Precedence.LogicalOR
  const SimpleLogicalORList: [string, Binary][] = [
    [`$38||$39`, new Binary('||', new AccessScope('$38'), new AccessScope('$39'))]
  ];
github aurelia / aurelia / packages / jit / dist / index.es6.js View on Github external
break primary;
                    }
                    else {
                        if (Profiler.enabled) {
                            leave$1();
                        }
                        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);
                }
                else {
                    result = new AccessScope(state.tokenValue, access & 511 /* Ancestor */);
                    access = 1024 /* Scope */;
                }
                state.assignable = true;
                nextToken(state);
                break;
            case 3076 /* ThisScope */: // $this
                state.assignable = false;
                nextToken(state);
                result = $this;
                access = 512 /* This */;
                break;
            case 671750 /* OpenParen */: // parenthesized expression
                nextToken(state);
                result = parse(state, 0 /* Reset */, 62 /* Assign */, bindingType);
                consume(state, 1835018 /* CloseParen */);
                access = 0 /* Reset */;
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
it('connects', function () {
    expect(connects(new AccessThis()                )).to.equal(false);
    expect(connects(new AccessScope('')             )).to.equal(true);
    expect(connects(new ArrayLiteral([])            )).to.equal(true);
    expect(connects(new ObjectLiteral([], [])       )).to.equal(true);
    expect(connects(new PrimitiveLiteral('')        )).to.equal(false);
    expect(connects(new Template([])                )).to.equal(true);
    expect(connects(new Unary('!', e)               )).to.equal(true);
    expect(connects(new CallScope('!', [])          )).to.equal(true);
    expect(connects(new CallMember(e, '', [])       )).to.equal(false);
    expect(connects(new CallFunction(e, [])         )).to.equal(false);
    expect(connects(new AccessMember(e, '')         )).to.equal(true);
    expect(connects(new AccessKeyed(e, e)           )).to.equal(true);
    expect(connects(new TaggedTemplate([], [], e)   )).to.equal(true);
    expect(connects(new Binary('+', e, e)           )).to.equal(true);
    expect(connects(new Conditional(e, e, e)        )).to.equal(true);
    expect(connects(new Assign(e, e)                )).to.equal(false);
    expect(connects(new ValueConverter(e, '', [])   )).to.equal(true);
    expect(connects(new BindingBehavior(e, '', [])  )).to.equal(true);
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
it('observes', function () {
    expect(observes(new AccessThis()                )).to.equal(false);
    expect(observes(new AccessScope('')             )).to.equal(true);
    expect(observes(new ArrayLiteral([])            )).to.equal(false);
    expect(observes(new ObjectLiteral([], [])       )).to.equal(false);
    expect(observes(new PrimitiveLiteral('')        )).to.equal(false);
    expect(observes(new Template([])                )).to.equal(false);
    expect(observes(new Unary('!', e)               )).to.equal(false);
    expect(observes(new CallScope('!', [])          )).to.equal(false);
    expect(observes(new CallMember(e, '', [])       )).to.equal(false);
    expect(observes(new CallFunction(e, [])         )).to.equal(false);
    expect(observes(new AccessMember(e, '')         )).to.equal(true);
    expect(observes(new AccessKeyed(e, e)           )).to.equal(true);
    expect(observes(new TaggedTemplate([], [], e)   )).to.equal(false);
    expect(observes(new Binary('+', e, e)           )).to.equal(false);
    expect(observes(new Conditional(e, e, e)        )).to.equal(false);
    expect(observes(new Assign(e, e)                )).to.equal(false);
    expect(observes(new ValueConverter(e, '', [])   )).to.equal(false);
    expect(observes(new BindingBehavior(e, '', [])  )).to.equal(false);
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
describe('performs \'instanceof\'', function () {
    class Foo {}
    class Bar extends Foo {}
    const tests: { expr: Binary; expected: boolean }[] = [
      {
        expr: new Binary(
          'instanceof',
          new AccessScope('foo', 0),
          new AccessMember(new AccessScope('foo', 0), 'constructor')
        ),
        expected: true
      },
      {
        expr: new Binary(
          'instanceof',
          new AccessScope('foo', 0),
          new AccessMember(new AccessScope('bar', 0), 'constructor')
        ),
        expected: false
      },
      {
        expr: new Binary(
          'instanceof',
          new AccessScope('bar', 0),
github aurelia / aurelia / packages / __tests__ / runtime / ast.spec.ts View on Github external
(_$1, [_t2, signals, signaler]) => {
      const value = {};
      const arg1 = {};
      const arg2 = {};
      const arg3 = {};
      const expr = new MockTracingExpression(new AccessScope('foo', 0));
      const args = [
        new MockTracingExpression(new AccessScope('a', 0)),
        new MockTracingExpression(new AccessScope('b', 0)),
        new MockTracingExpression(new AccessScope('c', 0))
      ];
      const sut = new ValueConverter(expr as any, 'mock', args as any);

      const methods = ['toView', 'fromView'];
      const mock = new MockValueConverter(methods);
      mock['signals'] = signals;
      const locator = new MockServiceLocator(new Map([['value-converter:mock', mock], [ISignaler, signaler]]));
      const observerLocator = createObserverLocator();
      const binding = new Binding(expr as any, null, null, null, observerLocator, locator);

      const scope = Scope.create(LF.none, { foo: value, a: arg1, b: arg2, c: arg3 }, null);
      return [`foo|mock:a:b:c`, scope, sut, mock, locator, binding, value, [arg1, arg2, arg3], methods];
    }
  ];
github aurelia / aurelia / packages / examples / test-aot / generated-configuration.ts View on Github external
nameTagHeaderVisible: new AccessScope('showHeader'),
  nameTagClasses: new HtmlLiteral([
    new PrimitiveLiteral('au name-tag '),
    new Conditional(
      new AccessScope('showHeader'),
      new PrimitiveLiteral('header-visible'),
      new PrimitiveLiteral('')
    )
  ]),
  name: new AccessScope('name'),
  submit: new CallScope('submit', emptyArray, 0),
  nameTagColor: new AccessScope('color'),
  duplicateMessage: new AccessScope('duplicateMessage'),
  checked: new AccessScope('checked'),
  nameTag: new AccessScope('nameTag'),
  todos: new AccessScope('todos'),
  addTodo: new CallScope('addTodo', emptyArray, 0),
  description: new AccessMember(new AccessScope('todo'), 'description')
};

const globalResources: any[] = [Repeat, If, Else];

export const GeneratedConfiguration = {
  register(container: IContainer) {
    container.get(IExpressionParser).cache(expressionCache);
    container.register(...globalResources);
  }
};