| <!DOCTYPE html> |
| <!-- |
| Copyright 2016 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="/tracing/core/scripting_controller.html"> |
| <link rel="import" href="/tracing/extras/tquery/filter.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tr.exportTo('tr.e.tquery', function() { |
| function FilterNot(subExpression) { |
| tr.e.tquery.Filter.call(this); |
| this.subExpression = subExpression; |
| } |
| |
| FilterNot.prototype = { |
| __proto__: tr.e.tquery.Filter.prototype, |
| |
| set subExpression(expr) { |
| this.subExpression_ = tr.e.tquery.Filter.normalizeFilterExpression(expr); |
| }, |
| |
| get subExpression() { |
| return this.subExpression_; |
| }, |
| |
| evaluate: function(context) { |
| return !this.subExpression.evaluate(context); |
| } |
| }; |
| tr.c.ScriptingObjectRegistry.register( |
| function() { |
| var exprs = Array.prototype.slice.call(arguments); |
| if (exprs.length !== 1) |
| throw new Error('not() must have exactly one subexpression'); |
| return new FilterNot(exprs[0]); |
| }, |
| { |
| name: 'not' |
| } |
| ); |
| return { |
| FilterNot: FilterNot |
| }; |
| }); |
| </script> |