repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/tty.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "process" module bindings.
///
/// The tty module provides the [TTYReadStream] and [TTYWriteStream] classes.
/// In most cases, it will not be necessary or possible to use this module
/// directly. However, it can be accessed using:
///
/// import 'package:node_interop/tty.dart';
///
/// void main() {
/// // For example:
/// print(tty.isatty(fileDescriptor));
/// }
///
/// When Node.js detects that it is being run with a text terminal ("TTY")
/// attached, `process.stdin` will, by default, be initialized as an instance
/// of [TTYReadStream] and both `process.stdout` and `process.stderr` will,
/// by default be instances of [TTYWriteStream]. The preferred method of
/// determining whether Node.js is being run within a TTY context is to check
/// that the value of the `process.stdout.isTTY` property is `true`.
///
/// In most cases, there should be little to no reason for an application to
/// manually create instances of the [TTYReadStream] and [TTYWriteStream]
/// classes.
@JS()
library node_interop.tty;
import 'package:js/js.dart';
import 'net.dart';
import 'node.dart';
TTY get tty => _tty ??= require('tls');
TTY _tty;
@JS()
@anonymous
abstract class TTY {
/// Returns `true` if the given [fd] is associated with a TTY and `false` if
/// it is not, including whenever fd is not a non-negative integer.
external bool isatty(num fd);
}
/// Represents the readable side of a TTY.
@JS()
@anonymous
abstract class TTYReadStream extends Socket {
/// A boolean that is true if the TTY is currently configured to operate as
/// a raw device. Defaults to `false`.
external bool get isRaw;
/// A boolean that is always true for TTYReadStream instances.
external bool get isTTY;
/// Allows configuration of this stream so that it operates as a raw device.
///
/// When in raw mode, input is always available character-by-character, not
/// including modifiers. Additionally, all special processing of characters
/// by the terminal is disabled, including echoing input characters. `CTRL+C`
/// will no longer cause a `SIGINT` when in this mode.
external TTYReadStream setRawMode(bool mode);
}
@JS()
@anonymous
abstract class TTYWriteStream extends Socket {
/// Clears the current line of this stream in a direction identified by [dir].
///
/// Returns `false` if the stream wishes for the calling code to wait for the
/// 'drain' event to be emitted before continuing to write additional data;
/// otherwise returns true.
///
/// The [dir] argument can be set to:
/// `-1`: to the left from cursor
/// `1`: to the right from cursor
/// `0`: the entire line
external bool clearLine(num dir, [void Function() callback]);
/// Clears this stream from the current cursor down.
///
/// Returns `false` if the stream wishes for the calling code to wait for the
/// 'drain' event to be emitted before continuing to write additional data;
/// otherwise returns true.
external bool clearScreenDown([void Function() callback]);
/// A number specifying the number of columns the TTY currently has.
///
/// This property is updated whenever the 'resize' event is emitted.
external int get columns;
/// Moves this stream's cursor to the specified position.
///
/// Returns `false` if the stream wishes for the calling code to wait for the
/// 'drain' event to be emitted before continuing to write additional data;
/// otherwise returns true.
external bool cursorTo(num x, [num y, void Function() callback]);
/// Use this to determine what colors the terminal supports.
///
/// Due to the nature of colors in terminals it is possible to either have
/// false positives or false negatives. It depends on process information and
/// the environment variables that may lie about what terminal is used. It is
/// possible to pass in an env object to simulate the usage of a specific
/// terminal. This can be useful to check how specific environment settings
/// behave.
///
/// The optional [env] argument can be used to pass environment variables to
/// check. This enables simulating the usage of a specific terminal.
/// Default: `process.env`.
external num getColorDepth([dynamic env]);
/// Returns the size of the TTY corresponding to this stream.
///
/// The returned array is of the type [numColumns, numRows] where numColumns
/// and numRows represent the number of columns and rows in the corresponding
/// TTY.
external List<num> getWindowSize();
/// Returns true if this stream supports at least as many colors as provided
/// in count.
///
/// Minimum support is 2 (black and white).
///
/// This has the same false positives and negatives as described in
/// [getColorDepth].
external bool hasColors([dynamic count, dynamic env]);
/// A boolean that is always `true` for this stream.
external bool get isTTY;
/// Moves this stream's cursor relative to its current position.
///
/// Returns `false` if the stream wishes for the calling code to wait for
/// the 'drain' event to be emitted before continuing to write additional
/// data; otherwise `true`.
///
/// Optional [callback] function is invoked once the operation completes.
external bool moveCursor(num dx, num dy, [void Function() callback]);
/// A number specifying the number of rows the TTY currently has.
///
/// This property is updated whenever the 'resize' event is emitted.
external int get rows;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/http.dart | // Copyright (c) 2017, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "http" module bindings.
///
/// Use top-level [http] object to access this module functionality.
/// To create an HTTP agent see [createHttpAgent].
@JS()
library node_interop.http;
import 'dart:js_util';
import 'package:js/js.dart';
import 'net.dart';
import 'node.dart';
import 'stream.dart';
HTTP get http => _http ??= require('http');
HTTP _http;
/// Convenience method for creating instances of "http" module's Agent class.
///
/// This is equivalent of Node's `new http.Agent([options])`.
HttpAgent createHttpAgent([HttpAgentOptions options]) {
var args = (options == null) ? [] : [options];
return callConstructor(http.Agent, args);
}
/// Listener on HTTP requests of [HttpServer].
///
/// See also:
/// - [HTTP.createServer]
typedef HttpRequestListener = void Function(
IncomingMessage request, ServerResponse response);
/// Main entry point to Node's "http" module functionality.
///
/// Usage:
///
/// HTTP http = require('http');
/// http.get("http://example.com");
///
/// See also:
/// - [createHttpAgent]
@JS()
@anonymous
abstract class HTTP {
/// A list of the HTTP methods that are supported by the parser.
external List<String> get METHODS;
/// A collection of all the standard HTTP response status codes, and the short
/// description of each. For example, `http.STATUS_CODES[404] === 'Not Found'`.
external dynamic get STATUS_CODES;
/// Returns a new instance of [HttpServer].
///
/// The [requestListener] is a function which is automatically added to the
/// "request" event.
external HttpServer createServer([HttpRequestListener requestListener]);
/// Makes GET request. The only difference between this method and
/// [request] is that it sets the method to GET and calls req.end()
/// automatically.
external ClientRequest get(dynamic urlOrOptions,
[void Function(IncomingMessage response) callback]);
/// Global instance of Agent which is used as the default for all HTTP client
/// requests.
external HttpAgent get globalAgent;
external ClientRequest request(RequestOptions options,
[void Function(IncomingMessage response) callback]);
/// Reference to constructor function of [HttpAgent] class.
///
/// See also:
/// - [createHttpAgent].
external Function get Agent;
}
@JS()
@anonymous
abstract class HttpAgent {
external Socket createConnection(options,
[void Function(dynamic error, dynamic stream) callback]);
external void keepSocketAlive(Socket socket);
external void reuseSocket(Socket socket, ClientRequest request);
external void destroy();
external dynamic get freeSockets;
external String getName(options);
external num get maxFreeSockets;
external num get maxSockets;
external dynamic get requests;
external dynamic get sockets;
}
@JS()
@anonymous
abstract class HttpAgentOptions {
external bool get keepAlive;
external num get keepAliveMsecs;
external num get maxSockets;
external num get maxFreeSockets;
external factory HttpAgentOptions({
bool keepAlive,
num keepAliveMsecs,
num maxSockets,
num maxFreeSockets,
});
}
@JS()
@anonymous
abstract class RequestOptions {
external String get protocol;
@Deprecated('Use "hostname" instead.')
external String get host;
external String get hostname;
external num get family;
external num get port;
external String get localAddress;
external String get socketPath;
external String get method;
external String get path;
external dynamic get headers;
external String get auth;
external dynamic get agent;
external num get timeout;
external factory RequestOptions({
String protocol,
String host,
String hostname,
num family,
num port,
String localAddress,
String socketPath,
String method,
String path,
dynamic headers,
String auth,
dynamic agent,
num timeout,
});
}
@JS()
abstract class ClientRequest implements Writable {
external void abort();
external int get aborted;
external Socket get connection;
@override
external void end([data, encodingOrCallback, void Function() callback]);
external void flushHeaders();
external String getHeader(String name);
external void removeHeader(String name);
external void setHeader(String name, dynamic value);
external void setNoDelay(bool noDelay);
external void setSocketKeepAlive([bool enable, num initialDelay]);
external void setTimeout(num msecs, [void Function() callback]);
external Socket get socket;
@override
external ClientRequest write(chunk,
[encodingOrCallback, void Function() callback]);
}
@JS()
abstract class HttpServer implements NetServer {
@override
external HttpServer close([void Function() callback]);
@override
external void listen([arg1, arg2, arg3, arg4]);
@override
external bool get listening;
external num get maxHeadersCount;
external void setTimeout([num msecs, void Function() callback]);
external num get timeout;
external num get keepAliveTimeout;
}
@JS()
@anonymous
abstract class ServerResponse implements Writable {
external void addTrailers(headers);
external Socket get connection;
@override
external void end([data, encodingOrCallback, void Function() callback]);
external bool get finished;
external dynamic getHeader(String name);
external List<String> getHeaderNames();
external dynamic getHeaders();
external bool hasHeader(String name);
external bool get headersSent;
external void removeHeader(String name);
external bool get sendDate;
external void setHeader(String name, dynamic value);
external void setTimeout(num msecs, [callback]);
external Socket get socket;
external num get statusCode;
external set statusCode(num value);
external String get statusMessage;
external set statusMessage(String value);
@override
external bool write(chunk, [encodingOrCallback, void Function() callback]);
external void writeContinue();
external void writeHead(num statusCode, [String statusMessage, headers]);
}
@JS()
@anonymous
abstract class IncomingMessage implements Readable {
@override
external void destroy([error]);
external dynamic get headers;
external String get httpVersion;
external String get method;
external List<String> get rawHeaders;
external List<String> get rawTrailers;
external void setTimeout(num msecs, void Function() callback);
external Socket get socket;
external num get statusCode;
external String get statusMessage;
external dynamic get trailers;
external String get url;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/process.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "process" module bindings.
///
/// The `process` object is a global that provides information about, and
/// control over, the current Node.js process.
///
/// As a global, it is always available to Node.js applications without using
/// `require()`.
@JS()
library node_interop.process;
import 'package:js/js.dart';
import 'events.dart';
import 'module.dart';
import 'net.dart';
import 'stream.dart';
import 'tty.dart';
@JS()
@anonymous
abstract class Process implements EventEmitter {
external void abort();
external String get arch;
external List get argv;
external String get argv0;
external dynamic get channel;
external void chdir(String directory);
external dynamic get config;
external bool get connected;
external CPUUsage cpuUsage([CPUUsage previousValue]);
external String cwd();
external void disconnect();
external void dlopen(module, String filename, [int flags]);
/// See official documentation for possible signatures:
/// - https://nodejs.org/api/process.html#process_process_emitwarning_warning_options
/// - https://nodejs.org/api/process.html#process_process_emitwarning_warning_type_code_ctor
external void emitWarning(warning, [arg1, arg2, arg3]);
external dynamic get env;
external List get execArgv;
external String get execPath;
external void exit([int code = 0]);
external int get exitCode;
external set exitCode(int code);
external num getegid();
external dynamic geteuid();
external dynamic getgid();
external List getgroups();
external int getuid();
external bool hasUncaughtExceptionCaptureCallback();
external List hrtime([List<int> time]);
external void initgroups(user, extra_group);
external void kill(num pid, [signal]);
external Module get mainModule;
external dynamic memoryUsage();
external void nextTick(Function callback,
[arg1, arg2, arg3, arg4, arg5, arg6, arg7]);
external bool get noDeprecation;
external int get pid;
external String get platform;
external int get ppid;
external Release get release;
external bool send(message, [sendHandle, options, void Function() callback]);
external void setegid(id);
external void seteuid(id);
external void setgid(id);
external void setgroups(List groups);
external void setuid(id);
external void setUncaughtExceptionCaptureCallback(Function fn);
/// Stream connected to `stderr` (fd `2`).
///
/// It is a [Socket] (which is a [Duplex] stream) unless fd `2` refers to a
/// file, in which case it is a [Writable] stream.
external TTYWriteStream get stderr;
/// Stream connected to `stdin` (fd `0`).
///
/// It is a [Socket] (which is a [Duplex] stream) unless fd `0` refers to a
/// file, in which case it is a [Readable] stream.
external TTYReadStream get stdin;
/// Stream connected to `stdout` (fd `1`).
///
/// It is a [Socket] (which is a [Duplex] stream) unless fd `1` refers to a
/// file, in which case it is a [Writable] stream.
external TTYWriteStream get stdout;
external bool get throwDeprecation;
external String get title;
external bool get traceDeprecation;
external void umask([int mask]);
external num uptime();
external String get version;
external dynamic get versions;
}
@JS()
@anonymous
abstract class CPUUsage {
external int get user;
external int get system;
}
@JS()
@anonymous
abstract class Release {
external String get name;
external String get sourceUrl;
external String get headersUrl;
external String get libUrl;
external String get lts;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/tls.dart | // Copyright (c) 2017, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "tls" module bindings.
///
/// Use library-level [tls] object as entrypoint.
@JS()
library node_interop.tls;
import 'dart:js_util';
import 'package:js/js.dart';
import 'buffer.dart';
import 'net.dart';
import 'node.dart';
import 'stream.dart';
TLS get tls => _tls ??= require('tls');
TLS _tls;
@JS()
@anonymous
abstract class TLS {
/// Reference to constructor function of [TLSSocket].
Function get TLSSocket;
external JsError checkServerIdentity(String host, TLSPeerCertificate cert);
/// See official documentation on possible signatures:
/// - https://nodejs.org/api/tls.html#tls_tls_connect_options_callback
///
/// Returns instance of [TLSSocket].
// Can not declare return type as [TLSSocket] because there is a getter with
// the same name.
external dynamic connect(arg1, [arg2, arg3, arg4]);
external TLSSecureContext createSecureContext(options);
external TLSServer createServer([options, Function secureConnectionListener]);
external List<String> getCiphers();
external String get DEFAULT_ECDH_CURVE;
}
TLSSocket createTLSSocket(Socket socket, TLSSocketOptions options) {
return callConstructor(tls.TLSSocket, [options]);
}
@JS()
@anonymous
abstract class TLSServer implements NetServer {
external void addContext(String hostname, context);
@override
external NetAddress address();
@override
external TLSServer close([void Function() callback]);
external Buffer getTicketKeys();
/// See official documentation on possible signatures:
/// - https://nodejs.org/api/net.html#net_server_listen
@override
external void listen([arg1, arg2, arg3, arg4]);
external void setTicketKeys(Buffer keys);
}
@JS()
@anonymous
abstract class TLSSocket implements Duplex {
external NetAddress address();
external dynamic get authorizationError;
external bool get authorized;
external void disableRenegotiation();
external bool get encrypted;
external TLSCipher getCipher();
external TLSEphemeralKeyInfo getEphemeralKeyInfo();
external TLSPeerCertificate getPeerCertificate([bool detailed]);
external String getProtocol();
external dynamic getSession();
external dynamic getTLSTicket();
external String get localAddress;
external num get localPort;
external String get remoteAddress;
external String get remoteFamily;
external num get remotePort;
external void renegotiate(options, Function callback);
external void setMaxSendFragment(num size);
}
@JS()
@anonymous
abstract class TLSCipher {
external String get name;
@deprecated
external String get version;
}
@JS()
@anonymous
abstract class TLSEphemeralKeyInfo {
external String get type;
external String get name;
external int get size;
}
@JS()
@anonymous
abstract class TLSPeerCertificate {
external dynamic get subject;
external dynamic get issuer;
external dynamic get issuerCertificate;
external dynamic get raw;
external dynamic get valid_from;
external dynamic get valid_to;
external String get fingerprint;
external String get serialNumber;
}
@JS()
@anonymous
abstract class TLSSocketOptions implements TLSSecureContextOptions {
external factory TLSSocketOptions({
bool isServer,
NetServer server,
bool requestCert,
bool rejectUnauthorized,
List NPNProtocols,
List ALPNProtocols,
Function SNICallback,
Buffer session,
bool requestOCSP,
dynamic secureContext,
pfx,
key,
String passphrase,
cert,
ca,
String ciphers,
bool honorCipherOrder,
String ecdhCurve,
String clientCertEngine,
crl,
dhparam,
num secureOptions,
String secureProtocol,
String sessionIdContext,
});
external bool get isServer;
external NetServer get server;
external bool get requestCert;
external bool get rejectUnauthorized;
external List get NPNProtocols;
external List get ALPNProtocols;
external Function get SNICallback;
external Buffer get session;
external bool get requestOCSP;
external dynamic get secureContext;
}
@JS()
@anonymous
abstract class TLSSecureContext {}
@JS()
@anonymous
abstract class TLSSecureContextOptions {
external factory TLSSecureContextOptions({
pfx,
key,
String passphrase,
cert,
ca,
String ciphers,
bool honorCipherOrder,
String ecdhCurve,
String clientCertEngine,
crl,
dhparam,
num secureOptions,
String secureProtocol,
String sessionIdContext,
});
external dynamic get pfx;
external dynamic get key;
external String get passphrase;
external dynamic get cert;
external dynamic get ca;
external String get ciphers;
external bool get honorCipherOrder;
external String get ecdhCurve;
external String get clientCertEngine;
external dynamic get crl;
external dynamic get dhparam;
external num get secureOptions;
external String get secureProtocol;
external String get sessionIdContext;
}
@JS()
@anonymous
abstract class TLSServerOptions implements TLSSecureContextOptions {
external factory TLSServerOptions({
String clientCertEngine,
num handshakeTimeout,
bool requestCert,
bool rejectUnauthorized,
List NPNProtocols,
List ALPNProtocols,
Function SNICallback,
num sessionTimeout,
Buffer ticketKeys,
pfx,
key,
String passphrase,
cert,
ca,
String ciphers,
bool honorCipherOrder,
String ecdhCurve,
crl,
dhparam,
num secureOptions,
String secureProtocol,
String sessionIdContext,
});
@override
external String get clientCertEngine;
external num get handshakeTimeout;
external bool get requestCert;
external bool get rejectUnauthorized;
external List get NPNProtocols;
external List get ALPNProtocols;
external Function get SNICallback;
external num get sessionTimeout;
external Buffer get ticketKeys;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/module.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "module" module bindings.
///
/// This library does not declare library-level getter for the module in order
/// to avoid name collision with a `module` object available in each module.
@JS()
library node_interop.module;
import 'package:js/js.dart';
@JS()
@anonymous
abstract class Modules {
external List<String> get builtinModules;
}
@JS()
@anonymous
abstract class Module {
external List<Module> get children;
external dynamic get exports;
external String get filename;
external String get id;
external bool get loaded;
external Module get parent;
external List<String> get paths;
external dynamic require(String id);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/buffer.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "buffer" module bindings.
///
/// Normally there should be no need to import this module directly as
/// [Buffer] class is available globally.
@JS()
library node_interop.buffer;
import 'package:js/js.dart';
import 'node.dart';
BufferModule get buffer => _buffer ??= require('buffer');
BufferModule _buffer;
@JS()
@anonymous
abstract class BufferModule {
external BufferConstants get constants;
/// Returns the maximum number of bytes that will be returned when
/// [Buffer.inspect] is called.
external int get INSPECT_MAX_BYTES;
/// An alias for [BufferConstants.MAX_LENGTH].
external int get kMaxLength;
/// Re-encodes the given [source] Buffer or Uint8Array instance from one
/// character encoding to another. Returns a new Buffer instance.
external Buffer transcode(source, String fromEnc, String toEnc);
}
@JS()
@anonymous
abstract class BufferConstants {
/// On 32-bit architectures, this value is (2^30)-1 (~1GB).
/// On 64-bit architectures, this value is (2^31)-1 (~2GB).
external int get MAX_LENGTH;
/// Represents the largest length that a string primitive can have,
/// counted in UTF-16 code units.
external int get MAX_STRING_LENGTH;
}
@JS()
abstract class Buffer {
/// Creates a new [Buffer] from data.
external static Buffer from(data, [arg1, arg2]);
/// Allocates a new [Buffer] of size bytes.
///
/// If [fill] is undefined, the Buffer will be zero-filled.
external static Buffer alloc(int size, [fill, String encoding]);
/// Allocates a new Buffer of size bytes.
///
/// If the size is larger than [BufferConstants.MAX_LENGTH] or smaller than 0,
/// a RangeError will be thrown. A zero-length Buffer will be created if
/// size is 0.
external static Buffer allocUnsafe(int size);
/// Allocates a new Buffer of size bytes.
///
/// The underlying memory for Buffer instances created in this way is not
/// initialized. The contents of the newly created Buffer are unknown and may
/// contain sensitive data. Use [Buffer.fill] to initialize such Buffer
/// instances to zeroes.
external static Buffer allocUnsafeSlow(int size);
/// Returns the actual byte length of a string.
external static Buffer byteLength(string, [encoding]);
/// Compares [buf1] to [buf2] typically for the purpose of sorting arrays of
/// Buffer instances.
external static int compare(buf1, buf2);
/// Returns a new Buffer which is the result of concatenating all the Buffer
/// instances in the list together.
external static Buffer concat(List list, [int totalLength]);
/// Returns `true` if [obj] is a [Buffer], `false` otherwise.
external static bool isBuffer(obj);
/// Returns `true` if [encoding] contains a supported character encoding,
/// or false otherwise.
external static bool isEncoding(String encoding);
/// This is the number of bytes used to determine the size of pre-allocated,
/// internal Buffer instances used for pooling.
///
/// This value may be modified.
external static int get poolSize;
external static set poolSize(int value);
// [] and []= operators are not supported by JS interop
// external operator [](int index);
// external operator []=(int index, int value);
external dynamic get buffer;
// Can not have static and regular methods of the same name in Dart.
// external bool compare();
/// Copies data from a region of buf to a region in [target] even if the target
/// memory region overlaps with buf.
external bool copy(target, [int targetStart, int sourceStart, int sourceEnd]);
/// Creates and returns an iterator of (index, byte) pairs from the contents
/// of this buffer.
external Iterable<List<int>> entries();
/// Returns `true` if both this and [other] buffer have exactly the same bytes,
/// `false` otherwise.
external bool equals(other);
/// Fills this buffer with the specified value. If the [offset] and [end] are
/// not given, the entire buffer will be filled.
external Buffer fill(value, [int offset, int end, String encoding]);
/// Equivalent to `indexOf() != -1`.
external bool includes(value, [int byteOffset, String encoding]);
external int indexOf(value, [int byteOffset, String encoding]);
/// Creates and returns an iterator of keys (indices) in this buffer.
external Iterable<int> keys();
/// Identical to [indexOf], except buffer is searched from back to front.
external int lastIndexOf(value, [int byteOffset, String encoding]);
/// Returns the amount of memory allocated for this buffer in bytes. Note that
/// this does not necessarily reflect the amount of "usable" data within buffer.
external int get length;
/// Reads a 64-bit double from this buffer at the specified offset with
/// specified endian format.
external num readDoubleBE(int offset, [bool noAssert]);
/// Reads a 64-bit double from this buffer at the specified offset with
/// specified endian format.
external num readDoubleLE(int offset, [bool noAssert]);
/// Reads a 32-bit float from this buffer at the specified [offset] with
/// specified endian format.
external num readFloatBE(int offset, [bool noAssert]);
/// Reads a 32-bit float from this buffer at the specified [offset] with
/// specified endian format.
external num readFloatLE(int offset, [bool noAssert]);
/// Reads a signed 8-bit integer from this buffer at the specified [offset].
external num readInt8(int offset, [bool noAssert]);
/// Reads a signed 16-bit integer from this buffer at the specified [offset]
/// with specified endian format.
external num readInt16BE(int offset, [bool noAssert]);
/// Reads a signed 16-bit integer from this buffer at the specified [offset]
/// with specified endian format.
external num readInt16LE(int offset, [bool noAssert]);
/// Reads a signed 32-bit integer from this buffer at the specified [offset]
/// with specified endian format.
external num readInt32BE(int offset, [bool noAssert]);
/// Reads a signed 32-bit integer from this buffer at the specified [offset]
/// with specified endian format.
external num readInt32LE(int offset, [bool noAssert]);
/// Reads [byteLength] number of bytes from this buffer at the specified [offset]
/// and interprets the result as a two's complement signed value.
///
/// Supports up to 48 bits of accuracy.
external int readIntBE(int offset, int byteLength, [bool noAssert]);
/// Reads [byteLength] number of bytes from this buffer at the specified [offset]
/// and interprets the result as a two's complement signed value.
///
/// Supports up to 48 bits of accuracy.
external int readIntLE(int offset, int byteLength, [bool noAssert]);
/// Reads a unsigned 8-bit integer from this buffer at the specified [offset].
external num readUInt8(int offset, [bool noAssert]);
/// Reads a unsigned 16-bit integer from this buffer at the specified [offset]
/// with specified endian format.
external num readUInt16BE(int offset, [bool noAssert]);
/// Reads a unsigned 16-bit integer from this buffer at the specified [offset]
/// with specified endian format.
external num readUInt16LE(int offset, [bool noAssert]);
/// Reads a unsigned 32-bit integer from this buffer at the specified [offset]
/// with specified endian format.
external num readUInt32BE(int offset, [bool noAssert]);
/// Reads a unsigned 32-bit integer from this buffer at the specified [offset]
/// with specified endian format.
external num readUInt32LE(int offset, [bool noAssert]);
/// Reads [byteLength] number of bytes from this buffer at the specified [offset]
/// and interprets the result as an unsigned integer.
///
/// Supports up to 48 bits of accuracy.
external int readUIntBE(int offset, int byteLength, [bool noAssert]);
/// Reads [byteLength] number of bytes from this buffer at the specified [offset]
/// and interprets the result as an unsigned integer.
///
/// Supports up to 48 bits of accuracy.
external int readUIntLE(int offset, int byteLength, [bool noAssert]);
/// Returns a new [Buffer] that references the same memory as the original,
/// but offset and cropped by the [start] and [end] indices.
external Buffer slice([int start, int end]);
/// Interprets this buffer as an array of unsigned 16-bit integers and swaps
/// the byte-order in-place.
external Buffer swap16();
/// Interprets this buffer as an array of unsigned 32-bit integers and swaps
/// the byte-order in-place.
external Buffer swap32();
/// Interprets this buffer as an array of 64-bit numbers and swaps
/// the byte-order in-place.
external Buffer swap64();
/// Returns a JSON representation of this buffer.
external dynamic toJSON();
/// Decodes this buffer to a string according to the specified character
/// [encoding].
@override
external String toString([String encoding, int start, int end]);
/// Creates and returns an iterator for this buffer values (bytes).
external Iterable<int> values();
/// Writes string to this buffer at [offset] according to the character
/// [encoding]. Returns number of bytes written.
external int write(String string, [int offset, int length, String encoding]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeDoubleBE(num value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeDoubleLE(num value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeFloatBE(num value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeFloatLE(num value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeInt8(num value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeInt16BE(num value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeInt16LE(num value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeInt32BE(num value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeInt32LE(num value, int offset, [bool noAssert]);
/// Writes [byteLength] bytes of value at the specified [offset]. Supports up
/// to 48 bits of accuracy.
external int writeIntBE(num value, int offset, int byteLength,
[bool noAssert]);
/// Writes [byteLength] bytes of value at the specified [offset]. Supports up
/// to 48 bits of accuracy.
external int writeIntLE(num value, int offset, int byteLength,
[bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeUInt8(int value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeUInt16BE(int value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeUInt16LE(int value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeUInt32BE(int value, int offset, [bool noAssert]);
/// Writes value at the specified [offset] with specified endian format.
/// Returns [offset] plus the number of bytes written.
external int writeUInt32LE(int value, int offset, [bool noAssert]);
/// Writes [byteLength] bytes of value at the specified [offset]. Supports up
/// to 48 bits of accuracy.
external int writeUIntBE(num value, int offset, int byteLength,
[bool noAssert]);
/// Writes [byteLength] bytes of value at the specified [offset]. Supports up
/// to 48 bits of accuracy.
external int writeUIntLE(num value, int offset, int byteLength,
[bool noAssert]);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/node_interop.dart | // Copyright (c) 2017, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node interop library.
///
/// This library exports only globally available APIs. Built-in Node modules
/// can be imported with `import 'package:node_interop/{moduleName}.dart`, e.g.
/// for the "fs" module:
///
/// import 'package:node_interop/fs.dart';
///
/// List<String> contents = fs.readdirSync('/tmp');
library node_interop;
export 'node.dart';
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/https.dart | // Copyright (c) 2017, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "https" module bindings.
///
/// Use library-level [https] object to access this module functionality.
/// To create HTTPS agent use [createHttpsAgent].
@JS()
library node_interop.https;
import 'dart:js_util';
import 'package:js/js.dart';
import 'http.dart';
import 'node.dart';
import 'tls.dart';
export 'http.dart'
show
HttpAgent,
HttpAgentOptions,
ClientRequest,
IncomingMessage,
ServerResponse;
HTTPS get https => _https ??= require('https');
HTTPS _https;
/// Convenience method for creating instances of "https" module's Agent class.
///
/// This is equivalent of Node's `new https.Agent([options])`.
HttpsAgent createHttpsAgent([HttpsAgentOptions options]) {
var args = (options == null) ? [] : [options];
return callConstructor(https.Agent, args);
}
@JS()
@anonymous
abstract class HTTPS {
/// Returns a new instance of [HttpsServer].
///
/// The requestListener is a function which is automatically added to the
/// 'request' event.
external HttpsServer createServer(
[TLSServerOptions options, HttpRequestListener requestListener]);
/// Makes GET request. The only difference between this method and
/// [request] is that it sets the method to GET and calls req.end()
/// automatically.
external ClientRequest get(dynamic urlOrOptions,
[void Function(IncomingMessage response) callback]);
/// Makes a request to a secure web server.
external ClientRequest request(RequestOptions options,
[void Function(IncomingMessage response) callback]);
/// Global instance of [HttpsAgent] for all HTTPS client requests.
external HttpAgent get globalAgent;
/// Reference to constructor function of [HttpsAgent] class.
///
/// See also:
/// - [createHttpsAgent].
external Function get Agent;
}
@JS()
@anonymous
abstract class HttpsAgent implements HttpAgent {}
@JS()
@anonymous
abstract class HttpsServer implements TLSServer, HttpServer {
external HttpsServer close([void Function() callback]);
@override
external void listen([arg1, arg2, arg3, arg4]);
@override
external void setTimeout([num msecs, void Function() callback]);
@override
external num get timeout;
@override
external num get keepAliveTimeout;
}
@JS()
@anonymous
abstract class HttpsAgentOptions {
external bool get keepAlive;
external num get keepAliveMsecs;
external num get maxSockets;
external num get maxFreeSockets;
/// Optionally override the trusted CA certificates.
///
/// Default is to trust the well-known CAs curated by Mozilla.
external dynamic get ca;
/// Cert chains in PEM format.
external dynamic get cert;
/// Cipher suite specification, replacing the default.
external String get ciphers;
/// Name of an OpenSSL engine which can provide the client certificate.
external String get clientCertEngine;
/// PEM formatted CRLs (Certificate Revocation Lists).
external dynamic get crl;
/// Private keys in PEM format.
external dynamic get key;
/// Shared passphrase used for a single private key and/or a PFX.
external String get passphrase;
/// PFX or PKCS12 encoded private key and certificate chain.
///
/// An alternative to providing key and cert individually.
external dynamic get pfx;
/// SSL method to use.
///
/// For example, 'TLSv1_2_method' to force TLS version 1.2. Default: 'TLS_method'.
/// Possible values listed here: https://www.openssl.org/docs/man1.1.0/ssl/ssl.html#Dealing-with-Protocol-Methods
external String get secureProtocol;
external factory HttpsAgentOptions({
bool keepAlive,
num keepAliveMsecs,
num maxSockets,
num maxFreeSockets,
dynamic ca,
dynamic cert,
String ciphers,
String clientCertEngine,
dynamic crl,
dynamic key,
String passphrase,
dynamic pfx,
String secureProtocol,
});
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/js.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Bindings for global JavaScript objects not specific to Node.js.
@JS()
library node_interop.js;
import 'package:js/js.dart';
@JS()
external dynamic get undefined;
@JS()
abstract class Promise {
external factory Promise(
Function(dynamic Function(dynamic value) resolve,
dynamic Function(dynamic error) reject)
executor);
external Promise then(dynamic Function(dynamic value) onFulfilled,
[dynamic Function(dynamic error) onRejected]);
}
@JS()
abstract class Date {
external factory Date(dynamic value);
external int getTime();
external String toISOString();
}
/// Returns a list of keys in a JavaScript [object].
///
/// This function binds to JavaScript `Object.keys()`.
@JS('Object.keys')
external List<String> objectKeys(object);
/// JavaScript Error object.
@JS('Error')
abstract class JsError {
external factory JsError([message]);
external String get message;
external String get stack;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/timers.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "timers" module bindings.
@JS()
library node_interop.timers;
import 'package:js/js.dart';
@JS()
abstract class Immediate {}
@JS()
abstract class Timeout {
external Timeout ref();
external Timeout unref();
}
@JS()
external Immediate setImmediate(Function callback,
[arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9]);
@JS()
external Timeout setInterval(Function callback, num delay,
[arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9]);
@JS()
external Timeout setTimeout(Function callback, num delay,
[arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9]);
@JS()
external void clearImmediate(Immediate immediate);
@JS()
external void clearInterval(Timeout timeout);
@JS()
external void clearTimeout(Timeout timeout);
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/events.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "events" module bindings.
@JS()
library node_interop.events;
import 'package:js/js.dart';
@JS()
@anonymous
abstract class EventEmitter {
external static int get defaultMaxListeners;
external static set defaultMaxListeners(int value);
external void addListener(eventName, Function listener);
external void emit(eventName, [arg1, arg2, arg3, arg4, arg5, arg6]);
external List eventNames();
external int getMaxListeners();
external int listenerCount(eventName);
external List<Function> listeners(eventName);
external EventEmitter on(eventName, Function listener);
external EventEmitter once(eventName, Function listener);
external EventEmitter prependListener(eventName, Function listener);
external EventEmitter prependOnceListener(eventName, Function listener);
external EventEmitter removeAllListeners(eventName);
external EventEmitter removeListener(eventName, Function listener);
external void setMaxListeners(int value);
external List<Function> rawListeners(eventName);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/child_process.dart | // Copyright (c) 2017, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "child_process" module bindings.
///
/// Use top-level [childProcess] object to access this module functionality.
@JS()
library node_interop.child_process;
import 'package:js/js.dart';
import 'events.dart';
import 'node.dart';
import 'stream.dart';
ChildProcessModule get childProcess =>
_childProcess ??= require('child_process');
ChildProcessModule _childProcess;
@JS()
@anonymous
abstract class ChildProcessModule {
/// Spawns a shell then executes the command within that shell, buffering any
/// generated output.
external ChildProcess exec(String command,
[ExecOptions options, ExecCallback callback]);
/// Similar to [exec] except that it does not spawn a shell.
///
/// The specified executable file is spawned directly as a new process making
/// it slightly more efficient.
external ChildProcess execFile(String file,
[List<String> args, ExecOptions options, ExecCallback callback]);
/// This is a special case of [spawn] used specifically to spawn new
/// Node.js processes.
external ChildProcess fork(String modulePath,
[List<String> args, ForkOptions options]);
/// Spawns a new process using the given [command], with command line arguments
/// in [args].
external ChildProcess spawn(String command,
[List<String> args, SpawnOptions options]);
/// This method is generally identical to [exec] with the exception that it
/// will not return until the child process has fully closed.
///
/// Returns stdout from the command as a [Buffer] or string.
external dynamic execSync(String command, [ExecOptions options]);
/// This method is generally identical to [execFile] with the exception that it
/// will not return until the child process has fully closed.
///
/// Returns stdout from the command as a [Buffer] or string.
external dynamic execFileSync(String file,
[List<String> args, ExecOptions options]);
/// This method is generally identical to [spawn] with the exception that it
/// will not return until the child process has fully closed.
external dynamic spawnSync(String command,
[List<String> args, ExecOptions options]);
}
typedef ExecCallback = void Function(
NodeJsError error, dynamic stdout, dynamic stderr);
@JS()
abstract class ChildProcess extends EventEmitter {
/// Reference to the child's IPC channel. If no IPC channel currently exists,
/// this property is `undefined`.
external dynamic get channel;
/// Indicates whether it is still possible to send and receive messages from
/// a child process.
external bool get connected;
/// Closes the IPC channel between parent and child, allowing the child to exit
/// gracefully once there are no other connections keeping it alive.
external void disconnect();
/// Sends a signal to the child process.
external void kill([String signal]);
/// Indicates whether the child process successfully received a signal
/// from [kill].
external bool get killed;
/// The process identifier (PID) of the child process.
external int get pid;
/// Send [message] to the child process.
external bool send(dynamic message,
[dynamic sendHandle, dynamic options, Function callback]);
/// A [Readable] stream that represents the child process's stderr.
external Readable get stderr;
/// A [Writable] stream that represents the child process's stdin.
external Writable get stdin;
/// A sparse array of pipes to the child process.
external List get stdio;
/// A [Readable] stream that represents the child process's stdout.
external Readable get stdout;
}
@JS()
@anonymous
abstract class ExecOptions {
external String get cwd;
external dynamic get env;
external String get encoding;
external String get shell;
external num get timeout;
external num get maxBuffer;
external num get uid;
external num get gid;
external factory ExecOptions({
String cwd,
dynamic env,
String encoding,
String shell,
num timeout,
num maxBuffer,
num uid,
num gid,
});
}
@JS()
@anonymous
abstract class ForkOptions {
external String get cwd;
external dynamic get env;
external String get execPath;
external List<String> get execArgv;
external bool get silent;
external dynamic get stdio;
external bool get windowsVerbatimArguments;
external num get uid;
external num get gid;
external factory ForkOptions({
String cwd,
dynamic env,
String execPath,
List<String> execArgv,
bool silent,
dynamic stdio,
bool windowsVerbatimArguments,
num uid,
num gid,
});
}
@JS()
@anonymous
abstract class SpawnOptions {
external String get cwd;
external dynamic get env;
external String get argv0;
external dynamic get stdio;
external bool get detached;
external num get uid;
external num get gid;
external dynamic get shell;
external bool get windowsVerbatimArguments;
external bool get windowsHide;
external factory SpawnOptions({
String cwd,
dynamic env,
String argv0,
dynamic stdio,
bool detached,
num uid,
num gid,
dynamic shell,
bool windowsVerbatimArguments,
bool windowsHide,
});
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/os.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "os" module bindings.
///
/// Use library-level [os] object to access functionality of this module.
@JS()
library node_interop.os;
import 'package:js/js.dart';
import 'node.dart';
OS get os => _os ??= require('os');
OS _os;
@JS()
@anonymous
abstract class OS {
external String get EOL;
external String arch();
external OSConstants get constants;
external List<CPU> cpus();
external String endianness();
external int freemem();
external String homedir();
external String hostname();
external List<int> loadavg();
external dynamic networkInterfaces();
external String platform();
external String release();
external String tmpdir();
external int totalmem();
external String type();
external int uptime();
external dynamic userInfo([options]);
}
@JS()
@anonymous
abstract class CPU {
external String get model;
external num get speed;
external CPUTimes get times;
}
@JS()
@anonymous
abstract class CPUTimes {
external num get user;
external num get nice;
external num get sys;
external num get idle;
external num get irq;
}
@JS()
@anonymous
abstract class OSConstants {
external OSSignalConstants get signals;
external OSErrorConstants get errno;
external OSDLOpenConstants get dlopen;
}
@JS()
@anonymous
abstract class OSSignalConstants {
external int get SIGHUP;
external int get SIGINT;
external int get SIGQUIT;
external int get SIGILL;
external int get SIGTRAP;
external int get SIGABRT;
external int get SIGIOT;
external int get SIGBUS;
external int get SIGFPE;
external int get SIGKILL;
external int get SIGUSR1;
external int get SIGUSR2;
external int get SIGSEGV;
external int get SIGPIPE;
external int get SIGALRM;
external int get SIGTERM;
external int get SIGCHLD;
external int get SIGSTKFLT;
external int get SIGCONT;
external int get SIGSTOP;
external int get SIGTSTP;
external int get SIGBREAK;
external int get SIGTTIN;
external int get SIGTTOU;
external int get SIGURG;
external int get SIGXCPU;
external int get SIGXFSZ;
external int get SIGVTALRM;
external int get SIGPROF;
external int get SIGWINCH;
external int get SIGIO;
external int get SIGPOLL;
external int get SIGLOST;
external int get SIGPWR;
external int get SIGINFO;
external int get SIGSYS;
external int get SIGUNUSED;
}
@JS()
@anonymous
abstract class OSErrorConstants {
external int get E2BIG;
external int get EACCES;
external int get EADDRINUSE;
external int get EADDRNOTAVAIL;
external int get EAFNOSUPPORT;
external int get EAGAIN;
external int get EALREADY;
external int get EBADF;
external int get EBADMSG;
external int get EBUSY;
external int get ECANCELED;
external int get ECHILD;
external int get ECONNABORTED;
external int get ECONNREFUSED;
external int get ECONNRESET;
external int get EDEADLK;
external int get EDESTADDRREQ;
external int get EDOM;
external int get EDQUOT;
external int get EEXIST;
external int get EFAULT;
external int get EFBIG;
external int get EHOSTUNREACH;
external int get EIDRM;
external int get EILSEQ;
external int get EINPROGRESS;
external int get EINTR;
external int get EINVAL;
external int get EIO;
external int get EISCONN;
external int get EISDIR;
external int get ELOOP;
external int get EMFILE;
external int get EMLINK;
external int get EMSGSIZE;
external int get EMULTIHOP;
external int get ENAMETOOLONG;
external int get ENETDOWN;
external int get ENETRESET;
external int get ENETUNREACH;
external int get ENFILE;
external int get ENOBUFS;
external int get ENODATA;
external int get ENODEV;
external int get ENOENT;
external int get ENOEXEC;
external int get ENOLCK;
external int get ENOLINK;
external int get ENOMEM;
external int get ENOMSG;
external int get ENOPROTOOPT;
external int get ENOSPC;
external int get ENOSR;
external int get ENOSTR;
external int get ENOSYS;
external int get ENOTCONN;
external int get ENOTDIR;
external int get ENOTEMPTY;
external int get ENOTSOCK;
external int get ENOTSUP;
external int get ENOTTY;
external int get ENXIO;
external int get EOPNOTSUPP;
external int get EOVERFLOW;
external int get EPERM;
external int get EPIPE;
external int get EPROTO;
external int get EPROTONOSUPPORT;
external int get EPROTOTYPE;
external int get ERANGE;
external int get EROFS;
external int get ESPIPE;
external int get ESRCH;
external int get ESTALE;
external int get ETIME;
external int get ETIMEDOUT;
external int get ETXTBSY;
external int get EWOULDBLOCK;
external int get EXDEV;
// Windows specific error constants
external int get WSAEINTR;
external int get WSAEBADF;
external int get WSAEACCES;
external int get WSAEFAULT;
external int get WSAEINVAL;
external int get WSAEMFILE;
external int get WSAEWOULDBLOCK;
external int get WSAEINPROGRESS;
external int get WSAEALREADY;
external int get WSAENOTSOCK;
external int get WSAEDESTADDRREQ;
external int get WSAEMSGSIZE;
external int get WSAEPROTOTYPE;
external int get WSAENOPROTOOPT;
external int get WSAEPROTONOSUPPORT;
external int get WSAESOCKTNOSUPPORT;
external int get WSAEOPNOTSUPP;
external int get WSAEPFNOSUPPORT;
external int get WSAEAFNOSUPPORT;
external int get WSAEADDRINUSE;
external int get WSAEADDRNOTAVAIL;
external int get WSAENETDOWN;
external int get WSAENETUNREACH;
external int get WSAENETRESET;
external int get WSAECONNABORTED;
external int get WSAECONNRESET;
external int get WSAENOBUFS;
external int get WSAEISCONN;
external int get WSAENOTCONN;
external int get WSAESHUTDOWN;
external int get WSAETOOMANYREFS;
external int get WSAETIMEDOUT;
external int get WSAECONNREFUSED;
external int get WSAELOOP;
external int get WSAENAMETOOLONG;
external int get WSAEHOSTDOWN;
external int get WSAEHOSTUNREACH;
external int get WSAENOTEMPTY;
external int get WSAEPROCLIM;
external int get WSAEUSERS;
external int get WSAEDQUOT;
external int get WSAESTALE;
external int get WSAEREMOTE;
external int get WSASYSNOTREADY;
external int get WSAVERNOTSUPPORTED;
external int get WSANOTINITIALISED;
external int get WSAEDISCON;
external int get WSAENOMORE;
external int get WSAECANCELLED;
external int get WSAEINVALIDPROCTABLE;
external int get WSAEINVALIDPROVIDER;
external int get WSAEPROVIDERFAILEDINIT;
external int get WSASYSCALLFAILURE;
external int get WSASERVICE_NOT_FOUND;
external int get WSATYPE_NOT_FOUND;
external int get WSA_E_NO_MORE;
external int get WSA_E_CANCELLED;
external int get WSAEREFUSED;
}
@JS()
@anonymous
abstract class OSDLOpenConstants {
external int get RTLD_LAZY;
external int get RTLD_NOW;
external int get RTLD_GLOBAL;
external int get RTLD_LOCAL;
external int get RTLD_DEEPBIND;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/dns.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "dns" module bindings.
@JS()
library node_interop.dns;
import 'package:js/js.dart';
import 'node.dart';
import 'util.dart';
DNS get dns => _dns ??= require('dns');
DNS _dns;
/// Main entry point to Node's "dns" module functionality.
///
/// Instead of using this class directly consider [dns] object.
///
/// Usage:
///
/// import 'package:node_interop/dns.dart';
///
/// void main() {
/// var options = new DNSLookupOptions(all: true, verbatim: true);
/// void lookupHandler(error, List<DNSAddress> addresses) {
/// console.log(addresses);
/// }
/// dns.lookup('google.com', options, allowInterop(lookupHandler));
/// }
@JS()
@anonymous
abstract class DNS implements Resolver {
/// Constructor for DNS [Resolver] class.
///
/// See also:
/// - [createDNSResolver] helper function.
external Function get Resolver;
/// Resolves a hostname (e.g. 'nodejs.org') into the first found IPv4 or
/// IPv6 record.
///
/// If `options.verbatim` is `true` then results are returned in the order
/// the DNS resolver returned them.
///
/// [callback]'s signature depends on the value of `options.all`.
///
/// See also:
/// - [https://nodejs.org/api/dns.html#dns_dns_lookup_hostname_options_callback](https://nodejs.org/api/dns.html#dns_dns_lookup_hostname_options_callback)
external void lookup(
String hostname, DNSLookupOptions options, Function callback);
}
@JS()
@anonymous
abstract class DNSLookupOptions {
external num get family;
external bool get all;
external bool get verbatim;
external factory DNSLookupOptions({num family, bool all, bool verbatim});
}
@JS()
@anonymous
abstract class DNSAddress {
external String get address;
external num get family;
}
Resolver createDNSResolver() {
return callConstructor(dns.Resolver, null);
}
/// An independent resolver for DNS requests.
///
/// Note that creating a new resolver uses the default server settings.
/// Setting the servers used for a resolver using [setServers] does not
/// affect other resolvers.
@JS()
@anonymous
abstract class Resolver {
external void resolve(String hostname, String rrtype,
void Function(dynamic error, dynamic records) callback);
external void resolve4(String hostname, optionsOrCallback,
[void Function(dynamic error, dynamic addresses) callback]);
external void resolve6(String hostname, optionsOrCallback,
[void Function(dynamic error, dynamic addresses) callback]);
external void resolveAny(
String hostname, void Function(dynamic error, List ret) callback);
external void resolveCname(
String hostname, void Function(dynamic error, List<String> ret) callback);
external void resolveMx(
String hostname, void Function(dynamic error, List addresses) callback);
external void resolveNaptr(
String hostname, void Function(dynamic error, List addresses) callback);
external void resolveNs(String hostname,
void Function(dynamic error, List<String> addresses) callback);
external void resolvePtr(String hostname,
void Function(dynamic error, List<String> addresses) callback);
external void resolveSoa(
String hostname, void Function(dynamic error, dynamic address) callback);
external void resolveSrv(
String hostname, void Function(dynamic error, List addresses) callback);
external void resolveTxt(String hostname,
void Function(dynamic error, List<List<String>> records) callback);
external void reverse(
String ip, void Function(dynamic error, List<String> hostnames) callback);
external List<String> getServers();
external void setServers(List<String> servers);
external void cancel();
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/test.dart | // Copyright (c) 2017, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Testing utilities for Dart applications with node_interop.
@JS()
library node_interop.test;
import 'package:js/js.dart';
import 'fs.dart';
import 'node.dart';
import 'path.dart';
/// Creates arbitrary file in the same directory with the compiled test file.
///
/// This is useful for creating native Node modules (as well as any other
/// fixtures) for testing interactions between Dart and JS.
///
/// Returns absolute path to the created file.
///
/// Example test case:
///
/// @JS()
/// @TestOn('node')
/// library pi_test;
///
/// import 'package:node_interop/test.dart';
/// import 'package:test/test.dart';
/// import 'package:js/js.dart';
///
/// /// Simple JS module which exports one value.
/// const fixtureJS = '''
/// exports.simplePI = 3.1415;
/// '''
///
/// @JS()
/// abstract class Fixture {
/// external num get simplePI;
/// }
///
/// void main() {
/// createFile('fixture.js', fixtureJS);
///
/// test('simple PI', function() {
/// Fixture fixture = require('./fixture.js');
/// expect(fixture.simplePI, 3.1415);
/// });
/// }
String createFile(String name, String contents) {
String script = process.argv[1];
var segments = script.split(path.sep);
segments
..removeLast()
..add(name);
var jsFilepath = path.sep + segments.join(path.sep);
fs.writeFileSync(jsFilepath, contents);
return jsFilepath;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_interop/querystring.dart | // Copyright (c) 2018, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// Node.js "querystring" module bindings.
///
/// Use library-level [querystring] object to access functionality of this module.
@JS()
library node_interop.querystring;
import 'package:js/js.dart';
import 'node.dart';
QueryString get querystring => _querystring ??= require('querystring');
QueryString _querystring;
@JS()
@anonymous
abstract class QueryString {
external String escape(String str);
external dynamic parse(String str, [String sep, String eq, options]);
external String stringify(obj, [String sep, String eq, options]);
external String unescape(String str);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse/pubspec_parse.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
export 'src/dependency.dart'
show
Dependency,
HostedDependency,
GitDependency,
SdkDependency,
PathDependency;
export 'src/pubspec.dart' show Pubspec;
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse/src/dependency.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: prefer_expression_function_bodies
part of 'dependency.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
SdkDependency _$SdkDependencyFromJson(Map json) {
return $checkedNew('SdkDependency', json, () {
$checkKeys(json,
requiredKeys: const ['sdk'], disallowNullValues: const ['sdk']);
final val = SdkDependency(
$checkedConvert(json, 'sdk', (v) => v as String),
version: $checkedConvert(
json, 'version', (v) => _constraintFromString(v as String)),
);
return val;
});
}
GitDependency _$GitDependencyFromJson(Map json) {
return $checkedNew('GitDependency', json, () {
$checkKeys(json,
requiredKeys: const ['url'], disallowNullValues: const ['url']);
final val = GitDependency(
$checkedConvert(json, 'url', (v) => parseGitUri(v as String)),
$checkedConvert(json, 'ref', (v) => v as String),
$checkedConvert(json, 'path', (v) => v as String),
);
return val;
});
}
HostedDependency _$HostedDependencyFromJson(Map json) {
return $checkedNew('HostedDependency', json, () {
$checkKeys(json,
allowedKeys: const ['version', 'hosted'],
disallowNullValues: const ['hosted']);
final val = HostedDependency(
version: $checkedConvert(
json, 'version', (v) => _constraintFromString(v as String)),
hosted: $checkedConvert(
json, 'hosted', (v) => v == null ? null : HostedDetails.fromJson(v)),
);
return val;
});
}
HostedDetails _$HostedDetailsFromJson(Map json) {
return $checkedNew('HostedDetails', json, () {
$checkKeys(json,
allowedKeys: const ['name', 'url'],
requiredKeys: const ['name'],
disallowNullValues: const ['name', 'url']);
final val = HostedDetails(
$checkedConvert(json, 'name', (v) => v as String),
$checkedConvert(json, 'url', (v) => parseGitUri(v as String)),
);
return val;
});
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse/src/pubspec.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:checked_yaml/checked_yaml.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:pub_semver/pub_semver.dart';
import 'dependency.dart';
part 'pubspec.g.dart';
@JsonSerializable()
class Pubspec {
// TODO: executables
final String name;
@JsonKey(fromJson: _versionFromString)
final Version version;
final String description;
/// This should be a URL pointing to the website for the package.
final String homepage;
/// Specifies where to publish this package.
///
/// Accepted values: `null`, `'none'` or an `http` or `https` URL.
///
/// [More information](https://dart.dev/tools/pub/pubspec#publish_to).
final String publishTo;
/// Optional field to specify the source code repository of the package.
/// Useful when a package has both a home page and a repository.
final Uri repository;
/// Optional field to a web page where developers can report new issues or
/// view existing ones.
final Uri issueTracker;
/// If there is exactly 1 value in [authors], returns it.
///
/// If there are 0 or more than 1, returns `null`.
@Deprecated(
'Here for completeness, but not recommended. Use `authors` instead.')
String get author {
if (authors.length == 1) {
return authors.single;
}
return null;
}
final List<String> authors;
final String documentation;
@JsonKey(fromJson: _environmentMap)
final Map<String, VersionConstraint> environment;
@JsonKey(fromJson: parseDeps, nullable: false)
final Map<String, Dependency> dependencies;
@JsonKey(fromJson: parseDeps, nullable: false)
final Map<String, Dependency> devDependencies;
@JsonKey(fromJson: parseDeps, nullable: false)
final Map<String, Dependency> dependencyOverrides;
/// Optional configuration specific to [Flutter](https://flutter.io/)
/// packages.
///
/// May include
/// [assets](https://flutter.io/docs/development/ui/assets-and-images)
/// and other settings.
final Map<String, dynamic> flutter;
/// If [author] and [authors] are both provided, their values are combined
/// with duplicates eliminated.
Pubspec(
this.name, {
this.version,
this.publishTo,
String author,
List<String> authors,
Map<String, VersionConstraint> environment,
this.homepage,
this.repository,
this.issueTracker,
this.documentation,
this.description,
Map<String, Dependency> dependencies,
Map<String, Dependency> devDependencies,
Map<String, Dependency> dependencyOverrides,
this.flutter,
}) : authors = _normalizeAuthors(author, authors),
environment = environment ?? const {},
dependencies = dependencies ?? const {},
devDependencies = devDependencies ?? const {},
dependencyOverrides = dependencyOverrides ?? const {} {
if (name == null || name.isEmpty) {
throw ArgumentError.value(name, 'name', '"name" cannot be empty.');
}
if (publishTo != null && publishTo != 'none') {
try {
final targetUri = Uri.parse(publishTo);
if (!(targetUri.isScheme('http') || targetUri.isScheme('https'))) {
throw const FormatException('Must be an http or https URL.');
}
} on FormatException catch (e) {
throw ArgumentError.value(publishTo, 'publishTo', e.message);
}
}
}
factory Pubspec.fromJson(Map json, {bool lenient = false}) {
lenient ??= false;
if (lenient) {
while (json.isNotEmpty) {
// Attempting to remove top-level properties that cause parsing errors.
try {
return _$PubspecFromJson(json);
} on CheckedFromJsonException catch (e) {
if (e.map == json && json.containsKey(e.key)) {
json = Map.from(json)..remove(e.key);
continue;
}
rethrow;
}
}
}
return _$PubspecFromJson(json);
}
/// Parses source [yaml] into [Pubspec].
///
/// When [lenient] is set, top-level property-parsing or type cast errors are
/// ignored and `null` values are returned.
factory Pubspec.parse(String yaml, {sourceUrl, bool lenient = false}) {
lenient ??= false;
return checkedYamlDecode(
yaml, (map) => Pubspec.fromJson(map, lenient: lenient),
sourceUrl: sourceUrl);
}
static List<String> _normalizeAuthors(String author, List<String> authors) {
final value = <String>{};
if (author != null) {
value.add(author);
}
if (authors != null) {
value.addAll(authors);
}
return value.toList();
}
}
Version _versionFromString(String input) =>
input == null ? null : Version.parse(input);
Map<String, VersionConstraint> _environmentMap(Map source) =>
source?.map((k, value) {
final key = k as String;
if (key == 'dart') {
// github.com/dart-lang/pub/blob/d84173eeb03c3/lib/src/pubspec.dart#L342
// 'dart' is not allowed as a key!
throw CheckedFromJsonException(
source,
'dart',
'VersionConstraint',
'Use "sdk" to for Dart SDK constraints.',
badKey: true,
);
}
VersionConstraint constraint;
if (value == null) {
constraint = null;
} else if (value is String) {
try {
constraint = VersionConstraint.parse(value);
} on FormatException catch (e) {
throw CheckedFromJsonException(source, key, 'Pubspec', e.message);
}
return MapEntry(key, constraint);
} else {
throw CheckedFromJsonException(
source, key, 'VersionConstraint', '`$value` is not a String.');
}
return MapEntry(key, constraint);
});
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse/src/pubspec.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: prefer_expression_function_bodies
part of 'pubspec.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Pubspec _$PubspecFromJson(Map json) {
return $checkedNew('Pubspec', json, () {
final val = Pubspec(
$checkedConvert(json, 'name', (v) => v as String),
version: $checkedConvert(
json, 'version', (v) => _versionFromString(v as String)),
publishTo: $checkedConvert(json, 'publish_to', (v) => v as String),
author: $checkedConvert(json, 'author', (v) => v as String),
authors: $checkedConvert(json, 'authors',
(v) => (v as List)?.map((e) => e as String)?.toList()),
environment: $checkedConvert(
json, 'environment', (v) => _environmentMap(v as Map)),
homepage: $checkedConvert(json, 'homepage', (v) => v as String),
repository: $checkedConvert(
json, 'repository', (v) => v == null ? null : Uri.parse(v as String)),
issueTracker: $checkedConvert(json, 'issue_tracker',
(v) => v == null ? null : Uri.parse(v as String)),
documentation: $checkedConvert(json, 'documentation', (v) => v as String),
description: $checkedConvert(json, 'description', (v) => v as String),
dependencies:
$checkedConvert(json, 'dependencies', (v) => parseDeps(v as Map)),
devDependencies:
$checkedConvert(json, 'dev_dependencies', (v) => parseDeps(v as Map)),
dependencyOverrides: $checkedConvert(
json, 'dependency_overrides', (v) => parseDeps(v as Map)),
flutter: $checkedConvert(
json,
'flutter',
(v) => (v as Map)?.map(
(k, e) => MapEntry(k as String, e),
)),
);
return val;
}, fieldKeyMap: const {
'publishTo': 'publish_to',
'issueTracker': 'issue_tracker',
'devDependencies': 'dev_dependencies',
'dependencyOverrides': 'dependency_overrides'
});
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/pubspec_parse/src/dependency.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:json_annotation/json_annotation.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:yaml/yaml.dart';
part 'dependency.g.dart';
Map<String, Dependency> parseDeps(Map source) =>
source?.map((k, v) {
final key = k as String;
Dependency value;
try {
value = _fromJson(v);
} on CheckedFromJsonException catch (e) {
if (e.map is! YamlMap) {
// This is likely a "synthetic" map created from a String value
// Use `source` to throw this exception with an actual YamlMap and
// extract the associated error information.
throw CheckedFromJsonException(source, key, e.className, e.message);
}
rethrow;
}
if (value == null) {
throw CheckedFromJsonException(
source, key, 'Pubspec', 'Not a valid dependency value.');
}
return MapEntry(key, value);
}) ??
{};
const _sourceKeys = ['sdk', 'git', 'path', 'hosted'];
/// Returns `null` if the data could not be parsed.
Dependency _fromJson(dynamic data) {
if (data is String || data == null) {
return _$HostedDependencyFromJson({'version': data});
}
if (data is Map) {
final matchedKeys =
data.keys.cast<String>().where((key) => key != 'version').toList();
if (data.isEmpty || (matchedKeys.isEmpty && data.containsKey('version'))) {
return _$HostedDependencyFromJson(data);
} else {
final firstUnrecognizedKey = matchedKeys
.firstWhere((k) => !_sourceKeys.contains(k), orElse: () => null);
return $checkedNew<Dependency>('Dependency', data, () {
if (firstUnrecognizedKey != null) {
throw UnrecognizedKeysException(
[firstUnrecognizedKey], data, _sourceKeys);
}
if (matchedKeys.length > 1) {
throw CheckedFromJsonException(data, matchedKeys[1], 'Dependency',
'A dependency may only have one source.');
}
final key = matchedKeys.single;
switch (key) {
case 'git':
return GitDependency.fromData(data[key]);
case 'path':
return PathDependency.fromData(data[key]);
case 'sdk':
return _$SdkDependencyFromJson(data);
case 'hosted':
return _$HostedDependencyFromJson(data);
}
throw StateError('There is a bug in pubspec_parse.');
});
}
}
// Not a String or a Map – return null so parent logic can throw proper error
return null;
}
abstract class Dependency {
Dependency._();
String get _info;
@override
String toString() => '$runtimeType: $_info';
}
@JsonSerializable()
class SdkDependency extends Dependency {
@JsonKey(nullable: false, disallowNullValue: true, required: true)
final String sdk;
@JsonKey(fromJson: _constraintFromString)
final VersionConstraint version;
SdkDependency(this.sdk, {this.version}) : super._();
@override
String get _info => sdk;
}
@JsonSerializable()
class GitDependency extends Dependency {
@JsonKey(fromJson: parseGitUri, required: true, disallowNullValue: true)
final Uri url;
final String ref;
final String path;
GitDependency(this.url, this.ref, this.path) : super._();
factory GitDependency.fromData(Object data) {
if (data is String) {
data = {'url': data};
}
if (data is Map) {
return _$GitDependencyFromJson(data);
}
throw ArgumentError.value(data, 'git', 'Must be a String or a Map.');
}
@override
String get _info => 'url@$url';
}
Uri parseGitUri(String value) =>
value == null ? null : _tryParseScpUri(value) ?? Uri.parse(value);
/// Supports URIs like `[user@]host.xz:path/to/repo.git/`
/// See https://git-scm.com/docs/git-clone#_git_urls_a_id_urls_a
Uri _tryParseScpUri(String value) {
final colonIndex = value.indexOf(':');
if (colonIndex < 0) {
return null;
} else if (colonIndex == value.indexOf('://')) {
// If the first colon is part of a scheme, it's not an scp-like URI
return null;
}
final slashIndex = value.indexOf('/');
if (slashIndex >= 0 && slashIndex < colonIndex) {
// Per docs: This syntax is only recognized if there are no slashes before
// the first colon. This helps differentiate a local path that contains a
// colon. For example the local path foo:bar could be specified as an
// absolute path or ./foo:bar to avoid being misinterpreted as an ssh url.
return null;
}
final atIndex = value.indexOf('@');
if (colonIndex > atIndex) {
final user = atIndex >= 0 ? value.substring(0, atIndex) : null;
final host = value.substring(atIndex + 1, colonIndex);
final path = value.substring(colonIndex + 1);
return Uri(scheme: 'ssh', userInfo: user, host: host, path: path);
}
return null;
}
class PathDependency extends Dependency {
final String path;
PathDependency(this.path) : super._();
factory PathDependency.fromData(Object data) {
if (data is String) {
return PathDependency(data);
}
throw ArgumentError.value(data, 'path', 'Must be a String.');
}
@override
String get _info => 'path@$path';
}
@JsonSerializable(disallowUnrecognizedKeys: true)
class HostedDependency extends Dependency {
@JsonKey(fromJson: _constraintFromString)
final VersionConstraint version;
@JsonKey(disallowNullValue: true)
final HostedDetails hosted;
HostedDependency({VersionConstraint version, this.hosted})
: version = version ?? VersionConstraint.any,
super._();
@override
String get _info => version.toString();
}
@JsonSerializable(disallowUnrecognizedKeys: true)
class HostedDetails {
@JsonKey(required: true, disallowNullValue: true)
final String name;
@JsonKey(fromJson: parseGitUri, disallowNullValue: true)
final Uri url;
HostedDetails(this.name, this.url);
factory HostedDetails.fromJson(Object data) {
if (data is String) {
data = {'name': data};
}
if (data is Map) {
return _$HostedDetailsFromJson(data);
}
throw ArgumentError.value(data, 'hosted', 'Must be a Map or String.');
}
}
VersionConstraint _constraintFromString(String input) =>
input == null ? null : VersionConstraint.parse(input);
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/isolate_channel.dart | // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
export 'src/isolate_channel.dart' show IsolateChannel;
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/stream_channel.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async/async.dart';
import 'src/guarantee_channel.dart';
import 'src/close_guarantee_channel.dart';
import 'src/stream_channel_transformer.dart';
export 'src/delegating_stream_channel.dart';
export 'src/disconnector.dart';
export 'src/json_document_transformer.dart';
export 'src/multi_channel.dart';
export 'src/stream_channel_completer.dart';
export 'src/stream_channel_controller.dart';
export 'src/stream_channel_transformer.dart';
/// An abstract class representing a two-way communication channel.
///
/// Users should consider the [stream] emitting a "done" event to be the
/// canonical indicator that the channel has closed. If they wish to close the
/// channel, they should close the [sink]—canceling the stream subscription is
/// not sufficient. Protocol errors may be emitted through the stream or through
/// [sink].done, depending on their underlying cause. Note that the sink may
/// silently drop events if the channel closes before [sink].close is called.
///
/// Implementations are strongly encouraged to mix in or extend
/// [StreamChannelMixin] to get default implementations of the various instance
/// methods. Adding new methods to this interface will not be considered a
/// breaking change if implementations are also added to [StreamChannelMixin].
///
/// Implementations must provide the following guarantees:
///
/// * The stream is single-subscription, and must follow all the guarantees of
/// single-subscription streams.
///
/// * Closing the sink causes the stream to close before it emits any more
/// events.
///
/// * After the stream closes, the sink is automatically closed. If this
/// happens, sink methods should silently drop their arguments until
/// [sink].close is called.
///
/// * If the stream closes before it has a listener, the sink should silently
/// drop events if possible.
///
/// * Canceling the stream's subscription has no effect on the sink. The channel
/// must still be able to respond to the other endpoint closing the channel
/// even after the subscription has been canceled.
///
/// * The sink *either* forwards errors to the other endpoint *or* closes as
/// soon as an error is added and forwards that error to the [sink].done
/// future.
///
/// These guarantees allow users to interact uniformly with all implementations,
/// and ensure that either endpoint closing the stream produces consistent
/// behavior.
abstract class StreamChannel<T> {
/// The single-subscription stream that emits values from the other endpoint.
Stream<T> get stream;
/// The sink for sending values to the other endpoint.
StreamSink<T> get sink;
/// Creates a new [StreamChannel] that communicates over [stream] and [sink].
///
/// Note that this stream/sink pair must provide the guarantees listed in the
/// [StreamChannel] documentation. If they don't do so natively,
/// [StreamChannel.withGuarantees] should be used instead.
factory StreamChannel(Stream<T> stream, StreamSink<T> sink) =>
_StreamChannel<T>(stream, sink);
/// Creates a new [StreamChannel] that communicates over [stream] and [sink].
///
/// Unlike [new StreamChannel], this enforces the guarantees listed in the
/// [StreamChannel] documentation. This makes it somewhat less efficient than
/// just wrapping a stream and a sink directly, so [new StreamChannel] should
/// be used when the guarantees are provided natively.
///
/// If [allowSinkErrors] is `false`, errors are not allowed to be passed to
/// [sink]. If any are, the connection will close and the error will be
/// forwarded to [sink].done.
factory StreamChannel.withGuarantees(Stream<T> stream, StreamSink<T> sink,
{bool allowSinkErrors = true}) =>
GuaranteeChannel(stream, sink, allowSinkErrors: allowSinkErrors);
/// Creates a new [StreamChannel] that communicates over [stream] and [sink].
///
/// This specifically enforces the second guarantee: closing the sink causes
/// the stream to close before it emits any more events. This guarantee is
/// invalidated when an asynchronous gap is added between the original
/// stream's event dispatch and the returned stream's, for example by
/// transforming it with a [StreamTransformer]. This is a lighter-weight way
/// of preserving that guarantee in particular than
/// [StreamChannel.withGuarantees].
factory StreamChannel.withCloseGuarantee(
Stream<T> stream, StreamSink<T> sink) =>
CloseGuaranteeChannel(stream, sink);
/// Connects this to [other], so that any values emitted by either are sent
/// directly to the other.
void pipe(StreamChannel<T> other);
/// Transforms this using [transformer].
///
/// This is identical to calling `transformer.bind(channel)`.
StreamChannel<S> transform<S>(StreamChannelTransformer<S, T> transformer);
/// Transforms only the [stream] component of this using [transformer].
StreamChannel<T> transformStream(StreamTransformer<T, T> transformer);
/// Transforms only the [sink] component of this using [transformer].
StreamChannel<T> transformSink(StreamSinkTransformer<T, T> transformer);
/// Returns a copy of this with [stream] replaced by [change]'s return
/// value.
StreamChannel<T> changeStream(Stream<T> change(Stream<T> stream));
/// Returns a copy of this with [sink] replaced by [change]'s return
/// value.
StreamChannel<T> changeSink(StreamSink<T> change(StreamSink<T> sink));
/// Returns a copy of this with the generic type coerced to [S].
///
/// If any events emitted by [stream] aren't of type [S], they're converted
/// into [CastError] events. Similarly, if any events are added to [sink] that
/// aren't of type [S], a [CastError] is thrown.
StreamChannel<S> cast<S>();
}
/// An implementation of [StreamChannel] that simply takes a stream and a sink
/// as parameters.
///
/// This is distinct from [StreamChannel] so that it can use
/// [StreamChannelMixin].
class _StreamChannel<T> extends StreamChannelMixin<T> {
@override
final Stream<T> stream;
@override
final StreamSink<T> sink;
_StreamChannel(this.stream, this.sink);
}
/// A mixin that implements the instance methods of [StreamChannel] in terms of
/// [stream] and [sink].
abstract class StreamChannelMixin<T> implements StreamChannel<T> {
@override
void pipe(StreamChannel<T> other) {
stream.pipe(other.sink);
other.stream.pipe(sink);
}
@override
StreamChannel<S> transform<S>(StreamChannelTransformer<S, T> transformer) =>
transformer.bind(this);
@override
StreamChannel<T> transformStream(StreamTransformer<T, T> transformer) =>
changeStream(transformer.bind);
@override
StreamChannel<T> transformSink(StreamSinkTransformer<T, T> transformer) =>
changeSink(transformer.bind);
@override
StreamChannel<T> changeStream(Stream<T> change(Stream<T> stream)) =>
StreamChannel.withCloseGuarantee(change(stream), sink);
@override
StreamChannel<T> changeSink(StreamSink<T> change(StreamSink<T> sink)) =>
StreamChannel.withCloseGuarantee(stream, change(sink));
@override
StreamChannel<S> cast<S>() => StreamChannel(
DelegatingStream.typed(stream), DelegatingStreamSink.typed(sink));
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/guarantee_channel.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async/async.dart';
import '../stream_channel.dart';
/// A [StreamChannel] that enforces the stream channel guarantees.
///
/// This is exposed via [new StreamChannel.withGuarantees].
class GuaranteeChannel<T> extends StreamChannelMixin<T> {
@override
Stream<T> get stream => _streamController.stream;
@override
StreamSink<T> get sink => _sink;
_GuaranteeSink<T> _sink;
/// The controller for [stream].
///
/// This intermediate controller allows us to continue listening for a done
/// event even after the user has canceled their subscription, and to send our
/// own done event when the sink is closed.
StreamController<T> _streamController;
/// The subscription to the inner stream.
StreamSubscription<T> _subscription;
/// Whether the sink has closed, causing the underlying channel to disconnect.
bool _disconnected = false;
GuaranteeChannel(Stream<T> innerStream, StreamSink<T> innerSink,
{bool allowSinkErrors = true}) {
_sink = _GuaranteeSink<T>(innerSink, this, allowErrors: allowSinkErrors);
// Enforce the single-subscription guarantee by changing a broadcast stream
// to single-subscription.
if (innerStream.isBroadcast) {
innerStream =
innerStream.transform(SingleSubscriptionTransformer<T, T>());
}
_streamController = StreamController<T>(
onListen: () {
// If the sink has disconnected, we've already called
// [_streamController.close].
if (_disconnected) return;
_subscription = innerStream.listen(_streamController.add,
onError: _streamController.addError, onDone: () {
_sink._onStreamDisconnected();
_streamController.close();
});
},
sync: true);
}
/// Called by [_GuaranteeSink] when the user closes it.
///
/// The sink closing indicates that the connection is closed, so the stream
/// should stop emitting events.
void _onSinkDisconnected() {
_disconnected = true;
if (_subscription != null) _subscription.cancel();
_streamController.close();
}
}
/// The sink for [GuaranteeChannel].
///
/// This wraps the inner sink to ignore events and cancel any in-progress
/// [addStream] calls when the underlying channel closes.
class _GuaranteeSink<T> implements StreamSink<T> {
/// The inner sink being wrapped.
final StreamSink<T> _inner;
/// The [GuaranteeChannel] this belongs to.
final GuaranteeChannel<T> _channel;
@override
Future<void> get done => _doneCompleter.future;
final _doneCompleter = Completer();
/// Whether connection is disconnected.
///
/// This can happen because the stream has emitted a done event, or because
/// the user added an error when [_allowErrors] is `false`.
bool _disconnected = false;
/// Whether the user has called [close].
bool _closed = false;
/// The subscription to the stream passed to [addStream], if a stream is
/// currently being added.
StreamSubscription<T> _addStreamSubscription;
/// The completer for the future returned by [addStream], if a stream is
/// currently being added.
Completer _addStreamCompleter;
/// Whether we're currently adding a stream with [addStream].
bool get _inAddStream => _addStreamSubscription != null;
/// Whether errors are passed on to the underlying sink.
///
/// If this is `false`, any error passed to the sink is piped to [done] and
/// the underlying sink is closed.
final bool _allowErrors;
_GuaranteeSink(this._inner, this._channel, {bool allowErrors = true})
: _allowErrors = allowErrors;
@override
void add(T data) {
if (_closed) throw StateError("Cannot add event after closing.");
if (_inAddStream) {
throw StateError("Cannot add event while adding stream.");
}
if (_disconnected) return;
_inner.add(data);
}
@override
void addError(error, [StackTrace stackTrace]) {
if (_closed) throw StateError("Cannot add event after closing.");
if (_inAddStream) {
throw StateError("Cannot add event while adding stream.");
}
if (_disconnected) return;
_addError(error, stackTrace);
}
/// Like [addError], but doesn't check to ensure that an error can be added.
///
/// This is called from [addStream], so it shouldn't fail if a stream is being
/// added.
void _addError(error, [StackTrace stackTrace]) {
if (_allowErrors) {
_inner.addError(error, stackTrace);
return;
}
_doneCompleter.completeError(error, stackTrace);
// Treat an error like both the stream and sink disconnecting.
_onStreamDisconnected();
_channel._onSinkDisconnected();
// Ignore errors from the inner sink. We're already surfacing one error, and
// if the user handles it we don't want them to have another top-level.
_inner.close().catchError((_) {});
}
@override
Future<void> addStream(Stream<T> stream) {
if (_closed) throw StateError("Cannot add stream after closing.");
if (_inAddStream) {
throw StateError("Cannot add stream while adding stream.");
}
if (_disconnected) return Future.value();
_addStreamCompleter = Completer.sync();
_addStreamSubscription = stream.listen(_inner.add,
onError: _addError, onDone: _addStreamCompleter.complete);
return _addStreamCompleter.future.then((_) {
_addStreamCompleter = null;
_addStreamSubscription = null;
});
}
@override
Future<void> close() {
if (_inAddStream) {
throw StateError("Cannot close sink while adding stream.");
}
if (_closed) return done;
_closed = true;
if (!_disconnected) {
_channel._onSinkDisconnected();
_doneCompleter.complete(_inner.close());
}
return done;
}
/// Called by [GuaranteeChannel] when the stream emits a done event.
///
/// The stream being done indicates that the connection is closed, so the
/// sink should stop forwarding events.
void _onStreamDisconnected() {
_disconnected = true;
if (!_doneCompleter.isCompleted) _doneCompleter.complete();
if (!_inAddStream) return;
_addStreamCompleter.complete(_addStreamSubscription.cancel());
_addStreamCompleter = null;
_addStreamSubscription = null;
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/isolate_channel.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:isolate';
import 'package:async/async.dart';
import '../stream_channel.dart';
/// A [StreamChannel] that communicates over a [ReceivePort]/[SendPort] pair,
/// presumably with another isolate.
///
/// The remote endpoint doesn't necessarily need to be running an
/// [IsolateChannel]. This can be used with any two ports, although the
/// [StreamChannel] semantics mean that this class will treat them as being
/// paired (for example, closing the [sink] will cause the [stream] to stop
/// emitting events).
///
/// The underlying isolate ports have no notion of closing connections. This
/// means that [stream] won't close unless [sink] is closed, and that closing
/// [sink] won't cause the remote endpoint to close. Users should take care to
/// ensure that they always close the [sink] of every [IsolateChannel] they use
/// to avoid leaving dangling [ReceivePort]s.
class IsolateChannel<T> extends StreamChannelMixin<T> {
@override
final Stream<T> stream;
@override
final StreamSink<T> sink;
/// Connects to a remote channel that was created with
/// [IsolateChannel.connectSend].
///
/// These constructors establish a connection using only a single
/// [SendPort]/[ReceivePort] pair, as long as each side uses one of the
/// connect constructors.
///
/// The connection protocol is guaranteed to remain compatible across versions
/// at least until the next major version release. If the protocol is
/// violated, the resulting channel will emit a single value on its stream and
/// then close.
factory IsolateChannel.connectReceive(ReceivePort receivePort) {
// We can't use a [StreamChannelCompleter] here because we need the return
// value to be an [IsolateChannel].
var streamCompleter = StreamCompleter<T>();
var sinkCompleter = StreamSinkCompleter<T>();
var channel =
IsolateChannel<T>._(streamCompleter.stream, sinkCompleter.sink);
// The first message across the ReceivePort should be a SendPort pointing to
// the remote end. If it's not, we'll make the stream emit an error
// complaining.
StreamSubscription<dynamic> subscription;
subscription = receivePort.listen((message) {
if (message is SendPort) {
var controller =
StreamChannelController<T>(allowForeignErrors: false, sync: true);
SubscriptionStream(subscription).cast<T>().pipe(controller.local.sink);
controller.local.stream
.listen((data) => message.send(data), onDone: receivePort.close);
streamCompleter.setSourceStream(controller.foreign.stream);
sinkCompleter.setDestinationSink(controller.foreign.sink);
return;
}
streamCompleter.setError(
StateError('Unexpected Isolate response "$message".'),
StackTrace.current);
sinkCompleter.setDestinationSink(NullStreamSink<T>());
subscription.cancel();
});
return channel;
}
/// Connects to a remote channel that was created with
/// [IsolateChannel.connectReceive].
///
/// These constructors establish a connection using only a single
/// [SendPort]/[ReceivePort] pair, as long as each side uses one of the
/// connect constructors.
///
/// The connection protocol is guaranteed to remain compatible across versions
/// at least until the next major version release.
factory IsolateChannel.connectSend(SendPort sendPort) {
var receivePort = ReceivePort();
sendPort.send(receivePort.sendPort);
return IsolateChannel(receivePort, sendPort);
}
/// Creates a stream channel that receives messages from [receivePort] and
/// sends them over [sendPort].
factory IsolateChannel(ReceivePort receivePort, SendPort sendPort) {
var controller =
StreamChannelController<T>(allowForeignErrors: false, sync: true);
receivePort.cast<T>().pipe(controller.local.sink);
controller.local.stream
.listen((data) => sendPort.send(data), onDone: receivePort.close);
return IsolateChannel._(controller.foreign.stream, controller.foreign.sink);
}
IsolateChannel._(this.stream, this.sink);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/multi_channel.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async/async.dart';
import '../stream_channel.dart';
/// A class that multiplexes multiple virtual channels across a single
/// underlying transport layer.
///
/// This should be connected to another [MultiChannel] on the other end of the
/// underlying channel. It starts with a single default virtual channel,
/// accessible via [stream] and [sink]. Additional virtual channels can be
/// created with [virtualChannel].
///
/// When a virtual channel is created by one endpoint, the other must connect to
/// it before messages may be sent through it. The first endpoint passes its
/// [VirtualChannel.id] to the second, which then creates a channel from that id
/// also using [virtualChannel]. For example:
///
/// ```dart
/// // First endpoint
/// var virtual = multiChannel.virtualChannel();
/// multiChannel.sink.add({
/// "channel": virtual.id
/// });
///
/// // Second endpoint
/// multiChannel.stream.listen((message) {
/// var virtual = multiChannel.virtualChannel(message["channel"]);
/// // ...
/// });
/// ```
///
/// Sending errors across a [MultiChannel] is not supported. Any errors from the
/// underlying stream will be reported only via the default
/// [MultiChannel.stream].
///
/// Each virtual channel may be closed individually. When all of them are
/// closed, the underlying [StreamSink] is closed automatically.
abstract class MultiChannel<T> implements StreamChannel<T> {
/// The default input stream.
///
/// This connects to the remote [sink].
@override
Stream<T> get stream;
/// The default output stream.
///
/// This connects to the remote [stream]. If this is closed, the remote
/// [stream] will close, but other virtual channels will remain open and new
/// virtual channels may be opened.
@override
StreamSink<T> get sink;
/// Creates a new [MultiChannel] that sends and receives messages over
/// [inner].
///
/// The inner channel must take JSON-like objects.
factory MultiChannel(StreamChannel<dynamic> inner) => _MultiChannel<T>(inner);
/// Creates a new virtual channel.
///
/// If [id] is not passed, this creates a virtual channel from scratch. Before
/// it's used, its [VirtualChannel.id] must be sent to the remote endpoint
/// where [virtualChannel] should be called with that id.
///
/// If [id] is passed, this creates a virtual channel corresponding to the
/// channel with that id on the remote channel.
///
/// Throws an [ArgumentError] if a virtual channel already exists for [id].
/// Throws a [StateError] if the underlying channel is closed.
VirtualChannel<T> virtualChannel([int id]);
}
/// The implementation of [MultiChannel].
///
/// This is private so that [VirtualChannel] can inherit from [MultiChannel]
/// without having to implement all the private members.
class _MultiChannel<T> extends StreamChannelMixin<T>
implements MultiChannel<T> {
/// The inner channel over which all communication is conducted.
///
/// This will be `null` if the underlying communication channel is closed.
StreamChannel<dynamic> _inner;
/// The subscription to [_inner].stream.
StreamSubscription<dynamic> _innerStreamSubscription;
@override
Stream<T> get stream => _mainController.foreign.stream;
@override
StreamSink<T> get sink => _mainController.foreign.sink;
/// The controller for this channel.
final _mainController = StreamChannelController<T>(sync: true);
/// A map from input IDs to [StreamChannelController]s that should be used to
/// communicate over those channels.
final _controllers = <int, StreamChannelController<T>>{};
/// Input IDs of controllers in [_controllers] that we've received messages
/// for but that have not yet had a local [virtualChannel] created.
final _pendingIds = Set<int>();
/// Input IDs of virtual channels that used to exist but have since been
/// closed.
final _closedIds = Set<int>();
/// The next id to use for a local virtual channel.
///
/// Ids are used to identify virtual channels. Each message is tagged with an
/// id; the receiving [MultiChannel] uses this id to look up which
/// [VirtualChannel] the message should be dispatched to.
///
/// The id scheme for virtual channels is somewhat complicated. This is
/// necessary to ensure that there are no conflicts even when both endpoints
/// have virtual channels with the same id; since both endpoints can send and
/// receive messages across each virtual channel, a naïve scheme would make it
/// impossible to tell whether a message was from a channel that originated in
/// the remote endpoint or a reply on a channel that originated in the local
/// endpoint.
///
/// The trick is that each endpoint only uses odd ids for its own channels.
/// When sending a message over a channel that was created by the remote
/// endpoint, the channel's id plus one is used. This way each [MultiChannel]
/// knows that if an incoming message has an odd id, it's coming from a
/// channel that was originally created remotely, but if it has an even id,
/// it's coming from a channel that was originally created locally.
var _nextId = 1;
_MultiChannel(this._inner) {
// The default connection is a special case which has id 0 on both ends.
// This allows it to begin connected without having to send over an id.
_controllers[0] = _mainController;
_mainController.local.stream.listen(
(message) => _inner.sink.add([0, message]),
onDone: () => _closeChannel(0, 0));
_innerStreamSubscription = _inner.stream.listen((message) {
var id = message[0];
// If the channel was closed before an incoming message was processed,
// ignore that message.
if (_closedIds.contains(id)) return;
var controller = _controllers.putIfAbsent(id, () {
// If we receive a message for a controller that doesn't have a local
// counterpart yet, create a controller for it to buffer incoming
// messages for when a local connection is created.
_pendingIds.add(id);
return StreamChannelController(sync: true);
});
if (message.length > 1) {
controller.local.sink.add(message[1]);
} else {
// A message without data indicates that the channel has been closed. We
// can just close the sink here without doing any more cleanup, because
// the sink closing will cause the stream to emit a done event which
// will trigger more cleanup.
controller.local.sink.close();
}
},
onDone: _closeInnerChannel,
onError: _mainController.local.sink.addError);
}
@override
VirtualChannel<T> virtualChannel([int id]) {
int inputId;
int outputId;
if (id != null) {
// Since the user is passing in an id, we're connected to a remote
// VirtualChannel. This means messages they send over this channel will
// have the original odd id, but our replies will have an even id.
inputId = id;
outputId = id + 1;
} else {
// Since we're generating an id, we originated this VirtualChannel. This
// means messages we send over this channel will have the original odd id,
// but the remote channel's replies will have an even id.
inputId = _nextId + 1;
outputId = _nextId;
_nextId += 2;
}
// If the inner channel has already closed, create new virtual channels in a
// closed state.
if (_inner == null) {
return VirtualChannel._(this, inputId, Stream.empty(), NullStreamSink());
}
StreamChannelController<T> controller;
if (_pendingIds.remove(inputId)) {
// If we've already received messages for this channel, use the controller
// where those messages are buffered.
controller = _controllers[inputId];
} else if (_controllers.containsKey(inputId) ||
_closedIds.contains(inputId)) {
throw ArgumentError("A virtual channel with id $id already exists.");
} else {
controller = StreamChannelController(sync: true);
_controllers[inputId] = controller;
}
controller.local.stream.listen(
(message) => _inner.sink.add([outputId, message]),
onDone: () => _closeChannel(inputId, outputId));
return VirtualChannel._(
this, outputId, controller.foreign.stream, controller.foreign.sink);
}
/// Closes the virtual channel for which incoming messages have [inputId] and
/// outgoing messages have [outputId].
void _closeChannel(int inputId, int outputId) {
_closedIds.add(inputId);
var controller = _controllers.remove(inputId);
controller.local.sink.close();
if (_inner == null) return;
// A message without data indicates that the virtual channel has been
// closed.
_inner.sink.add([outputId]);
if (_controllers.isEmpty) _closeInnerChannel();
}
/// Closes the underlying communication channel.
void _closeInnerChannel() {
_inner.sink.close();
_innerStreamSubscription.cancel();
_inner = null;
// Convert this to a list because the close is dispatched synchronously, and
// that could conceivably remove a controller from [_controllers].
for (var controller in List.from(_controllers.values)) {
controller.local.sink.close();
}
_controllers.clear();
}
}
/// A virtual channel created by [MultiChannel].
///
/// This implements [MultiChannel] for convenience.
/// [VirtualChannel.virtualChannel] is semantically identical to the parent's
/// [MultiChannel.virtualChannel].
class VirtualChannel<T> extends StreamChannelMixin<T>
implements MultiChannel<T> {
/// The [MultiChannel] that created this.
final MultiChannel<T> _parent;
/// The identifier for this channel.
///
/// This can be sent across the [MultiChannel] to provide the remote endpoint
/// a means to connect to this channel. Nothing about this is guaranteed
/// except that it will be JSON-serializable.
final int id;
@override
final Stream<T> stream;
@override
final StreamSink<T> sink;
VirtualChannel._(this._parent, this.id, this.stream, this.sink);
@override
VirtualChannel<T> virtualChannel([id]) => _parent.virtualChannel(id);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/stream_channel_completer.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async/async.dart';
import '../stream_channel.dart';
/// A [channel] where the source and destination are provided later.
///
/// The [channel] is a normal channel that can be listened to and that events
/// can be added to immediately, but until [setChannel] is called it won't emit
/// any events and all events added to it will be buffered.
class StreamChannelCompleter<T> {
/// The completer for this channel's stream.
final _streamCompleter = StreamCompleter<T>();
/// The completer for this channel's sink.
final _sinkCompleter = StreamSinkCompleter<T>();
/// The channel for this completer.
StreamChannel<T> get channel => _channel;
StreamChannel<T> _channel;
/// Whether [setChannel] has been called.
bool _set = false;
/// Convert a `Future<StreamChannel>` to a `StreamChannel`.
///
/// This creates a channel using a channel completer, and sets the source
/// channel to the result of the future when the future completes.
///
/// If the future completes with an error, the returned channel's stream will
/// instead contain just that error. The sink will silently discard all
/// events.
static StreamChannel fromFuture(Future<StreamChannel> channelFuture) {
var completer = StreamChannelCompleter();
channelFuture.then(completer.setChannel, onError: completer.setError);
return completer.channel;
}
StreamChannelCompleter() {
_channel = StreamChannel<T>(_streamCompleter.stream, _sinkCompleter.sink);
}
/// Set a channel as the source and destination for [channel].
///
/// A channel may be set at most once.
///
/// Either [setChannel] or [setError] may be called at most once. Trying to
/// call either of them again will fail.
void setChannel(StreamChannel<T> channel) {
if (_set) throw StateError("The channel has already been set.");
_set = true;
_streamCompleter.setSourceStream(channel.stream);
_sinkCompleter.setDestinationSink(channel.sink);
}
/// Indicates that there was an error connecting the channel.
///
/// This makes the stream emit [error] and close. It makes the sink discard
/// all its events.
///
/// Either [setChannel] or [setError] may be called at most once. Trying to
/// call either of them again will fail.
void setError(error, [StackTrace stackTrace]) {
if (_set) throw StateError("The channel has already been set.");
_set = true;
_streamCompleter.setError(error, stackTrace);
_sinkCompleter.setDestinationSink(NullStreamSink());
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/delegating_stream_channel.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import '../stream_channel.dart';
/// A simple delegating wrapper around [StreamChannel].
///
/// Subclasses can override individual methods, or use this to expose only
/// [StreamChannel] methods.
class DelegatingStreamChannel<T> extends StreamChannelMixin<T> {
/// The inner channel to which methods are forwarded.
final StreamChannel<T> _inner;
@override
Stream<T> get stream => _inner.stream;
@override
StreamSink<T> get sink => _inner.sink;
DelegatingStreamChannel(this._inner);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/json_document_transformer.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:convert';
import 'package:async/async.dart';
import '../stream_channel.dart';
import 'stream_channel_transformer.dart';
/// A [StreamChannelTransformer] that transforms JSON documents—strings that
/// contain individual objects encoded as JSON—into decoded Dart objects.
///
/// This decodes JSON that's emitted by the transformed channel's stream, and
/// encodes objects so that JSON is passed to the transformed channel's sink.
///
/// If the transformed channel emits invalid JSON, this emits a
/// [FormatException]. If an unencodable object is added to the sink, it
/// synchronously throws a [JsonUnsupportedObjectError].
final StreamChannelTransformer<Object, String> jsonDocument =
const _JsonDocument();
class _JsonDocument implements StreamChannelTransformer<Object, String> {
const _JsonDocument();
@override
StreamChannel<Object> bind(StreamChannel<String> channel) {
var stream = channel.stream.map(jsonDecode);
var sink = StreamSinkTransformer<Object, String>.fromHandlers(
handleData: (data, sink) {
sink.add(jsonEncode(data));
}).bind(channel.sink);
return StreamChannel.withCloseGuarantee(stream, sink);
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/disconnector.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async/async.dart';
import '../stream_channel.dart';
/// Allows the caller to force a channel to disconnect.
///
/// When [disconnect] is called, the channel (or channels) transformed by this
/// transformer will act as though the remote end had disconnected—the stream
/// will emit a done event, and the sink will ignore future inputs. The inner
/// sink will also be closed to notify the remote end of the disconnection.
///
/// If a channel is transformed after the [disconnect] has been called, it will
/// be disconnected immediately.
class Disconnector<T> implements StreamChannelTransformer<T, T> {
/// Whether [disconnect] has been called.
bool get isDisconnected => _disconnectMemo.hasRun;
/// The sinks for transformed channels.
///
/// Note that we assume that transformed channels provide the stream channel
/// guarantees. This allows us to only track sinks, because we know closing
/// the underlying sink will cause the stream to emit a done event.
final _sinks = <_DisconnectorSink<T>>[];
/// Disconnects all channels that have been transformed.
///
/// Returns a future that completes when all inner sinks' [StreamSink.close]
/// futures have completed. Note that a [StreamController]'s sink won't close
/// until the corresponding stream has a listener.
Future<void> disconnect() => _disconnectMemo.runOnce(() {
var futures = _sinks.map((sink) => sink._disconnect()).toList();
_sinks.clear();
return Future.wait(futures, eagerError: true);
});
final _disconnectMemo = AsyncMemoizer();
@override
StreamChannel<T> bind(StreamChannel<T> channel) {
return channel.changeSink((innerSink) {
var sink = _DisconnectorSink<T>(innerSink);
if (isDisconnected) {
// Ignore errors here, because otherwise there would be no way for the
// user to handle them gracefully.
sink._disconnect().catchError((_) {});
} else {
_sinks.add(sink);
}
return sink;
});
}
}
/// A sink wrapper that can force a disconnection.
class _DisconnectorSink<T> implements StreamSink<T> {
/// The inner sink.
final StreamSink<T> _inner;
@override
Future<void> get done => _inner.done;
/// Whether [Disconnector.disconnect] has been called.
var _isDisconnected = false;
/// Whether the user has called [close].
var _closed = false;
/// The subscription to the stream passed to [addStream], if a stream is
/// currently being added.
StreamSubscription<T> _addStreamSubscription;
/// The completer for the future returned by [addStream], if a stream is
/// currently being added.
Completer _addStreamCompleter;
/// Whether we're currently adding a stream with [addStream].
bool get _inAddStream => _addStreamSubscription != null;
_DisconnectorSink(this._inner);
@override
void add(T data) {
if (_closed) throw StateError("Cannot add event after closing.");
if (_inAddStream) {
throw StateError("Cannot add event while adding stream.");
}
if (_isDisconnected) return;
_inner.add(data);
}
@override
void addError(error, [StackTrace stackTrace]) {
if (_closed) throw StateError("Cannot add event after closing.");
if (_inAddStream) {
throw StateError("Cannot add event while adding stream.");
}
if (_isDisconnected) return;
_inner.addError(error, stackTrace);
}
@override
Future<void> addStream(Stream<T> stream) {
if (_closed) throw StateError("Cannot add stream after closing.");
if (_inAddStream) {
throw StateError("Cannot add stream while adding stream.");
}
if (_isDisconnected) return Future.value();
_addStreamCompleter = Completer.sync();
_addStreamSubscription = stream.listen(_inner.add,
onError: _inner.addError, onDone: _addStreamCompleter.complete);
return _addStreamCompleter.future.then((_) {
_addStreamCompleter = null;
_addStreamSubscription = null;
});
}
@override
Future<void> close() {
if (_inAddStream) {
throw StateError("Cannot close sink while adding stream.");
}
_closed = true;
return _inner.close();
}
/// Disconnects this sink.
///
/// This closes the underlying sink and stops forwarding events. It returns
/// the [StreamSink.close] future for the underlying sink.
Future<void> _disconnect() {
_isDisconnected = true;
var future = _inner.close();
if (_inAddStream) {
_addStreamCompleter.complete(_addStreamSubscription.cancel());
_addStreamCompleter = null;
_addStreamSubscription = null;
}
return future;
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/stream_channel_transformer.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'package:async/async.dart';
import '../stream_channel.dart';
/// A [StreamChannelTransformer] transforms the events being passed to and
/// emitted by a [StreamChannel].
///
/// This works on the same principle as [StreamTransformer] and
/// [StreamSinkTransformer]. Each transformer defines a [bind] method that takes
/// in the original [StreamChannel] and returns the transformed version.
///
/// Transformers must be able to have [bind] called multiple times. If a
/// subclass implements [bind] explicitly, it should be sure that the returned
/// stream follows the second stream channel guarantee: closing the sink causes
/// the stream to close before it emits any more events. This guarantee is
/// invalidated when an asynchronous gap is added between the original stream's
/// event dispatch and the returned stream's, for example by transforming it
/// with a [StreamTransformer]. The guarantee can be easily preserved using
/// [StreamChannel.withCloseGuarantee].
class StreamChannelTransformer<S, T> {
/// The transformer to use on the channel's stream.
final StreamTransformer<T, S> _streamTransformer;
/// The transformer to use on the channel's sink.
final StreamSinkTransformer<S, T> _sinkTransformer;
/// Creates a [StreamChannelTransformer] from existing stream and sink
/// transformers.
const StreamChannelTransformer(
this._streamTransformer, this._sinkTransformer);
/// Creates a [StreamChannelTransformer] from a codec's encoder and decoder.
///
/// All input to the inner channel's sink is encoded using [Codec.encoder],
/// and all output from its stream is decoded using [Codec.decoder].
StreamChannelTransformer.fromCodec(Codec<S, T> codec)
: this(codec.decoder,
StreamSinkTransformer.fromStreamTransformer(codec.encoder));
/// Transforms the events sent to and emitted by [channel].
///
/// Creates a new channel. When events are passed to the returned channel's
/// sink, the transformer will transform them and pass the transformed
/// versions to `channel.sink`. When events are emitted from the
/// `channel.straem`, the transformer will transform them and pass the
/// transformed versions to the returned channel's stream.
StreamChannel<S> bind(StreamChannel<T> channel) =>
StreamChannel<S>.withCloseGuarantee(
channel.stream.transform(_streamTransformer),
_sinkTransformer.bind(channel.sink));
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/stream_channel_controller.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import '../stream_channel.dart';
/// A controller for exposing a new [StreamChannel].
///
/// This exposes two connected [StreamChannel]s, [local] and [foreign]. The
/// user's code should use [local] to emit and receive events. Then [foreign]
/// can be returned for others to use. For example, here's a simplified version
/// of the implementation of [new IsolateChannel]:
///
/// ```dart
/// StreamChannel isolateChannel(ReceivePort receivePort, SendPort sendPort) {
/// var controller = new StreamChannelController(allowForeignErrors: false);
///
/// // Pipe all events from the receive port into the local sink...
/// receivePort.pipe(controller.local.sink);
///
/// // ...and all events from the local stream into the send port.
/// controller.local.stream.listen(sendPort.send, onDone: receivePort.close);
///
/// // Then return the foreign controller for your users to use.
/// return controller.foreign;
/// }
/// ```
class StreamChannelController<T> {
/// The local channel.
///
/// This channel should be used directly by the creator of this
/// [StreamChannelController] to send and receive events.
StreamChannel<T> get local => _local;
StreamChannel<T> _local;
/// The foreign channel.
///
/// This channel should be returned to external users so they can communicate
/// with [local].
StreamChannel<T> get foreign => _foreign;
StreamChannel<T> _foreign;
/// Creates a [StreamChannelController].
///
/// If [sync] is true, events added to either channel's sink are synchronously
/// dispatched to the other channel's stream. This should only be done if the
/// source of those events is already asynchronous.
///
/// If [allowForeignErrors] is `false`, errors are not allowed to be passed to
/// the foreign channel's sink. If any are, the connection will close and the
/// error will be forwarded to the foreign channel's [StreamSink.done] future.
/// This guarantees that the local stream will never emit errors.
StreamChannelController({bool allowForeignErrors = true, bool sync = false}) {
var localToForeignController = StreamController<T>(sync: sync);
var foreignToLocalController = StreamController<T>(sync: sync);
_local = StreamChannel<T>.withGuarantees(
foreignToLocalController.stream, localToForeignController.sink);
_foreign = StreamChannel<T>.withGuarantees(
localToForeignController.stream, foreignToLocalController.sink,
allowSinkErrors: allowForeignErrors);
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/stream_channel/src/close_guarantee_channel.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async/async.dart';
import '../stream_channel.dart';
/// A [StreamChannel] that specifically enforces the stream channel guarantee
/// that closing the sink causes the stream to close before it emits any more
/// events
///
/// This is exposed via [new StreamChannel.withCloseGuarantee].
class CloseGuaranteeChannel<T> extends StreamChannelMixin<T> {
@override
Stream<T> get stream => _stream;
_CloseGuaranteeStream<T> _stream;
@override
StreamSink<T> get sink => _sink;
_CloseGuaranteeSink<T> _sink;
/// The subscription to the inner stream.
StreamSubscription<T> _subscription;
/// Whether the sink has closed, causing the underlying channel to disconnect.
bool _disconnected = false;
CloseGuaranteeChannel(Stream<T> innerStream, StreamSink<T> innerSink) {
_sink = _CloseGuaranteeSink<T>(innerSink, this);
_stream = _CloseGuaranteeStream<T>(innerStream, this);
}
}
/// The stream for [CloseGuaranteeChannel].
///
/// This wraps the inner stream to save the subscription on the channel when
/// [listen] is called.
class _CloseGuaranteeStream<T> extends Stream<T> {
/// The inner stream this is delegating to.
final Stream<T> _inner;
/// The [CloseGuaranteeChannel] this belongs to.
final CloseGuaranteeChannel<T> _channel;
_CloseGuaranteeStream(this._inner, this._channel);
@override
StreamSubscription<T> listen(void onData(T event),
{Function onError, void onDone(), bool cancelOnError}) {
// If the channel is already disconnected, we shouldn't dispatch anything
// but a done event.
if (_channel._disconnected) {
onData = null;
onError = null;
}
var subscription = _inner.listen(onData,
onError: onError, onDone: onDone, cancelOnError: cancelOnError);
if (!_channel._disconnected) {
_channel._subscription = subscription;
}
return subscription;
}
}
/// The sink for [CloseGuaranteeChannel].
///
/// This wraps the inner sink to cancel the stream subscription when the sink is
/// canceled.
class _CloseGuaranteeSink<T> extends DelegatingStreamSink<T> {
/// The [CloseGuaranteeChannel] this belongs to.
final CloseGuaranteeChannel<T> _channel;
_CloseGuaranteeSink(StreamSink<T> inner, this._channel) : super(inner);
@override
Future<void> close() {
var done = super.close();
_channel._disconnected = true;
if (_channel._subscription != null) {
// Don't dispatch anything but a done event.
_channel._subscription.onData(null);
_channel._subscription.onError(null);
}
return done;
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/built_collection.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/// Built Collections bring the benefits of immutability to your Dart code via
/// the [builder pattern](http://en.wikipedia.org/wiki/Builder_pattern).
///
/// Each of the core SDK collections is split in two: a mutable builder class
/// and an immutable "built" class. Builders are for computation,
/// "built" classes are for safely sharing with no need to copy defensively.
///
/// Built collections:
///
/// * are immutable, if the elements/keys/values used are immutable;
/// * are comparable;
/// * are hashable;
/// * reject nulls;
/// * require generic type parameters;
/// * reject wrong-type elements;
/// * use copy-on-write to avoid copying unnecessarily.
///
/// See below for details on each of these points.
///
///
/// # Recommend Style
///
/// A project can benefit greatly from using Built Collections throughout.
/// Methods that will not mutate a collection can accept the "built" version,
/// making it clear that no mutation will happen and completely avoiding
/// the need for defensive copying.
///
/// For code that is public to other projects or teams not using
/// Built Collections, prefer to accept `Iterable` where possible. That way
/// your code is compatible with SDK collections, Built Collections and any
/// other collection implementation that builds on `Iterable`.
///
/// It's okay to accept `List`, `Set` or `Map` if needed. Built Collections
/// provide efficient conversion to their SDK counterparts via
/// `BuiltList.toList`, `BuiltListMultimap.toMap`, `BuiltSet.toSet`,
/// `BuiltMap.toMap` and `BuiltSetMultimap.toMap`.
///
///
/// # Built Collections are Immutable
///
/// Built Collections do not offer any methods that modify the collection. In
/// order to make changes, first call `toBuilder` to get a mutable builder.
///
/// In particular, Built Collections do not implement or extend their mutable
/// counterparts. `BuiltList` implements `Iterable`, but not `List`. `BuiltSet`
/// implements `Iterable`, but not `Set`. `BuiltMap`, `BuiltListMultimap` and
/// `BuiltSetMultimap` share no interface with the SDK collections.
///
/// Built Collections can contain mutable elements. However, this use is not
/// recommended, as mutations to the elements will break comparison and
/// hashing.
///
///
/// # Built Collections are Comparable
///
/// Core SDK collections do not offer equality checks by default.
///
/// Built Collections do a deep comparison against other Built Collections
/// of the same type, only. Hashing is used to make repeated comparisons fast.
///
///
/// # Built Collections are Hashable
///
/// Core SDK collections do not compute a deep hashCode.
///
/// Built Collections do compute, and cache, a deep hashCode. That means they
/// can be stored inside collections that need hashing, such as hash sets and
/// hash maps. They also use the cached hash code to speed up repeated
/// comparisons.
///
///
/// # Built Collections Reject Nulls
///
/// A `null` in a collection is usually a bug, so Built Collections and their
/// builders throw if given a `null` element, key or value.
///
///
/// # Built Collections Require Generic Type Parameters
///
/// A `List<dynamic>` is error-prone because it can be assigned to a `List` of
/// any type without warning. So, all Built Collections must be created with
/// explicit element, key or value types.
///
///
/// # Built Collections Reject Wrong-type Elements, Keys and Values
///
/// Collections that happen to contain elements, keys or values that are not of
/// the right type can lead to difficult-to-find bugs. So, all Built
/// Collections and their builders are aggressive about validating types, even
/// with checked mode disabled.
///
///
/// # Built Collections Avoid Copying Unnecessarily
///
/// Built Collections and their builder and helper types collaborate to avoid
/// copying unless it's necessary.
///
/// In particular, `BuiltList.toList`, `BuiltListMultimap.toMap`,
/// `BuiltSet.toSet`, `BuiltMap.toMap` and `BuiltSetMultimap.toMap` do not make
/// a copy, but return a copy-on-write wrapper. So, Built Collections can be
/// efficiently and easily used with code that needs core SDK collections but
/// does not mutate them.
export 'src/list.dart' hide OverriddenHashcodeBuiltList;
export 'src/list_multimap.dart' hide OverriddenHashcodeBuiltListMultimap;
export 'src/map.dart' hide OverriddenHashcodeBuiltMap;
export 'src/set.dart' hide OverriddenHashcodeBuiltSet;
export 'src/set_multimap.dart' hide OverriddenHashcodeBuiltSetMultimap;
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/set_multimap.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
library built_collection.set_multimap;
import 'package:quiver/collection.dart' show SetMultimap;
import 'package:quiver/core.dart' show hashObjects, hash2;
import 'internal/copy_on_write_map.dart';
import 'set.dart';
part 'set_multimap/built_set_multimap.dart';
part 'set_multimap/set_multimap_builder.dart';
// Internal only, for testing.
class OverriddenHashcodeBuiltSetMultimap<K, V> extends _BuiltSetMultimap<K, V> {
final int _overridenHashCode;
OverriddenHashcodeBuiltSetMultimap(map, this._overridenHashCode)
: super.copyAndCheck(map.keys, (k) => map[k]);
@override
// ignore: hash_and_equals
int get hashCode => _overridenHashCode;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/list_multimap.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
library built_collection.list_multimap;
import 'package:quiver/collection.dart' show ListMultimap;
import 'package:quiver/core.dart' show hashObjects, hash2;
import 'internal/copy_on_write_map.dart';
import 'list.dart';
part 'list_multimap/built_list_multimap.dart';
part 'list_multimap/list_multimap_builder.dart';
// Internal only, for testing.
class OverriddenHashcodeBuiltListMultimap<K, V>
extends _BuiltListMultimap<K, V> {
final int _overridenHashCode;
OverriddenHashcodeBuiltListMultimap(map, this._overridenHashCode)
: super.copyAndCheck(map.keys, (k) => map[k]);
@override
// ignore: hash_and_equals
int get hashCode => _overridenHashCode;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/map.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
library built_collection.map;
import 'package:quiver/core.dart' show hashObjects, hash2;
import 'internal/copy_on_write_map.dart';
part 'map/built_map.dart';
part 'map/map_builder.dart';
// Internal only, for testing.
class OverriddenHashcodeBuiltMap<K, V> extends _BuiltMap<K, V> {
final int _overrridenHashCode;
OverriddenHashcodeBuiltMap(map, this._overrridenHashCode)
: super.copyAndCheckTypes(map.keys, (k) => map[k]);
@override
// ignore: hash_and_equals
int get hashCode => _overrridenHashCode;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/list.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
library built_collection.list;
import 'dart:math' show Random;
import 'package:built_collection/src/iterable.dart' show BuiltIterable;
import 'package:built_collection/src/set.dart' show BuiltSet;
import 'package:quiver/core.dart' show hashObjects;
import 'internal/copy_on_write_list.dart';
import 'internal/iterables.dart';
part 'list/built_list.dart';
part 'list/list_builder.dart';
// Internal only, for testing.
class OverriddenHashcodeBuiltList<T> extends _BuiltList<T> {
final int _overridenHashCode;
OverriddenHashcodeBuiltList(Iterable iterable, this._overridenHashCode)
: super.copyAndCheckTypes(iterable);
@override
// ignore: hash_and_equals
int get hashCode => _overridenHashCode;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/iterable.dart | // Copyright (c) 2017, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
library built_collection.iterable;
import 'package:built_collection/src/list.dart' show BuiltList;
import 'package:built_collection/src/set.dart' show BuiltSet;
part 'iterable/built_iterable.dart';
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/set.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
library built_collection.set;
import 'package:built_collection/src/iterable.dart' show BuiltIterable;
import 'package:built_collection/src/list.dart' show BuiltList;
import 'package:collection/collection.dart' show UnmodifiableSetView;
import 'package:quiver/core.dart' show hashObjects;
import 'internal/copy_on_write_set.dart';
import 'internal/iterables.dart';
part 'set/built_set.dart';
part 'set/set_builder.dart';
// Internal only, for testing.
class OverriddenHashcodeBuiltSet<T> extends _BuiltSet<T> {
final int _overridenHashCode;
OverriddenHashcodeBuiltSet(Iterable iterable, this._overridenHashCode)
: super.copyAndCheckTypes(iterable);
@override
// ignore: hash_and_equals
int get hashCode => _overridenHashCode;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/list_multimap/built_list_multimap.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.list_multimap;
/// The Built Collection [ListMultimap].
///
/// It implements the non-mutating part of the [ListMultimap] interface.
/// Iteration over keys is in the same order in which they were inserted.
/// Modifications are made via [ListMultimapBuilder].
///
/// See the
/// [Built Collection library documentation]
/// (#built_collection/built_collection)
/// for the general properties of Built Collections.
abstract class BuiltListMultimap<K, V> {
final Map<K, BuiltList<V>> _map;
// Precomputed.
final BuiltList<V> _emptyList = BuiltList<V>();
// Cached.
int _hashCode;
Iterable<K> _keys;
Iterable<V> _values;
/// Instantiates with elements from a [Map], [ListMultimap] or
/// [BuiltListMultimap].
///
/// Must be called with a generic type parameter.
///
/// Wrong:
/// `new BuiltListMultimap({1: ['1'], 2: ['2'], 3: ['3']})`.
///
/// Right:
/// `new BuiltListMultimap<int, String>({1: ['1'], 2: ['2'], 3: ['3']})`,
///
/// Rejects nulls. Rejects keys and values of the wrong type.
factory BuiltListMultimap([multimap = const {}]) {
if (multimap is _BuiltListMultimap &&
multimap.hasExactKeyAndValueTypes(K, V)) {
return multimap as BuiltListMultimap<K, V>;
} else if (multimap is Map ||
multimap is ListMultimap ||
multimap is BuiltListMultimap) {
return _BuiltListMultimap<K, V>.copyAndCheck(
multimap.keys, (k) => multimap[k]);
} else {
throw ArgumentError('expected Map, ListMultimap or BuiltListMultimap, '
'got ${multimap.runtimeType}');
}
}
/// Creates a [ListMultimapBuilder], applies updates to it, and builds.
factory BuiltListMultimap.build(
Function(ListMultimapBuilder<K, V>) updates) =>
(ListMultimapBuilder<K, V>()..update(updates)).build();
/// Converts to a [ListMultimapBuilder] for modification.
///
/// The `BuiltListMultimap` remains immutable and can continue to be used.
ListMultimapBuilder<K, V> toBuilder() => ListMultimapBuilder<K, V>(this);
/// Converts to a [ListMultimapBuilder], applies updates to it, and builds.
BuiltListMultimap<K, V> rebuild(
Function(ListMultimapBuilder<K, V>) updates) =>
(toBuilder()..update(updates)).build();
/// Converts to a [Map].
///
/// Note that the implementation is efficient: it returns a copy-on-write
/// wrapper around the data from this `BuiltListMultimap`. So, if no
/// mutations are made to the result, no copy is made.
///
/// This allows efficient use of APIs that ask for a mutable collection
/// but don't actually mutate it.
Map<K, BuiltList<V>> toMap() => CopyOnWriteMap<K, BuiltList<V>>(_map);
/// Deep hashCode.
///
/// A `BuiltListMultimap` is only equal to another `BuiltListMultimap` with
/// equal key/values pairs in any order. Then, the `hashCode` is guaranteed
/// to be the same.
@override
int get hashCode {
_hashCode ??= hashObjects(_map.keys
.map((key) => hash2(key.hashCode, _map[key].hashCode))
.toList(growable: false)
..sort());
return _hashCode;
}
/// Deep equality.
///
/// A `BuiltListMultimap` is only equal to another `BuiltListMultimap` with
/// equal key/values pairs in any order.
@override
bool operator ==(dynamic other) {
if (identical(other, this)) return true;
if (other is! BuiltListMultimap) return false;
if (other.length != length) return false;
if (other.hashCode != hashCode) return false;
for (var key in keys) {
if (other[key] != this[key]) return false;
}
return true;
}
@override
String toString() => _map.toString();
/// Returns as an immutable map.
///
/// Useful when producing or using APIs that need the [Map] interface. This
/// differs from [toMap] where mutations are explicitly disallowed.
Map<K, Iterable<V>> asMap() => Map<K, Iterable<V>>.unmodifiable(_map);
// ListMultimap.
/// As [ListMultimap], but results are [BuiltList]s and not mutable.
BuiltList<V> operator [](Object key) {
var result = _map[key];
return identical(result, null) ? _emptyList : result;
}
/// As [ListMultimap.containsKey].
bool containsKey(Object key) => _map.containsKey(key);
/// As [ListMultimap.containsValue].
bool containsValue(Object value) => values.contains(value);
/// As [ListMultimap.forEach].
void forEach(void Function(K, V) f) {
_map.forEach((key, values) {
values.forEach((value) {
f(key, value);
});
});
}
/// As [ListMultimap.forEachKey].
void forEachKey(void Function(K, Iterable<V>) f) {
_map.forEach((key, values) {
f(key, values);
});
}
/// As [ListMultimap.isEmpty].
bool get isEmpty => _map.isEmpty;
/// As [ListMultimap.isNotEmpty].
bool get isNotEmpty => _map.isNotEmpty;
/// As [ListMultimap.keys], but result is stable; it always returns the same
/// instance.
Iterable<K> get keys {
_keys ??= _map.keys;
return _keys;
}
/// As [ListMultimap.length].
int get length => _map.length;
/// As [ListMultimap.values], but result is stable; it always returns the
/// same instance.
Iterable<V> get values {
_values ??= _map.values.expand((x) => x);
return _values;
}
// Internal.
BuiltListMultimap._(this._map) {
if (K == dynamic) {
throw UnsupportedError('explicit key type required, '
'for example "new BuiltListMultimap<int, int>"');
}
if (V == dynamic) {
throw UnsupportedError('explicit value type required,'
' for example "new BuiltListMultimap<int, int>"');
}
}
}
/// Default implementation of the public [BuiltListMultimap] interface.
class _BuiltListMultimap<K, V> extends BuiltListMultimap<K, V> {
_BuiltListMultimap.withSafeMap(Map<K, BuiltList<V>> map) : super._(map);
_BuiltListMultimap.copyAndCheck(Iterable keys, Function lookup)
: super._(<K, BuiltList<V>>{}) {
for (var key in keys) {
if (key is K) {
_map[key] = BuiltList<V>(lookup(key));
} else {
throw ArgumentError('map contained invalid key: $key');
}
}
}
bool hasExactKeyAndValueTypes(Type key, Type value) => K == key && V == value;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/list_multimap/list_multimap_builder.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.list_multimap;
/// The Built Collection builder for [BuiltListMultimap].
///
/// It implements the mutating part of the [ListMultimap] interface.
///
/// See the
/// [Built Collection library documentation](#built_collection/built_collection)
/// for the general properties of Built Collections.
class ListMultimapBuilder<K, V> {
// BuiltLists copied from another instance so they can be reused directly for
// keys without changes.
Map<K, BuiltList<V>> _builtMap;
// Instance that _builtMap belongs to. If present, _builtMap must not be
// mutated.
_BuiltListMultimap<K, V> _builtMapOwner;
// ListBuilders for keys that are being changed.
Map<K, ListBuilder<V>> _builderMap;
/// Instantiates with elements from a [Map], [ListMultimap] or
/// [BuiltListMultimap].
///
/// Must be called with a generic type parameter.
///
/// Wrong:
/// `new ListMultimapBuilder({1: ['1'], 2: ['2'], 3: ['3']})`.
///
/// Right:
/// `new ListMultimapBuilder<int, String>({1: ['1'], 2: ['2'], 3: ['3']})`,
///
/// Rejects nulls. Rejects keys and values of the wrong type.
factory ListMultimapBuilder([multimap = const {}]) {
return ListMultimapBuilder<K, V>._uninitialized()..replace(multimap);
}
/// Converts to a [BuiltListMultimap].
///
/// The `ListMultimapBuilder` can be modified again and used to create any
/// number of `BuiltListMultimap`s.
BuiltListMultimap<K, V> build() {
if (_builtMapOwner == null) {
for (var key in _builderMap.keys) {
var builtList = _builderMap[key].build();
if (builtList.isEmpty) {
_builtMap.remove(key);
} else {
_builtMap[key] = builtList;
}
}
_builtMapOwner = _BuiltListMultimap<K, V>.withSafeMap(_builtMap);
}
return _builtMapOwner;
}
/// Applies a function to `this`.
void update(Function(ListMultimapBuilder<K, V>) updates) {
updates(this);
}
/// Replaces all elements with elements from a [Map], [ListMultimap] or
/// [BuiltListMultimap].
///
/// Any [ListBuilder]s associated with this collection are disconnected.
void replace(dynamic multimap) {
if (multimap is _BuiltListMultimap<K, V>) {
_setOwner(multimap);
} else if (multimap is Map ||
multimap is ListMultimap ||
multimap is BuiltListMultimap) {
_setWithCopyAndCheck(multimap.keys, (k) => multimap[k]);
} else {
throw ArgumentError('expected Map, ListMultimap or BuiltListMultimap, '
'got ${multimap.runtimeType}');
}
}
/// As [Map.fromIterable] but adds.
///
/// Additionally, you may specify [values] instead of [value]. This new
/// parameter allows you to supply a function that returns an [Iterable]
/// of values.
///
/// [key] and [value] default to the identity function. [values] is ignored
/// if not specified.
void addIterable<T>(Iterable<T> iterable,
{K Function(T) key,
V Function(T) value,
Iterable<V> Function(T) values}) {
if (value != null && values != null) {
throw ArgumentError('expected value or values to be set, got both');
}
key ??= (T x) => x as K;
if (values != null) {
for (var element in iterable) {
addValues(key(element), values(element));
}
} else {
value ??= (T x) => x as V;
for (var element in iterable) {
add(key(element), value(element));
}
}
}
// Based on ListMultimap.
/// As [ListMultimap.add].
void add(K key, V value) {
_makeWriteableCopy();
_checkKey(key);
_checkValue(value);
_getValuesBuilder(key).add(value);
}
/// As [ListMultimap.addValues].
void addValues(K key, Iterable<V> values) {
// _disown is called in add.
values.forEach((value) {
add(key, value);
});
}
/// As [ListMultimap.addAll].
void addAll(ListMultimap<K, V> other) {
// _disown is called in add.
other.forEach((key, value) {
add(key, value);
});
}
/// As [ListMultimap.remove].
bool remove(Object key, V value) {
if (key is! K) return false;
_makeWriteableCopy();
return _getValuesBuilder(key).remove(value);
}
/// As [ListMultimap.removeAll], but results are [BuiltList]s.
BuiltList<V> removeAll(Object key) {
if (key is! K) return BuiltList<V>();
_makeWriteableCopy();
var builder = _builderMap[key];
if (builder == null) {
_builderMap[key] = ListBuilder<V>();
return _builtMap[key] ?? BuiltList<V>();
}
var old = builder.build();
builder.clear();
return old;
}
/// As [ListMultimap.clear].
///
/// Any [ListBuilder]s associated with this collection are disconnected.
void clear() {
_makeWriteableCopy();
_builtMap.clear();
_builderMap.clear();
}
/// As [ListMultimap], but results are [ListBuilder]s.
ListBuilder<V> operator [](Object key) {
_makeWriteableCopy();
return key is K ? _getValuesBuilder(key) : ListBuilder<V>();
}
// Internal.
ListBuilder<V> _getValuesBuilder(K key) {
var result = _builderMap[key];
if (result == null) {
var builtValues = _builtMap[key];
if (builtValues == null) {
result = ListBuilder<V>();
} else {
result = builtValues.toBuilder();
}
_builderMap[key] = result;
}
return result;
}
void _makeWriteableCopy() {
if (_builtMapOwner != null) {
_builtMap = Map<K, BuiltList<V>>.from(_builtMap);
_builtMapOwner = null;
}
}
ListMultimapBuilder._uninitialized() {
_checkGenericTypeParameter();
}
void _setOwner(_BuiltListMultimap<K, V> builtListMultimap) {
_builtMapOwner = builtListMultimap;
_builtMap = builtListMultimap._map;
_builderMap = <K, ListBuilder<V>>{};
}
void _setWithCopyAndCheck(Iterable keys, Function lookup) {
_builtMapOwner = null;
_builtMap = <K, BuiltList<V>>{};
_builderMap = <K, ListBuilder<V>>{};
for (var key in keys) {
if (key is K) {
for (var value in lookup(key)) {
if (value is V) {
add(key, value);
} else {
throw ArgumentError(
'map contained invalid value: $value, for key $key');
}
}
} else {
throw ArgumentError('map contained invalid key: $key');
}
}
}
void _checkGenericTypeParameter() {
if (K == dynamic) {
throw UnsupportedError('explicit key type required, '
'for example "new ListMultimapBuilder<int, int>"');
}
if (V == dynamic) {
throw UnsupportedError('explicit value type required, '
'for example "new ListMultimapBuilder<int, int>"');
}
}
void _checkKey(K key) {
if (identical(key, null)) {
throw ArgumentError('null key');
}
}
void _checkValue(V value) {
if (identical(value, null)) {
throw ArgumentError('null value');
}
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/internal/copy_on_write_map.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
typedef _MapFactory<K, V> = Map<K, V> Function();
class CopyOnWriteMap<K, V> implements Map<K, V> {
final _MapFactory<K, V> _mapFactory;
bool _copyBeforeWrite;
Map<K, V> _map;
CopyOnWriteMap(this._map, [this._mapFactory]) : _copyBeforeWrite = true;
// Read-only methods: just forward.
@override
V operator [](Object key) => _map[key];
@override
Map<K2, V2> cast<K2, V2>() => CopyOnWriteMap<K2, V2>(_map.cast<K2, V2>());
@override
bool containsKey(Object key) => _map.containsKey(key);
@override
bool containsValue(Object value) => _map.containsValue(value);
@override
Iterable<MapEntry<K, V>> get entries => _map.entries;
@override
void forEach(void Function(K, V) f) => _map.forEach(f);
@override
bool get isEmpty => _map.isEmpty;
@override
bool get isNotEmpty => _map.isNotEmpty;
@override
Iterable<K> get keys => _map.keys;
@override
int get length => _map.length;
@override
Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(K, V) f) => _map.map(f);
@override
Iterable<V> get values => _map.values;
// Mutating methods: copy first if needed.
@override
void operator []=(K key, V value) {
_maybeCopyBeforeWrite();
_map[key] = value;
}
@override
void addAll(Map<K, V> other) {
_maybeCopyBeforeWrite();
_map.addAll(other);
}
@override
void addEntries(Iterable<MapEntry<K, V>> entries) {
_maybeCopyBeforeWrite();
_map.addEntries(entries);
}
@override
void clear() {
_maybeCopyBeforeWrite();
_map.clear();
}
@override
V putIfAbsent(K key, V Function() ifAbsent) {
_maybeCopyBeforeWrite();
return _map.putIfAbsent(key, ifAbsent);
}
@override
V remove(Object key) {
_maybeCopyBeforeWrite();
return _map.remove(key);
}
@override
void removeWhere(bool Function(K, V) test) {
_maybeCopyBeforeWrite();
_map.removeWhere(test);
}
@override
String toString() => _map.toString();
@override
V update(K key, V Function(V) update, {V Function() ifAbsent}) {
_maybeCopyBeforeWrite();
return _map.update(key, update, ifAbsent: ifAbsent);
}
@override
void updateAll(V Function(K, V) update) {
_maybeCopyBeforeWrite();
_map.updateAll(update);
}
// Internal.
void _maybeCopyBeforeWrite() {
if (!_copyBeforeWrite) return;
_copyBeforeWrite = false;
_map = _mapFactory != null
? (_mapFactory()..addAll(_map))
: Map<K, V>.from(_map);
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/internal/iterables.dart | // Copyright (c) 2019, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
import 'package:built_collection/src/iterable.dart' show BuiltIterable;
/// Evaluates a lazy iterable.
///
/// A whitelist of known non-lazy types is returned directly instead.
Iterable<E> evaluateIterable<E>(Iterable<E> iterable) {
if (iterable is! List && iterable is! BuiltIterable && iterable is! Set) {
iterable = iterable.toList();
}
return iterable;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/internal/copy_on_write_list.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
import 'dart:math';
class CopyOnWriteList<E> implements List<E> {
bool _copyBeforeWrite;
final bool _growable;
List<E> _list;
CopyOnWriteList(this._list, this._growable) : _copyBeforeWrite = true;
// Read-only methods: just forward.
@override
int get length => _list.length;
@override
E operator [](int index) => _list[index];
@override
List<E> operator +(List<E> other) => _list + other;
@override
bool any(bool Function(E) test) => _list.any(test);
@override
Map<int, E> asMap() => _list.asMap();
@override
List<T> cast<T>() => CopyOnWriteList<T>(_list.cast<T>(), _growable);
@override
bool contains(Object element) => _list.contains(element);
@override
E elementAt(int index) => _list.elementAt(index);
@override
bool every(bool Function(E) test) => _list.every(test);
@override
Iterable<T> expand<T>(Iterable<T> Function(E) f) => _list.expand(f);
@override
E get first => _list.first;
@override
E firstWhere(bool Function(E) test, {E Function() orElse}) =>
_list.firstWhere(test, orElse: orElse);
@override
T fold<T>(T initialValue, T Function(T, E) combine) =>
_list.fold(initialValue, combine);
@override
Iterable<E> followedBy(Iterable<E> other) => _list.followedBy(other);
@override
void forEach(void Function(E) f) => _list.forEach(f);
@override
Iterable<E> getRange(int start, int end) => _list.getRange(start, end);
@override
int indexOf(E element, [int start = 0]) => _list.indexOf(element, start);
@override
int indexWhere(bool Function(E) test, [int start = 0]) =>
_list.indexWhere(test, start);
@override
bool get isEmpty => _list.isEmpty;
@override
bool get isNotEmpty => _list.isNotEmpty;
@override
Iterator<E> get iterator => _list.iterator;
@override
String join([String separator = '']) => _list.join(separator);
@override
E get last => _list.last;
@override
int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start);
@override
int lastIndexWhere(bool Function(E) test, [int start]) =>
_list.lastIndexWhere(test, start);
@override
E lastWhere(bool Function(E) test, {E Function() orElse}) =>
_list.lastWhere(test, orElse: orElse);
@override
Iterable<T> map<T>(T Function(E) f) => _list.map(f);
@override
E reduce(E Function(E, E) combine) => _list.reduce(combine);
@override
Iterable<E> get reversed => _list.reversed;
@override
E get single => _list.single;
@override
E singleWhere(bool Function(E) test, {E Function() orElse}) =>
_list.singleWhere(test, orElse: orElse);
@override
Iterable<E> skip(int count) => _list.skip(count);
@override
Iterable<E> skipWhile(bool Function(E) test) => _list.skipWhile(test);
@override
List<E> sublist(int start, [int end]) => _list.sublist(start, end);
@override
Iterable<E> take(int count) => _list.take(count);
@override
Iterable<E> takeWhile(bool Function(E) test) => _list.takeWhile(test);
@override
List<E> toList({bool growable = true}) => _list.toList(growable: growable);
@override
Set<E> toSet() => _list.toSet();
@override
Iterable<E> where(bool Function(E) test) => _list.where(test);
@override
Iterable<T> whereType<T>() => _list.whereType<T>();
// Mutating methods: copy first if needed.
@override
set length(int length) {
_maybeCopyBeforeWrite();
_list.length = length;
}
@override
void operator []=(int index, E element) {
_maybeCopyBeforeWrite();
_list[index] = element;
}
@override
set first(E element) {
_maybeCopyBeforeWrite();
_list.first = element;
}
@override
set last(E element) {
_maybeCopyBeforeWrite();
_list.last = element;
}
@override
void add(E value) {
_maybeCopyBeforeWrite();
_list.add(value);
}
@override
void addAll(Iterable<E> iterable) {
_maybeCopyBeforeWrite();
_list.addAll(iterable);
}
@override
void sort([int Function(E, E) compare]) {
_maybeCopyBeforeWrite();
_list.sort(compare);
}
@override
void shuffle([Random random]) {
_maybeCopyBeforeWrite();
_list.shuffle(random);
}
@override
void clear() {
_maybeCopyBeforeWrite();
_list.clear();
}
@override
void insert(int index, E element) {
_maybeCopyBeforeWrite();
_list.insert(index, element);
}
@override
void insertAll(int index, Iterable<E> iterable) {
_maybeCopyBeforeWrite();
_list.insertAll(index, iterable);
}
@override
void setAll(int index, Iterable<E> iterable) {
_maybeCopyBeforeWrite();
_list.setAll(index, iterable);
}
@override
bool remove(Object value) {
_maybeCopyBeforeWrite();
return _list.remove(value);
}
@override
E removeAt(int index) {
_maybeCopyBeforeWrite();
return _list.removeAt(index);
}
@override
E removeLast() {
_maybeCopyBeforeWrite();
return _list.removeLast();
}
@override
void removeWhere(bool Function(E) test) {
_maybeCopyBeforeWrite();
_list.removeWhere(test);
}
@override
void retainWhere(bool Function(E) test) {
_maybeCopyBeforeWrite();
_list.retainWhere(test);
}
@override
void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
_maybeCopyBeforeWrite();
_list.setRange(start, end, iterable, skipCount);
}
@override
void removeRange(int start, int end) {
_maybeCopyBeforeWrite();
_list.removeRange(start, end);
}
@override
void fillRange(int start, int end, [E fillValue]) {
_maybeCopyBeforeWrite();
_list.fillRange(start, end, fillValue);
}
@override
void replaceRange(int start, int end, Iterable<E> iterable) {
_maybeCopyBeforeWrite();
_list.replaceRange(start, end, iterable);
}
@override
String toString() => _list.toString();
// Internal.
void _maybeCopyBeforeWrite() {
if (!_copyBeforeWrite) return;
_copyBeforeWrite = false;
_list = List<E>.from(_list, growable: _growable);
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/internal/copy_on_write_set.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
typedef _SetFactory<E> = Set<E> Function();
class CopyOnWriteSet<E> implements Set<E> {
final _SetFactory<E> _setFactory;
bool _copyBeforeWrite;
Set<E> _set;
CopyOnWriteSet(this._set, [this._setFactory]) : _copyBeforeWrite = true;
// Read-only methods: just forward.
@override
int get length => _set.length;
@override
E lookup(Object object) => _set.lookup(object);
@override
Set<E> intersection(Set<Object> other) => _set.intersection(other);
@override
Set<E> union(Set<E> other) => _set.union(other);
@override
Set<E> difference(Set<Object> other) => _set.difference(other);
@override
bool containsAll(Iterable<Object> other) => _set.containsAll(other);
@override
bool any(bool Function(E) test) => _set.any(test);
@override
Set<T> cast<T>() => CopyOnWriteSet<T>(_set.cast<T>());
@override
bool contains(Object element) => _set.contains(element);
@override
E elementAt(int index) => _set.elementAt(index);
@override
bool every(bool Function(E) test) => _set.every(test);
@override
Iterable<T> expand<T>(Iterable<T> Function(E) f) => _set.expand(f);
@override
E get first => _set.first;
@override
E firstWhere(bool Function(E) test, {E Function() orElse}) =>
_set.firstWhere(test, orElse: orElse);
@override
T fold<T>(T initialValue, T Function(T, E) combine) =>
_set.fold(initialValue, combine);
@override
Iterable<E> followedBy(Iterable<E> other) => _set.followedBy(other);
@override
void forEach(void Function(E) f) => _set.forEach(f);
@override
bool get isEmpty => _set.isEmpty;
@override
bool get isNotEmpty => _set.isNotEmpty;
@override
Iterator<E> get iterator => _set.iterator;
@override
String join([String separator = '']) => _set.join(separator);
@override
E get last => _set.last;
@override
E lastWhere(bool Function(E) test, {E Function() orElse}) =>
_set.lastWhere(test, orElse: orElse);
@override
Iterable<T> map<T>(T Function(E) f) => _set.map(f);
@override
E reduce(E Function(E, E) combine) => _set.reduce(combine);
@override
E get single => _set.single;
@override
E singleWhere(bool Function(E) test, {E Function() orElse}) =>
_set.singleWhere(test, orElse: orElse);
@override
Iterable<E> skip(int count) => _set.skip(count);
@override
Iterable<E> skipWhile(bool Function(E) test) => _set.skipWhile(test);
@override
Iterable<E> take(int count) => _set.take(count);
@override
Iterable<E> takeWhile(bool Function(E) test) => _set.takeWhile(test);
@override
List<E> toList({bool growable = true}) => _set.toList(growable: growable);
@override
Set<E> toSet() => _set.toSet();
@override
Iterable<E> where(bool Function(E) test) => _set.where(test);
@override
Iterable<T> whereType<T>() => _set.whereType<T>();
// Mutating methods: copy first if needed.
@override
bool add(E value) {
_maybeCopyBeforeWrite();
return _set.add(value);
}
@override
void addAll(Iterable<E> iterable) {
_maybeCopyBeforeWrite();
_set.addAll(iterable);
}
@override
void clear() {
_maybeCopyBeforeWrite();
_set.clear();
}
@override
bool remove(Object value) {
_maybeCopyBeforeWrite();
return _set.remove(value);
}
@override
void removeWhere(bool Function(E) test) {
_maybeCopyBeforeWrite();
_set.removeWhere(test);
}
@override
void retainWhere(bool Function(E) test) {
_maybeCopyBeforeWrite();
_set.retainWhere(test);
}
@override
void removeAll(Iterable<Object> elements) {
_maybeCopyBeforeWrite();
_set.removeAll(elements);
}
@override
void retainAll(Iterable<Object> elements) {
_maybeCopyBeforeWrite();
_set.retainAll(elements);
}
@override
String toString() => _set.toString();
// Internal.
void _maybeCopyBeforeWrite() {
if (!_copyBeforeWrite) return;
_copyBeforeWrite = false;
_set =
_setFactory != null ? (_setFactory()..addAll(_set)) : Set<E>.from(_set);
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/internal/test_helpers.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
import '../list.dart';
import '../list_multimap.dart';
import '../map.dart';
import '../set.dart';
import '../set_multimap.dart';
/// Internal only test helpers.
class BuiltCollectionTestHelpers {
static BuiltList<int> overridenHashcodeBuiltList(
Iterable iterable, int hashCode) =>
OverriddenHashcodeBuiltList<int>(iterable, hashCode);
static BuiltListMultimap<int, String> overridenHashcodeBuiltListMultimap(
Object map, int hashCode) =>
OverriddenHashcodeBuiltListMultimap<int, String>(map, hashCode);
static BuiltListMultimap<String, String>
overridenHashcodeBuiltListMultimapWithStringKeys(
Object map, int hashCode) =>
OverriddenHashcodeBuiltListMultimap<String, String>(map, hashCode);
static BuiltMap<int, String> overridenHashcodeBuiltMap(
Object map, int hashCode) =>
OverriddenHashcodeBuiltMap<int, String>(map, hashCode);
static BuiltMap<String, String> overridenHashcodeBuiltMapWithStringKeys(
Object map, int hashCode) =>
OverriddenHashcodeBuiltMap<String, String>(map, hashCode);
static BuiltSet<int> overridenHashcodeBuiltSet(
Iterable iterable, int hashCode) =>
OverriddenHashcodeBuiltSet<int>(iterable, hashCode);
static BuiltSetMultimap<int, String> overridenHashcodeBuiltSetMultimap(
Object map, int hashCode) =>
OverriddenHashcodeBuiltSetMultimap<int, String>(map, hashCode);
static BuiltSetMultimap<String, String>
overridenHashcodeBuiltSetMultimapWithStringKeys(
Object map, int hashCode) =>
OverriddenHashcodeBuiltSetMultimap<String, String>(map, hashCode);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/list/built_list.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.list;
/// The Built Collection [List].
///
/// It implements [Iterable] and the non-mutating part of the [List] interface.
/// Modifications are made via [ListBuilder].
///
/// See the
/// [Built Collection library documentation]
/// (#built_collection/built_collection)
/// for the general properties of Built Collections.
abstract class BuiltList<E> implements Iterable<E>, BuiltIterable<E> {
final List<E> _list;
int _hashCode;
/// Instantiates with elements from an [Iterable].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new BuiltList([1, 2, 3])`.
///
/// Right: `new BuiltList<int>([1, 2, 3])`.
///
/// Rejects nulls. Rejects elements of the wrong type.
factory BuiltList([Iterable iterable = const []]) =>
BuiltList<E>.from(iterable);
/// Instantiates with elements from an [Iterable].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new BuiltList.from([1, 2, 3])`.
///
/// Right: `new BuiltList<int>.from([1, 2, 3])`.
///
/// Rejects nulls. Rejects elements of the wrong type.
factory BuiltList.from(Iterable iterable) {
if (iterable is _BuiltList && iterable.hasExactElementType(E)) {
return iterable as BuiltList<E>;
} else {
return _BuiltList<E>.copyAndCheckTypes(iterable);
}
}
/// Instantiates with elements from an [Iterable<E>].
///
/// `E` must not be `dynamic`.
///
/// Rejects nulls. Rejects elements of the wrong type.
factory BuiltList.of(Iterable<E> iterable) {
if (iterable is _BuiltList<E> && iterable.hasExactElementType(E)) {
return iterable;
} else {
return _BuiltList<E>.copyAndCheckForNull(iterable);
}
}
/// Creates a [ListBuilder], applies updates to it, and builds.
factory BuiltList.build(Function(ListBuilder<E>) updates) =>
(ListBuilder<E>()..update(updates)).build();
/// Converts to a [ListBuilder] for modification.
///
/// The `BuiltList` remains immutable and can continue to be used.
ListBuilder<E> toBuilder() => ListBuilder<E>(this);
/// Converts to a [ListBuilder], applies updates to it, and builds.
BuiltList<E> rebuild(Function(ListBuilder<E>) updates) =>
(toBuilder()..update(updates)).build();
@override
BuiltList<E> toBuiltList() => this;
@override
BuiltSet<E> toBuiltSet() => BuiltSet<E>(this);
/// Deep hashCode.
///
/// A `BuiltList` is only equal to another `BuiltList` with equal elements in
/// the same order. Then, the `hashCode` is guaranteed to be the same.
@override
int get hashCode {
_hashCode ??= hashObjects(_list);
return _hashCode;
}
/// Deep equality.
///
/// A `BuiltList` is only equal to another `BuiltList` with equal elements in
/// the same order.
@override
bool operator ==(dynamic other) {
if (identical(other, this)) return true;
if (other is! BuiltList) return false;
if (other.length != length) return false;
if (other.hashCode != hashCode) return false;
for (var i = 0; i != length; ++i) {
if (other[i] != this[i]) return false;
}
return true;
}
@override
String toString() => _list.toString();
/// Returns as an immutable list.
///
/// Useful when producing or using APIs that need the [List] interface. This
/// differs from [toList] where mutations are explicitly disallowed.
List<E> asList() => List<E>.unmodifiable(_list);
// List.
/// As [List.elementAt].
E operator [](int index) => _list[index];
/// As [List.+].
BuiltList<E> operator +(BuiltList<E> other) =>
_BuiltList<E>.withSafeList(_list + other._list);
/// As [List.length].
@override
int get length => _list.length;
/// As [List.reversed].
Iterable<E> get reversed => _list.reversed;
/// As [List.indexOf].
int indexOf(E element, [int start = 0]) => _list.indexOf(element, start);
/// As [List.lastIndexOf].
int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start);
/// As [List.indexWhere].
int indexWhere(bool Function(E) test, [int start = 0]) =>
_list.indexWhere(test, start);
/// As [List.lastIndexWhere].
int lastIndexWhere(bool Function(E) test, [int start]) =>
_list.lastIndexWhere(test, start);
/// As [List.sublist] but returns a `BuiltList<E>`.
BuiltList<E> sublist(int start, [int end]) =>
_BuiltList<E>.withSafeList(_list.sublist(start, end));
/// As [List.getRange].
Iterable<E> getRange(int start, int end) => _list.getRange(start, end);
/// As [List.asMap].
Map<int, E> asMap() => _list.asMap();
// Iterable.
@override
Iterator<E> get iterator => _list.iterator;
@override
Iterable<T> map<T>(T Function(E) f) => _list.map(f);
@override
Iterable<E> where(bool Function(E) test) => _list.where(test);
@override
Iterable<T> whereType<T>() => _list.whereType<T>();
@override
Iterable<T> expand<T>(Iterable<T> Function(E) f) => _list.expand(f);
@override
bool contains(Object element) => _list.contains(element);
@override
void forEach(void Function(E) f) => _list.forEach(f);
@override
E reduce(E Function(E, E) combine) => _list.reduce(combine);
@override
T fold<T>(T initialValue, T Function(T, E) combine) =>
_list.fold(initialValue, combine);
@override
Iterable<E> followedBy(Iterable<E> other) => _list.followedBy(other);
@override
bool every(bool Function(E) test) => _list.every(test);
@override
String join([String separator = '']) => _list.join(separator);
@override
bool any(bool Function(E) test) => _list.any(test);
/// As [Iterable.toList].
///
/// Note that the implementation is efficient: it returns a copy-on-write
/// wrapper around the data from this `BuiltList`. So, if no mutations are
/// made to the result, no copy is made.
///
/// This allows efficient use of APIs that ask for a mutable collection
/// but don't actually mutate it.
@override
List<E> toList({bool growable = true}) => CopyOnWriteList<E>(_list, growable);
@override
Set<E> toSet() => _list.toSet();
@override
bool get isEmpty => _list.isEmpty;
@override
bool get isNotEmpty => _list.isNotEmpty;
@override
Iterable<E> take(int n) => _list.take(n);
@override
Iterable<E> takeWhile(bool Function(E) test) => _list.takeWhile(test);
@override
Iterable<E> skip(int n) => _list.skip(n);
@override
Iterable<E> skipWhile(bool Function(E) test) => _list.skipWhile(test);
@override
E get first => _list.first;
@override
E get last => _list.last;
@override
E get single => _list.single;
@override
E firstWhere(bool Function(E) test, {E Function() orElse}) =>
_list.firstWhere(test, orElse: orElse);
@override
E lastWhere(bool Function(E) test, {E Function() orElse}) =>
_list.lastWhere(test, orElse: orElse);
@override
E singleWhere(bool Function(E) test, {E Function() orElse}) =>
_list.singleWhere(test, orElse: orElse);
@override
E elementAt(int index) => _list.elementAt(index);
@override
Iterable<T> cast<T>() => Iterable.castFrom<E, T>(_list);
// Internal.
BuiltList._(this._list) {
if (E == dynamic) {
throw UnsupportedError(
'explicit element type required, for example "new BuiltList<int>"');
}
}
}
/// Default implementation of the public [BuiltList] interface.
class _BuiltList<E> extends BuiltList<E> {
_BuiltList.withSafeList(List<E> list) : super._(list);
_BuiltList.copyAndCheckTypes([Iterable iterable = const []])
: super._(List<E>.from(iterable, growable: false)) {
for (var element in _list) {
if (element is! E) {
throw ArgumentError('iterable contained invalid element: $element');
}
}
}
_BuiltList.copyAndCheckForNull(Iterable<E> iterable)
: super._(List<E>.from(iterable, growable: false)) {
for (var element in _list) {
if (identical(element, null)) {
throw ArgumentError('iterable contained invalid element: null');
}
}
}
bool hasExactElementType(Type type) => E == type;
}
/// Extensions for [BuiltList] on [List].
extension BuiltListExtension<T> on List<T> {
/// Converts to a [BuiltList].
BuiltList<T> build() {
// We know a `List` is not a `BuiltList`, so we have to copy.
return _BuiltList<T>.copyAndCheckForNull(this);
}
}
/// Extensions for [BuiltList] on [Iterable].
extension BuiltListIterableExtension<E> on Iterable<E> {
/// Converts to a [BuiltList].
///
/// Just returns the [Iterable] if it is already a `BuiltList<E>`.
BuiltList<E> toBuiltList() => BuiltList<E>.of(this);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/list/list_builder.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.list;
/// The Built Collection builder for [BuiltList].
///
/// It implements the mutating part of the [List] interface.
///
/// See the
/// [Built Collection library documentation](#built_collection/built_collection)
/// for the general properties of Built Collections.
class ListBuilder<E> {
List<E> _list;
_BuiltList<E> _listOwner;
/// Instantiates with elements from an [Iterable].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new ListBuilder([1, 2, 3])`.
///
/// Right: `new ListBuilder<int>([1, 2, 3])`,
///
/// Rejects nulls. Rejects elements of the wrong type.
factory ListBuilder([Iterable iterable = const []]) {
return ListBuilder<E>._uninitialized()..replace(iterable);
}
/// Converts to a [BuiltList].
///
/// The `ListBuilder` can be modified again and used to create any number
/// of `BuiltList`s.
BuiltList<E> build() {
if (_listOwner == null) {
_setOwner(_BuiltList<E>.withSafeList(_list));
}
return _listOwner;
}
/// Applies a function to `this`.
void update(Function(ListBuilder<E>) updates) {
updates(this);
}
/// Replaces all elements with elements from an [Iterable].
void replace(Iterable iterable) {
if (iterable is _BuiltList<E>) {
_setOwner(iterable);
} else {
_setSafeList(List<E>.from(iterable));
}
}
// Based on List.
/// As [List.elementAt].
E operator [](int index) => _list[index];
/// As [List].
void operator []=(int index, E element) {
_checkElement(element);
_safeList[index] = element;
}
/// As [List.first].
E get first => _list.first;
/// As [List.first].
set first(E value) {
_checkElement(value);
_safeList.first = value;
}
/// As [List.last].
E get last => _list.last;
/// As [List.last].
set last(E value) {
_checkElement(value);
_safeList.last = value;
}
/// As [List.length].
int get length => _list.length;
/// As [List.isEmpty].
bool get isEmpty => _list.isEmpty;
/// As [List.isNotEmpty].
bool get isNotEmpty => _list.isNotEmpty;
/// As [List.add].
void add(E value) {
_checkElement(value);
_safeList.add(value);
}
/// As [List.addAll].
void addAll(Iterable<E> iterable) {
// Add directly to the underlying `List` then check elements there, for
// performance. Roll back the changes if validation fails.
var safeList = _safeList;
var lengthBefore = safeList.length;
safeList.addAll(iterable);
try {
for (var i = lengthBefore; i != safeList.length; ++i) {
_checkElement(safeList[i]);
}
} catch (_) {
safeList.removeRange(lengthBefore, safeList.length);
rethrow;
}
}
/// As [List.reversed], but updates the builder in place. Returns nothing.
void reverse() {
_list = _list.reversed.toList(growable: true);
_listOwner = null;
}
/// As [List.sort].
void sort([int Function(E, E) compare]) {
_safeList.sort(compare);
}
/// As [List.shuffle].
void shuffle([Random random]) {
_safeList.shuffle(random);
}
/// As [List.clear].
void clear() {
_safeList.clear();
}
/// As [List.insert].
void insert(int index, E element) {
_checkElement(element);
_safeList.insert(index, element);
}
/// As [List.insertAll].
void insertAll(int index, Iterable<E> iterable) {
// Add directly to the underlying `List` then check elements there, for
// performance. Roll back the changes if validation fails.
var safeList = _safeList;
var lengthBefore = safeList.length;
safeList.insertAll(index, iterable);
var insertedLength = safeList.length - lengthBefore;
try {
for (var i = index; i != index + insertedLength; ++i) {
_checkElement(safeList[i]);
}
} catch (_) {
safeList.removeRange(index, index + insertedLength);
rethrow;
}
}
/// As [List.setAll].
void setAll(int index, Iterable<E> iterable) {
iterable = evaluateIterable(iterable);
_checkElements(iterable);
_safeList.setAll(index, iterable);
}
/// As [List.remove].
bool remove(Object value) => _safeList.remove(value);
/// As [List.removeAt].
E removeAt(int index) => _safeList.removeAt(index);
/// As [List.removeLast].
E removeLast() => _safeList.removeLast();
/// As [List.removeWhere].
void removeWhere(bool Function(E) test) {
_safeList.removeWhere(test);
}
/// As [List.retainWhere].
///
/// This method is an alias of [where].
void retainWhere(bool Function(E) test) {
_safeList.retainWhere(test);
}
/// As [List.sublist], but updates the builder in place. Returns nothing.
void sublist(int start, [int end]) {
_setSafeList(_list.sublist(start, end));
}
/// As [List.setRange].
void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
iterable = evaluateIterable(iterable);
_checkElements(iterable);
_safeList.setRange(start, end, iterable, skipCount);
}
/// As [List.removeRange].
void removeRange(int start, int end) {
_safeList.removeRange(start, end);
}
/// As [List.fillRange], but requires a value.
void fillRange(int start, int end, E fillValue) {
_checkElement(fillValue);
_safeList.fillRange(start, end, fillValue);
}
/// As [List.replaceRange].
void replaceRange(int start, int end, Iterable<E> iterable) {
iterable = evaluateIterable(iterable);
_checkElements(iterable);
_safeList.replaceRange(start, end, iterable);
}
// Based on Iterable.
/// As [Iterable.map], but updates the builder in place. Returns nothing.
void map(E Function(E) f) {
var result = _list.map(f).toList(growable: true);
_checkElements(result);
_setSafeList(result);
}
/// As [Iterable.where], but updates the builder in place. Returns nothing.
///
/// This method is an alias of [retainWhere].
void where(bool Function(E) test) => retainWhere(test);
/// As [Iterable.expand], but updates the builder in place. Returns nothing.
void expand(Iterable<E> Function(E) f) {
var result = _list.expand(f).toList(growable: true);
_checkElements(result);
_setSafeList(result);
}
/// As [Iterable.take], but updates the builder in place. Returns nothing.
void take(int n) {
_setSafeList(_list = _list.take(n).toList(growable: true));
}
/// As [Iterable.takeWhile], but updates the builder in place. Returns
/// nothing.
void takeWhile(bool Function(E) test) {
_setSafeList(_list = _list.takeWhile(test).toList(growable: true));
}
/// As [Iterable.skip], but updates the builder in place. Returns nothing.
void skip(int n) {
_setSafeList(_list.skip(n).toList(growable: true));
}
/// As [Iterable.skipWhile], but updates the builder in place. Returns
/// nothing.
void skipWhile(bool Function(E) test) {
_setSafeList(_list.skipWhile(test).toList(growable: true));
}
// Internal.
ListBuilder._uninitialized() {
_checkGenericTypeParameter();
}
void _setOwner(_BuiltList<E> listOwner) {
_list = listOwner._list;
_listOwner = listOwner;
}
void _setSafeList(List<E> list) {
_list = list;
_listOwner = null;
}
List<E> get _safeList {
if (_listOwner != null) {
_setSafeList(List<E>.from(_list, growable: true));
}
return _list;
}
void _checkGenericTypeParameter() {
if (E == dynamic) {
throw UnsupportedError('explicit element type required, '
'for example "new ListBuilder<int>"');
}
}
void _checkElement(E element) {
if (identical(element, null)) {
throw ArgumentError('null element');
}
}
void _checkElements(Iterable<E> elements) {
for (var element in elements) {
_checkElement(element);
}
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/iterable/built_iterable.dart | // Copyright (c) 2017, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.iterable;
/// [Iterable] that is either a [BuiltList] or a [BuiltSet].
abstract class BuiltIterable<E> implements Iterable<E> {
/// Converts to a [BuiltList].
BuiltList<E> toBuiltList();
/// Converts to a [BuiltSet].
BuiltSet<E> toBuiltSet();
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/map/built_map.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.map;
typedef _MapFactory<K, V> = Map<K, V> Function();
/// The Built Collection [Map].
///
/// It implements the non-mutating part of the [Map] interface. Iteration over
/// keys is in the same order in which they were inserted. Modifications are
/// made via [MapBuilder].
///
/// See the
/// [Built Collection library documentation](#built_collection/built_collection)
/// for the general properties of Built Collections.
abstract class BuiltMap<K, V> {
final _MapFactory<K, V> _mapFactory;
final Map<K, V> _map;
// Cached.
int _hashCode;
Iterable<K> _keys;
Iterable<V> _values;
/// Instantiates with elements from a [Map] or [BuiltMap].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new BuiltMap({1: '1', 2: '2', 3: '3'})`.
///
/// Right: `new BuiltMap<int, String>({1: '1', 2: '2', 3: '3'})`.
///
/// Rejects nulls. Rejects keys and values of the wrong type.
factory BuiltMap([map = const {}]) {
if (map is _BuiltMap && map.hasExactKeyAndValueTypes(K, V)) {
return map as BuiltMap<K, V>;
} else if (map is Map || map is BuiltMap) {
return _BuiltMap<K, V>.copyAndCheckTypes(map.keys, (k) => map[k]);
} else {
throw ArgumentError('expected Map or BuiltMap, got ${map.runtimeType}');
}
}
/// Instantiates with elements from a [Map].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new BuiltMap.from({1: '1', 2: '2', 3: '3'})`.
///
/// Right: `new BuiltMap<int, String>.from({1: '1', 2: '2', 3: '3'})`.
///
/// Rejects nulls. Rejects keys and values of the wrong type.
factory BuiltMap.from(Map map) {
return _BuiltMap<K, V>.copyAndCheckTypes(map.keys, (k) => map[k]);
}
/// Instantiates with elements from a [Map<K, V>].
///
/// `K` and `V` are inferred from `map`, and must not be `dynamic`.
///
/// Rejects nulls. Rejects keys and values of the wrong type.
factory BuiltMap.of(Map<K, V> map) {
return _BuiltMap<K, V>.copyAndCheckForNull(map.keys, (k) => map[k]);
}
/// Creates a [MapBuilder], applies updates to it, and builds.
factory BuiltMap.build(Function(MapBuilder<K, V>) updates) =>
(MapBuilder<K, V>()..update(updates)).build();
/// Converts to a [MapBuilder] for modification.
///
/// The `BuiltMap` remains immutable and can continue to be used.
MapBuilder<K, V> toBuilder() => MapBuilder<K, V>._fromBuiltMap(this);
/// Converts to a [MapBuilder], applies updates to it, and builds.
BuiltMap<K, V> rebuild(Function(MapBuilder<K, V>) updates) =>
(toBuilder()..update(updates)).build();
/// Returns as an immutable map.
///
/// Useful when producing or using APIs that need the [Map] interface. This
/// differs from [toMap] where mutations are explicitly disallowed.
Map<K, V> asMap() => Map<K, V>.unmodifiable(_map);
/// Converts to a [Map].
///
/// Note that the implementation is efficient: it returns a copy-on-write
/// wrapper around the data from this `BuiltMap`. So, if no mutations are
/// made to the result, no copy is made.
///
/// This allows efficient use of APIs that ask for a mutable collection
/// but don't actually mutate it.
Map<K, V> toMap() => CopyOnWriteMap<K, V>(_map, _mapFactory);
/// Deep hashCode.
///
/// A `BuiltMap` is only equal to another `BuiltMap` with equal key/value
/// pairs in any order. Then, the `hashCode` is guaranteed to be the same.
@override
int get hashCode {
_hashCode ??= hashObjects(_map.keys
.map((key) => hash2(key.hashCode, _map[key].hashCode))
.toList(growable: false)
..sort());
return _hashCode;
}
/// Deep equality.
///
/// A `BuiltMap` is only equal to another `BuiltMap` with equal key/value
/// pairs in any order.
@override
bool operator ==(dynamic other) {
if (identical(other, this)) return true;
if (other is! BuiltMap) return false;
if (other.length != length) return false;
if (other.hashCode != hashCode) return false;
for (var key in keys) {
if (other[key] != this[key]) return false;
}
return true;
}
@override
String toString() => _map.toString();
// Map.
/// As [Map].
V operator [](Object key) => _map[key];
/// As [Map.containsKey].
bool containsKey(Object key) => _map.containsKey(key);
/// As [Map.containsValue].
bool containsValue(Object value) => _map.containsValue(value);
/// As [Map.forEach].
void forEach(void Function(K, V) f) {
_map.forEach(f);
}
/// As [Map.isEmpty].
bool get isEmpty => _map.isEmpty;
/// As [Map.isNotEmpty].
bool get isNotEmpty => _map.isNotEmpty;
/// As [Map.keys], but result is stable; it always returns the same instance.
Iterable<K> get keys {
_keys ??= _map.keys;
return _keys;
}
/// As [Map.length].
int get length => _map.length;
/// As [Map.values], but result is stable; it always returns the same
/// instance.
Iterable<V> get values {
_values ??= _map.values;
return _values;
}
/// As [Map.entries].
Iterable<MapEntry<K, V>> get entries => _map.entries;
/// As [Map.map], but returns a [BuiltMap].
BuiltMap<K2, V2> map<K2, V2>(MapEntry<K2, V2> Function(K, V) f) =>
_BuiltMap<K2, V2>.withSafeMap(null, _map.map(f));
// Internal.
BuiltMap._(this._mapFactory, this._map) {
if (K == dynamic) {
throw UnsupportedError(
'explicit key type required, for example "new BuiltMap<int, int>"');
}
if (V == dynamic) {
throw UnsupportedError('explicit value type required,'
' for example "new BuiltMap<int, int>"');
}
}
}
/// Default implementation of the public [BuiltMap] interface.
class _BuiltMap<K, V> extends BuiltMap<K, V> {
_BuiltMap.withSafeMap(_MapFactory<K, V> mapFactory, Map<K, V> map)
: super._(mapFactory, map);
_BuiltMap.copyAndCheckTypes(Iterable keys, Function lookup)
: super._(null, <K, V>{}) {
for (var key in keys) {
if (key is K) {
var value = lookup(key);
if (value is V) {
_map[key] = value;
} else {
throw ArgumentError('map contained invalid value: $value');
}
} else {
throw ArgumentError('map contained invalid key: $key');
}
}
}
_BuiltMap.copyAndCheckForNull(Iterable<K> keys, V Function(K) lookup)
: super._(null, <K, V>{}) {
for (var key in keys) {
if (identical(key, null)) {
throw ArgumentError('map contained invalid key: null');
}
var value = lookup(key);
if (value == null) {
throw ArgumentError('map contained invalid value: null');
}
_map[key] = value;
}
}
bool hasExactKeyAndValueTypes(Type key, Type value) => K == key && V == value;
}
/// Extensions for [BuiltMap] on [Map].
extension BuiltMapExtension<K, V> on Map<K, V> {
/// Converts to a [BuiltMap].
BuiltMap<K, V> build() => BuiltMap<K, V>.of(this);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/map/map_builder.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.map;
/// The Built Collection builder for [BuiltMap].
///
/// It implements the mutating part of the [Map] interface.
///
/// See the
/// [Built Collection library documentation](#built_collection/built_collection)
/// for the general properties of Built Collections.
class MapBuilder<K, V> {
/// Used by [_createMap] to instantiate [_map]. The default value is `null`.
_MapFactory<K, V> _mapFactory;
Map<K, V> _map;
_BuiltMap<K, V> _mapOwner;
/// Instantiates with elements from a [Map] or [BuiltMap].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new MapBuilder({1: '1', 2: '2', 3: '3'})`.
///
/// Right: `new MapBuilder<int, String>({1: '1', 2: '2', 3: '3'})`,
///
/// Rejects nulls. Rejects keys and values of the wrong type.
factory MapBuilder([map = const {}]) {
return MapBuilder<K, V>._uninitialized()..replace(map);
}
/// Converts to a [BuiltMap].
///
/// The `MapBuilder` can be modified again and used to create any number
/// of `BuiltMap`s.
BuiltMap<K, V> build() {
_mapOwner ??= _BuiltMap<K, V>.withSafeMap(_mapFactory, _map);
return _mapOwner;
}
/// Applies a function to `this`.
void update(Function(MapBuilder<K, V> builder) updates) {
updates(this);
}
/// Replaces all elements with elements from a [Map] or [BuiltMap].
void replace(Object map) {
if (map is _BuiltMap<K, V> && map._mapFactory == _mapFactory) {
_setOwner(map);
} else if (map is BuiltMap) {
var replacement = _createMap();
map.forEach((Object key, Object value) {
replacement[key as K] = value as V;
});
_setSafeMap(replacement);
} else if (map is Map) {
var replacement = _createMap();
map.forEach((Object key, Object value) {
replacement[key as K] = value as V;
});
_setSafeMap(replacement);
} else {
throw ArgumentError('expected Map or BuiltMap, got ${map.runtimeType}');
}
}
/// Uses `base` as the collection type for all maps created by this builder.
///
/// // Iterates over elements in ascending order.
/// new MapBuilder<int, String>()
/// ..withBase(() => new SplayTreeMap<int, String>());
///
/// // Uses custom equality.
/// new MapBuilder<int, String>()
/// ..withBase(() => new LinkedHashMap<int, String>(
/// equals: (int a, int b) => a % 255 == b % 255,
/// hashCode: (int n) => (n % 255).hashCode));
///
/// The map returned by `base` must be empty, mutable, and each call must
/// instantiate and return a new object.
///
/// Use [withDefaultBase] to reset `base` to the default value.
void withBase(_MapFactory<K, V> base) {
if (base == null) {
throw ArgumentError.notNull('base');
}
_mapFactory = base;
_setSafeMap(_createMap()..addAll(_map));
}
/// As [withBase], but sets `base` back to the default value, which
/// instantiates `Map<K, V>`.
void withDefaultBase() {
_mapFactory = null;
_setSafeMap(_createMap()..addAll(_map));
}
/// As [Map.fromIterable] but adds.
///
/// [key] and [value] default to the identity function.
void addIterable<T>(Iterable<T> iterable,
{K Function(T) key, V Function(T) value}) {
key ??= (T x) => x as K;
value ??= (T x) => x as V;
for (var element in iterable) {
this[key(element)] = value(element);
}
}
// Based on Map.
/// As [Map].
V operator [](Object key) => _map[key];
/// As [Map].
void operator []=(K key, V value) {
_checkKey(key);
_checkValue(value);
_safeMap[key] = value;
}
/// As [Map.length].
int get length => _map.length;
/// As [Map.isEmpty].
bool get isEmpty => _map.isEmpty;
/// As [Map.isNotEmpty].
bool get isNotEmpty => _map.isNotEmpty;
/// As [Map.putIfAbsent].
V putIfAbsent(K key, V Function() ifAbsent) {
_checkKey(key);
return _safeMap.putIfAbsent(key, () {
var value = ifAbsent();
_checkValue(value);
return value;
});
}
/// As [Map.addAll].
void addAll(Map<K, V> other) {
_checkKeys(other.keys);
_checkValues(other.values);
_safeMap.addAll(other);
}
/// As [Map.remove].
V remove(Object key) => _safeMap.remove(key);
/// As [Map.removeWhere].
void removeWhere(bool Function(K, V) predicate) {
_safeMap.removeWhere(predicate);
}
/// As [Map.clear].
void clear() {
_safeMap.clear();
}
/// As [Map.addEntries].
void addEntries(Iterable<MapEntry<K, V>> newEntries) {
_safeMap.addEntries(newEntries);
}
/// As [Map.update].
V updateValue(K key, V Function(V) update, {V Function() ifAbsent}) =>
_safeMap.update(key, update, ifAbsent: ifAbsent);
/// As [Map.updateAll].
void updateAllValues(V Function(K, V) update) {
_safeMap.updateAll(update);
}
// Internal.
MapBuilder._uninitialized() {
_checkGenericTypeParameter();
}
MapBuilder._fromBuiltMap(_BuiltMap<K, V> map)
: _mapFactory = map._mapFactory,
_map = map._map,
_mapOwner = map;
void _setOwner(_BuiltMap<K, V> mapOwner) {
assert(mapOwner._mapFactory == _mapFactory,
"Can't reuse a built map that uses a different base");
_mapOwner = mapOwner;
_map = mapOwner._map;
}
void _setSafeMap(Map<K, V> map) {
_mapOwner = null;
_map = map;
}
Map<K, V> get _safeMap {
if (_mapOwner != null) {
_map = _createMap()..addAll(_map);
_mapOwner = null;
}
return _map;
}
Map<K, V> _createMap() => _mapFactory != null ? _mapFactory() : <K, V>{};
void _checkGenericTypeParameter() {
if (K == dynamic) {
throw UnsupportedError(
'explicit key type required, for example "new MapBuilder<int, int>"');
}
if (V == dynamic) {
throw UnsupportedError('explicit value type required, '
'for example "new MapBuilder<int, int>"');
}
}
void _checkKey(K key) {
if (identical(key, null)) {
throw ArgumentError('null key');
}
}
void _checkKeys(Iterable<K> keys) {
for (var key in keys) {
_checkKey(key);
}
}
void _checkValue(V value) {
if (identical(value, null)) {
throw ArgumentError('null value');
}
}
void _checkValues(Iterable<V> values) {
for (var value in values) {
_checkValue(value);
}
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/set/built_set.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.set;
typedef _SetFactory<E> = Set<E> Function();
/// The Built Collection [Set].
///
/// It implements [Iterable] and the non-mutating part of the [Set] interface.
/// Iteration is in the same order in which the elements were inserted.
/// Modifications are made via [SetBuilder].
///
/// See the
/// [Built Collection library documentation](#built_collection/built_collection)
/// for the general properties of Built Collections.
abstract class BuiltSet<E> implements Iterable<E>, BuiltIterable<E> {
final _SetFactory<E> _setFactory;
final Set<E> _set;
int _hashCode;
/// Instantiates with elements from an [Iterable].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new BuiltSet([1, 2, 3])`.
///
/// Right: `new BuiltSet<int>([1, 2, 3])`.
///
/// Rejects nulls. Rejects elements of the wrong type.
factory BuiltSet([Iterable iterable = const []]) => BuiltSet.from(iterable);
/// Instantiates with elements from an [Iterable].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new BuiltSet([1, 2, 3])`.
///
/// Right: `new BuiltSet<int>([1, 2, 3])`.
///
/// Rejects nulls. Rejects elements of the wrong type.
factory BuiltSet.from(Iterable iterable) {
if (iterable is _BuiltSet && iterable.hasExactElementType(E)) {
return iterable as BuiltSet<E>;
} else {
return _BuiltSet<E>.copyAndCheckTypes(iterable);
}
}
/// Instantiates with elements from an [Iterable<E>].
///
/// `E` must not be `dynamic`.
///
/// Rejects nulls. Rejects elements of the wrong type.
factory BuiltSet.of(Iterable<E> iterable) {
if (iterable is _BuiltSet<E> && iterable.hasExactElementType(E)) {
return iterable;
} else {
return _BuiltSet<E>.copyAndCheckForNull(iterable);
}
}
/// Creates a [SetBuilder], applies updates to it, and builds.
factory BuiltSet.build(Function(SetBuilder<E>) updates) =>
(SetBuilder<E>()..update(updates)).build();
/// Converts to a [SetBuilder] for modification.
///
/// The `BuiltSet` remains immutable and can continue to be used.
SetBuilder<E> toBuilder() => SetBuilder<E>._fromBuiltSet(this);
/// Converts to a [SetBuilder], applies updates to it, and builds.
BuiltSet<E> rebuild(Function(SetBuilder<E>) updates) =>
(toBuilder()..update(updates)).build();
@override
BuiltList<E> toBuiltList() => BuiltList<E>(this);
@override
BuiltSet<E> toBuiltSet() => this;
/// Deep hashCode.
///
/// A `BuiltSet` is only equal to another `BuiltSet` with equal elements in
/// any order. Then, the `hashCode` is guaranteed to be the same.
@override
int get hashCode {
_hashCode ??= hashObjects(
_set.map((e) => e.hashCode).toList(growable: false)..sort());
return _hashCode;
}
/// Deep equality.
///
/// A `BuiltSet` is only equal to another `BuiltSet` with equal elements in
/// any order.
@override
bool operator ==(dynamic other) {
if (identical(other, this)) return true;
if (other is! BuiltSet) return false;
if (other.length != length) return false;
if (other.hashCode != hashCode) return false;
return containsAll(other);
}
@override
String toString() => _set.toString();
/// Returns as an immutable set.
///
/// Useful when producing or using APIs that need the [Set] interface. This
/// differs from [toSet] where mutations are explicitly disallowed.
Set<E> asSet() => UnmodifiableSetView<E>(_set);
// Set.
/// As [Set.length].
@override
int get length => _set.length;
/// As [Set.containsAll].
bool containsAll(Iterable<Object> other) => _set.containsAll(other);
/// As [Set.difference] but takes and returns a `BuiltSet<E>`.
BuiltSet<E> difference(BuiltSet<Object> other) =>
_BuiltSet<E>.withSafeSet(_setFactory, _set.difference(other._set));
/// As [Set.intersection] but takes and returns a `BuiltSet<E>`.
BuiltSet<E> intersection(BuiltSet<Object> other) =>
_BuiltSet<E>.withSafeSet(_setFactory, _set.intersection(other._set));
/// As [Set.lookup].
E lookup(Object object) => _set.lookup(object);
/// As [Set.union] but takes and returns a `BuiltSet<E>`.
BuiltSet<E> union(BuiltSet<E> other) =>
_BuiltSet<E>.withSafeSet(_setFactory, _set.union(other._set));
// Iterable.
@override
Iterator<E> get iterator => _set.iterator;
@override
Iterable<T> cast<T>() => Iterable.castFrom<E, T>(_set);
@override
Iterable<E> followedBy(Iterable<E> other) => _set.followedBy(other);
@override
Iterable<T> whereType<T>() => _set.whereType<T>();
@override
Iterable<T> map<T>(T Function(E) f) => _set.map(f);
@override
Iterable<E> where(bool Function(E) test) => _set.where(test);
@override
Iterable<T> expand<T>(Iterable<T> Function(E) f) => _set.expand(f);
@override
bool contains(Object element) => _set.contains(element);
@override
void forEach(void Function(E) f) => _set.forEach(f);
@override
E reduce(E Function(E, E) combine) => _set.reduce(combine);
@override
T fold<T>(T initialValue, T Function(T, E) combine) =>
_set.fold(initialValue, combine);
@override
bool every(bool Function(E) test) => _set.every(test);
@override
String join([String separator = '']) => _set.join(separator);
@override
bool any(bool Function(E) test) => _set.any(test);
/// As [Iterable.toSet].
///
/// Note that the implementation is efficient: it returns a copy-on-write
/// wrapper around the data from this `BuiltSet`. So, if no mutations are
/// made to the result, no copy is made.
///
/// This allows efficient use of APIs that ask for a mutable collection
/// but don't actually mutate it.
@override
Set<E> toSet() => CopyOnWriteSet<E>(_set, _setFactory);
@override
List<E> toList({bool growable = true}) => _set.toList(growable: growable);
@override
bool get isEmpty => _set.isEmpty;
@override
bool get isNotEmpty => _set.isNotEmpty;
@override
Iterable<E> take(int n) => _set.take(n);
@override
Iterable<E> takeWhile(bool Function(E) test) => _set.takeWhile(test);
@override
Iterable<E> skip(int n) => _set.skip(n);
@override
Iterable<E> skipWhile(bool Function(E) test) => _set.skipWhile(test);
@override
E get first => _set.first;
@override
E get last => _set.last;
@override
E get single => _set.single;
@override
E firstWhere(bool Function(E) test, {E Function() orElse}) =>
_set.firstWhere(test, orElse: orElse);
@override
E lastWhere(bool Function(E) test, {E Function() orElse}) =>
_set.lastWhere(test, orElse: orElse);
@override
E singleWhere(bool Function(E) test, {E Function() orElse}) =>
_set.singleWhere(test, orElse: orElse);
@override
E elementAt(int index) => _set.elementAt(index);
// Internal.
BuiltSet._(this._setFactory, this._set) {
if (E == dynamic) {
throw UnsupportedError(
'explicit element type required, for example "new BuiltSet<int>"');
}
}
}
/// Default implementation of the public [BuiltSet] interface.
class _BuiltSet<E> extends BuiltSet<E> {
_BuiltSet.withSafeSet(_SetFactory<E> setFactory, Set<E> set)
: super._(setFactory, set);
_BuiltSet.copyAndCheckTypes(Iterable iterable) : super._(null, <E>{}) {
for (var element in iterable) {
if (element is E) {
_set.add(element);
} else {
throw ArgumentError('iterable contained invalid element: $element');
}
}
}
_BuiltSet.copyAndCheckForNull(Iterable iterable) : super._(null, <E>{}) {
for (var element in iterable) {
if (identical(element, null)) {
throw ArgumentError('iterable contained invalid element: null');
} else {
_set.add(element);
}
}
}
bool hasExactElementType(Type type) => E == type;
}
/// Extensions for [BuiltSet] on [Set].
extension BuiltSetExtension<T> on Set<T> {
/// Converts to a [BuiltSet].
BuiltSet<T> build() {
// We know a `Set` is not a `BuiltSet`, so we have to copy.
return _BuiltSet<T>.copyAndCheckForNull(this);
}
}
/// Extensions for [BuiltSet] on [Iterable].
extension BuiltSetIterableExtension<E> on Iterable<E> {
/// Converts to a [BuiltSet].
///
/// Just returns the [Iterable] if it is already a `BuiltSet<E>`.
BuiltSet<E> toBuiltSet() => BuiltSet<E>.of(this);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/set/set_builder.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.set;
/// The Built Collection builder for [BuiltSet].
///
/// It implements the mutating part of the [Set] interface.
///
/// See the
/// [Built Collection library documentation](#built_collection/built_collection)
/// for the general properties of Built Collections.
class SetBuilder<E> {
/// Used by [_createSet] to instantiate [_set]. The default value is `null`.
_SetFactory<E> _setFactory;
Set<E> _set;
_BuiltSet<E> _setOwner;
/// Instantiates with elements from an [Iterable].
///
/// Must be called with a generic type parameter.
///
/// Wrong: `new SetBuilder([1, 2, 3])`.
///
/// Right: `new SetBuilder<int>([1, 2, 3])`,
///
/// Rejects nulls. Rejects elements of the wrong type.
factory SetBuilder([Iterable iterable = const []]) {
return SetBuilder<E>._uninitialized()..replace(iterable);
}
/// Converts to a [BuiltSet].
///
/// The `SetBuilder` can be modified again and used to create any number
/// of `BuiltSet`s.
BuiltSet<E> build() {
_setOwner ??= _BuiltSet<E>.withSafeSet(_setFactory, _set);
return _setOwner;
}
/// Applies a function to `this`.
void update(Function(SetBuilder<E>) updates) {
updates(this);
}
/// Replaces all elements with elements from an [Iterable].
void replace(Iterable iterable) {
if (iterable is _BuiltSet<E> && iterable._setFactory == _setFactory) {
_withOwner(iterable);
} else {
// Can't use addAll because it requires an Iterable<E>.
var set = _createSet();
for (var element in iterable) {
if (element is E) {
set.add(element);
} else {
throw ArgumentError('iterable contained invalid element: $element');
}
}
_setSafeSet(set);
}
}
/// Uses `base` as the collection type for all sets created by this builder.
///
/// // Iterates over elements in ascending order.
/// new SetBuilder<int>()..withBase(() => new SplayTreeSet<int>());
///
/// // Uses custom equality.
/// new SetBuilder<int>()..withBase(() => new LinkedHashSet<int>(
/// equals: (int a, int b) => a % 255 == b % 255,
/// hashCode: (int n) => (n % 255).hashCode));
///
/// The set returned by `base` must be empty, mutable, and each call must
/// instantiate and return a new object. The methods `difference`,
/// `intersection` and `union` of the returned set must create sets of the
/// same type.
///
/// Use [withDefaultBase] to reset `base` to the default value.
void withBase(_SetFactory<E> base) {
if (base == null) {
throw ArgumentError.notNull('base');
}
_setFactory = base;
_setSafeSet(_createSet()..addAll(_set));
}
/// As [withBase], but sets `base` back to the default value, which
/// instantiates `Set<E>`.
void withDefaultBase() {
_setFactory = null;
_setSafeSet(_createSet()..addAll(_set));
}
// Based on Set.
/// As [Set.length].
int get length => _set.length;
/// As [Set.isEmpty].
bool get isEmpty => _set.isEmpty;
/// As [Set.isNotEmpty].
bool get isNotEmpty => _set.isNotEmpty;
/// As [Set.add].
bool add(E value) {
_checkElement(value);
return _safeSet.add(value);
}
/// As [Set.addAll].
void addAll(Iterable<E> iterable) {
iterable = evaluateIterable(iterable);
_checkElements(iterable);
_safeSet.addAll(iterable);
}
/// As [Set.clear].
void clear() {
_safeSet.clear();
}
/// As [Set.remove].
bool remove(Object value) => _safeSet.remove(value);
/// As [Set.removeAll].
void removeAll(Iterable<Object> elements) {
_safeSet.removeAll(elements);
}
/// As [Set.removeWhere].
void removeWhere(bool Function(E) test) {
_safeSet.removeWhere(test);
}
/// As [Set.retainAll].
void retainAll(Iterable<Object> elements) {
_safeSet.retainAll(elements);
}
/// As [Set.retainWhere].
///
/// This method is an alias of [where].
void retainWhere(bool Function(E) test) {
_safeSet.retainWhere(test);
}
// Based on Iterable.
/// As [Iterable.map], but updates the builder in place. Returns nothing.
void map(E Function(E) f) {
var result = _createSet()..addAll(_set.map(f));
_checkElements(result);
_setSafeSet(result);
}
/// As [Iterable.where], but updates the builder in place. Returns nothing.
///
/// This method is an alias of [retainWhere].
void where(bool Function(E) test) => retainWhere(test);
/// As [Iterable.expand], but updates the builder in place. Returns nothing.
void expand(Iterable<E> Function(E) f) {
var result = _createSet()..addAll(_set.expand(f));
_checkElements(result);
_setSafeSet(result);
}
/// As [Iterable.take], but updates the builder in place. Returns nothing.
void take(int n) {
_setSafeSet(_createSet()..addAll(_set.take(n)));
}
/// As [Iterable.takeWhile], but updates the builder in place. Returns
/// nothing.
void takeWhile(bool Function(E) test) {
_setSafeSet(_createSet()..addAll(_set.takeWhile(test)));
}
/// As [Iterable.skip], but updates the builder in place. Returns nothing.
void skip(int n) {
_setSafeSet(_createSet()..addAll(_set.skip(n)));
}
/// As [Iterable.skipWhile], but updates the builder in place. Returns
/// nothing.
void skipWhile(bool Function(E) test) {
_setSafeSet(_createSet()..addAll(_set.skipWhile(test)));
}
// Internal.
SetBuilder._uninitialized() {
_checkGenericTypeParameter();
}
SetBuilder._fromBuiltSet(_BuiltSet<E> set)
: _setFactory = set._setFactory,
_set = set._set,
_setOwner = set;
void _withOwner(_BuiltSet<E> setOwner) {
assert(setOwner._setFactory == _setFactory,
"Can't reuse a built set that uses a different base");
_set = setOwner._set;
_setOwner = setOwner;
}
void _setSafeSet(Set<E> set) {
_setOwner = null;
_set = set;
}
Set<E> get _safeSet {
if (_setOwner != null) {
_set = _createSet()..addAll(_set);
_setOwner = null;
}
return _set;
}
Set<E> _createSet() => _setFactory != null ? _setFactory() : <E>{};
void _checkGenericTypeParameter() {
if (E == dynamic) {
throw UnsupportedError('explicit element type required, '
'for example "new SetBuilder<int>"');
}
}
void _checkElement(E element) {
if (identical(element, null)) {
throw ArgumentError('null element');
}
}
void _checkElements(Iterable<E> elements) {
for (var element in elements) {
_checkElement(element);
}
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/set_multimap/set_multimap_builder.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.set_multimap;
/// The Built Collection builder for [BuiltSetMultimap].
///
/// It implements the mutating part of the [SetMultimap] interface.
///
/// See the
/// [Built Collection library documentation](#built_collection/built_collection)
/// for the general properties of Built Collections.
class SetMultimapBuilder<K, V> {
// BuiltSets copied from another instance so they can be reused directly for
// keys without changes.
Map<K, BuiltSet<V>> _builtMap;
// Instance that _builtMap belongs to. If present, _builtMap must not be
// mutated.
_BuiltSetMultimap<K, V> _builtMapOwner;
// SetBuilders for keys that are being changed.
Map<K, SetBuilder<V>> _builderMap;
/// Instantiates with elements from a [Map], [SetMultimap] or
/// [BuiltSetMultimap].
///
/// Must be called with a generic type parameter.
///
/// Wrong:
/// `new SetMultimapBuilder({1: ['1'], 2: ['2'], 3: ['3']})`.
///
/// Right:
/// `new SetMultimapBuilder<int, String>({1: ['1'], 2: ['2'], 3: ['3']})`,
///
/// Rejects nulls. Rejects keys and values of the wrong type.
factory SetMultimapBuilder([multimap = const {}]) {
return SetMultimapBuilder<K, V>._uninitialized()..replace(multimap);
}
/// Converts to a [BuiltSetMultimap].
///
/// The `SetMultimapBuilder` can be modified again and used to create any
/// number of `BuiltSetMultimap`s.
BuiltSetMultimap<K, V> build() {
if (_builtMapOwner == null) {
for (var key in _builderMap.keys) {
var builtSet = _builderMap[key].build();
if (builtSet.isEmpty) {
_builtMap.remove(key);
} else {
_builtMap[key] = builtSet;
}
}
_builtMapOwner = _BuiltSetMultimap<K, V>.withSafeMap(_builtMap);
}
return _builtMapOwner;
}
/// Applies a function to `this`.
void update(Function(SetMultimapBuilder<K, V>) updates) {
updates(this);
}
/// Replaces all elements with elements from a [Map], [SetMultimap] or
/// [BuiltSetMultimap].
void replace(dynamic multimap) {
if (multimap is _BuiltSetMultimap<K, V>) {
_setOwner(multimap);
} else if (multimap is Map ||
multimap is SetMultimap ||
multimap is BuiltSetMultimap) {
_setWithCopyAndCheck(multimap.keys, (k) => multimap[k]);
} else {
throw ArgumentError('expected Map, SetMultimap or BuiltSetMultimap, '
'got ${multimap.runtimeType}');
}
}
/// As [Map.fromIterable] but adds.
///
/// Additionally, you may specify [values] instead of [value]. This new
/// parameter allows you to supply a function that returns an [Iterable]
/// of values.
///
/// [key] and [value] default to the identity function. [values] is ignored
/// if not specified.
void addIterable<T>(Iterable<T> iterable,
{K Function(T) key,
V Function(T) value,
Iterable<V> Function(T) values}) {
if (value != null && values != null) {
throw ArgumentError('expected value or values to be set, got both');
}
key ??= (T x) => x as K;
if (values != null) {
for (var element in iterable) {
addValues(key(element), values(element));
}
} else {
value ??= (T x) => x as V;
for (var element in iterable) {
add(key(element), value(element));
}
}
}
// Based on SetMultimap.
/// As [SetMultimap.add].
void add(K key, V value) {
_makeWriteableCopy();
_checkKey(key);
_checkValue(value);
_getValuesBuilder(key).add(value);
}
/// As [SetMultimap.addValues].
void addValues(K key, Iterable<V> values) {
// _disown is called in add.
values.forEach((value) {
add(key, value);
});
}
/// As [SetMultimap.addAll].
void addAll(SetMultimap<K, V> other) {
// _disown is called in add.
other.forEach((key, value) {
add(key, value);
});
}
/// As [SetMultimap.remove] but returns nothing.
void remove(Object key, V value) {
if (key is K) {
_makeWriteableCopy();
_getValuesBuilder(key).remove(value);
}
}
/// As [SetMultimap.removeAll] but returns nothing.
void removeAll(Object key) {
if (key is K) {
_makeWriteableCopy();
_builtMap = _builtMap;
_builderMap[key] = SetBuilder<V>();
}
}
/// As [SetMultimap.clear].
void clear() {
_makeWriteableCopy();
_builtMap.clear();
_builderMap.clear();
}
// Internal.
SetBuilder<V> _getValuesBuilder(K key) {
var result = _builderMap[key];
if (result == null) {
var builtValues = _builtMap[key];
if (builtValues == null) {
result = SetBuilder<V>();
} else {
result = builtValues.toBuilder();
}
_builderMap[key] = result;
}
return result;
}
void _makeWriteableCopy() {
if (_builtMapOwner != null) {
_builtMap = Map<K, BuiltSet<V>>.from(_builtMap);
_builtMapOwner = null;
}
}
SetMultimapBuilder._uninitialized() {
_checkGenericTypeParameter();
}
void _setOwner(_BuiltSetMultimap<K, V> builtSetMultimap) {
_builtMapOwner = builtSetMultimap;
_builtMap = builtSetMultimap._map;
_builderMap = <K, SetBuilder<V>>{};
}
void _setWithCopyAndCheck(Iterable keys, Function lookup) {
_builtMapOwner = null;
_builtMap = <K, BuiltSet<V>>{};
_builderMap = <K, SetBuilder<V>>{};
for (var key in keys) {
if (key is K) {
for (var value in lookup(key)) {
if (value is V) {
add(key, value);
} else {
throw ArgumentError(
'map contained invalid value: $value, for key $key');
}
}
} else {
throw ArgumentError('map contained invalid key: $key');
}
}
}
void _checkGenericTypeParameter() {
if (K == dynamic) {
throw UnsupportedError('explicit key type required, '
'for example "new SetMultimapBuilder<int, int>"');
}
if (V == dynamic) {
throw UnsupportedError('explicit value type required, '
'for example "new SetMultimapBuilder<int, int>"');
}
}
void _checkKey(K key) {
if (identical(key, null)) {
throw ArgumentError('invalid key: $key');
}
}
void _checkValue(V value) {
if (identical(value, null)) {
throw ArgumentError('invalid value: $value');
}
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/built_collection/src/set_multimap/built_set_multimap.dart | // Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of built_collection.set_multimap;
/// The Built Collection [SetMultimap].
///
/// It implements the non-mutating part of the [SetMultimap] interface.
/// Iteration over keys is in the same order in which they were inserted.
/// Modifications are made via [SetMultimapBuilder].
///
/// See the
/// [Built Collection library documentation](#built_collection/built_collection)
/// for the general properties of Built Collections.
abstract class BuiltSetMultimap<K, V> {
final Map<K, BuiltSet<V>> _map;
// Precomputed.
final BuiltSet<V> _emptySet = BuiltSet<V>();
// Cached.
int _hashCode;
Iterable<K> _keys;
Iterable<V> _values;
/// Instantiates with elements from a [Map], [SetMultimap] or
/// [BuiltSetMultimap].
///
/// Must be called with a generic type parameter.
///
/// Wrong:
/// `new BuiltSetMultimap({1: ['1'], 2: ['2'], 3: ['3']})`.
///
/// Right:
/// `new BuiltSetMultimap<int, String>({1: ['1'], 2: ['2'], 3: ['3']})`,
///
/// Rejects nulls. Rejects keys and values of the wrong type.
factory BuiltSetMultimap([multimap = const {}]) {
if (multimap is _BuiltSetMultimap &&
multimap.hasExactKeyAndValueTypes(K, V)) {
return multimap as BuiltSetMultimap<K, V>;
} else if (multimap is Map ||
multimap is SetMultimap ||
multimap is BuiltSetMultimap) {
return _BuiltSetMultimap<K, V>.copyAndCheck(
multimap.keys, (k) => multimap[k]);
} else {
throw ArgumentError('expected Map, SetMultimap or BuiltSetMultimap, '
'got ${multimap.runtimeType}');
}
}
/// Creates a [SetMultimapBuilder], applies updates to it, and builds.
factory BuiltSetMultimap.build(Function(SetMultimapBuilder<K, V>) updates) =>
(SetMultimapBuilder<K, V>()..update(updates)).build();
/// Converts to a [SetMultimapBuilder] for modification.
///
/// The `BuiltSetMultimap` remains immutable and can continue to be used.
SetMultimapBuilder<K, V> toBuilder() => SetMultimapBuilder<K, V>(this);
/// Converts to a [SetMultimapBuilder], applies updates to it, and builds.
BuiltSetMultimap<K, V> rebuild(Function(SetMultimapBuilder<K, V>) updates) =>
(toBuilder()..update(updates)).build();
/// Converts to a [Map].
///
/// Note that the implementation is efficient: it returns a copy-on-write
/// wrapper around the data from this `BuiltSetMultimap`. So, if no mutations
/// are made to the result, no copy is made.
///
/// This allows efficient use of APIs that ask for a mutable collection
/// but don't actually mutate it.
Map<K, BuiltSet<V>> toMap() => CopyOnWriteMap<K, BuiltSet<V>>(_map);
/// Deep hashCode.
///
/// A `BuiltSetMultimap` is only equal to another `BuiltSetMultimap` with
/// equal key/values pairs in any order. Then, the `hashCode` is guaranteed
/// to be the same.
@override
int get hashCode {
_hashCode ??= hashObjects(_map.keys
.map((key) => hash2(key.hashCode, _map[key].hashCode))
.toList(growable: false)
..sort());
return _hashCode;
}
/// Deep equality.
///
/// A `BuiltSetMultimap` is only equal to another `BuiltSetMultimap` with
/// equal key/values pairs in any order.
@override
bool operator ==(dynamic other) {
if (identical(other, this)) return true;
if (other is! BuiltSetMultimap) return false;
if (other.length != length) return false;
if (other.hashCode != hashCode) return false;
for (var key in keys) {
if (other[key] != this[key]) return false;
}
return true;
}
/// Returns as an immutable map.
///
/// Useful when producing or using APIs that need the [Map] interface. This
/// differs from [toMap] where mutations are explicitly disallowed.
Map<K, Iterable<V>> asMap() => Map<K, Iterable<V>>.unmodifiable(_map);
@override
String toString() => _map.toString();
// SetMultimap.
/// As [SetMultimap], but results are [BuiltSet]s and not mutable.
BuiltSet<V> operator [](Object key) {
var result = _map[key];
return identical(result, null) ? _emptySet : result;
}
/// As [SetMultimap.containsKey].
bool containsKey(Object key) => _map.containsKey(key);
/// As [SetMultimap.containsValue].
bool containsValue(Object value) => values.contains(value);
/// As [SetMultimap.forEach].
void forEach(void Function(K, V) f) {
_map.forEach((key, values) {
values.forEach((value) {
f(key, value);
});
});
}
/// As [SetMultimap.forEachKey].
void forEachKey(void Function(K, Iterable<V>) f) {
_map.forEach((key, values) {
f(key, values);
});
}
/// As [SetMultimap.isEmpty].
bool get isEmpty => _map.isEmpty;
/// As [SetMultimap.isNotEmpty].
bool get isNotEmpty => _map.isNotEmpty;
/// As [SetMultimap.keys], but result is stable; it always returns the same
/// instance.
Iterable<K> get keys {
_keys ??= _map.keys;
return _keys;
}
/// As [SetMultimap.length].
int get length => _map.length;
/// As [SetMultimap.values], but result is stable; it always returns the
/// same instance.
Iterable<V> get values {
_values ??= _map.values.expand((x) => x);
return _values;
}
// Internal.
BuiltSetMultimap._(this._map) {
if (K == dynamic) {
throw UnsupportedError('explicit key type required, '
'for example "new BuiltSetMultimap<int, int>"');
}
if (V == dynamic) {
throw UnsupportedError('explicit value type required,'
' for example "new BuiltSetMultimap<int, int>"');
}
}
}
/// Default implementation of the public [BuiltSetMultimap] interface.
class _BuiltSetMultimap<K, V> extends BuiltSetMultimap<K, V> {
_BuiltSetMultimap.withSafeMap(Map<K, BuiltSet<V>> map) : super._(map);
_BuiltSetMultimap.copyAndCheck(Iterable keys, Function lookup)
: super._(<K, BuiltSet<V>>{}) {
for (var key in keys) {
if (key is K) {
_map[key] = BuiltSet<V>(lookup(key));
} else {
throw ArgumentError('map contained invalid key: $key');
}
}
}
bool hasExactKeyAndValueTypes(Type key, Type value) => K == key && V == value;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/node_preamble/preamble.dart | library node_preamble;
final _minified = r"""var dartNodePreambleSelf="undefined"!=typeof global?global:window,self=Object.create(dartNodePreambleSelf);if(self.scheduleImmediate=self.setImmediate?function(e){dartNodePreambleSelf.setImmediate(e)}:function(e){setTimeout(e,0)},self.require=require,self.exports=exports,"undefined"!=typeof process)self.process=process;if("undefined"!=typeof __dirname)self.__dirname=__dirname;if("undefined"!=typeof __filename)self.__filename=__filename;var dartNodeIsActuallyNode=!dartNodePreambleSelf.window;try{if("undefined"!=typeof WorkerGlobalScope&&dartNodePreambleSelf instanceof WorkerGlobalScope)dartNodeIsActuallyNode=!1;if(dartNodePreambleSelf.process&&dartNodePreambleSelf.process.versions&&dartNodePreambleSelf.process.versions.hasOwnProperty("electron")&&dartNodePreambleSelf.process.versions.hasOwnProperty("node"))dartNodeIsActuallyNode=!0}catch(e){}if(dartNodeIsActuallyNode){var url=("undefined"!=typeof __webpack_require__?__non_webpack_require__:require)("url");self.location={get href(){if(url.pathToFileURL)return url.pathToFileURL(process.cwd()).href+"/";else return"file://"+function(){var e=process.cwd();if("win32"!=process.platform)return e;else return"/"+e.replace(/\\/g,"/")}()+"/"}},function(){function e(){try{throw new Error}catch(t){var e=t.stack,r=new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$","mg"),l=null;do{var o=r.exec(e);if(null!=o)l=o}while(null!=o);return l[1]}}var r=null;self.document={get currentScript(){if(null==r)r={src:e()};return r}}}(),self.dartDeferredLibraryLoader=function(e,r,l){try{load(e),r()}catch(e){l(e)}}}""";
final _normal = r"""
// make sure to keep this as 'var'
// we don't want block scoping
var dartNodePreambleSelf = typeof global !== "undefined" ? global : window;
var self = Object.create(dartNodePreambleSelf);
self.scheduleImmediate = self.setImmediate
? function (cb) {
dartNodePreambleSelf.setImmediate(cb);
}
: function(cb) {
setTimeout(cb, 0);
};
// CommonJS globals.
self.require = require;
self.exports = exports;
// Node.js specific exports, check to see if they exist & or polyfilled
if (typeof process !== "undefined") {
self.process = process;
}
if (typeof __dirname !== "undefined") {
self.__dirname = __dirname;
}
if (typeof __filename !== "undefined") {
self.__filename = __filename;
}
// if we're running in a browser, Dart supports most of this out of box
// make sure we only run these in Node.js environment
var dartNodeIsActuallyNode = !dartNodePreambleSelf.window
try {
// Check if we're in a Web Worker instead.
if ("undefined" !== typeof WorkerGlobalScope && dartNodePreambleSelf instanceof WorkerGlobalScope) {
dartNodeIsActuallyNode = false;
}
// Check if we're in Electron, with Node.js integration, and override if true.
if (dartNodePreambleSelf.process && dartNodePreambleSelf.process.versions && dartNodePreambleSelf.process.versions.hasOwnProperty('electron') && dartNodePreambleSelf.process.versions.hasOwnProperty('node')) {
dartNodeIsActuallyNode = true;
}
} catch(e) {}
if (dartNodeIsActuallyNode) {
// This line is to:
// 1) Prevent Webpack from bundling.
// 2) In Webpack on Node.js, make sure we're using the native Node.js require, which is available via __non_webpack_require__
// https://github.com/mbullington/node_preamble.dart/issues/18#issuecomment-527305561
var url = ("undefined" !== typeof __webpack_require__ ? __non_webpack_require__ : require)("url");
self.location = {
get href() {
if (url.pathToFileURL) {
return url.pathToFileURL(process.cwd()).href + "/";
} else {
// This isn't really a correct transformation, but it's the best we have
// for versions of Node <10.12.0 which introduced `url.pathToFileURL()`.
// For example, it will fail for paths that contain characters that need
// to be escaped in URLs.
return "file://" + (function() {
var cwd = process.cwd();
if (process.platform != "win32") return cwd;
return "/" + cwd.replace(/\\/g, "/");
})() + "/"
}
}
};
(function() {
function computeCurrentScript() {
try {
throw new Error();
} catch(e) {
var stack = e.stack;
var re = new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$", "mg");
var lastMatch = null;
do {
var match = re.exec(stack);
if (match != null) lastMatch = match;
} while (match != null);
return lastMatch[1];
}
}
var cachedCurrentScript = null;
self.document = {
get currentScript() {
if (cachedCurrentScript == null) {
cachedCurrentScript = {src: computeCurrentScript()};
}
return cachedCurrentScript;
}
};
})();
self.dartDeferredLibraryLoader = function(uri, successCallback, errorCallback) {
try {
load(uri);
successCallback();
} catch (error) {
errorCallback(error);
}
};
}
""";
/// Returns the text of the preamble.
///
/// If [minified] is true, returns the minified version rather than the
/// human-readable version.
String getPreamble({bool minified: false, List<String> additionalGlobals: const []}) =>
(minified ? _minified : _normal) +
(additionalGlobals == null ? "" :
additionalGlobals.map((global) => "self.$global=$global;").join());
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/command_runner.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:collection';
import 'dart:math' as math;
import 'src/arg_parser.dart';
import 'src/arg_parser_exception.dart';
import 'src/arg_results.dart';
import 'src/help_command.dart';
import 'src/usage_exception.dart';
import 'src/utils.dart';
export 'src/usage_exception.dart';
/// A class for invoking [Command]s based on raw command-line arguments.
///
/// The type argument `T` represents the type returned by [Command.run] and
/// [CommandRunner.run]; it can be ommitted if you're not using the return
/// values.
class CommandRunner<T> {
/// The name of the executable being run.
///
/// Used for error reporting and [usage].
final String executableName;
/// A short description of this executable.
final String description;
/// A single-line template for how to invoke this executable.
///
/// Defaults to "$executableName <command> `arguments`". Subclasses can
/// override this for a more specific template.
String get invocation => '$executableName <command> [arguments]';
/// Generates a string displaying usage information for the executable.
///
/// This includes usage for the global arguments as well as a list of
/// top-level commands.
String get usage => _wrap('$description\n\n') + _usageWithoutDescription;
/// An optional footer for [usage].
///
/// If a subclass overrides this to return a string, it will automatically be
/// added to the end of [usage].
String get usageFooter => null;
/// Returns [usage] with [description] removed from the beginning.
String get _usageWithoutDescription {
var usagePrefix = 'Usage:';
var buffer = StringBuffer();
buffer.writeln(
'$usagePrefix ${_wrap(invocation, hangingIndent: usagePrefix.length)}\n');
buffer.writeln(_wrap('Global options:'));
buffer.writeln('${argParser.usage}\n');
buffer.writeln(
'${_getCommandUsage(_commands, lineLength: argParser.usageLineLength)}\n');
buffer.write(_wrap(
'Run "$executableName help <command>" for more information about a command.'));
if (usageFooter != null) {
buffer.write('\n${_wrap(usageFooter)}');
}
return buffer.toString();
}
/// An unmodifiable view of all top-level commands defined for this runner.
Map<String, Command<T>> get commands => UnmodifiableMapView(_commands);
final _commands = <String, Command<T>>{};
/// The top-level argument parser.
///
/// Global options should be registered with this parser; they'll end up
/// available via [Command.globalResults]. Commands should be registered with
/// [addCommand] rather than directly on the parser.
ArgParser get argParser => _argParser;
final ArgParser _argParser;
CommandRunner(this.executableName, this.description, {int usageLineLength})
: _argParser = ArgParser(usageLineLength: usageLineLength) {
argParser.addFlag('help',
abbr: 'h', negatable: false, help: 'Print this usage information.');
addCommand(HelpCommand<T>());
}
/// Prints the usage information for this runner.
///
/// This is called internally by [run] and can be overridden by subclasses to
/// control how output is displayed or integrate with a logging system.
void printUsage() => print(usage);
/// Throws a [UsageException] with [message].
void usageException(String message) =>
throw UsageException(message, _usageWithoutDescription);
/// Adds [Command] as a top-level command to this runner.
void addCommand(Command<T> command) {
var names = [command.name, ...command.aliases];
for (var name in names) {
_commands[name] = command;
argParser.addCommand(name, command.argParser);
}
command._runner = this;
}
/// Parses [args] and invokes [Command.run] on the chosen command.
///
/// This always returns a [Future] in case the command is asynchronous. The
/// [Future] will throw a [UsageException] if [args] was invalid.
Future<T> run(Iterable<String> args) =>
Future.sync(() => runCommand(parse(args)));
/// Parses [args] and returns the result, converting an [ArgParserException]
/// to a [UsageException].
///
/// This is notionally a protected method. It may be overridden or called from
/// subclasses, but it shouldn't be called externally.
ArgResults parse(Iterable<String> args) {
try {
return argParser.parse(args);
} on ArgParserException catch (error) {
if (error.commands.isEmpty) usageException(error.message);
var command = commands[error.commands.first];
for (var commandName in error.commands.skip(1)) {
command = command.subcommands[commandName];
}
command.usageException(error.message);
return null;
}
}
/// Runs the command specified by [topLevelResults].
///
/// This is notionally a protected method. It may be overridden or called from
/// subclasses, but it shouldn't be called externally.
///
/// It's useful to override this to handle global flags and/or wrap the entire
/// command in a block. For example, you might handle the `--verbose` flag
/// here to enable verbose logging before running the command.
///
/// This returns the return value of [Command.run].
Future<T> runCommand(ArgResults topLevelResults) async {
var argResults = topLevelResults;
var commands = _commands;
Command command;
var commandString = executableName;
while (commands.isNotEmpty) {
if (argResults.command == null) {
if (argResults.rest.isEmpty) {
if (command == null) {
// No top-level command was chosen.
printUsage();
return null;
}
command.usageException('Missing subcommand for "$commandString".');
} else {
if (command == null) {
usageException(
'Could not find a command named "${argResults.rest[0]}".');
}
command.usageException('Could not find a subcommand named '
'"${argResults.rest[0]}" for "$commandString".');
}
}
// Step into the command.
argResults = argResults.command;
command = commands[argResults.name];
command._globalResults = topLevelResults;
command._argResults = argResults;
commands = command._subcommands;
commandString += ' ${argResults.name}';
if (argResults.options.contains('help') && argResults['help']) {
command.printUsage();
return null;
}
}
if (topLevelResults['help']) {
command.printUsage();
return null;
}
// Make sure there aren't unexpected arguments.
if (!command.takesArguments && argResults.rest.isNotEmpty) {
command.usageException(
'Command "${argResults.name}" does not take any arguments.');
}
return (await command.run()) as T;
}
String _wrap(String text, {int hangingIndent}) => wrapText(text,
length: argParser.usageLineLength, hangingIndent: hangingIndent);
}
/// A single command.
///
/// A command is known as a "leaf command" if it has no subcommands and is meant
/// to be run. Leaf commands must override [run].
///
/// A command with subcommands is known as a "branch command" and cannot be run
/// itself. It should call [addSubcommand] (often from the constructor) to
/// register subcommands.
abstract class Command<T> {
/// The name of this command.
String get name;
/// A description of this command, included in [usage].
String get description;
/// A short description of this command, included in [parent]'s
/// [CommandRunner.usage].
///
/// This defaults to the first line of [description].
String get summary => description.split('\n').first;
/// A single-line template for how to invoke this command (e.g. `"pub get
/// `package`"`).
String get invocation {
var parents = [name];
for (var command = parent; command != null; command = command.parent) {
parents.add(command.name);
}
parents.add(runner.executableName);
var invocation = parents.reversed.join(' ');
return _subcommands.isNotEmpty
? '$invocation <subcommand> [arguments]'
: '$invocation [arguments]';
}
/// The command's parent command, if this is a subcommand.
///
/// This will be `null` until [addSubcommand] has been called with
/// this command.
Command<T> get parent => _parent;
Command<T> _parent;
/// The command runner for this command.
///
/// This will be `null` until [CommandRunner.addCommand] has been called with
/// this command or one of its parents.
CommandRunner<T> get runner {
if (parent == null) return _runner;
return parent.runner;
}
CommandRunner<T> _runner;
/// The parsed global argument results.
///
/// This will be `null` until just before [Command.run] is called.
ArgResults get globalResults => _globalResults;
ArgResults _globalResults;
/// The parsed argument results for this command.
///
/// This will be `null` until just before [Command.run] is called.
ArgResults get argResults => _argResults;
ArgResults _argResults;
/// The argument parser for this command.
///
/// Options for this command should be registered with this parser (often in
/// the constructor); they'll end up available via [argResults]. Subcommands
/// should be registered with [addSubcommand] rather than directly on the
/// parser.
///
/// This can be overridden to change the arguments passed to the `ArgParser`
/// constructor.
ArgParser get argParser => _argParser;
final _argParser = ArgParser();
/// Generates a string displaying usage information for this command.
///
/// This includes usage for the command's arguments as well as a list of
/// subcommands, if there are any.
String get usage => _wrap('$description\n\n') + _usageWithoutDescription;
/// An optional footer for [usage].
///
/// If a subclass overrides this to return a string, it will automatically be
/// added to the end of [usage].
String get usageFooter => null;
String _wrap(String text, {int hangingIndent}) {
return wrapText(text,
length: argParser.usageLineLength, hangingIndent: hangingIndent);
}
/// Returns [usage] with [description] removed from the beginning.
String get _usageWithoutDescription {
var length = argParser.usageLineLength;
var usagePrefix = 'Usage: ';
var buffer = StringBuffer()
..writeln(
usagePrefix + _wrap(invocation, hangingIndent: usagePrefix.length))
..writeln(argParser.usage);
if (_subcommands.isNotEmpty) {
buffer.writeln();
buffer.writeln(_getCommandUsage(
_subcommands,
isSubcommand: true,
lineLength: length,
));
}
buffer.writeln();
buffer.write(
_wrap('Run "${runner.executableName} help" to see global options.'));
if (usageFooter != null) {
buffer.writeln();
buffer.write(_wrap(usageFooter));
}
return buffer.toString();
}
/// An unmodifiable view of all sublevel commands of this command.
Map<String, Command<T>> get subcommands => UnmodifiableMapView(_subcommands);
final _subcommands = <String, Command<T>>{};
/// Whether or not this command should be hidden from help listings.
///
/// This is intended to be overridden by commands that want to mark themselves
/// hidden.
///
/// By default, leaf commands are always visible. Branch commands are visible
/// as long as any of their leaf commands are visible.
bool get hidden {
// Leaf commands are visible by default.
if (_subcommands.isEmpty) return false;
// Otherwise, a command is hidden if all of its subcommands are.
return _subcommands.values.every((subcommand) => subcommand.hidden);
}
/// Whether or not this command takes positional arguments in addition to
/// options.
///
/// If false, [CommandRunner.run] will throw a [UsageException] if arguments
/// are provided. Defaults to true.
///
/// This is intended to be overridden by commands that don't want to receive
/// arguments. It has no effect for branch commands.
bool get takesArguments => true;
/// Alternate names for this command.
///
/// These names won't be used in the documentation, but they will work when
/// invoked on the command line.
///
/// This is intended to be overridden.
List<String> get aliases => const [];
Command() {
if (!argParser.allowsAnything) {
argParser.addFlag('help',
abbr: 'h', negatable: false, help: 'Print this usage information.');
}
}
/// Runs this command.
///
/// The return value is wrapped in a `Future` if necessary and returned by
/// [CommandRunner.runCommand].
FutureOr<T> run() {
throw UnimplementedError(_wrap('Leaf command $this must implement run().'));
}
/// Adds [Command] as a subcommand of this.
void addSubcommand(Command<T> command) {
var names = [command.name, ...command.aliases];
for (var name in names) {
_subcommands[name] = command;
argParser.addCommand(name, command.argParser);
}
command._parent = this;
}
/// Prints the usage information for this command.
///
/// This is called internally by [run] and can be overridden by subclasses to
/// control how output is displayed or integrate with a logging system.
void printUsage() => print(usage);
/// Throws a [UsageException] with [message].
void usageException(String message) =>
throw UsageException(_wrap(message), _usageWithoutDescription);
}
/// Returns a string representation of [commands] fit for use in a usage string.
///
/// [isSubcommand] indicates whether the commands should be called "commands" or
/// "subcommands".
String _getCommandUsage(Map<String, Command> commands,
{bool isSubcommand = false, int lineLength}) {
// Don't include aliases.
var names =
commands.keys.where((name) => !commands[name].aliases.contains(name));
// Filter out hidden ones, unless they are all hidden.
var visible = names.where((name) => !commands[name].hidden);
if (visible.isNotEmpty) names = visible;
// Show the commands alphabetically.
names = names.toList()..sort();
var length = names.map((name) => name.length).reduce(math.max);
var buffer = StringBuffer('Available ${isSubcommand ? "sub" : ""}commands:');
var columnStart = length + 5;
for (var name in names) {
var lines = wrapTextAsLines(commands[name].summary,
start: columnStart, length: lineLength);
buffer.writeln();
buffer.write(' ${padRight(name, length)} ${lines.first}');
for (var line in lines.skip(1)) {
buffer.writeln();
buffer.write(' ' * columnStart);
buffer.write(line);
}
}
return buffer.toString();
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/args.dart | // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
export 'src/arg_parser.dart';
export 'src/arg_parser_exception.dart';
export 'src/arg_results.dart' hide newArgResults;
export 'src/option.dart' hide newOption;
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/arg_results.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:collection';
import 'arg_parser.dart';
/// Creates a new [ArgResults].
///
/// Since [ArgResults] doesn't have a public constructor, this lets [ArgParser]
/// get to it. This function isn't exported to the public API of the package.
ArgResults newArgResults(
ArgParser parser,
Map<String, dynamic> parsed,
String name,
ArgResults command,
List<String> rest,
List<String> arguments) {
return ArgResults._(parser, parsed, name, command, rest, arguments);
}
/// The results of parsing a series of command line arguments using
/// [ArgParser.parse()].
///
/// Includes the parsed options and any remaining unparsed command line
/// arguments.
class ArgResults {
/// The [ArgParser] whose options were parsed for these results.
final ArgParser _parser;
/// The option values that were parsed from arguments.
final Map<String, dynamic> _parsed;
/// If these are the results for parsing a command's options, this will be the
/// name of the command. For top-level results, this returns `null`.
final String name;
/// The command that was selected, or `null` if none was.
///
/// This will contain the options that were selected for that command.
final ArgResults command;
/// The remaining command-line arguments that were not parsed as options or
/// flags.
///
/// If `--` was used to separate the options from the remaining arguments,
/// it will not be included in this list unless parsing stopped before the
/// `--` was reached.
final List<String> rest;
/// The original list of arguments that were parsed.
final List<String> arguments;
/// Creates a new [ArgResults].
ArgResults._(this._parser, this._parsed, this.name, this.command,
List<String> rest, List<String> arguments)
: rest = UnmodifiableListView(rest),
arguments = UnmodifiableListView(arguments);
/// Gets the parsed command-line option named [name].
dynamic operator [](String name) {
if (!_parser.options.containsKey(name)) {
throw ArgumentError('Could not find an option named "$name".');
}
return _parser.options[name].getOrDefault(_parsed[name]);
}
/// Get the names of the available options as an [Iterable].
///
/// This includes the options whose values were parsed or that have defaults.
/// Options that weren't present and have no default will be omitted.
Iterable<String> get options {
var result = Set<String>.from(_parsed.keys);
// Include the options that have defaults.
_parser.options.forEach((name, option) {
if (option.defaultsTo != null) result.add(name);
});
return result;
}
/// Returns `true` if the option with [name] was parsed from an actual
/// argument.
///
/// Returns `false` if it wasn't provided and the default value or no default
/// value would be used instead.
bool wasParsed(String name) {
var option = _parser.options[name];
if (option == null) {
throw ArgumentError('Could not find an option named "$name".');
}
return _parsed.containsKey(name);
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/arg_parser.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// TODO(nweiz): Remove this ignore when sdk#30084 is fixed or when args no
// longer refers to its own deprecated members.
// ignore_for_file: deprecated_member_use
import 'dart:collection';
import 'allow_anything_parser.dart';
import 'arg_results.dart';
import 'option.dart';
import 'parser.dart';
import 'usage.dart';
/// A class for taking a list of raw command line arguments and parsing out
/// options and flags from them.
class ArgParser {
final Map<String, Option> _options;
final Map<String, ArgParser> _commands;
/// The options that have been defined for this parser.
final Map<String, Option> options;
/// The commands that have been defined for this parser.
final Map<String, ArgParser> commands;
/// A list of the [Option]s in [options] intermingled with [String]
/// separators.
final _optionsAndSeparators = [];
/// Whether or not this parser parses options that appear after non-option
/// arguments.
final bool allowTrailingOptions;
/// An optional maximum line length for [usage] messages.
///
/// If specified, then help messages in the usage are wrapped at the given
/// column, after taking into account the width of the options. Will refuse to
/// wrap help text to less than 10 characters of help text per line if there
/// isn't enough space on the line. It preserves embedded newlines, and
/// attempts to wrap at whitespace breaks (although it will split words if
/// there is no whitespace at which to split).
///
/// If null (the default), help messages are not wrapped.
final int usageLineLength;
/// Whether or not this parser treats unrecognized options as non-option
/// arguments.
bool get allowsAnything => false;
/// Creates a new ArgParser.
///
/// If [allowTrailingOptions] is `true` (the default), the parser will parse
/// flags and options that appear after positional arguments. If it's `false`,
/// the parser stops parsing as soon as it finds an argument that is neither
/// an option nor a command.
factory ArgParser({bool allowTrailingOptions = true, int usageLineLength}) =>
ArgParser._(<String, Option>{}, <String, ArgParser>{},
allowTrailingOptions: allowTrailingOptions,
usageLineLength: usageLineLength);
/// Creates a new ArgParser that treats *all input* as non-option arguments.
///
/// This is intended to allow arguments to be passed through to child
/// processes without needing to be redefined in the parent.
///
/// Options may not be defined for this parser.
factory ArgParser.allowAnything() = AllowAnythingParser;
ArgParser._(Map<String, Option> options, Map<String, ArgParser> commands,
{bool allowTrailingOptions = true, this.usageLineLength})
: _options = options,
options = UnmodifiableMapView(options),
_commands = commands,
commands = UnmodifiableMapView(commands),
allowTrailingOptions = allowTrailingOptions ?? false;
/// Defines a command.
///
/// A command is a named argument which may in turn define its own options and
/// subcommands using the given parser. If [parser] is omitted, implicitly
/// creates a new one. Returns the parser for the command.
///
/// Note that adding commands this way will not impact the [usage] string. To
/// add commands which are included in the usage string see `CommandRunner`.
ArgParser addCommand(String name, [ArgParser parser]) {
// Make sure the name isn't in use.
if (_commands.containsKey(name)) {
throw ArgumentError('Duplicate command "$name".');
}
parser ??= ArgParser();
_commands[name] = parser;
return parser;
}
/// Defines a boolean flag.
///
/// This adds an [Option] with the given properties to [options].
///
/// The [abbr] argument is a single-character string that can be used as a
/// shorthand for this flag. For example, `abbr: "a"` will allow the user to
/// pass `-a` to enable the flag.
///
/// The [help] argument is used by [usage] to describe this flag.
///
/// The [defaultsTo] argument indicates the value this flag will have if the
/// user doesn't explicitly pass it in.
///
/// The [negatable] argument indicates whether this flag's value can be set to
/// `false`. For example, if [name] is `flag`, the user can pass `--no-flag`
/// to set its value to `false`.
///
/// The [callback] argument is invoked with the flag's value when the flag
/// is parsed. Note that this makes argument parsing order-dependent in ways
/// that are often surprising, and its use is discouraged in favor of reading
/// values from the [ArgResults].
///
/// If [hide] is `true`, this option won't be included in [usage].
///
/// Throws an [ArgumentError] if:
///
/// * There is already an option named [name].
/// * There is already an option using abbreviation [abbr].
void addFlag(String name,
{String abbr,
String help,
bool defaultsTo = false,
bool negatable = true,
void Function(bool) callback,
bool hide = false}) {
_addOption(
name,
abbr,
help,
null,
null,
null,
defaultsTo,
callback == null ? null : (value) => callback(value as bool),
OptionType.flag,
negatable: negatable,
hide: hide);
}
/// Defines an option that takes a value.
///
/// This adds an [Option] with the given properties to [options].
///
/// The [abbr] argument is a single-character string that can be used as a
/// shorthand for this option. For example, `abbr: "a"` will allow the user to
/// pass `-a value` or `-avalue`.
///
/// The [help] argument is used by [usage] to describe this option.
///
/// The [valueHelp] argument is used by [usage] as a name for the value this
/// option takes. For example, `valueHelp: "FOO"` will include
/// `--option=<FOO>` rather than just `--option` in the usage string.
///
/// The [allowed] argument is a list of valid values for this option. If
/// it's non-`null` and the user passes a value that's not included in the
/// list, [parse] will throw a [FormatException]. The allowed values will also
/// be included in [usage].
///
/// The [allowedHelp] argument is a map from values in [allowed] to
/// documentation for those values that will be included in [usage].
///
/// The [defaultsTo] argument indicates the value this option will have if the
/// user doesn't explicitly pass it in (or `null` by default).
///
/// The [callback] argument is invoked with the option's value when the option
/// is parsed. Note that this makes argument parsing order-dependent in ways
/// that are often surprising, and its use is discouraged in favor of reading
/// values from the [ArgResults].
///
/// The [allowMultiple] and [splitCommas] options are deprecated; the
/// [addMultiOption] method should be used instead.
///
/// If [hide] is `true`, this option won't be included in [usage].
///
/// Throws an [ArgumentError] if:
///
/// * There is already an option with name [name].
/// * There is already an option using abbreviation [abbr].
/// * [splitCommas] is passed but [allowMultiple] is `false`.
void addOption(String name,
{String abbr,
String help,
String valueHelp,
Iterable<String> allowed,
Map<String, String> allowedHelp,
String defaultsTo,
Function callback,
@Deprecated('Use addMultiOption() instead.') bool allowMultiple = false,
@Deprecated('Use addMultiOption() instead.') bool splitCommas,
bool hide = false}) {
if (!allowMultiple && splitCommas != null) {
throw ArgumentError(
'splitCommas may not be set if allowMultiple is false.');
}
_addOption(
name,
abbr,
help,
valueHelp,
allowed,
allowedHelp,
allowMultiple
? (defaultsTo == null ? <String>[] : [defaultsTo])
: defaultsTo,
callback,
allowMultiple ? OptionType.multiple : OptionType.single,
splitCommas: splitCommas,
hide: hide);
}
/// Defines an option that takes multiple values.
///
/// The [abbr] argument is a single-character string that can be used as a
/// shorthand for this option. For example, `abbr: "a"` will allow the user to
/// pass `-a value` or `-avalue`.
///
/// The [help] argument is used by [usage] to describe this option.
///
/// The [valueHelp] argument is used by [usage] as a name for the value this
/// argument takes. For example, `valueHelp: "FOO"` will include
/// `--option=<FOO>` rather than just `--option` in the usage string.
///
/// The [allowed] argument is a list of valid values for this argument. If
/// it's non-`null` and the user passes a value that's not included in the
/// list, [parse] will throw a [FormatException]. The allowed values will also
/// be included in [usage].
///
/// The [allowedHelp] argument is a map from values in [allowed] to
/// documentation for those values that will be included in [usage].
///
/// The [defaultsTo] argument indicates the values this option will have if
/// the user doesn't explicitly pass it in (or `[]` by default).
///
/// The [callback] argument is invoked with the option's value when the option
/// is parsed. Note that this makes argument parsing order-dependent in ways
/// that are often surprising, and its use is discouraged in favor of reading
/// values from the [ArgResults].
///
/// If [splitCommas] is `true` (the default), multiple options may be passed
/// by writing `--option a,b` in addition to `--option a --option b`.
///
/// If [hide] is `true`, this option won't be included in [usage].
///
/// Throws an [ArgumentError] if:
///
/// * There is already an option with name [name].
/// * There is already an option using abbreviation [abbr].
void addMultiOption(String name,
{String abbr,
String help,
String valueHelp,
Iterable<String> allowed,
Map<String, String> allowedHelp,
Iterable<String> defaultsTo,
void Function(List<String>) callback,
bool splitCommas = true,
bool hide = false}) {
_addOption(
name,
abbr,
help,
valueHelp,
allowed,
allowedHelp,
defaultsTo?.toList() ?? <String>[],
callback == null ? null : (value) => callback(value as List<String>),
OptionType.multiple,
splitCommas: splitCommas,
hide: hide);
}
void _addOption(
String name,
String abbr,
String help,
String valueHelp,
Iterable<String> allowed,
Map<String, String> allowedHelp,
defaultsTo,
Function callback,
OptionType type,
{bool negatable = false,
bool splitCommas,
bool hide = false}) {
// Make sure the name isn't in use.
if (_options.containsKey(name)) {
throw ArgumentError('Duplicate option "$name".');
}
// Make sure the abbreviation isn't too long or in use.
if (abbr != null) {
var existing = findByAbbreviation(abbr);
if (existing != null) {
throw ArgumentError(
'Abbreviation "$abbr" is already used by "${existing.name}".');
}
}
var option = newOption(name, abbr, help, valueHelp, allowed, allowedHelp,
defaultsTo, callback, type,
negatable: negatable, splitCommas: splitCommas, hide: hide);
_options[name] = option;
_optionsAndSeparators.add(option);
}
/// Adds a separator line to the usage.
///
/// In the usage text for the parser, this will appear between any options
/// added before this call and ones added after it.
void addSeparator(String text) {
_optionsAndSeparators.add(text);
}
/// Parses [args], a list of command-line arguments, matches them against the
/// flags and options defined by this parser, and returns the result.
ArgResults parse(Iterable<String> args) =>
Parser(null, this, Queue.of(args)).parse();
/// Generates a string displaying usage information for the defined options.
///
/// This is basically the help text shown on the command line.
@Deprecated('Replaced with get usage. getUsage() will be removed in args 1.0')
String getUsage() => usage;
/// Generates a string displaying usage information for the defined options.
///
/// This is basically the help text shown on the command line.
String get usage {
return Usage(_optionsAndSeparators, lineLength: usageLineLength).generate();
}
/// Get the default value for an option. Useful after parsing to test if the
/// user specified something other than the default.
dynamic getDefault(String option) {
if (!options.containsKey(option)) {
throw ArgumentError('No option named $option');
}
return options[option].defaultsTo;
}
/// Finds the option whose abbreviation is [abbr], or `null` if no option has
/// that abbreviation.
Option findByAbbreviation(String abbr) {
return options.values
.firstWhere((option) => option.abbr == abbr, orElse: () => null);
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/arg_parser_exception.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// An exception thrown by `ArgParser`.
class ArgParserException extends FormatException {
/// The command(s) that were parsed before discovering the error.
///
/// This will be empty if the error was on the root parser.
final List<String> commands;
ArgParserException(String message, [Iterable<String> commands])
: commands = commands == null ? const [] : List.unmodifiable(commands),
super(message);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/allow_anything_parser.dart | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:collection';
import 'arg_parser.dart';
import 'arg_results.dart';
import 'option.dart';
import 'parser.dart';
/// An ArgParser that treats *all input* as non-option arguments.
class AllowAnythingParser implements ArgParser {
@override
Map<String, Option> get options => const {};
@override
Map<String, ArgParser> get commands => const {};
@override
bool get allowTrailingOptions => false;
@override
bool get allowsAnything => true;
@override
int get usageLineLength => null;
@override
ArgParser addCommand(String name, [ArgParser parser]) {
throw UnsupportedError(
"ArgParser.allowAnything().addCommands() isn't supported.");
}
@override
void addFlag(String name,
{String abbr,
String help,
bool defaultsTo = false,
bool negatable = true,
void Function(bool) callback,
bool hide = false}) {
throw UnsupportedError(
"ArgParser.allowAnything().addFlag() isn't supported.");
}
@override
void addOption(String name,
{String abbr,
String help,
String valueHelp,
Iterable<String> allowed,
Map<String, String> allowedHelp,
String defaultsTo,
Function callback,
bool allowMultiple = false,
bool splitCommas,
bool hide = false}) {
throw UnsupportedError(
"ArgParser.allowAnything().addOption() isn't supported.");
}
@override
void addMultiOption(String name,
{String abbr,
String help,
String valueHelp,
Iterable<String> allowed,
Map<String, String> allowedHelp,
Iterable<String> defaultsTo,
void Function(List<String>) callback,
bool splitCommas = true,
bool hide = false}) {
throw UnsupportedError(
"ArgParser.allowAnything().addMultiOption() isn't supported.");
}
@override
void addSeparator(String text) {
throw UnsupportedError(
"ArgParser.allowAnything().addSeparator() isn't supported.");
}
@override
ArgResults parse(Iterable<String> args) =>
Parser(null, this, Queue.of(args)).parse();
@override
String getUsage() => usage;
@override
String get usage => '';
@override
dynamic getDefault(String option) {
throw ArgumentError('No option named $option');
}
@override
Option findByAbbreviation(String abbr) => null;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/parser.dart | // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:collection';
import 'arg_parser.dart';
import 'arg_parser_exception.dart';
import 'arg_results.dart';
import 'option.dart';
/// The actual argument parsing class.
///
/// Unlike [ArgParser] which is really more an "arg grammar", this is the class
/// that does the parsing and holds the mutable state required during a parse.
class Parser {
/// If parser is parsing a command's options, this will be the name of the
/// command. For top-level results, this returns `null`.
final String commandName;
/// The parser for the supercommand of this command parser, or `null` if this
/// is the top-level parser.
final Parser parent;
/// The grammar being parsed.
final ArgParser grammar;
/// The arguments being parsed.
final Queue<String> args;
/// The remaining non-option, non-command arguments.
final rest = <String>[];
/// The accumulated parsed options.
final Map<String, dynamic> results = <String, dynamic>{};
Parser(this.commandName, this.grammar, this.args,
[this.parent, List<String> rest]) {
if (rest != null) this.rest.addAll(rest);
}
/// The current argument being parsed.
String get current => args.first;
/// Parses the arguments. This can only be called once.
ArgResults parse() {
var arguments = args.toList();
if (grammar.allowsAnything) {
return newArgResults(
grammar, const {}, commandName, null, arguments, arguments);
}
ArgResults commandResults;
// Parse the args.
while (args.isNotEmpty) {
if (current == '--') {
// Reached the argument terminator, so stop here.
args.removeFirst();
break;
}
// Try to parse the current argument as a command. This happens before
// options so that commands can have option-like names.
var command = grammar.commands[current];
if (command != null) {
validate(rest.isEmpty, 'Cannot specify arguments before a command.');
var commandName = args.removeFirst();
var commandParser = Parser(commandName, command, args, this, rest);
try {
commandResults = commandParser.parse();
} on ArgParserException catch (error) {
if (commandName == null) rethrow;
throw ArgParserException(
error.message, [commandName, ...error.commands]);
}
// All remaining arguments were passed to command so clear them here.
rest.clear();
break;
}
// Try to parse the current argument as an option. Note that the order
// here matters.
if (parseSoloOption()) continue;
if (parseAbbreviation(this)) continue;
if (parseLongOption()) continue;
// This argument is neither option nor command, so stop parsing unless
// the [allowTrailingOptions] option is set.
if (!grammar.allowTrailingOptions) break;
rest.add(args.removeFirst());
}
// Invoke the callbacks.
grammar.options.forEach((name, option) {
if (option.callback == null) return;
option.callback(option.getOrDefault(results[name]));
});
// Add in the leftover arguments we didn't parse to the innermost command.
rest.addAll(args);
args.clear();
return newArgResults(
grammar, results, commandName, commandResults, rest, arguments);
}
/// Pulls the value for [option] from the second argument in [args].
///
/// Validates that there is a valid value there.
void readNextArgAsValue(Option option) {
// Take the option argument from the next command line arg.
validate(args.isNotEmpty, 'Missing argument for "${option.name}".');
setOption(results, option, current);
args.removeFirst();
}
/// Tries to parse the current argument as a "solo" option, which is a single
/// hyphen followed by a single letter.
///
/// We treat this differently than collapsed abbreviations (like "-abc") to
/// handle the possible value that may follow it.
bool parseSoloOption() {
// Hand coded regexp: r'^-([a-zA-Z0-9])$'
// Length must be two, hyphen followed by any letter/digit.
if (current.length != 2) return false;
if (!current.startsWith('-')) return false;
var opt = current[1];
if (!_isLetterOrDigit(opt.codeUnitAt(0))) return false;
var option = grammar.findByAbbreviation(opt);
if (option == null) {
// Walk up to the parent command if possible.
validate(parent != null, 'Could not find an option or flag "-$opt".');
return parent.parseSoloOption();
}
args.removeFirst();
if (option.isFlag) {
setFlag(results, option, true);
} else {
readNextArgAsValue(option);
}
return true;
}
/// Tries to parse the current argument as a series of collapsed abbreviations
/// (like "-abc") or a single abbreviation with the value directly attached
/// to it (like "-mrelease").
bool parseAbbreviation(Parser innermostCommand) {
// Hand coded regexp: r'^-([a-zA-Z0-9]+)(.*)$'
// Hyphen then at least one letter/digit then zero or more
// anything-but-newlines.
if (current.length < 2) return false;
if (!current.startsWith('-')) return false;
// Find where we go from letters/digits to rest.
var index = 1;
while (
index < current.length && _isLetterOrDigit(current.codeUnitAt(index))) {
++index;
}
// Must be at least one letter/digit.
if (index == 1) return false;
// If the first character is the abbreviation for a non-flag option, then
// the rest is the value.
var lettersAndDigits = current.substring(1, index);
var rest = current.substring(index);
if (rest.contains('\n') || rest.contains('\r')) return false;
var c = lettersAndDigits.substring(0, 1);
var first = grammar.findByAbbreviation(c);
if (first == null) {
// Walk up to the parent command if possible.
validate(
parent != null, 'Could not find an option with short name "-$c".');
return parent.parseAbbreviation(innermostCommand);
} else if (!first.isFlag) {
// The first character is a non-flag option, so the rest must be the
// value.
var value = '${lettersAndDigits.substring(1)}$rest';
setOption(results, first, value);
} else {
// If we got some non-flag characters, then it must be a value, but
// if we got here, it's a flag, which is wrong.
validate(
rest == '',
'Option "-$c" is a flag and cannot handle value '
'"${lettersAndDigits.substring(1)}$rest".');
// Not an option, so all characters should be flags.
// We use "innermostCommand" here so that if a parent command parses the
// *first* letter, subcommands can still be found to parse the other
// letters.
for (var i = 0; i < lettersAndDigits.length; i++) {
var c = lettersAndDigits.substring(i, i + 1);
innermostCommand.parseShortFlag(c);
}
}
args.removeFirst();
return true;
}
void parseShortFlag(String c) {
var option = grammar.findByAbbreviation(c);
if (option == null) {
// Walk up to the parent command if possible.
validate(
parent != null, 'Could not find an option with short name "-$c".');
parent.parseShortFlag(c);
return;
}
// In a list of short options, only the first can be a non-flag. If
// we get here we've checked that already.
validate(
option.isFlag, 'Option "-$c" must be a flag to be in a collapsed "-".');
setFlag(results, option, true);
}
/// Tries to parse the current argument as a long-form named option, which
/// may include a value like "--mode=release" or "--mode release".
bool parseLongOption() {
// Hand coded regexp: r'^--([a-zA-Z\-_0-9]+)(=(.*))?$'
// Two hyphens then at least one letter/digit/hyphen, optionally an equal
// sign followed by zero or more anything-but-newlines.
if (!current.startsWith('--')) return false;
var index = current.indexOf('=');
var name = index == -1 ? current.substring(2) : current.substring(2, index);
for (var i = 0; i != name.length; ++i) {
if (!_isLetterDigitHyphenOrUnderscore(name.codeUnitAt(i))) return false;
}
var value = index == -1 ? null : current.substring(index + 1);
if (value != null && (value.contains('\n') || value.contains('\r'))) {
return false;
}
var option = grammar.options[name];
if (option != null) {
args.removeFirst();
if (option.isFlag) {
validate(
value == null, 'Flag option "$name" should not be given a value.');
setFlag(results, option, true);
} else if (value != null) {
// We have a value like --foo=bar.
setOption(results, option, value);
} else {
// Option like --foo, so look for the value as the next arg.
readNextArgAsValue(option);
}
} else if (name.startsWith('no-')) {
// See if it's a negated flag.
name = name.substring('no-'.length);
option = grammar.options[name];
if (option == null) {
// Walk up to the parent command if possible.
validate(parent != null, 'Could not find an option named "$name".');
return parent.parseLongOption();
}
args.removeFirst();
validate(option.isFlag, 'Cannot negate non-flag option "$name".');
validate(option.negatable, 'Cannot negate option "$name".');
setFlag(results, option, false);
} else {
// Walk up to the parent command if possible.
validate(parent != null, 'Could not find an option named "$name".');
return parent.parseLongOption();
}
return true;
}
/// Called during parsing to validate the arguments.
///
/// Throws an [ArgParserException] if [condition] is `false`.
void validate(bool condition, String message) {
if (!condition) throw ArgParserException(message);
}
/// Validates and stores [value] as the value for [option], which must not be
/// a flag.
void setOption(Map results, Option option, String value) {
assert(!option.isFlag);
if (!option.isMultiple) {
_validateAllowed(option, value);
results[option.name] = value;
return;
}
var list = results.putIfAbsent(option.name, () => <String>[]);
if (option.splitCommas) {
for (var element in value.split(',')) {
_validateAllowed(option, element);
list.add(element);
}
} else {
_validateAllowed(option, value);
list.add(value);
}
}
/// Validates and stores [value] as the value for [option], which must be a
/// flag.
void setFlag(Map results, Option option, bool value) {
assert(option.isFlag);
results[option.name] = value;
}
/// Validates that [value] is allowed as a value of [option].
void _validateAllowed(Option option, String value) {
if (option.allowed == null) return;
validate(option.allowed.contains(value),
'"$value" is not an allowed value for option "${option.name}".');
}
}
bool _isLetterOrDigit(int codeUnit) =>
// Uppercase letters.
(codeUnit >= 65 && codeUnit <= 90) ||
// Lowercase letters.
(codeUnit >= 97 && codeUnit <= 122) ||
// Digits.
(codeUnit >= 48 && codeUnit <= 57);
bool _isLetterDigitHyphenOrUnderscore(int codeUnit) =>
_isLetterOrDigit(codeUnit) ||
// Hyphen.
codeUnit == 45 ||
// Underscore.
codeUnit == 95;
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/option.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Creates a new [Option].
///
/// Since [Option] doesn't have a public constructor, this lets `ArgParser`
/// get to it. This function isn't exported to the public API of the package.
Option newOption(
String name,
String abbr,
String help,
String valueHelp,
Iterable<String> allowed,
Map<String, String> allowedHelp,
defaultsTo,
Function callback,
OptionType type,
{bool negatable,
bool splitCommas,
bool hide = false}) {
return Option._(name, abbr, help, valueHelp, allowed, allowedHelp, defaultsTo,
callback, type,
negatable: negatable, splitCommas: splitCommas, hide: hide);
}
/// A command-line option.
///
/// This represents both boolean flags and options which take a value.
class Option {
/// The name of the option that the user passes as an argument.
final String name;
/// A single-character string that can be used as a shorthand for this option.
///
/// For example, `abbr: "a"` will allow the user to pass `-a value` or
/// `-avalue`.
final String abbr;
@Deprecated('Use abbr instead.')
String get abbreviation => abbr;
/// A description of this option.
final String help;
/// A name for the value this option takes.
final String valueHelp;
/// A list of valid values for this option.
final List<String> allowed;
/// A map from values in [allowed] to documentation for those values.
final Map<String, String> allowedHelp;
/// The value this option will have if the user doesn't explicitly pass it in
final dynamic defaultsTo;
@Deprecated('Use defaultsTo instead.')
dynamic get defaultValue => defaultsTo;
/// Whether this flag's value can be set to `false`.
///
/// For example, if [name] is `flag`, the user can pass `--no-flag` to set its
/// value to `false`.
///
/// This is `null` unless [type] is [OptionType.flag].
final bool negatable;
/// The callback to invoke with the option's value when the option is parsed.
final Function callback;
/// Whether this is a flag, a single value option, or a multi-value option.
final OptionType type;
/// Whether multiple values may be passed by writing `--option a,b` in
/// addition to `--option a --option b`.
final bool splitCommas;
/// Whether this option should be hidden from usage documentation.
final bool hide;
/// Whether the option is boolean-valued flag.
bool get isFlag => type == OptionType.flag;
/// Whether the option takes a single value.
bool get isSingle => type == OptionType.single;
/// Whether the option allows multiple values.
bool get isMultiple => type == OptionType.multiple;
Option._(
this.name,
this.abbr,
this.help,
this.valueHelp,
Iterable<String> allowed,
Map<String, String> allowedHelp,
this.defaultsTo,
this.callback,
OptionType type,
{this.negatable,
bool splitCommas,
this.hide = false})
: allowed = allowed == null ? null : List.unmodifiable(allowed),
allowedHelp =
allowedHelp == null ? null : Map.unmodifiable(allowedHelp),
type = type,
// If the user doesn't specify [splitCommas], it defaults to true for
// multiple options.
splitCommas = splitCommas ?? type == OptionType.multiple {
if (name.isEmpty) {
throw ArgumentError('Name cannot be empty.');
} else if (name.startsWith('-')) {
throw ArgumentError('Name $name cannot start with "-".');
}
// Ensure name does not contain any invalid characters.
if (_invalidChars.hasMatch(name)) {
throw ArgumentError('Name "$name" contains invalid characters.');
}
if (abbr != null) {
if (abbr.length != 1) {
throw ArgumentError('Abbreviation must be null or have length 1.');
} else if (abbr == '-') {
throw ArgumentError('Abbreviation cannot be "-".');
}
if (_invalidChars.hasMatch(abbr)) {
throw ArgumentError('Abbreviation is an invalid character.');
}
}
}
/// Returns [value] if non-`null`, otherwise returns the default value for
/// this option.
///
/// For single-valued options, it will be [defaultsTo] if set or `null`
/// otherwise. For multiple-valued options, it will be an empty list or a
/// list containing [defaultsTo] if set.
dynamic getOrDefault(value) {
if (value != null) return value;
if (isMultiple) return defaultsTo ?? <String>[];
return defaultsTo;
}
static final _invalidChars = RegExp(r'''[ \t\r\n"'\\/]''');
}
/// What kinds of values an option accepts.
class OptionType {
/// An option that can only be `true` or `false`.
///
/// The presence of the option name itself in the argument list means `true`.
static const flag = OptionType._('OptionType.flag');
@Deprecated('Use OptionType.flag instead.')
static const FLAG = flag; // ignore: constant_identifier_names
/// An option that takes a single value.
///
/// Examples:
///
/// --mode debug
/// -mdebug
/// --mode=debug
///
/// If the option is passed more than once, the last one wins.
static const single = OptionType._('OptionType.single');
@Deprecated('Use OptionType.single instead.')
static const SINGLE = single; // ignore: constant_identifier_names
/// An option that allows multiple values.
///
/// Example:
///
/// --output text --output xml
///
/// In the parsed `ArgResults`, a multiple-valued option will always return
/// a list, even if one or no values were passed.
static const multiple = OptionType._('OptionType.multiple');
@Deprecated('Use OptionType.multiple instead.')
static const MULTIPLE = multiple; // ignore: constant_identifier_names
final String name;
const OptionType._(this.name);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/usage_exception.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class UsageException implements Exception {
final String message;
final String usage;
UsageException(this.message, this.usage);
@override
String toString() => '$message\n\n$usage';
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/usage.dart | // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math' as math;
import '../args.dart';
import 'utils.dart';
/// Takes an [ArgParser] and generates a string of usage (i.e. help) text for
/// its defined options.
///
/// Internally, it works like a tabular printer. The output is divided into
/// three horizontal columns, like so:
///
/// -h, --help Prints the usage information
/// | | | |
///
/// It builds the usage text up one column at a time and handles padding with
/// spaces and wrapping to the next line to keep the cells correctly lined up.
class Usage {
/// Abbreviation, long name, help.
static const _columnCount = 3;
/// A list of the [Option]s intermingled with [String] separators.
final List optionsAndSeparators;
/// The working buffer for the generated usage text.
StringBuffer buffer;
/// The column that the "cursor" is currently on.
///
/// If the next call to [write()] is not for this column, it will correctly
/// handle advancing to the next column (and possibly the next row).
int currentColumn = 0;
/// The width in characters of each column.
List<int> columnWidths;
/// The number of sequential lines of text that have been written to the last
/// column (which shows help info).
///
/// We track this so that help text that spans multiple lines can be padded
/// with a blank line after it for separation. Meanwhile, sequential options
/// with single-line help will be compacted next to each other.
int numHelpLines = 0;
/// How many newlines need to be rendered before the next bit of text can be
/// written.
///
/// We do this lazily so that the last bit of usage doesn't have dangling
/// newlines. We only write newlines right *before* we write some real
/// content.
int newlinesNeeded = 0;
/// The horizontal character position at which help text is wrapped. Help that
/// extends past this column will be wrapped at the nearest whitespace (or
/// truncated if there is no available whitespace).
final int lineLength;
Usage(this.optionsAndSeparators, {this.lineLength});
/// Generates a string displaying usage information for the defined options.
/// This is basically the help text shown on the command line.
String generate() {
buffer = StringBuffer();
calculateColumnWidths();
for (var optionOrSeparator in optionsAndSeparators) {
if (optionOrSeparator is String) {
// Ensure that there's always a blank line before a separator.
if (buffer.isNotEmpty) buffer.write('\n\n');
buffer.write(optionOrSeparator);
newlinesNeeded = 1;
continue;
}
var option = optionOrSeparator as Option;
if (option.hide) continue;
write(0, getAbbreviation(option));
write(1, getLongOption(option));
if (option.help != null) write(2, option.help);
if (option.allowedHelp != null) {
var allowedNames = option.allowedHelp.keys.toList(growable: false);
allowedNames.sort();
newline();
for (var name in allowedNames) {
write(1, getAllowedTitle(option, name));
write(2, option.allowedHelp[name]);
}
newline();
} else if (option.allowed != null) {
write(2, buildAllowedList(option));
} else if (option.isFlag) {
if (option.defaultsTo == true) {
write(2, '(defaults to on)');
}
} else if (option.isMultiple) {
if (option.defaultsTo != null && option.defaultsTo.isNotEmpty) {
write(
2,
'(defaults to ' +
option.defaultsTo.map((value) => '"$value"').join(', ') +
')');
}
} else {
if (option.defaultsTo != null) {
write(2, '(defaults to "${option.defaultsTo}")');
}
}
}
return buffer.toString();
}
String getAbbreviation(Option option) =>
option.abbr == null ? '' : '-${option.abbr}, ';
String getLongOption(Option option) {
var result;
if (option.negatable) {
result = '--[no-]${option.name}';
} else {
result = '--${option.name}';
}
if (option.valueHelp != null) result += '=<${option.valueHelp}>';
return result;
}
String getAllowedTitle(Option option, String allowed) {
var isDefault = option.defaultsTo is List
? option.defaultsTo.contains(allowed)
: option.defaultsTo == allowed;
return ' [$allowed]' + (isDefault ? ' (default)' : '');
}
void calculateColumnWidths() {
var abbr = 0;
var title = 0;
for (var option in optionsAndSeparators) {
if (option is! Option) continue;
if (option.hide) continue;
// Make room in the first column if there are abbreviations.
abbr = math.max(abbr, getAbbreviation(option).length);
// Make room for the option.
title = math.max(title, getLongOption(option).length);
// Make room for the allowed help.
if (option.allowedHelp != null) {
for (var allowed in option.allowedHelp.keys) {
title = math.max(title, getAllowedTitle(option, allowed).length);
}
}
}
// Leave a gutter between the columns.
title += 4;
columnWidths = [abbr, title];
}
void newline() {
newlinesNeeded++;
currentColumn = 0;
numHelpLines = 0;
}
void write(int column, String text) {
var lines = text.split('\n');
// If we are writing the last column, word wrap it to fit.
if (column == columnWidths.length && lineLength != null) {
var wrappedLines = <String>[];
var start = columnWidths
.sublist(0, column)
.reduce((start, width) => start += width);
for (var line in lines) {
wrappedLines
.addAll(wrapTextAsLines(line, start: start, length: lineLength));
}
lines = wrappedLines;
}
// Strip leading and trailing empty lines.
while (lines.isNotEmpty && lines[0].trim() == '') {
lines.removeRange(0, 1);
}
while (lines.isNotEmpty && lines[lines.length - 1].trim() == '') {
lines.removeLast();
}
for (var line in lines) {
writeLine(column, line);
}
}
void writeLine(int column, String text) {
// Write any pending newlines.
while (newlinesNeeded > 0) {
buffer.write('\n');
newlinesNeeded--;
}
// Advance until we are at the right column (which may mean wrapping around
// to the next line.
while (currentColumn != column) {
if (currentColumn < _columnCount - 1) {
buffer.write(' ' * columnWidths[currentColumn]);
} else {
buffer.write('\n');
}
currentColumn = (currentColumn + 1) % _columnCount;
}
if (column < columnWidths.length) {
// Fixed-size column, so pad it.
buffer.write(text.padRight(columnWidths[column]));
} else {
// The last column, so just write it.
buffer.write(text);
}
// Advance to the next column.
currentColumn = (currentColumn + 1) % _columnCount;
// If we reached the last column, we need to wrap to the next line.
if (column == _columnCount - 1) newlinesNeeded++;
// Keep track of how many consecutive lines we've written in the last
// column.
if (column == _columnCount - 1) {
numHelpLines++;
} else {
numHelpLines = 0;
}
}
String buildAllowedList(Option option) {
var isDefault = option.defaultsTo is List
? option.defaultsTo.contains
: (value) => value == option.defaultsTo;
var allowedBuffer = StringBuffer();
allowedBuffer.write('[');
var first = true;
for (var allowed in option.allowed) {
if (!first) allowedBuffer.write(', ');
allowedBuffer.write(allowed);
if (isDefault(allowed)) {
allowedBuffer.write(' (default)');
}
first = false;
}
allowedBuffer.write(']');
return allowedBuffer.toString();
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/utils.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math' as math;
/// Pads [source] to [length] by adding spaces at the end.
String padRight(String source, int length) =>
source + ' ' * (length - source.length);
/// Wraps a block of text into lines no longer than [length].
///
/// Tries to split at whitespace, but if that's not good enough to keep it
/// under the limit, then it splits in the middle of a word.
///
/// Preserves indentation (leading whitespace) for each line (delimited by '\n')
/// in the input, and indents wrapped lines the same amount.
///
/// If [hangingIndent] is supplied, then that many spaces are added to each
/// line, except for the first line. This is useful for flowing text with a
/// heading prefix (e.g. "Usage: "):
///
/// ```dart
/// var prefix = "Usage: ";
/// print(prefix + wrapText(invocation, hangingIndent: prefix.length, length: 40));
/// ```
///
/// yields:
/// ```
/// Usage: app main_command <subcommand>
/// [arguments]
/// ```
///
/// If [length] is not specified, then no wrapping occurs, and the original
/// [text] is returned unchanged.
String wrapText(String text, {int length, int hangingIndent}) {
if (length == null) return text;
hangingIndent ??= 0;
var splitText = text.split('\n');
var result = <String>[];
for (var line in splitText) {
var trimmedText = line.trimLeft();
final leadingWhitespace =
line.substring(0, line.length - trimmedText.length);
var notIndented;
if (hangingIndent != 0) {
// When we have a hanging indent, we want to wrap the first line at one
// width, and the rest at another (offset by hangingIndent), so we wrap
// them twice and recombine.
var firstLineWrap = wrapTextAsLines(trimmedText,
length: length - leadingWhitespace.length);
notIndented = [firstLineWrap.removeAt(0)];
trimmedText = trimmedText.substring(notIndented[0].length).trimLeft();
if (firstLineWrap.isNotEmpty) {
notIndented.addAll(wrapTextAsLines(trimmedText,
length: length - leadingWhitespace.length - hangingIndent));
}
} else {
notIndented = wrapTextAsLines(trimmedText,
length: length - leadingWhitespace.length);
}
String hangingIndentString;
result.addAll(notIndented.map<String>((String line) {
// Don't return any lines with just whitespace on them.
if (line.isEmpty) return '';
var result = '${hangingIndentString ?? ''}$leadingWhitespace$line';
hangingIndentString ??= ' ' * hangingIndent;
return result;
}));
}
return result.join('\n');
}
/// Wraps a block of text into lines no longer than [length],
/// starting at the [start] column, and returns the result as a list of strings.
///
/// Tries to split at whitespace, but if that's not good enough to keep it
/// under the limit, then splits in the middle of a word. Preserves embedded
/// newlines, but not indentation (it trims whitespace from each line).
///
/// If [length] is not specified, then no wrapping occurs, and the original
/// [text] is returned after splitting it on newlines. Whitespace is not trimmed
/// in this case.
List<String> wrapTextAsLines(String text, {int start = 0, int length}) {
assert(start >= 0);
/// Returns true if the code unit at [index] in [text] is a whitespace
/// character.
///
/// Based on: https://en.wikipedia.org/wiki/Whitespace_character#Unicode
bool isWhitespace(String text, int index) {
var rune = text.codeUnitAt(index);
return rune >= 0x0009 && rune <= 0x000D ||
rune == 0x0020 ||
rune == 0x0085 ||
rune == 0x1680 ||
rune == 0x180E ||
rune >= 0x2000 && rune <= 0x200A ||
rune == 0x2028 ||
rune == 0x2029 ||
rune == 0x202F ||
rune == 0x205F ||
rune == 0x3000 ||
rune == 0xFEFF;
}
if (length == null) return text.split('\n');
var result = <String>[];
var effectiveLength = math.max(length - start, 10);
for (var line in text.split('\n')) {
line = line.trim();
if (line.length <= effectiveLength) {
result.add(line);
continue;
}
var currentLineStart = 0;
var lastWhitespace;
for (var i = 0; i < line.length; ++i) {
if (isWhitespace(line, i)) lastWhitespace = i;
if (i - currentLineStart >= effectiveLength) {
// Back up to the last whitespace, unless there wasn't any, in which
// case we just split where we are.
if (lastWhitespace != null) i = lastWhitespace;
result.add(line.substring(currentLineStart, i).trim());
// Skip any intervening whitespace.
while (isWhitespace(line, i) && i < line.length) {
i++;
}
currentLineStart = i;
lastWhitespace = null;
}
}
result.add(line.substring(currentLineStart).trim());
}
return result;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/args/src/help_command.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import '../command_runner.dart';
/// The built-in help command that's added to every [CommandRunner].
///
/// This command displays help information for the various subcommands.
class HelpCommand<T> extends Command<T> {
@override
final name = 'help';
@override
String get description =>
'Display help information for ${runner.executableName}.';
@override
String get invocation => '${runner.executableName} help [command]';
@override
bool get hidden => true;
@override
T run() {
// Show the default help if no command was specified.
if (argResults.rest.isEmpty) {
runner.printUsage();
return null;
}
// Walk the command tree to show help for the selected command or
// subcommand.
var commands = runner.commands;
Command command;
var commandString = runner.executableName;
for (var name in argResults.rest) {
if (commands.isEmpty) {
command.usageException(
'Command "$commandString" does not expect a subcommand.');
}
if (commands[name] == null) {
if (command == null) {
runner.usageException('Could not find a command named "$name".');
}
command.usageException(
'Could not find a subcommand named "$name" for "$commandString".');
}
command = commands[name];
commands = command.subcommands;
commandString += ' $name';
}
command.printUsage();
return null;
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/analyzer.dart | // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@deprecated
library analyzer;
import 'dart:io';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/src/dart/scanner/reader.dart';
import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/error.dart';
import 'package:analyzer/src/file_system/file_system.dart';
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/string_source.dart';
import 'package:path/path.dart' as pathos;
export 'package:analyzer/dart/ast/ast.dart';
export 'package:analyzer/dart/ast/visitor.dart';
export 'package:analyzer/error/error.dart';
export 'package:analyzer/error/listener.dart';
export 'package:analyzer/src/dart/ast/utilities.dart';
export 'package:analyzer/src/error.dart';
export 'package:analyzer/src/error/codes.dart';
export 'package:analyzer/src/generated/utilities_dart.dart';
/// Parses a string of Dart code into an AST.
///
/// If [name] is passed, it's used in error messages as the name of the code
/// being parsed.
///
/// Throws an [AnalyzerErrorGroup] if any errors occurred, unless
/// [suppressErrors] is `true`, in which case any errors are discarded.
///
/// If [parseFunctionBodies] is [false] then only function signatures will be
/// parsed. (Currently broken; function bodies are always parsed).
///
/// Deprecated - please use the `parseString` function
/// (from package:analyzer/dart/analysis/utilities.dart) instead.
///
/// Note that `parseString` does not support the `parseFunctionBodies` option;
/// callers that don't require function bodies should simply ignore them.
@Deprecated('Please use parseString instead')
CompilationUnit parseCompilationUnit(String contents,
{String name,
bool suppressErrors: false,
bool parseFunctionBodies: true,
FeatureSet featureSet}) {
// TODO(paulberry): make featureSet a required parameter
featureSet ??= FeatureSet.fromEnableFlags([]);
Source source = new StringSource(contents, name);
return _parseSource(contents, source, featureSet,
suppressErrors: suppressErrors, parseFunctionBodies: parseFunctionBodies);
}
/// Parses a Dart file into an AST.
///
/// Throws an [AnalyzerErrorGroup] if any errors occurred, unless
/// [suppressErrors] is `true`, in which case any errors are discarded.
///
/// If [parseFunctionBodies] is [false] then only function signatures will be
/// parsed. (Currently broken; function bodies are always parsed).
///
/// Deprecated - please use the `parseFile2` function
/// (from package:analyzer/dart/analysis/utilities.dart) instead.
///
/// Note that `parseFile2` does not support the `parseFunctionBodies` option;
/// callers that don't require function bodies should simply ignore them.
@Deprecated('Please use parseFile2 instead')
CompilationUnit parseDartFile(String path,
{bool suppressErrors: false,
bool parseFunctionBodies: true,
FeatureSet featureSet}) {
// TODO(paulberry): Make featureSet a required parameter
featureSet ??= FeatureSet.fromEnableFlags([]);
String contents = new File(path).readAsStringSync();
var sourceFactory = new SourceFactory(
[new ResourceUriResolver(PhysicalResourceProvider.INSTANCE)]);
var absolutePath = pathos.absolute(path);
var source = sourceFactory.forUri(pathos.toUri(absolutePath).toString());
if (source == null) {
throw new ArgumentError("Can't get source for path $path");
}
if (!source.exists()) {
throw new ArgumentError("Source $source doesn't exist");
}
return _parseSource(contents, source, featureSet,
suppressErrors: suppressErrors, parseFunctionBodies: parseFunctionBodies);
}
/// Parses the script tag and directives in a string of Dart code into an AST.
/// (Currently broken; the entire file is parsed).
///
/// Stops parsing when the first non-directive is encountered. The rest of the
/// string will not be parsed.
///
/// If [name] is passed, it's used in error messages as the name of the code
/// being parsed.
///
/// Throws an [AnalyzerErrorGroup] if any errors occurred, unless
/// [suppressErrors] is `true`, in which case any errors are discarded.
///
/// Deprecated - please use the `parseString` function
/// (from package:analyzer/dart/analysis/utilities.dart) instead.
///
/// Note that `parseString` parses the whole file; callers that only require
/// directives should simply ignore the rest of the parse result.
@Deprecated('Please use parseString instead')
CompilationUnit parseDirectives(String contents,
{String name, bool suppressErrors: false, FeatureSet featureSet}) {
// TODO(paulberry): make featureSet a required parameter.
featureSet ??= FeatureSet.fromEnableFlags([]);
var source = new StringSource(contents, name);
var errorCollector = new _ErrorCollector();
var reader = new CharSequenceReader(contents);
var scanner = new Scanner(source, reader, errorCollector)
..configureFeatures(featureSet);
var token = scanner.tokenize();
var parser = new Parser(source, errorCollector, featureSet: featureSet);
var unit = parser.parseDirectives(token);
unit.lineInfo = new LineInfo(scanner.lineStarts);
if (errorCollector.hasErrors && !suppressErrors) throw errorCollector.group;
return unit;
}
/// Converts an AST node representing a string literal into a [String].
@Deprecated('Please use StringLiteral.stringValue instead')
String stringLiteralToString(StringLiteral literal) {
return literal.stringValue;
}
CompilationUnit _parseSource(
String contents, Source source, FeatureSet featureSet,
{bool suppressErrors: false, bool parseFunctionBodies: true}) {
var reader = new CharSequenceReader(contents);
var errorCollector = new _ErrorCollector();
var scanner = new Scanner(source, reader, errorCollector)
..configureFeatures(featureSet);
var token = scanner.tokenize();
var parser = new Parser(source, errorCollector, featureSet: featureSet)
..parseFunctionBodies = parseFunctionBodies;
var unit = parser.parseCompilationUnit(token)
..lineInfo = new LineInfo(scanner.lineStarts);
if (errorCollector.hasErrors && !suppressErrors) throw errorCollector.group;
return unit;
}
/// A simple error listener that collects errors into an [AnalyzerErrorGroup].
class _ErrorCollector extends AnalysisErrorListener {
final _errors = <AnalysisError>[];
_ErrorCollector();
/// The group of errors collected.
AnalyzerErrorGroup get group =>
new AnalyzerErrorGroup.fromAnalysisErrors(_errors);
/// Whether any errors where collected.
bool get hasErrors => _errors.isNotEmpty;
@override
void onError(AnalysisError error) => _errors.add(error);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/instrumentation/file_instrumentation.dart | // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:io';
import 'package:analyzer/instrumentation/instrumentation.dart';
/**
* An [InstrumentationServer] that writes to a file.
*/
class FileInstrumentationServer implements InstrumentationServer {
final String filePath;
IOSink _sink;
FileInstrumentationServer(this.filePath) {
File file = new File(filePath);
_sink = file.openWrite();
}
@override
String get describe => "file: $filePath";
@override
String get sessionId => '';
@override
void log(String message) {
_sink.writeln(message);
}
@override
void logWithPriority(String message) {
log(message);
}
@override
Future shutdown() async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
await _sink.close();
_sink = null;
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/instrumentation/instrumentation.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
/**
* A container with analysis performance constants.
*/
class AnalysisPerformanceKind {
static const String FULL = 'analysis_full';
static const String INCREMENTAL = 'analysis_incremental';
}
/**
* The interface used by client code to communicate with an instrumentation
* server.
*/
abstract class InstrumentationServer {
/**
* A user-friendly description of this instrumentation server.
*/
String get describe;
/**
* Return the identifier used to identify the current session.
*/
String get sessionId;
/**
* Pass the given [message] to the instrumentation server so that it will be
* logged with other messages.
*
* This method should be used for most logging.
*/
void log(String message);
/**
* Pass the given [message] to the instrumentation server so that it will be
* logged with other messages.
*
* This method should only be used for logging high priority messages, such as
* exceptions that cause the server to shutdown.
*/
void logWithPriority(String message);
/**
* Signal that the client is done communicating with the instrumentation
* server. This method should be invoked exactly one time and no other methods
* should be invoked on this instance after this method has been invoked.
*/
Future shutdown();
}
/**
* The interface used by client code to communicate with an instrumentation
* server by wrapping an [InstrumentationServer].
*/
class InstrumentationService {
/**
* An instrumentation service that will not log any instrumentation data.
*/
static final InstrumentationService NULL_SERVICE =
new InstrumentationService(null);
static const String TAG_ANALYSIS_TASK = 'Task';
static const String TAG_ERROR = 'Err';
static const String TAG_EXCEPTION = 'Ex';
static const String TAG_FILE_READ = 'Read';
static const String TAG_INFO = 'Info';
static const String TAG_LOG_ENTRY = 'Log';
static const String TAG_NOTIFICATION = 'Noti';
static const String TAG_PERFORMANCE = 'Perf';
static const String TAG_PLUGIN_ERROR = 'PluginErr';
static const String TAG_PLUGIN_EXCEPTION = 'PluginEx';
static const String TAG_PLUGIN_NOTIFICATION = 'PluginNoti';
static const String TAG_PLUGIN_REQUEST = 'PluginReq';
static const String TAG_PLUGIN_RESPONSE = 'PluginRes';
static const String TAG_PLUGIN_TIMEOUT = 'PluginTo';
static const String TAG_REQUEST = 'Req';
static const String TAG_RESPONSE = 'Res';
static const String TAG_SUBPROCESS_START = 'SPStart';
static const String TAG_SUBPROCESS_RESULT = 'SPResult';
static const String TAG_VERSION = 'Ver';
static const String TAG_WATCH_EVENT = 'Watch';
/**
* The instrumentation server used to communicate with the server, or `null`
* if instrumentation data should not be logged.
*/
InstrumentationServer _instrumentationServer;
/**
* Counter used to generate unique ID's for [logSubprocessStart].
*/
int _subprocessCounter = 0;
/**
* Initialize a newly created instrumentation service to communicate with the
* given [_instrumentationServer].
*/
InstrumentationService(this._instrumentationServer);
InstrumentationServer get instrumentationServer => _instrumentationServer;
/**
* Return `true` if this [InstrumentationService] was initialized with a
* non-`null` server (and hence instrumentation is active).
*/
bool get isActive => _instrumentationServer != null;
/**
* Return the identifier used to identify the current session.
*/
String get sessionId => _instrumentationServer?.sessionId ?? '';
/**
* The current time, expressed as a decimal encoded number of milliseconds.
*/
String get _timestamp => new DateTime.now().millisecondsSinceEpoch.toString();
/**
* Log the fact that an error, described by the given [message], has occurred.
*/
void logError(String message) {
_log(TAG_ERROR, message);
}
/**
* Log that the given non-priority [exception] was thrown, with the given
* [stackTrace].
*/
void logException(dynamic exception, StackTrace stackTrace) {
if (_instrumentationServer != null) {
String message = _toString(exception);
String trace = _toString(stackTrace);
_instrumentationServer.log(_join([TAG_EXCEPTION, message, trace]));
}
}
/**
* Log that the contents of the file with the given [path] were read. The file
* had the given [content] and [modificationTime].
*/
void logFileRead(String path, int modificationTime, String content) {
if (_instrumentationServer != null) {
String timeStamp = _toString(modificationTime);
_instrumentationServer
.log(_join([TAG_FILE_READ, path, timeStamp, content]));
}
}
/**
* Log unstructured text information for debugging purposes.
*/
void logInfo(String message) => _log(TAG_INFO, message);
/**
* Log that a log entry that was written to the analysis engine's log. The log
* entry has the given [level] and [message], and was created at the given
* [time].
*/
void logLogEntry(String level, DateTime time, String message,
Object exception, StackTrace stackTrace) {
if (_instrumentationServer != null) {
String timeStamp =
time == null ? 'null' : time.millisecondsSinceEpoch.toString();
String exceptionText = exception.toString();
String stackTraceText = stackTrace.toString();
_instrumentationServer.log(_join([
TAG_LOG_ENTRY,
level,
timeStamp,
message,
exceptionText,
stackTraceText
]));
}
}
/**
* Log that a notification has been sent to the client.
*/
void logNotification(String notification) {
_log(TAG_NOTIFICATION, notification);
}
/**
* Log the given performance fact.
*/
void logPerformance(String kind, Stopwatch sw, String message) {
sw.stop();
String elapsed = sw.elapsedMilliseconds.toString();
if (_instrumentationServer != null) {
_instrumentationServer
.log(_join([TAG_PERFORMANCE, kind, elapsed, message]));
}
}
/**
* Log the fact that an error, described by the given [message], was reported
* by the given [plugin].
*/
void logPluginError(
PluginData plugin, String code, String message, String stackTrace) {
if (_instrumentationServer != null) {
List<String> fields = <String>[
TAG_PLUGIN_ERROR,
code,
message,
stackTrace
];
plugin.addToFields(fields);
_instrumentationServer.log(_join(fields));
}
}
/**
* Log that the given non-priority [exception] was thrown, with the given
* [stackTrace] by the given [plugin].
*/
void logPluginException(
PluginData plugin, dynamic exception, StackTrace stackTrace) {
if (_instrumentationServer != null) {
List<String> fields = <String>[
TAG_PLUGIN_EXCEPTION,
_toString(exception),
_toString(stackTrace)
];
plugin.addToFields(fields);
_instrumentationServer.log(_join(fields));
}
}
void logPluginNotification(String pluginId, String notification) {
if (_instrumentationServer != null) {
_instrumentationServer.log(
_join([TAG_PLUGIN_NOTIFICATION, notification, pluginId, '', '']));
}
}
void logPluginRequest(String pluginId, String request) {
if (_instrumentationServer != null) {
_instrumentationServer
.log(_join([TAG_PLUGIN_REQUEST, request, pluginId, '', '']));
}
}
void logPluginResponse(String pluginId, String response) {
if (_instrumentationServer != null) {
_instrumentationServer
.log(_join([TAG_PLUGIN_RESPONSE, response, pluginId, '', '']));
}
}
/**
* Log that the given [plugin] took too long to execute the given [request].
* This doesn't necessarily imply that there is a problem with the plugin,
* only that this particular response was not included in the data returned
* to the client.
*/
void logPluginTimeout(PluginData plugin, String request) {
if (_instrumentationServer != null) {
List<String> fields = <String>[TAG_PLUGIN_TIMEOUT, request];
plugin.addToFields(fields);
_instrumentationServer.log(_join(fields));
}
}
/**
* Log that the given priority [exception] was thrown, with the given
* [stackTrace].
*/
void logPriorityException(dynamic exception, StackTrace stackTrace) {
if (_instrumentationServer != null) {
String message = _toString(exception);
String trace = _toString(stackTrace);
_instrumentationServer
.logWithPriority(_join([TAG_EXCEPTION, message, trace]));
}
}
/**
* Log that a request has been sent to the client.
*/
void logRequest(String request) {
_log(TAG_REQUEST, request);
}
/**
* Log that a response has been sent to the client.
*/
void logResponse(String response) {
_log(TAG_RESPONSE, response);
}
/**
* Log the result of executing a subprocess. [subprocessId] should be the
* unique ID returned by [logSubprocessStart].
*/
void logSubprocessResult(
int subprocessId, int exitCode, String stdout, String stderr) {
if (_instrumentationServer != null) {
_instrumentationServer.log(_join([
TAG_SUBPROCESS_RESULT,
subprocessId.toString(),
exitCode.toString(),
json.encode(stdout),
json.encode(stderr)
]));
}
}
/**
* Log that the given subprocess is about to be executed. Returns a unique
* identifier that can be used to identify the subprocess for later log
* entries.
*/
int logSubprocessStart(
String executablePath, List<String> arguments, String workingDirectory) {
int subprocessId = _subprocessCounter++;
if (_instrumentationServer != null) {
_instrumentationServer.log(_join([
TAG_SUBPROCESS_START,
subprocessId.toString(),
executablePath,
workingDirectory,
json.encode(arguments)
]));
}
return subprocessId;
}
/**
* Signal that the client has started analysis server.
* This method should be invoked exactly one time.
*/
void logVersion(String uuid, String clientId, String clientVersion,
String serverVersion, String sdkVersion) {
String normalize(String value) =>
value != null && value.isNotEmpty ? value : 'unknown';
if (_instrumentationServer != null) {
_instrumentationServer.logWithPriority(_join([
TAG_VERSION,
uuid,
normalize(clientId),
normalize(clientVersion),
serverVersion,
sdkVersion
]));
}
}
/**
* Log that the file system watcher sent an event. The [folderPath] is the
* path to the folder containing the changed file, the [filePath] is the path
* of the file that changed, and the [changeType] indicates what kind of
* change occurred.
*/
void logWatchEvent(String folderPath, String filePath, String changeType) {
if (_instrumentationServer != null) {
_instrumentationServer
.log(_join([TAG_WATCH_EVENT, folderPath, filePath, changeType]));
}
}
/**
* Signal that the client is done communicating with the instrumentation
* server. This method should be invoked exactly one time and no other methods
* should be invoked on this instance after this method has been invoked.
*/
Future shutdown() async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
if (_instrumentationServer != null) {
await _instrumentationServer.shutdown();
_instrumentationServer = null;
}
}
/**
* Write an escaped version of the given [field] to the given [buffer].
*/
void _escape(StringBuffer buffer, String field) {
int index = field.indexOf(':');
if (index < 0) {
buffer.write(field);
return;
}
int start = 0;
while (index >= 0) {
buffer.write(field.substring(start, index));
buffer.write('::');
start = index + 1;
index = field.indexOf(':', start);
}
buffer.write(field.substring(start));
}
/**
* Return the result of joining the values of the given fields, escaping the
* separator character by doubling it.
*/
String _join(List<String> fields) {
StringBuffer buffer = new StringBuffer();
buffer.write(_timestamp);
int length = fields.length;
for (int i = 0; i < length; i++) {
buffer.write(':');
_escape(buffer, fields[i] ?? 'null');
}
return buffer.toString();
}
/**
* Log the given message with the given tag.
*/
void _log(String tag, String message) {
if (_instrumentationServer != null) {
_instrumentationServer.log(_join([tag, message]));
}
}
/**
* Convert the given [object] to a string.
*/
String _toString(Object object) {
if (object == null) {
return 'null';
}
return object.toString();
}
}
/**
* An [InstrumentationServer] that sends messages to multiple instances.
*/
class MulticastInstrumentationServer implements InstrumentationServer {
final List<InstrumentationServer> _servers;
MulticastInstrumentationServer(this._servers);
@override
String get describe {
return _servers
.map((InstrumentationServer server) => server.describe)
.join("\n");
}
@override
String get sessionId => _servers[0].sessionId;
@override
void log(String message) {
for (InstrumentationServer server in _servers) {
server.log(message);
}
}
@override
void logWithPriority(String message) {
for (InstrumentationServer server in _servers) {
server.logWithPriority(message);
}
}
@override
Future shutdown() async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
for (InstrumentationServer server in _servers) {
await server.shutdown();
}
}
}
/**
* Information about a plugin.
*/
class PluginData {
/**
* The id used to uniquely identify the plugin.
*/
final String pluginId;
/**
* The name of the plugin.
*/
final String name;
/**
* The version of the plugin.
*/
final String version;
/**
* Initialize a newly created set of data about a plugin.
*/
PluginData(this.pluginId, this.name, this.version);
/**
* Add the information about the plugin to the list of [fields] to be sent to
* the instrumentation server.
*/
void addToFields(List<String> fields) {
fields.add(pluginId);
fields.add(name ?? '');
fields.add(version ?? '');
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/context/declared_variables.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@deprecated
library analyzer.context.declared_variables;
export 'package:analyzer/dart/analysis/declared_variables.dart';
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/context/context_root.dart | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@deprecated
library context.context_root;
export 'package:analyzer/src/context/context_root.dart';
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/features.dart | // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:meta/meta.dart';
import 'package:pub_semver/pub_semver.dart';
/// Information about a single language feature whose presence or absence
/// depends on the supported Dart SDK version, and possibly on the presence of
/// experimental flags.
abstract class Feature {
/// Feature information for the 2018 constant update.
static const constant_update_2018 = ExperimentalFeatures.constant_update_2018;
/// Feature information for non-nullability by default.
static const non_nullable = ExperimentalFeatures.non_nullable;
/// Feature information for control flow collections.
static const control_flow_collections =
ExperimentalFeatures.control_flow_collections;
/// Feature information for extension methods.
static const extension_methods = ExperimentalFeatures.extension_methods;
/// Feature information for spread collections.
static const spread_collections = ExperimentalFeatures.spread_collections;
/// Feature information for set literals.
static const set_literals = ExperimentalFeatures.set_literals;
/// Feature information for the triple-shift operator.
static const triple_shift = ExperimentalFeatures.triple_shift;
/// Feature information for variance.
static const variance = ExperimentalFeatures.variance;
/// If the feature may be enabled or disabled on the command line, the
/// experimental flag that may be used to enable it. Otherwise `null`.
///
/// Should be `null` if [status] is `current` or `abandoned`.
String get experimentalFlag;
/// If [status] is not `future`, the first version of the Dart SDK in which
/// the given feature was supported. Otherwise `null`.
Version get firstSupportedVersion;
/// The status of the feature.
FeatureStatus get status;
}
/// An unordered collection of [Feature] objects.
abstract class FeatureSet {
/// Computes a set of features for use in a unit test. Computes the set of
/// features enabled in [sdkVersion], plus any specified [additionalFeatures].
///
/// If [sdkVersion] is not supplied (or is `null`), then the current set of
/// enabled features is used as the starting point.
@visibleForTesting
factory FeatureSet.forTesting(
{String sdkVersion, List<Feature> additionalFeatures}) =
// ignore: invalid_use_of_visible_for_testing_member
ExperimentStatus.forTesting;
/// Computes the set of features implied by the given set of experimental
/// enable flags.
factory FeatureSet.fromEnableFlags(List<String> flags) =
ExperimentStatus.fromStrings;
/// Queries whether the given [feature] is contained in this feature set.
bool isEnabled(Feature feature);
/// Computes a subset of this FeatureSet by removing any features that weren't
/// available in the given Dart SDK version.
FeatureSet restrictToVersion(Version version);
}
/// Information about the status of a language feature.
enum FeatureStatus {
/// The language feature has not yet shipped. It may not be used unless an
/// experimental flag is used to enable it.
future,
/// The language feature has not yet shipped, but we are testing the effect of
/// enabling it by default. It may be used in any library with an appopriate
/// version constraint, unless an experimental flag is used to disable it.
provisional,
/// The language feature has been shipped. It may be used in any library with
/// an appropriate version constraint.
current,
/// The language feature is no longer planned. It may not be used.
abandoned,
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/analysis_context_collection.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
import 'package:meta/meta.dart';
/// A collection of analysis contexts.
///
/// Clients may not extend, implement or mix-in this class.
abstract class AnalysisContextCollection {
/// Initialize a newly created collection of analysis contexts that can
/// analyze the files that are included by the list of [includedPaths].
///
/// All paths must be absolute and normalized.
///
/// If a [resourceProvider] is given, then it will be used to access the file
/// system, otherwise the default resource provider will be used.
factory AnalysisContextCollection(
{@required List<String> includedPaths,
List<String> excludedPaths,
ResourceProvider resourceProvider}) = AnalysisContextCollectionImpl;
/// Return all of the analysis contexts in this collection.
List<AnalysisContext> get contexts;
/// Return the existing analysis context that should be used to analyze the
/// given [path], or throw [StateError] if the [path] is not analyzed in any
/// of the created analysis contexts.
AnalysisContext contextFor(String path);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/declared_variables.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/constant/value.dart';
import 'package:analyzer/src/dart/constant/value.dart';
import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
/// An object used to provide access to the values of variables that have been
/// defined on the command line using the `-D` option.
///
/// Clients may not extend, implement or mix-in this class.
class DeclaredVariables {
/// A table mapping the names of declared variables to their values.
Map<String, String> _declaredVariables = <String, String>{};
/// Initialize a newly created set of declared variables in which there are no
/// variables.
DeclaredVariables();
/// Initialize a newly created set of declared variables to define variables
/// whose names are the keys in the give [variableMap] and whose values are
/// the corresponding values from the map.
DeclaredVariables.fromMap(Map<String, String> variableMap) {
_declaredVariables.addAll(variableMap);
}
/// Return the names of the variables for which a value has been defined.
Iterable<String> get variableNames => _declaredVariables.keys;
/// Add all variables of [other] to this object.
@deprecated
void addAll(DeclaredVariables other) {
_declaredVariables.addAll(other._declaredVariables);
}
/// Define a variable with the given [name] to have the given [value].
@deprecated
void define(String name, String value) {
_declaredVariables[name] = value;
}
/// Return the raw string value of the variable with the given [name],
/// or `null` of the variable is not defined.
String get(String name) => _declaredVariables[name];
/// Return the value of the variable with the given [name] interpreted as a
/// 'boolean' value. If the variable is not defined (or [name] is `null`), a
/// DartObject representing "unknown" is returned. If the value cannot be
/// parsed as a boolean, a DartObject representing 'null' is returned. The
/// [typeProvider] is the type provider used to find the type 'bool'.
DartObject getBool(TypeProvider typeProvider, String name) {
String value = _declaredVariables[name];
if (value == null) {
return new DartObjectImpl(typeProvider.boolType, BoolState.UNKNOWN_VALUE);
}
if (value == "true") {
return new DartObjectImpl(typeProvider.boolType, BoolState.TRUE_STATE);
} else if (value == "false") {
return new DartObjectImpl(typeProvider.boolType, BoolState.FALSE_STATE);
}
return new DartObjectImpl(typeProvider.nullType, NullState.NULL_STATE);
}
/// Return the value of the variable with the given [name] interpreted as an
/// integer value. If the variable is not defined (or [name] is `null`), a
/// DartObject representing "unknown" is returned. If the value cannot be
/// parsed as an integer, a DartObject representing 'null' is returned.
DartObject getInt(TypeProvider typeProvider, String name) {
String value = _declaredVariables[name];
if (value == null) {
return new DartObjectImpl(typeProvider.intType, IntState.UNKNOWN_VALUE);
}
int bigInteger;
try {
bigInteger = int.parse(value);
} on FormatException {
return new DartObjectImpl(typeProvider.nullType, NullState.NULL_STATE);
}
return new DartObjectImpl(typeProvider.intType, new IntState(bigInteger));
}
/// Return the value of the variable with the given [name] interpreted as a
/// String value, or `null` if the variable is not defined. Return the value
/// of the variable with the given name interpreted as a String value. If the
/// variable is not defined (or [name] is `null`), a DartObject representing
/// "unknown" is returned. The [typeProvider] is the type provider used to
/// find the type 'String'.
DartObject getString(TypeProvider typeProvider, String name) {
String value = _declaredVariables[name];
if (value == null) {
return new DartObjectImpl(
typeProvider.stringType, StringState.UNKNOWN_VALUE);
}
return new DartObjectImpl(typeProvider.stringType, new StringState(value));
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/session.dart | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/declared_variables.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/uri_converter.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart';
/// A consistent view of the results of analyzing one or more files.
///
/// The methods in this class that return analysis results will throw an
/// [InconsistentAnalysisException] if the result to be returned might be
/// inconsistent with any previously returned results.
///
/// Clients may not extend, implement or mix-in this class.
abstract class AnalysisSession {
/// The analysis context that created this session.
AnalysisContext get analysisContext;
/// The declared environment variables.
DeclaredVariables get declaredVariables;
/// Return the [ResourceProvider] that is used to access the file system.
ResourceProvider get resourceProvider;
/// Return the source factory used to resolve URIs.
///
/// Deprecated: Use the methods on [uriConverter] instead.
@deprecated
SourceFactory get sourceFactory;
/// Return a type provider that is consistent with the results returned by
/// this session.
Future<TypeProvider> get typeProvider;
/// Return the type system being used by this session.
Future<TypeSystem> get typeSystem;
/// Return the URI converter used to convert between URI's and file paths.
UriConverter get uriConverter;
/// Return a future that will complete with information about the errors
/// contained in the file with the given absolute, normalized [path].
///
/// If the file cannot be analyzed by this session, then the result will have
/// a result state indicating the nature of the problem.
Future<ErrorsResult> getErrors(String path);
/// Return a future that will complete with the library element representing
/// the library with the given [uri].
Future<LibraryElement> getLibraryByUri(String uri);
/// Return a future that will complete with information about the results of
/// parsing the file with the given absolute, normalized [path].
///
/// Deprecated: Use [getParsedUnit] instead.
@deprecated
Future<ParseResult> getParsedAst(String path);
/// Return information about the results of parsing the file with the given
/// absolute, normalized [path].
///
/// Deprecated: Use [getParsedUnit] instead.
@deprecated
ParseResult getParsedAstSync(String path);
/// Return information about the results of parsing units of the library file
/// with the given absolute, normalized [path].
///
/// Throw [ArgumentError] if the given [path] is not the defining compilation
/// unit for a library (that is, is a part of a library).
ParsedLibraryResult getParsedLibrary(String path);
/// Return information about the results of parsing units of the library file
/// with the given library [element].
///
/// Throw [ArgumentError] if the [element] was not produced by this session.
ParsedLibraryResult getParsedLibraryByElement(LibraryElement element);
/// Return information about the results of parsing the file with the given
/// absolute, normalized [path].
ParsedUnitResult getParsedUnit(String path);
/// Return information about the file at the given absolute, normalized
/// [path].
FileResult getFile(String path);
/// Return a future that will complete with information about the results of
/// resolving the file with the given absolute, normalized [path].
///
/// Deprecated: Use [getResolvedUnit] instead.
@deprecated
Future<ResolveResult> getResolvedAst(String path);
/// Return a future that will complete with information about the results of
/// resolving all of the files in the library with the given absolute,
/// normalized [path].
///
/// Throw [ArgumentError] if the given [path] is not the defining compilation
/// unit for a library (that is, is a part of a library).
Future<ResolvedLibraryResult> getResolvedLibrary(String path);
/// Return a future that will complete with information about the results of
/// resolving all of the files in the library with the library [element].
///
/// Throw [ArgumentError] if the [element] was not produced by this session.
Future<ResolvedLibraryResult> getResolvedLibraryByElement(
LibraryElement element);
/// Return a future that will complete with information about the results of
/// resolving the file with the given absolute, normalized [path].
Future<ResolvedUnitResult> getResolvedUnit(String path);
/// Return a future that will complete with the source kind of the file with
/// the given absolute, normalized [path]. If the path does not represent a
/// file or if the kind of the file cannot be determined, then the future will
/// complete with [SourceKind.UNKNOWN].
Future<SourceKind> getSourceKind(String path);
/// Return a future that will complete with information about the results of
/// building the element model for the file with the given absolute,
/// normalized[path].
Future<UnitElementResult> getUnitElement(String path);
/// Return a future that will complete with the signature for the file with
/// the given absolute, normalized [path], or `null` if the file cannot be
/// analyzed. This is the same signature returned in the result from
/// [getUnitElement].
///
/// The signature is based on the APIs of the files of the library (including
/// the file itself), and the transitive closure of files imported and
/// exported by the library. If the signature of a file has not changed, then
/// there have been no changes that would cause any files that depend on it to
/// need to be re-analyzed.
Future<String> getUnitElementSignature(String path);
}
/// The exception thrown by an [AnalysisSession] if a result is requested that
/// might be inconsistent with any previously returned results.
class InconsistentAnalysisException extends AnalysisException {
InconsistentAnalysisException()
: super('Requested result might be inconsistent with previously '
'returned results');
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/context_root.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/file_system/file_system.dart';
/// Information about the root directory associated with an analysis context.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ContextRoot {
/// A list of the files and directories within the root directory that should
/// not be analyzed.
List<Resource> get excluded;
/// A collection of the absolute, normalized paths of files and directories
/// within the root directory that should not be analyzed.
Iterable<String> get excludedPaths;
/// A list of the files and directories within the root directory that should
/// be analyzed. If all of the files in the root directory (other than those
/// that are explicitly excluded) should be analyzed, then this list will
/// contain the root directory.
List<Resource> get included;
/// A collection of the absolute, normalized paths of files within the root
/// directory that should be analyzed. If all of the files in the root
/// directory (other than those that are explicitly excluded) should be
/// analyzed, then this collection will contain the path of the root
/// directory.
Iterable<String> get includedPaths;
/// The analysis options file that should be used when analyzing the files
/// within this context root, or `null` if there is no options file.
File get optionsFile;
/// The packages file that should be used when analyzing the files within this
/// context root, or `null` if there is no options file.
File get packagesFile;
/// The resource provider used to access the file system.
ResourceProvider get resourceProvider;
/// The root directory containing the files to be analyzed.
Folder get root;
/// Return the absolute, normalized paths of all of the files that are
/// contained in this context. These are all of the files that are included
/// directly or indirectly by one or more of the [includedPaths] and that are
/// not excluded by any of the [excludedPaths].
///
/// Note that the list is not filtered based on the file suffix, so non-Dart
/// files can be returned.
Iterable<String> analyzedFiles();
/// Return `true` if the file or directory with the given [path] will be
/// analyzed in this context. A file (or directory) will be analyzed if it is
/// either the same as or contained in one of the [includedPaths] and, if it
/// is contained in one of the [includedPaths], is not the same as or
/// contained in one of the [excludedPaths].
bool isAnalyzed(String path);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/context_builder.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/dart/analysis/declared_variables.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/context_builder.dart';
import 'package:meta/meta.dart';
/// A utility class used to build an analysis context based on a context root.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ContextBuilder {
/// Initialize a newly created context builder. If a [resourceProvider] is
/// given, then it will be used to access the file system, otherwise the
/// default resource provider will be used.
factory ContextBuilder({ResourceProvider resourceProvider}) =
ContextBuilderImpl;
/// Return an analysis context corresponding to the given [contextRoot].
///
/// If a set of [declaredVariables] is provided, the values will be used to
/// map the the variable names found in `fromEnvironment` invocations to the
/// constant value that will be returned. If none is given, then no variables
/// will be defined.
///
/// If a list of [librarySummaryPaths] is provided, then the summary files at
/// those paths will be used, when possible, when analyzing the libraries
/// contained in the summary files.
///
/// If an [sdkPath] is provided, and if it is a valid path to a directory
/// containing a valid SDK, then the SDK in the referenced directory will be
/// used when analyzing the code in the context.
///
/// If an [sdkSummaryPath] is provided, then that file will be used as the
/// summary file for the SDK.
AnalysisContext createContext(
{@required ContextRoot contextRoot,
DeclaredVariables declaredVariables,
List<String> librarySummaryPaths,
String sdkPath,
String sdkSummaryPath});
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/analysis_context.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/src/generated/engine.dart';
/// A representation of a body of code and the context in which the code is to
/// be analyzed.
///
/// The body of code is represented as a collection of files and directories, as
/// defined by the list of included paths. If the list of included paths
/// contains one or more directories, then zero or more files or directories
/// within the included directories can be excluded from analysis, as defined by
/// the list of excluded paths.
///
/// Clients may not extend, implement or mix-in this class.
abstract class AnalysisContext {
/// The analysis options used to control the way the code is analyzed.
AnalysisOptions get analysisOptions;
/// Return the context root from which this context was created.
ContextRoot get contextRoot;
/// Return the currently active analysis session.
AnalysisSession get currentSession;
/// A list of the absolute, normalized paths of files and directories that
/// will not be analyzed.
///
/// Deprecated: Use `contextRoot.excludedPaths`.
@deprecated
List<String> get excludedPaths;
/// A list of the absolute, normalized paths of files and directories that
/// will be analyzed. If a path in the list represents a file, then that file
/// will be analyzed, even if it is in the list of [excludedPaths]. If path in
/// the list represents a directory, then all of the files contained in that
/// directory, either directly or indirectly, and that are not explicitly
/// excluded by the list of [excludedPaths] will be analyzed.
///
/// Deprecated: Use `contextRoot.includedPaths`.
@deprecated
List<String> get includedPaths;
/// Return the absolute, normalized paths of all of the files that are
/// contained in this context. These are all of the files that are included
/// directly or indirectly by one or more of the [includedPaths] and that are
/// not excluded by any of the [excludedPaths].
///
/// Deprecated: Use `contextRoot.analyzedFiles`.
@deprecated
Iterable<String> analyzedFiles();
/// Return `true` if the file or directory with the given [path] will be
/// analyzed in this context. A file (or directory) will be analyzed if it is
/// either the same as or contained in one of the [includedPaths] and, if it
/// is contained in one of the [includedPaths], is not the same as or
/// contained in one of the [excludedPaths].
///
/// Deprecated: Use `contextRoot.isAnalyzed`.
@deprecated
bool isAnalyzed(String path);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/uri_converter.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// A utility class used to convert between URIs and absolute file paths.
abstract class UriConverter {
/// Return the URI that should be used to reference the file at the absolute
/// [path], or `null` if there is no valid way to reference the file in this
/// converter’s context. The file at that path is not required to exist.
///
/// If a [containingPath] is provided and both the [path] and [containingPath]
/// are within the root of this converter’s context, then the returned URI
/// will be a relative path. Otherwise, the returned URI will be an absolute
/// URI.
///
/// Throws an `ArgumentError` if the [path] is `null` or is not a valid
/// absolute file path.
Uri pathToUri(String path, {String containingPath});
/// Return the absolute path of the file to which the absolute [uri] resolves,
/// or `null` if the [uri] cannot be resolved in this converter’s context.
///
/// Throws an `ArgumentError` if the [uri] is `null` or is not an absolute
/// URI.
String uriToPath(Uri uri);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/utilities.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/analysis_context_collection.dart';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/dart/analysis/results.dart';
import 'package:analyzer/src/dart/scanner/reader.dart';
import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/string_source.dart';
import 'package:meta/meta.dart';
/// Return the result of parsing the file at the given [path].
///
/// If a [resourceProvider] is given, it will be used to access the file system.
///
/// [featureSet] determines what set of features will be assumed by the parser.
/// This parameter is required because the analyzer does not yet have a
/// performant way of computing the correct feature set for a single file to be
/// parsed. Callers that need the feature set to be strictly correct must
/// create an [AnalysisContextCollection], query it to get an [AnalysisContext],
/// query it to get an [AnalysisSession], and then call `getParsedUnit`.
///
/// Callers that don't need the feature set to be strictly correct can pass in
/// `FeatureSet.fromEnableFlags([])` to enable the default set of features; this
/// is much more performant than using an analysis session, because it doesn't
/// require the analyzer to process the SDK.
///
/// If [throwIfDiagnostics] is `true` (the default), then if any diagnostics are
/// produced because of syntactic errors in the [content] an `ArgumentError`
/// will be thrown. If the parameter is `false`, then the caller can check the
/// result to see whether there are any errors.
ParseStringResult parseFile(
{@required String path,
ResourceProvider resourceProvider,
@required FeatureSet featureSet,
bool throwIfDiagnostics: true}) {
if (featureSet == null) {
throw ArgumentError('A non-null feature set must be provided.');
}
resourceProvider ??= PhysicalResourceProvider.INSTANCE;
var content = (resourceProvider.getResource(path) as File).readAsStringSync();
return parseString(
content: content,
path: path,
featureSet: featureSet,
throwIfDiagnostics: throwIfDiagnostics);
}
/// Return the result of parsing the file at the given [path].
///
/// If a [resourceProvider] is given, it will be used to access the file system.
///
/// [featureSet] determines what set of features will be assumed by the parser.
/// This parameter is required because the analyzer does not yet have a
/// performant way of computing the correct feature set for a single file to be
/// parsed. Callers that need the feature set to be strictly correct must
/// create an [AnalysisContextCollection], query it to get an [AnalysisContext],
/// query it to get an [AnalysisSession], and then call `getParsedUnit`.
///
/// Callers that don't need the feature set to be strictly correct can pass in
/// `FeatureSet.fromEnableFlags([])` to enable the default set of features; this
/// is much more performant than using an analysis session, because it doesn't
/// require the analyzer to process the SDK.
///
/// If [throwIfDiagnostics] is `true` (the default), then if any diagnostics are
/// produced because of syntactic errors in the [content] an `ArgumentError`
/// will be thrown. If the parameter is `false`, then the caller can check the
/// result to see whether there are any errors.
@Deprecated('Use parseFile')
ParseStringResult parseFile2(
{@required String path,
ResourceProvider resourceProvider,
@required FeatureSet featureSet,
bool throwIfDiagnostics: true}) {
return parseFile(
path: path,
resourceProvider: resourceProvider,
featureSet: featureSet,
throwIfDiagnostics: throwIfDiagnostics);
}
/// Returns the result of parsing the given [content] as a compilation unit.
///
/// If a [featureSet] is provided, it will be the default set of features that
/// will be assumed by the parser.
///
/// If a [path] is provided, it will be used as the name of the file when
/// reporting errors.
///
/// If [throwIfDiagnostics] is `true` (the default), then if any diagnostics are
/// produced because of syntactic errors in the [content] an `ArgumentError`
/// will be thrown. If the parameter is `false`, then the caller can check the
/// result to see whether there are any `errors`.
ParseStringResult parseString(
{@required String content,
FeatureSet featureSet,
String path,
bool throwIfDiagnostics: true}) {
featureSet ??= FeatureSet.fromEnableFlags([]);
var source = StringSource(content, path);
var reader = CharSequenceReader(content);
var errorCollector = RecordingErrorListener();
var scanner = Scanner(source, reader, errorCollector)
..configureFeatures(featureSet);
var token = scanner.tokenize();
var parser = Parser(source, errorCollector, featureSet: scanner.featureSet);
var unit = parser.parseCompilationUnit(token);
unit.lineInfo = LineInfo(scanner.lineStarts);
ParseStringResult result =
ParseStringResultImpl(content, unit, errorCollector.errors);
if (throwIfDiagnostics && result.errors.isNotEmpty) {
throw new ArgumentError('Content produced diagnostics when parsed');
}
return result;
}
/// Return the result of resolving the file at the given [path].
///
/// If a [resourceProvider] is given, it will be used to access the file system.
///
/// Note that if more than one file is going to be resolved then this function
/// is inefficient. Clients should instead use [AnalysisContextCollection] to
/// create one or more contexts and use those contexts to resolve the files.
Future<ResolvedUnitResult> resolveFile(
{@required String path, ResourceProvider resourceProvider}) async {
AnalysisContext context =
_createAnalysisContext(path: path, resourceProvider: resourceProvider);
return await context.currentSession.getResolvedUnit(path);
}
/// Return a newly create analysis context in which the file at the given [path]
/// can be analyzed.
///
/// If a [resourceProvider] is given, it will be used to access the file system.
AnalysisContext _createAnalysisContext(
{@required String path, ResourceProvider resourceProvider}) {
AnalysisContextCollection collection = new AnalysisContextCollection(
includedPaths: <String>[path],
resourceProvider: resourceProvider ?? PhysicalResourceProvider.INSTANCE,
);
List<AnalysisContext> contexts = collection.contexts;
if (contexts.length != 1) {
throw new ArgumentError('path must be an absolute path to a single file');
}
return contexts[0];
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/context_locator.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/context_locator.dart';
import 'package:meta/meta.dart';
/// Determines the list of analysis contexts that can be used to analyze the
/// files and folders that should be analyzed given a list of included files and
/// folders and a list of excluded files and folders.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ContextLocator {
/// Initialize a newly created context locator. If a [resourceProvider] is
/// supplied, it will be used to access the file system. Otherwise the default
/// resource provider will be used.
factory ContextLocator({ResourceProvider resourceProvider}) =
ContextLocatorImpl;
/// Return a list of the analysis contexts that should be used to analyze the
/// files that are included by the list of [includedPaths] and not excluded by
/// the list of [excludedPaths].
///
/// If an [optionsFile] is specified, then it is assumed to be the path to the
/// `analysis_options.yaml` (or `.analysis_options`) file that should be used
/// in place of the ones that would be found by looking in the directories
/// containing the context roots.
///
/// If a [packagesFile] is specified, then it is assumed to be the path to the
/// `.packages` file that should be used in place of the one that would be
/// found by looking in the directories containing the context roots.
///
/// If the [sdkPath] is specified, then it is used as the path to the root of
/// the SDK that should be used during analysis.
@deprecated
List<AnalysisContext> locateContexts(
{@required List<String> includedPaths,
List<String> excludedPaths: const <String>[],
String optionsFile,
String packagesFile,
String sdkPath});
/// Return a list of the context roots that should be used to analyze the
/// files that are included by the list of [includedPaths] and not excluded by
/// the list of [excludedPaths].
///
/// If an [optionsFile] is specified, then it is assumed to be the path to the
/// `analysis_options.yaml` (or `.analysis_options`) file that should be used
/// in place of the ones that would be found by looking in the directories
/// containing the context roots.
///
/// If a [packagesFile] is specified, then it is assumed to be the path to the
/// `.packages` file that should be used in place of the one that would be
/// found by looking in the directories containing the context roots.
List<ContextRoot> locateRoots(
{@required List<String> includedPaths,
List<String> excludedPaths,
String optionsFile,
String packagesFile});
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/analysis/results.dart | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart';
/// The result of performing some kind of analysis on a single file. Every
/// result that implements this interface will also implement a sub-interface.
///
/// Clients may not extend, implement or mix-in this class.
abstract class AnalysisResult {
/// The absolute and normalized path of the file that was analyzed.
String get path;
/// Return the session used to compute this result.
AnalysisSession get session;
/// The state of the results.
ResultState get state;
/// The absolute URI of the file that was analyzed.
Uri get uri;
}
/// An analysis result that includes the errors computed during analysis.
///
/// Clients may not extend, implement or mix-in this class.
abstract class AnalysisResultWithErrors implements FileResult {
/// The analysis errors that were computed during analysis.
List<AnalysisError> get errors;
}
/// The declaration of an [Element].
abstract class ElementDeclarationResult {
/// The [Element] that this object describes.
Element get element;
/// The node that declares the [element]. Depending on whether it is returned
/// from [ResolvedLibraryResult] or [ParsedLibraryResult] it might be resolved
/// or just parsed.
AstNode get node;
/// If this declaration is returned from [ParsedLibraryResult], the parsed
/// unit that contains the [node]. Otherwise `null`.
ParsedUnitResult get parsedUnit;
/// If this declaration is returned from [ResolvedLibraryResult], the
/// resolved unit that contains the [node]. Otherwise `null`.
ResolvedUnitResult get resolvedUnit;
}
/// The result of computing all of the errors contained in a single file, both
/// syntactic and semantic.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ErrorsResult implements AnalysisResultWithErrors {}
/// The result of computing some cheap information for a single file, when full
/// parsed file is not required, so [ParsedUnitResult] is not necessary.
///
/// Clients may not extend, implement or mix-in this class.
abstract class FileResult implements AnalysisResult {
/// Whether the file is a part.
bool get isPart;
/// Information about lines in the content.
LineInfo get lineInfo;
}
/// The result of building parsed AST(s) for the whole library.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ParsedLibraryResult implements AnalysisResult {
/// The parsed units of the library.
List<ParsedUnitResult> get units;
/// Return the declaration of the [element], or `null` if the [element]
/// is synthetic. Throw [ArgumentError] if the [element] is not defined in
/// this library.
ElementDeclarationResult getElementDeclaration(Element element);
}
/// The result of parsing of a single file. The errors returned include only
/// those discovered during scanning and parsing.
///
/// Clients may not extend, implement or mix-in this class.
// ignore: deprecated_member_use_from_same_package
abstract class ParsedUnitResult implements ParseResult {}
/// The result of parsing of a single file. The errors returned include only
/// those discovered during scanning and parsing.
///
/// Clients may not extend, implement or mix-in this class.
@deprecated
abstract class ParseResult implements AnalysisResultWithErrors {
/// The content of the file that was scanned and parsed.
String get content;
/// The parsed, unresolved compilation unit for the [content].
CompilationUnit get unit;
}
/// The result of parsing of a single file. The errors returned include only
/// those discovered during scanning and parsing.
///
/// Similar to [ParsedUnitResult], but does not allow access to an analysis
/// session.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ParseStringResult {
/// The content of the file that was scanned and parsed.
String get content;
/// The analysis errors that were computed during analysis.
List<AnalysisError> get errors;
/// Information about lines in the content.
LineInfo get lineInfo;
/// The parsed, unresolved compilation unit for the [content].
CompilationUnit get unit;
}
/// The result of building resolved AST(s) for the whole library.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ResolvedLibraryResult implements AnalysisResult {
/// The element representing this library.
LibraryElement get element;
/// The type provider used when resolving the library.
TypeProvider get typeProvider;
/// The resolved units of the library.
List<ResolvedUnitResult> get units;
/// Return the declaration of the [element], or `null` if the [element]
/// is synthetic. Throw [ArgumentError] if the [element] is not defined in
/// this library.
ElementDeclarationResult getElementDeclaration(Element element);
}
/// The result of building a resolved AST for a single file. The errors returned
/// include both syntactic and semantic errors.
///
/// Clients may not extend, implement or mix-in this class.
// ignore: deprecated_member_use_from_same_package
abstract class ResolvedUnitResult implements ResolveResult {}
/// The result of building a resolved AST for a single file. The errors returned
/// include both syntactic and semantic errors.
///
/// Clients may not extend, implement or mix-in this class.
@deprecated
abstract class ResolveResult implements AnalysisResultWithErrors {
/// The content of the file that was scanned, parsed and resolved.
String get content;
/// The element representing the library containing the compilation [unit].
LibraryElement get libraryElement;
/// The type provider used when resolving the compilation [unit].
TypeProvider get typeProvider;
/// The type system used when resolving the compilation [unit].
TypeSystem get typeSystem;
/// The fully resolved compilation unit for the [content].
CompilationUnit get unit;
}
/// An indication of whether an analysis result is valid, and if not why.
enum ResultState {
/// An indication that analysis could not be performed because the path
/// represents a file of a type that cannot be analyzed.
INVALID_FILE_TYPE,
/// An indication that analysis could not be performed because the path does
/// not represent a file. It might represent something else, such as a
/// directory, or it might not represent anything.
NOT_A_FILE,
/// An indication that analysis completed normally and the results are valid.
VALID
}
/// The result of building the element model for a single file.
///
/// Clients may not extend, implement or mix-in this class.
abstract class UnitElementResult implements AnalysisResult {
/// The element of the file.
CompilationUnitElement get element;
/// The signature of the library containing the [element]. This is the same
/// signature returned by the method [AnalysisSession.getUnitElementSignature]
/// when given the path to the compilation unit represented by the [element].
///
/// The signature is based on the APIs of the files of the library (including
/// the file itself), and the transitive closure of files imported and
/// exported by the library. If the signature of a file has not changed, then
/// there have been no changes that would cause any files that depend on it
/// to need to be re-analyzed.
String get signature;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/constant/value.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// The interface used to access the result of constant evaluation.
///
/// Because the analyzer does not have any of the code under analysis loaded, it
/// does not do real evaluation. Instead it performs a symbolic computation and
/// presents those results through this interface.
///
/// Instances of these constant values are accessed through the
/// [element model](../element/element.dart).
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
/// A representation of the value of a compile-time constant expression.
///
/// Note that, unlike the mirrors system, the object being represented does *not*
/// exist. This interface allows static analysis tools to determine something
/// about the state of the object that would exist if the code that creates the
/// object were executed, but none of the code being analyzed is actually
/// executed.
///
/// Clients may not extend, implement or mix-in this class.
abstract class DartObject {
/// Return `true` if the value of the object being represented is known.
///
/// This method will return `false` if
/// * the value being represented is the value of a declared variable (a
/// variable whose value is provided at run-time using a `-D` command-line
/// option), or
/// * the value is a function.
///
/// The result of this method does not imply anything about the state of
/// object representations returned by the method [getField], those that are
/// elements of the list returned by [toListValue], or the keys or values in
/// the map returned by [toMapValue]. For example, a representation of a list
/// can return `true` even if one or more of the elements of that list would
/// return `false`.
bool get hasKnownValue;
/// Return `true` if the object being represented represents the value 'null'.
bool get isNull;
/// Return a representation of the type of the object being represented.
///
/// For values resulting from the invocation of a 'const' constructor, this
/// will be a representation of the run-time type of the object.
///
/// For values resulting from a literal expression, this will be a
/// representation of the static type of the value -- `int` for integer
/// literals, `List` for list literals, etc. -- even when the static type is an
/// abstract type (such as `List`) and hence will never be the run-time type of
/// the represented object.
///
/// For values resulting from any other kind of expression, this will be a
/// representation of the result of evaluating the expression.
///
/// Return `null` if the expression cannot be evaluated, either because it is
/// not a valid constant expression or because one or more of the values used
/// in the expression does not have a known value.
///
/// This method can return a representation of the type, even if this object
/// would return `false` from [hasKnownValue].
ParameterizedType get type;
/// Return a representation of the value of the field with the given [name].
///
/// Return `null` if either the object being represented does not have a field
/// with the given name or if the implementation of the class of the object is
/// invalid, making it impossible to determine that value of the field.
///
/// Note that, unlike the mirrors API, this method does *not* invoke a getter;
/// it simply returns a representation of the known state of a field.
DartObject getField(String name);
/// Return a boolean corresponding to the value of the object being
/// represented, or `null` if
/// * this object is not of type 'bool',
/// * the value of the object being represented is not known, or
/// * the value of the object being represented is `null`.
bool toBoolValue();
/// Return a double corresponding to the value of the object being represented,
/// or `null`
/// if
/// * this object is not of type 'double',
/// * the value of the object being represented is not known, or
/// * the value of the object being represented is `null`.
double toDoubleValue();
/// Return an element corresponding to the value of the object being
/// represented, or `null`
/// if
/// * this object is not of a function type,
/// * the value of the object being represented is not known, or
/// * the value of the object being represented is `null`.
ExecutableElement toFunctionValue();
/// Return an integer corresponding to the value of the object being
/// represented, or `null` if
/// * this object is not of type 'int',
/// * the value of the object being represented is not known, or
/// * the value of the object being represented is `null`.
int toIntValue();
/// Return a list corresponding to the value of the object being represented,
/// or `null` if
/// * this object is not of type 'List', or
/// * the value of the object being represented is `null`.
List<DartObject> toListValue();
/// Return a map corresponding to the value of the object being represented, or
/// `null` if
/// * this object is not of type 'Map', or
/// * the value of the object being represented is `null`.
Map<DartObject, DartObject> toMapValue();
/// Return a set corresponding to the value of the object being represented,
/// or `null` if
/// * this object is not of type 'Set', or
/// * the value of the object being represented is `null`.
Set<DartObject> toSetValue();
/// Return a string corresponding to the value of the object being represented,
/// or `null` if
/// * this object is not of type 'String',
/// * the value of the object being represented is not known, or
/// * the value of the object being represented is `null`.
String toStringValue();
/// Return a string corresponding to the value of the object being represented,
/// or `null` if
/// * this object is not of type 'Symbol', or
/// * the value of the object being represented is `null`.
/// (We return the string
String toSymbolValue();
/// Return the representation of the type corresponding to the value of the
/// object being represented, or `null` if
/// * this object is not of type 'Type', or
/// * the value of the object being represented is `null`.
DartType toTypeValue();
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/ast.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/precedence.dart';
/// Defines the AST model. The AST (Abstract Syntax Tree) model describes the
/// syntactic (as opposed to semantic) structure of Dart code. The semantic
/// structure of the code is modeled by the
/// [element model](../dart_element_element/dart_element_element-library.html).
///
/// An AST consists of nodes (instances of a subclass of [AstNode]). The nodes
/// are organized in a tree structure in which the children of a node are the
/// smaller syntactic units from which the node is composed. For example, a
/// binary expression consists of two sub-expressions (the operands) and an
/// operator. The two expressions are represented as nodes. The operator is not
/// represented as a node.
///
/// The AST is constructed by the parser based on the sequence of tokens
/// produced by the scanner. Most nodes provide direct access to the tokens used
/// to build the node. For example, the token for the operator in a binary
/// expression can be accessed from the node representing the binary expression.
///
/// While any node can theoretically be the root of an AST structure, almost all
/// of the AST structures known to the analyzer have a [CompilationUnit] as the
/// root of the structure. A compilation unit represents all of the Dart code in
/// a single file.
///
/// An AST can be either unresolved or resolved. When an AST is unresolved
/// certain properties will not have been computed and the accessors for those
/// properties will return `null`. The documentation for those getters should
/// describe that this is a possibility.
///
/// When an AST is resolved, the identifiers in the AST will be associated with
/// the elements that they refer to and every expression in the AST will have a
/// type associated with it.
import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/element/element.dart' show AuxiliaryElements;
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/source.dart' show LineInfo, Source;
import 'package:analyzer/src/generated/utilities_dart.dart';
/// Two or more string literals that are implicitly concatenated because of
/// being adjacent (separated only by whitespace).
///
/// While the grammar only allows adjacent strings when all of the strings are
/// of the same kind (single line or multi-line), this class doesn't enforce
/// that restriction.
///
/// adjacentStrings ::=
/// [StringLiteral] [StringLiteral]+
///
/// Clients may not extend, implement or mix-in this class.
abstract class AdjacentStrings implements StringLiteral {
/// Return the strings that are implicitly concatenated.
NodeList<StringLiteral> get strings;
}
/// An AST node that can be annotated with both a documentation comment and a
/// list of annotations.
///
/// Clients may not extend, implement or mix-in this class.
abstract class AnnotatedNode implements AstNode {
/// Return the documentation comment associated with this node, or `null` if
/// this node does not have a documentation comment associated with it.
Comment get documentationComment;
/// Set the documentation comment associated with this node to the given
/// [comment].
void set documentationComment(Comment comment);
/// Return the first token following the comment and metadata.
Token get firstTokenAfterCommentAndMetadata;
/// Return the annotations associated with this node.
NodeList<Annotation> get metadata;
/// Return a list containing the comment and annotations associated with this
/// node, sorted in lexical order.
List<AstNode> get sortedCommentAndAnnotations;
}
/// An annotation that can be associated with an AST node.
///
/// metadata ::=
/// annotation*
///
/// annotation ::=
/// '@' [Identifier] ('.' [SimpleIdentifier])? [ArgumentList]?
///
/// Clients may not extend, implement or mix-in this class.
abstract class Annotation implements AstNode {
/// Return the arguments to the constructor being invoked, or `null` if this
/// annotation is not the invocation of a constructor.
ArgumentList get arguments;
/// Set the arguments to the constructor being invoked to the given
/// [arguments].
void set arguments(ArgumentList arguments);
/// Return the at sign that introduced the annotation.
Token get atSign;
/// Set the at sign that introduced the annotation to the given [token].
void set atSign(Token token);
/// Return the name of the constructor being invoked, or `null` if this
/// annotation is not the invocation of a named constructor.
SimpleIdentifier get constructorName;
/// Set the name of the constructor being invoked to the given [name].
void set constructorName(SimpleIdentifier name);
/// Return the element associated with this annotation, or `null` if the AST
/// structure has not been resolved or if this annotation could not be
/// resolved.
Element get element;
/// Set the element associated with this annotation to the given [element].
void set element(Element element);
/// Return the element annotation representing this annotation in the element
/// model.
ElementAnnotation get elementAnnotation;
/// Set the element annotation representing this annotation in the element
/// model to the given [annotation].
void set elementAnnotation(ElementAnnotation annotation);
/// Return the name of the class defining the constructor that is being
/// invoked or the name of the field that is being referenced.
Identifier get name;
/// Set the name of the class defining the constructor that is being invoked
/// or the name of the field that is being referenced to the given [name].
void set name(Identifier name);
/// Return the period before the constructor name, or `null` if this
/// annotation is not the invocation of a named constructor.
Token get period;
/// Set the period before the constructor name to the given [token].
void set period(Token token);
}
/// A list of arguments in the invocation of an executable element (that is, a
/// function, method, or constructor).
///
/// argumentList ::=
/// '(' arguments? ')'
///
/// arguments ::=
/// [NamedExpression] (',' [NamedExpression])*
/// | [Expression] (',' [Expression])* (',' [NamedExpression])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class ArgumentList implements AstNode {
/// Return the expressions producing the values of the arguments. Although the
/// language requires that positional arguments appear before named arguments,
/// this class allows them to be intermixed.
NodeList<Expression> get arguments;
/// Set the parameter elements corresponding to each of the arguments in this
/// list to the given list of [parameters]. The list of parameters must be the
/// same length as the number of arguments, but can contain `null` entries if
/// a given argument does not correspond to a formal parameter.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [correspondingStaticParameters] instead.
@deprecated
void set correspondingPropagatedParameters(List<ParameterElement> parameters);
/// Set the parameter elements corresponding to each of the arguments in this
/// list to the given list of [parameters]. The list of parameters must be the
/// same length as the number of arguments, but can contain `null` entries if
/// a given argument does not correspond to a formal parameter.
void set correspondingStaticParameters(List<ParameterElement> parameters);
/// Return the left parenthesis.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the right parenthesis.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
}
/// An as expression.
///
/// asExpression ::=
/// [Expression] 'as' [TypeAnnotation]
///
/// Clients may not extend, implement or mix-in this class.
abstract class AsExpression implements Expression {
/// Return the 'as' operator.
Token get asOperator;
/// Set the 'as' operator to the given [token].
void set asOperator(Token token);
/// Return the expression used to compute the value being cast.
Expression get expression;
/// Set the expression used to compute the value being cast to the given
/// [expression].
void set expression(Expression expression);
/// Return the type being cast to.
TypeAnnotation get type;
/// Set the type being cast to to the given [type].
void set type(TypeAnnotation type);
}
/// An assert in the initializer list of a constructor.
///
/// assertInitializer ::=
/// 'assert' '(' [Expression] (',' [Expression])? ')'
///
/// Clients may not extend, implement or mix-in this class.
abstract class AssertInitializer implements Assertion, ConstructorInitializer {}
/// An assertion, either in a block or in the initializer list of a constructor.
///
/// Clients may not extend, implement or mix-in this class.
abstract class Assertion implements AstNode {
/// Return the token representing the 'assert' keyword.
Token get assertKeyword;
/// Set the token representing the 'assert' keyword to the given [token].
void set assertKeyword(Token token);
/// Return the comma between the [condition] and the [message], or `null` if
/// no message was supplied.
Token get comma;
/// Set the comma between the [condition] and the [message] to the given
/// [token].
void set comma(Token token);
/// Return the condition that is being asserted to be `true`.
Expression get condition;
/// Set the condition that is being asserted to be `true` to the given
/// [condition].
void set condition(Expression condition);
/// Return the left parenthesis.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the message to report if the assertion fails, or `null` if no
/// message was supplied.
Expression get message;
/// Set the message to report if the assertion fails to the given
/// [expression].
void set message(Expression expression);
/// Return the right parenthesis.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
}
/// An assert statement.
///
/// assertStatement ::=
/// 'assert' '(' [Expression] (',' [Expression])? ')' ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class AssertStatement implements Assertion, Statement {
/// Return the semicolon terminating the statement.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
}
/// An assignment expression.
///
/// assignmentExpression ::=
/// [Expression] operator [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class AssignmentExpression
implements Expression, MethodReferenceExpression {
/// Return the expression used to compute the left hand side.
Expression get leftHandSide;
/// Return the expression used to compute the left hand side.
void set leftHandSide(Expression expression);
/// Return the assignment operator being applied.
Token get operator;
/// Set the assignment operator being applied to the given [token].
void set operator(Token token);
/// Return the expression used to compute the right hand side.
Expression get rightHandSide;
/// Set the expression used to compute the left hand side to the given
/// [expression].
void set rightHandSide(Expression expression);
}
/// A node in the AST structure for a Dart program.
///
/// Clients may not extend, implement or mix-in this class.
abstract class AstNode implements SyntacticEntity {
/// A comparator that can be used to sort AST nodes in lexical order. In other
/// words, `compare` will return a negative value if the offset of the first
/// node is less than the offset of the second node, zero (0) if the nodes
/// have the same offset, and a positive value if the offset of the first node
/// is greater than the offset of the second node.
static Comparator<AstNode> LEXICAL_ORDER =
(AstNode first, AstNode second) => first.offset - second.offset;
/// Return the first token included in this node's source range.
Token get beginToken;
/// Return an iterator that can be used to iterate through all the entities
/// (either AST nodes or tokens) that make up the contents of this node,
/// including doc comments but excluding other comments.
Iterable<SyntacticEntity> get childEntities;
/// Return the offset of the character immediately following the last
/// character of this node's source range. This is equivalent to
/// `node.getOffset() + node.getLength()`. For a compilation unit this will be
/// equal to the length of the unit's source. For synthetic nodes this will be
/// equivalent to the node's offset (because the length is zero (0) by
/// definition).
@override
int get end;
/// Return the last token included in this node's source range.
Token get endToken;
/// Return `true` if this node is a synthetic node. A synthetic node is a node
/// that was introduced by the parser in order to recover from an error in the
/// code. Synthetic nodes always have a length of zero (`0`).
bool get isSynthetic;
@override
int get length;
@override
int get offset;
/// Return this node's parent node, or `null` if this node is the root of an
/// AST structure.
///
/// Note that the relationship between an AST node and its parent node may
/// change over the lifetime of a node.
AstNode get parent;
/// Return the node at the root of this node's AST structure. Note that this
/// method's performance is linear with respect to the depth of the node in
/// the AST structure (O(depth)).
AstNode get root;
/// Use the given [visitor] to visit this node. Return the value returned by
/// the visitor as a result of visiting this node.
E accept<E>(AstVisitor<E> visitor);
/// Return the token before [target] or `null` if it cannot be found.
Token findPrevious(Token target);
/// Return the value of the property with the given [name], or `null` if this
/// node does not have a property with the given name.
E getProperty<E>(String name);
/// Set the value of the property with the given [name] to the given [value].
/// If the value is `null`, the property will effectively be removed.
void setProperty(String name, Object value);
/// Return either this node or the most immediate ancestor of this node for
/// which the [predicate] returns `true`, or `null` if there is no such node.
E thisOrAncestorMatching<E extends AstNode>(Predicate<AstNode> predicate);
/// Return either this node or the most immediate ancestor of this node that
/// has the given type, or `null` if there is no such node.
T thisOrAncestorOfType<T extends AstNode>();
/// Return a textual description of this node in a form approximating valid
/// source. The returned string will not be valid source primarily in the case
/// where the node itself is not well-formed.
String toSource();
/// Use the given [visitor] to visit all of the children of this node. The
/// children will be visited in lexical order.
void visitChildren(AstVisitor visitor);
}
/// An object that can be used to visit an AST structure.
///
/// Clients may not extend, implement or mix-in this class. There are classes
/// that implement this interface that provide useful default behaviors in
/// `package:analyzer/dart/ast/visitor.dart`. A couple of the most useful
/// include
/// * SimpleAstVisitor which implements every visit method by doing nothing,
/// * RecursiveAstVisitor which will cause every node in a structure to be
/// visited, and
/// * ThrowingAstVisitor which implements every visit method by throwing an
/// exception.
abstract class AstVisitor<R> {
R visitAdjacentStrings(AdjacentStrings node);
R visitAnnotation(Annotation node);
R visitArgumentList(ArgumentList node);
R visitAsExpression(AsExpression node);
R visitAssertInitializer(AssertInitializer node);
R visitAssertStatement(AssertStatement assertStatement);
R visitAssignmentExpression(AssignmentExpression node);
R visitAwaitExpression(AwaitExpression node);
R visitBinaryExpression(BinaryExpression node);
R visitBlock(Block node);
R visitBlockFunctionBody(BlockFunctionBody node);
R visitBooleanLiteral(BooleanLiteral node);
R visitBreakStatement(BreakStatement node);
R visitCascadeExpression(CascadeExpression node);
R visitCatchClause(CatchClause node);
R visitClassDeclaration(ClassDeclaration node);
R visitClassTypeAlias(ClassTypeAlias node);
R visitComment(Comment node);
R visitCommentReference(CommentReference node);
R visitCompilationUnit(CompilationUnit node);
R visitConditionalExpression(ConditionalExpression node);
R visitConfiguration(Configuration node);
R visitConstructorDeclaration(ConstructorDeclaration node);
R visitConstructorFieldInitializer(ConstructorFieldInitializer node);
R visitConstructorName(ConstructorName node);
R visitContinueStatement(ContinueStatement node);
R visitDeclaredIdentifier(DeclaredIdentifier node);
R visitDefaultFormalParameter(DefaultFormalParameter node);
R visitDoStatement(DoStatement node);
R visitDottedName(DottedName node);
R visitDoubleLiteral(DoubleLiteral node);
R visitEmptyFunctionBody(EmptyFunctionBody node);
R visitEmptyStatement(EmptyStatement node);
R visitEnumConstantDeclaration(EnumConstantDeclaration node);
R visitEnumDeclaration(EnumDeclaration node);
R visitExportDirective(ExportDirective node);
R visitExpressionFunctionBody(ExpressionFunctionBody node);
R visitExpressionStatement(ExpressionStatement node);
R visitExtendsClause(ExtendsClause node);
R visitExtensionDeclaration(ExtensionDeclaration node);
R visitExtensionOverride(ExtensionOverride node);
R visitFieldDeclaration(FieldDeclaration node);
R visitFieldFormalParameter(FieldFormalParameter node);
R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node);
R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node);
R visitForElement(ForElement node);
R visitFormalParameterList(FormalParameterList node);
R visitForPartsWithDeclarations(ForPartsWithDeclarations node);
R visitForPartsWithExpression(ForPartsWithExpression node);
R visitForStatement(ForStatement node);
R visitFunctionDeclaration(FunctionDeclaration node);
R visitFunctionDeclarationStatement(FunctionDeclarationStatement node);
R visitFunctionExpression(FunctionExpression node);
R visitFunctionExpressionInvocation(FunctionExpressionInvocation node);
R visitFunctionTypeAlias(FunctionTypeAlias functionTypeAlias);
R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node);
R visitGenericFunctionType(GenericFunctionType node);
R visitGenericTypeAlias(GenericTypeAlias node);
R visitHideCombinator(HideCombinator node);
R visitIfElement(IfElement node);
R visitIfStatement(IfStatement node);
R visitImplementsClause(ImplementsClause node);
R visitImportDirective(ImportDirective node);
R visitIndexExpression(IndexExpression node);
R visitInstanceCreationExpression(InstanceCreationExpression node);
R visitIntegerLiteral(IntegerLiteral node);
R visitInterpolationExpression(InterpolationExpression node);
R visitInterpolationString(InterpolationString node);
R visitIsExpression(IsExpression node);
R visitLabel(Label node);
R visitLabeledStatement(LabeledStatement node);
R visitLibraryDirective(LibraryDirective node);
R visitLibraryIdentifier(LibraryIdentifier node);
R visitListLiteral(ListLiteral node);
R visitMapLiteralEntry(MapLiteralEntry node);
R visitMethodDeclaration(MethodDeclaration node);
R visitMethodInvocation(MethodInvocation node);
R visitMixinDeclaration(MixinDeclaration node);
R visitNamedExpression(NamedExpression node);
R visitNativeClause(NativeClause node);
R visitNativeFunctionBody(NativeFunctionBody node);
R visitNullLiteral(NullLiteral node);
R visitOnClause(OnClause node);
R visitParenthesizedExpression(ParenthesizedExpression node);
R visitPartDirective(PartDirective node);
R visitPartOfDirective(PartOfDirective node);
R visitPostfixExpression(PostfixExpression node);
R visitPrefixedIdentifier(PrefixedIdentifier node);
R visitPrefixExpression(PrefixExpression node);
R visitPropertyAccess(PropertyAccess node);
R visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node);
R visitRethrowExpression(RethrowExpression node);
R visitReturnStatement(ReturnStatement node);
R visitScriptTag(ScriptTag node);
R visitSetOrMapLiteral(SetOrMapLiteral node);
R visitShowCombinator(ShowCombinator node);
R visitSimpleFormalParameter(SimpleFormalParameter node);
R visitSimpleIdentifier(SimpleIdentifier node);
R visitSimpleStringLiteral(SimpleStringLiteral node);
R visitSpreadElement(SpreadElement node);
R visitStringInterpolation(StringInterpolation node);
R visitSuperConstructorInvocation(SuperConstructorInvocation node);
R visitSuperExpression(SuperExpression node);
R visitSwitchCase(SwitchCase node);
R visitSwitchDefault(SwitchDefault node);
R visitSwitchStatement(SwitchStatement node);
R visitSymbolLiteral(SymbolLiteral node);
R visitThisExpression(ThisExpression node);
R visitThrowExpression(ThrowExpression node);
R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node);
R visitTryStatement(TryStatement node);
R visitTypeArgumentList(TypeArgumentList node);
R visitTypeName(TypeName node);
R visitTypeParameter(TypeParameter node);
R visitTypeParameterList(TypeParameterList node);
R visitVariableDeclaration(VariableDeclaration node);
R visitVariableDeclarationList(VariableDeclarationList node);
R visitVariableDeclarationStatement(VariableDeclarationStatement node);
R visitWhileStatement(WhileStatement node);
R visitWithClause(WithClause node);
R visitYieldStatement(YieldStatement node);
}
/// An await expression.
///
/// awaitExpression ::=
/// 'await' [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class AwaitExpression implements Expression {
/// Return the 'await' keyword.
Token get awaitKeyword;
/// Set the 'await' keyword to the given [token].
void set awaitKeyword(Token token);
/// Return the expression whose value is being waited on.
Expression get expression;
/// Set the expression whose value is being waited on to the given
/// [expression].
void set expression(Expression expression);
}
/// A binary (infix) expression.
///
/// binaryExpression ::=
/// [Expression] [Token] [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class BinaryExpression
implements Expression, MethodReferenceExpression {
/// Return the expression used to compute the left operand.
Expression get leftOperand;
/// Set the expression used to compute the left operand to the given
/// [expression].
void set leftOperand(Expression expression);
/// Return the binary operator being applied.
Token get operator;
/// Set the binary operator being applied to the given [token].
void set operator(Token token);
/// Return the expression used to compute the right operand.
Expression get rightOperand;
/// Set the expression used to compute the right operand to the given
/// [expression].
void set rightOperand(Expression expression);
/// The function type of the invocation, or `null` if the AST structure has
/// not been resolved, or if the invocation could not be resolved.
FunctionType get staticInvokeType;
/// Sets the function type of the invocation.
void set staticInvokeType(FunctionType value);
}
/// A sequence of statements.
///
/// block ::=
/// '{' statement* '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class Block implements Statement {
/// Return the left curly bracket.
Token get leftBracket;
/// Set the left curly bracket to the given [token].
void set leftBracket(Token token);
/// Return the right curly bracket.
Token get rightBracket;
/// Set the right curly bracket to the given [token].
void set rightBracket(Token token);
/// Return the statements contained in the block.
NodeList<Statement> get statements;
}
/// A function body that consists of a block of statements.
///
/// blockFunctionBody ::=
/// ('async' | 'async' '*' | 'sync' '*')? [Block]
///
/// Clients may not extend, implement or mix-in this class.
abstract class BlockFunctionBody implements FunctionBody {
/// Return the block representing the body of the function.
Block get block;
/// Set the block representing the body of the function to the given [block].
void set block(Block block);
/// Set token representing the 'async' or 'sync' keyword to the given [token].
void set keyword(Token token);
/// Set the star following the 'async' or 'sync' keyword to the given [token].
void set star(Token token);
}
/// A boolean literal expression.
///
/// booleanLiteral ::=
/// 'false' | 'true'
///
/// Clients may not extend, implement or mix-in this class.
abstract class BooleanLiteral implements Literal {
/// Return the token representing the literal.
Token get literal;
/// Set the token representing the literal to the given [token].
void set literal(Token token);
/// Return the value of the literal.
bool get value;
}
/// A break statement.
///
/// breakStatement ::=
/// 'break' [SimpleIdentifier]? ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class BreakStatement implements Statement {
/// Return the token representing the 'break' keyword.
Token get breakKeyword;
/// Set the token representing the 'break' keyword to the given [token].
void set breakKeyword(Token token);
/// Return the label associated with the statement, or `null` if there is no
/// label.
SimpleIdentifier get label;
/// Set the label associated with the statement to the given [identifier].
void set label(SimpleIdentifier identifier);
/// Return the semicolon terminating the statement.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
/// Return the node from which this break statement is breaking. This will be
/// either a [Statement] (in the case of breaking out of a loop), a
/// [SwitchMember] (in the case of a labeled break statement whose label
/// matches a label on a switch case in an enclosing switch statement), or
/// `null` if the AST has not yet been resolved or if the target could not be
/// resolved. Note that if the source code has errors, the target might be
/// invalid (e.g. trying to break to a switch case).
AstNode get target;
/// Set the node from which this break statement is breaking to the given
/// [node].
void set target(AstNode node);
}
/// A sequence of cascaded expressions: expressions that share a common target.
/// There are three kinds of expressions that can be used in a cascade
/// expression: [IndexExpression], [MethodInvocation] and [PropertyAccess].
///
/// cascadeExpression ::=
/// [Expression] cascadeSection*
///
/// cascadeSection ::=
/// ('..' | '?..') (cascadeSelector arguments*)
/// (assignableSelector arguments*)*
/// (assignmentOperator expressionWithoutCascade)?
///
/// cascadeSelector ::=
/// '[ ' expression '] '
/// | identifier
///
/// Clients may not extend, implement or mix-in this class.
abstract class CascadeExpression implements Expression {
/// Return the cascade sections sharing the common target.
NodeList<Expression> get cascadeSections;
/// Return the target of the cascade sections.
Expression get target;
/// Set the target of the cascade sections to the given [target].
void set target(Expression target);
}
/// A catch clause within a try statement.
///
/// onPart ::=
/// catchPart [Block]
/// | 'on' type catchPart? [Block]
///
/// catchPart ::=
/// 'catch' '(' [SimpleIdentifier] (',' [SimpleIdentifier])? ')'
///
/// Clients may not extend, implement or mix-in this class.
abstract class CatchClause implements AstNode {
/// Return the body of the catch block.
Block get body;
/// Set the body of the catch block to the given [block].
void set body(Block block);
/// Return the token representing the 'catch' keyword, or `null` if there is
/// no 'catch' keyword.
Token get catchKeyword;
/// Set the token representing the 'catch' keyword to the given [token].
void set catchKeyword(Token token);
/// Return the comma separating the exception parameter from the stack trace
/// parameter, or `null` if there is no stack trace parameter.
Token get comma;
/// Set the comma separating the exception parameter from the stack trace
/// parameter to the given [token].
void set comma(Token token);
/// Return the parameter whose value will be the exception that was thrown, or
/// `null` if there is no 'catch' keyword.
SimpleIdentifier get exceptionParameter;
/// Set the parameter whose value will be the exception that was thrown to the
/// given [parameter].
void set exceptionParameter(SimpleIdentifier parameter);
/// Return the type of exceptions caught by this catch clause, or `null` if
/// this catch clause catches every type of exception.
TypeAnnotation get exceptionType;
/// Set the type of exceptions caught by this catch clause to the given
/// [exceptionType].
void set exceptionType(TypeAnnotation exceptionType);
/// Return the left parenthesis, or `null` if there is no 'catch' keyword.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the token representing the 'on' keyword, or `null` if there is no
/// 'on' keyword.
Token get onKeyword;
/// Set the token representing the 'on' keyword to the given [token].
void set onKeyword(Token token);
/// Return the right parenthesis, or `null` if there is no 'catch' keyword.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
/// Return the parameter whose value will be the stack trace associated with
/// the exception, or `null` if there is no stack trace parameter.
SimpleIdentifier get stackTraceParameter;
/// Set the parameter whose value will be the stack trace associated with the
/// exception to the given [parameter].
void set stackTraceParameter(SimpleIdentifier parameter);
}
/// The declaration of a class.
///
/// classDeclaration ::=
/// 'abstract'? 'class' [SimpleIdentifier] [TypeParameterList]?
/// ([ExtendsClause] [WithClause]?)?
/// [ImplementsClause]?
/// '{' [ClassMember]* '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ClassDeclaration implements ClassOrMixinDeclaration {
/// Return the 'abstract' keyword, or `null` if the keyword was absent.
Token get abstractKeyword;
/// Set the 'abstract' keyword to the given [token].
void set abstractKeyword(Token token);
/// Return the token representing the 'class' keyword.
Token get classKeyword;
/// Set the token representing the 'class' keyword.
void set classKeyword(Token token);
@deprecated
@override
ClassElement get element;
/// Return the extends clause for this class, or `null` if the class does not
/// extend any other class.
ExtendsClause get extendsClause;
/// Set the extends clause for this class to the given [extendsClause].
void set extendsClause(ExtendsClause extendsClause);
/// Set the implements clause for the class to the given [implementsClause].
void set implementsClause(ImplementsClause implementsClause);
/// Return `true` if this class is declared to be an abstract class.
bool get isAbstract;
/// Set the left curly bracket to the given [token].
void set leftBracket(Token token);
/// Return the native clause for this class, or `null` if the class does not
/// have a native clause.
NativeClause get nativeClause;
/// Set the native clause for this class to the given [nativeClause].
void set nativeClause(NativeClause nativeClause);
/// Set the right curly bracket to the given [token].
void set rightBracket(Token token);
/// Set the type parameters for the class to the given list of
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
/// Return the with clause for the class, or `null` if the class does not have
/// a with clause.
WithClause get withClause;
/// Set the with clause for the class to the given [withClause].
void set withClause(WithClause withClause);
/// Return the constructor declared in the class with the given [name], or
/// `null` if there is no such constructor. If the [name] is `null` then the
/// default constructor will be searched for.
ConstructorDeclaration getConstructor(String name);
}
/// A node that declares a name within the scope of a class declarations.
///
/// When the 'extension-methods' experiment is enabled, these nodes can also be
/// located inside extension declarations.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ClassMember implements Declaration {}
/// The declaration of a class or mixin.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ClassOrMixinDeclaration implements NamedCompilationUnitMember {
@override
ClassElement get declaredElement;
/// Returns the implements clause for the class/mixin, or `null` if the
/// class/mixin does not implement any interfaces.
ImplementsClause get implementsClause;
/// Returns the left curly bracket.
Token get leftBracket;
/// Returns the members defined by the class/mixin.
NodeList<ClassMember> get members;
/// Returns the right curly bracket.
Token get rightBracket;
/// Returns the type parameters for the class/mixin, or `null` if the
/// class/mixin does not have any type parameters.
TypeParameterList get typeParameters;
/// Returns the field declared in the class/mixin with the given [name], or
/// `null` if there is no such field.
VariableDeclaration getField(String name);
/// Returns the method declared in the class/mixin with the given [name], or
/// `null` if there is no such method.
MethodDeclaration getMethod(String name);
}
/// A class type alias.
///
/// classTypeAlias ::=
/// [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplication
///
/// mixinApplication ::=
/// [TypeName] [WithClause] [ImplementsClause]? ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ClassTypeAlias implements TypeAlias {
/// Return the token for the 'abstract' keyword, or `null` if this is not
/// defining an abstract class.
Token get abstractKeyword;
/// Set the token for the 'abstract' keyword to the given [token].
void set abstractKeyword(Token token);
@override
ClassElement get declaredElement;
/// Return the token for the '=' separating the name from the definition.
Token get equals;
/// Set the token for the '=' separating the name from the definition to the
/// given [token].
void set equals(Token token);
/// Return the implements clause for this class, or `null` if there is no
/// implements clause.
ImplementsClause get implementsClause;
/// Set the implements clause for this class to the given [implementsClause].
void set implementsClause(ImplementsClause implementsClause);
/// Return `true` if this class is declared to be an abstract class.
bool get isAbstract;
/// Return the name of the superclass of the class being declared.
TypeName get superclass;
/// Set the name of the superclass of the class being declared to the given
/// [superclass] name.
void set superclass(TypeName superclass);
/// Return the type parameters for the class, or `null` if the class does not
/// have any type parameters.
TypeParameterList get typeParameters;
/// Set the type parameters for the class to the given list of
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
/// Return the with clause for this class.
WithClause get withClause;
/// Set the with clause for this class to the given with [withClause].
void set withClause(WithClause withClause);
}
/// An element in a list, map or set literal.
///
/// collectionElement ::=
/// [Expression]
/// | [IfElement]
/// | [ForElement]
/// | [MapLiteralEntry]
/// | [SpreadElement]
///
/// Clients may not extend, implement or mix-in this class.
abstract class CollectionElement implements AstNode {}
/// A combinator associated with an import or export directive.
///
/// combinator ::=
/// [HideCombinator]
/// | [ShowCombinator]
///
/// Clients may not extend, implement or mix-in this class.
abstract class Combinator implements AstNode {
/// Return the 'hide' or 'show' keyword specifying what kind of processing is
/// to be done on the names.
Token get keyword;
/// Set the 'hide' or 'show' keyword specifying what kind of processing is
/// to be done on the names to the given [token].
void set keyword(Token token);
}
/// A comment within the source code.
///
/// comment ::=
/// endOfLineComment
/// | blockComment
/// | documentationComment
///
/// endOfLineComment ::=
/// '//' (CHARACTER - EOL)* EOL
///
/// blockComment ::=
/// '/ *' CHARACTER* '*/'
///
/// documentationComment ::=
/// '/ **' (CHARACTER | [CommentReference])* '*/'
/// | ('///' (CHARACTER - EOL)* EOL)+
///
/// Clients may not extend, implement or mix-in this class.
abstract class Comment implements AstNode {
/// Return `true` if this is a block comment.
bool get isBlock;
/// Return `true` if this is a documentation comment.
bool get isDocumentation;
/// Return `true` if this is an end-of-line comment.
bool get isEndOfLine;
/// Return the references embedded within the documentation comment.
NodeList<CommentReference> get references;
/// Return the tokens representing the comment.
List<Token> get tokens;
}
/// A reference to a Dart element that is found within a documentation comment.
///
/// commentReference ::=
/// '[' 'new'? [Identifier] ']'
///
/// Clients may not extend, implement or mix-in this class.
abstract class CommentReference implements AstNode {
/// Return the identifier being referenced.
Identifier get identifier;
/// Set the identifier being referenced to the given [identifier].
void set identifier(Identifier identifier);
/// Return the token representing the 'new' keyword, or `null` if there was no
/// 'new' keyword.
Token get newKeyword;
/// Set the token representing the 'new' keyword to the given [token].
void set newKeyword(Token token);
}
/// A compilation unit.
///
/// While the grammar restricts the order of the directives and declarations
/// within a compilation unit, this class does not enforce those restrictions.
/// In particular, the children of a compilation unit will be visited in lexical
/// order even if lexical order does not conform to the restrictions of the
/// grammar.
///
/// compilationUnit ::=
/// directives declarations
///
/// directives ::=
/// [ScriptTag]? [LibraryDirective]? namespaceDirective* [PartDirective]*
/// | [PartOfDirective]
///
/// namespaceDirective ::=
/// [ImportDirective]
/// | [ExportDirective]
///
/// declarations ::=
/// [CompilationUnitMember]*
///
/// Clients may not extend, implement or mix-in this class.
abstract class CompilationUnit implements AstNode {
/// Set the first token included in this node's source range to the given
/// [token].
void set beginToken(Token token);
/// Return the declarations contained in this compilation unit.
NodeList<CompilationUnitMember> get declarations;
/// Return the element associated with this compilation unit, or `null` if the
/// AST structure has not been resolved.
CompilationUnitElement get declaredElement;
/// Return the directives contained in this compilation unit.
NodeList<Directive> get directives;
/// Return the element associated with this compilation unit, or `null` if the
/// AST structure has not been resolved.
@deprecated
CompilationUnitElement get element;
/// Set the element associated with this compilation unit to the given
/// [element].
void set element(CompilationUnitElement element);
/// Set the last token included in this node's source range to the given
/// [token].
void set endToken(Token token);
/// The set of features available to this compilation unit, or `null` if
/// unknown.
///
/// Determined by some combination of the .packages file, the enclosing
/// package's SDK version constraint, and/or the presence of a `@dart`
/// directive in a comment at the top of the file.
///
/// Might be `null` if, for example, this [CompilationUnit] has been
/// resynthesized from a summary.
FeatureSet get featureSet;
/// Return the line information for this compilation unit.
LineInfo get lineInfo;
/// Set the line information for this compilation unit to the given [info].
void set lineInfo(LineInfo info);
/// Return the script tag at the beginning of the compilation unit, or `null`
/// if there is no script tag in this compilation unit.
ScriptTag get scriptTag;
/// Set the script tag at the beginning of the compilation unit to the given
/// [scriptTag].
void set scriptTag(ScriptTag scriptTag);
/// Return a list containing all of the directives and declarations in this
/// compilation unit, sorted in lexical order.
List<AstNode> get sortedDirectivesAndDeclarations;
}
/// A node that declares one or more names within the scope of a compilation
/// unit.
///
/// compilationUnitMember ::=
/// [ClassDeclaration]
/// | [MixinDeclaration]
/// | [ExtensionDeclaration]
/// | [EnumDeclaration]
/// | [TypeAlias]
/// | [FunctionDeclaration]
/// | [TopLevelVariableDeclaration]
///
/// Clients may not extend, implement or mix-in this class.
abstract class CompilationUnitMember implements Declaration {}
/// A conditional expression.
///
/// conditionalExpression ::=
/// [Expression] '?' [Expression] ':' [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class ConditionalExpression implements Expression {
/// Return the token used to separate the then expression from the else
/// expression.
Token get colon;
/// Set the token used to separate the then expression from the else
/// expression to the given [token].
void set colon(Token token);
/// Return the condition used to determine which of the expressions is
/// executed next.
Expression get condition;
/// Set the condition used to determine which of the expressions is executed
/// next to the given [expression].
void set condition(Expression expression);
/// Return the expression that is executed if the condition evaluates to
/// `false`.
Expression get elseExpression;
/// Set the expression that is executed if the condition evaluates to `false`
/// to the given [expression].
void set elseExpression(Expression expression);
/// Return the token used to separate the condition from the then expression.
Token get question;
/// Set the token used to separate the condition from the then expression to
/// the given [token].
void set question(Token token);
/// Return the expression that is executed if the condition evaluates to
/// `true`.
Expression get thenExpression;
/// Set the expression that is executed if the condition evaluates to `true`
/// to the given [expression].
void set thenExpression(Expression expression);
}
/// A configuration in either an import or export directive.
///
/// configuration ::=
/// 'if' '(' test ')' uri
///
/// test ::=
/// dottedName ('==' stringLiteral)?
///
/// dottedName ::=
/// identifier ('.' identifier)*
///
/// Clients may not extend, implement or mix-in this class.
abstract class Configuration implements AstNode {
/// Return the token for the equal operator, or `null` if the condition does
/// not include an equality test.
Token get equalToken;
/// Set the token for the equal operator to the given [token].
void set equalToken(Token token);
/// Return the token for the 'if' keyword.
Token get ifKeyword;
/// Set the token for the 'if' keyword to the given [token].
void set ifKeyword(Token token);
/// Return the token for the left parenthesis.
Token get leftParenthesis;
/// Set the token for the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the URI of the implementation library to be used if the condition
/// is true.
@deprecated
StringLiteral get libraryUri;
/// Set the URI of the implementation library to be used if the condition is
/// true to the given [uri].
@deprecated
void set libraryUri(StringLiteral uri);
/// Return the name of the declared variable whose value is being used in the
/// condition.
DottedName get name;
/// Set the name of the declared variable whose value is being used in the
/// condition to the given [name].
void set name(DottedName name);
/// Return the token for the right parenthesis.
Token get rightParenthesis;
/// Set the token for the right parenthesis to the given [token].
void set rightParenthesis(Token token);
/// Return the URI of the implementation library to be used if the condition
/// is true.
StringLiteral get uri;
/// Set the URI of the implementation library to be used if the condition is
/// true to the given [uri].
void set uri(StringLiteral uri);
/// Return the source to which the [uri] was resolved.
Source get uriSource;
/// Set the source to which the [uri] was resolved to the given [source].
void set uriSource(Source source);
/// Return the value to which the value of the declared variable will be
/// compared, or `null` if the condition does not include an equality test.
StringLiteral get value;
/// Set the value to which the value of the declared variable will be
/// compared to the given [value].
void set value(StringLiteral value);
}
/// A constructor declaration.
///
/// constructorDeclaration ::=
/// constructorSignature [FunctionBody]?
/// | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier])? arguments
///
/// constructorSignature ::=
/// 'external'? constructorName formalParameterList initializerList?
/// | 'external'? 'factory' factoryName formalParameterList initializerList?
/// | 'external'? 'const' constructorName formalParameterList initializerList?
///
/// constructorName ::=
/// [SimpleIdentifier] ('.' [SimpleIdentifier])?
///
/// factoryName ::=
/// [Identifier] ('.' [SimpleIdentifier])?
///
/// initializerList ::=
/// ':' [ConstructorInitializer] (',' [ConstructorInitializer])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class ConstructorDeclaration implements ClassMember {
/// Return the body of the constructor, or `null` if the constructor does not
/// have a body.
FunctionBody get body;
/// Set the body of the constructor to the given [functionBody].
void set body(FunctionBody functionBody);
/// Return the token for the 'const' keyword, or `null` if the constructor is
/// not a const constructor.
Token get constKeyword;
/// Set the token for the 'const' keyword to the given [token].
void set constKeyword(Token token);
@override
ConstructorElement get declaredElement;
@override
@deprecated
ConstructorElement get element;
/// Set the element associated with this constructor to the given [element].
void set element(ConstructorElement element);
/// Return the token for the 'external' keyword to the given [token].
Token get externalKeyword;
/// Set the token for the 'external' keyword, or `null` if the constructor
/// is not external.
void set externalKeyword(Token token);
/// Return the token for the 'factory' keyword, or `null` if the constructor
/// is not a factory constructor.
Token get factoryKeyword;
/// Set the token for the 'factory' keyword to the given [token].
void set factoryKeyword(Token token);
/// Return the initializers associated with the constructor.
NodeList<ConstructorInitializer> get initializers;
/// Return the name of the constructor, or `null` if the constructor being
/// declared is unnamed.
SimpleIdentifier get name;
/// Set the name of the constructor to the given [identifier].
void set name(SimpleIdentifier identifier);
/// Return the parameters associated with the constructor.
FormalParameterList get parameters;
/// Set the parameters associated with the constructor to the given list of
/// [parameters].
void set parameters(FormalParameterList parameters);
/// Return the token for the period before the constructor name, or `null` if
/// the constructor being declared is unnamed.
Token get period;
/// Set the token for the period before the constructor name to the given
/// [token].
void set period(Token token);
/// Return the name of the constructor to which this constructor will be
/// redirected, or `null` if this is not a redirecting factory constructor.
ConstructorName get redirectedConstructor;
/// Set the name of the constructor to which this constructor will be
/// redirected to the given [redirectedConstructor] name.
void set redirectedConstructor(ConstructorName redirectedConstructor);
/// Return the type of object being created. This can be different than the
/// type in which the constructor is being declared if the constructor is the
/// implementation of a factory constructor.
Identifier get returnType;
/// Set the type of object being created to the given [typeName].
void set returnType(Identifier typeName);
/// Return the token for the separator (colon or equals) before the
/// initializer list or redirection, or `null` if there are no initializers.
Token get separator;
/// Set the token for the separator (colon or equals) before the initializer
/// list or redirection to the given [token].
void set separator(Token token);
}
/// The initialization of a field within a constructor's initialization list.
///
/// fieldInitializer ::=
/// ('this' '.')? [SimpleIdentifier] '=' [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class ConstructorFieldInitializer implements ConstructorInitializer {
/// Return the token for the equal sign between the field name and the
/// expression.
Token get equals;
/// Set the token for the equal sign between the field name and the
/// expression to the given [token].
void set equals(Token token);
/// Return the expression computing the value to which the field will be
/// initialized.
Expression get expression;
/// Set the expression computing the value to which the field will be
/// initialized to the given [expression].
void set expression(Expression expression);
/// Return the name of the field being initialized.
SimpleIdentifier get fieldName;
/// Set the name of the field being initialized to the given [identifier].
void set fieldName(SimpleIdentifier identifier);
/// Return the token for the period after the 'this' keyword, or `null` if
/// there is no 'this' keyword.
Token get period;
/// Set the token for the period after the 'this' keyword to the given
/// [token].
void set period(Token token);
/// Return the token for the 'this' keyword, or `null` if there is no 'this'
/// keyword.
Token get thisKeyword;
/// Set the token for the 'this' keyword to the given [token].
void set thisKeyword(Token token);
}
/// A node that can occur in the initializer list of a constructor declaration.
///
/// constructorInitializer ::=
/// [SuperConstructorInvocation]
/// | [ConstructorFieldInitializer]
/// | [RedirectingConstructorInvocation]
///
/// Clients may not extend, implement or mix-in this class.
abstract class ConstructorInitializer implements AstNode {}
/// The name of a constructor.
///
/// constructorName ::=
/// type ('.' identifier)?
///
/// Clients may not extend, implement or mix-in this class.
abstract class ConstructorName implements AstNode, ConstructorReferenceNode {
/// Return the name of the constructor, or `null` if the specified constructor
/// is the unnamed constructor.
SimpleIdentifier get name;
/// Set the name of the constructor to the given [name].
void set name(SimpleIdentifier name);
/// Return the token for the period before the constructor name, or `null` if
/// the specified constructor is the unnamed constructor.
Token get period;
/// Set the token for the period before the constructor name to the given
/// [token].
void set period(Token token);
/// Return the name of the type defining the constructor.
TypeName get type;
/// Set the name of the type defining the constructor to the given [type]
/// name.
void set type(TypeName type);
}
/// An AST node that makes reference to a constructor.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ConstructorReferenceNode implements AstNode {
/// Return the element associated with the referenced constructor based on
/// static type information, or `null` if the AST structure has not been
/// resolved or if the constructor could not be resolved.
ConstructorElement get staticElement;
/// Set the element associated with the referenced constructor based on static
/// type information to the given [element].
void set staticElement(ConstructorElement element);
}
/// A continue statement.
///
/// continueStatement ::=
/// 'continue' [SimpleIdentifier]? ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ContinueStatement implements Statement {
/// Return the token representing the 'continue' keyword.
Token get continueKeyword;
/// Set the token representing the 'continue' keyword to the given [token].
void set continueKeyword(Token token);
/// Return the label associated with the statement, or `null` if there is no
/// label.
SimpleIdentifier get label;
/// Set the label associated with the statement to the given [identifier].
void set label(SimpleIdentifier identifier);
/// Return the semicolon terminating the statement.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
/// Return the node to which this continue statement is continuing. This will
/// be either a [Statement] (in the case of continuing a loop), a
/// [SwitchMember] (in the case of continuing from one switch case to
/// another), or `null` if the AST has not yet been resolved or if the target
/// could not be resolved. Note that if the source code has errors, the target
/// might be invalid (e.g. the target may be in an enclosing function).
AstNode get target;
/// Set the node to which this continue statement is continuing to the given
/// [node].
void set target(AstNode node);
}
/// A node that represents the declaration of one or more names. Each declared
/// name is visible within a name scope.
///
/// Clients may not extend, implement or mix-in this class.
abstract class Declaration implements AnnotatedNode {
/// Return the element associated with this declaration, or `null` if either
/// this node corresponds to a list of declarations or if the AST structure
/// has not been resolved.
Element get declaredElement;
/// Return the element associated with this declaration, or `null` if either
/// this node corresponds to a list of declarations or if the AST structure
/// has not been resolved.
@deprecated
Element get element;
}
/// The declaration of a single identifier.
///
/// declaredIdentifier ::=
/// [Annotation] finalConstVarOrType [SimpleIdentifier]
///
/// Clients may not extend, implement or mix-in this class.
abstract class DeclaredIdentifier implements Declaration {
@override
LocalVariableElement get declaredElement;
@deprecated
@override
LocalVariableElement get element;
/// Return the name of the variable being declared.
SimpleIdentifier get identifier;
/// Set the name of the variable being declared to the given [identifier].
void set identifier(SimpleIdentifier identifier);
/// Return `true` if this variable was declared with the 'const' modifier.
bool get isConst;
/// Return `true` if this variable was declared with the 'final' modifier.
/// Variables that are declared with the 'const' modifier will return `false`
/// even though they are implicitly final.
bool get isFinal;
/// Return the token representing either the 'final', 'const' or 'var'
/// keyword, or `null` if no keyword was used.
Token get keyword;
/// Set the token representing either the 'final', 'const' or 'var' keyword to
/// the given [token].
void set keyword(Token token);
/// Return the name of the declared type of the parameter, or `null` if the
/// parameter does not have a declared type.
TypeAnnotation get type;
/// Set the declared type of the parameter to the given [type].
void set type(TypeAnnotation type);
}
/// A formal parameter with a default value. There are two kinds of parameters
/// that are both represented by this class: named formal parameters and
/// positional formal parameters.
///
/// defaultFormalParameter ::=
/// [NormalFormalParameter] ('=' [Expression])?
///
/// defaultNamedParameter ::=
/// [NormalFormalParameter] (':' [Expression])?
///
/// Clients may not extend, implement or mix-in this class.
abstract class DefaultFormalParameter implements FormalParameter {
/// Return the expression computing the default value for the parameter, or
/// `null` if there is no default value.
Expression get defaultValue;
/// Set the expression computing the default value for the parameter to the
/// given [expression].
void set defaultValue(Expression expression);
/// Set the kind of this parameter to the given [kind].
void set kind(ParameterKind kind);
/// Return the formal parameter with which the default value is associated.
NormalFormalParameter get parameter;
/// Set the formal parameter with which the default value is associated to the
/// given [formalParameter].
void set parameter(NormalFormalParameter formalParameter);
/// Return the token separating the parameter from the default value, or
/// `null` if there is no default value.
Token get separator;
/// Set the token separating the parameter from the default value to the given
/// [token].
void set separator(Token token);
}
/// A node that represents a directive.
///
/// directive ::=
/// [ExportDirective]
/// | [ImportDirective]
/// | [LibraryDirective]
/// | [PartDirective]
/// | [PartOfDirective]
///
/// Clients may not extend, implement or mix-in this class.
abstract class Directive implements AnnotatedNode {
/// Return the element associated with this directive, or `null` if the AST
/// structure has not been resolved or if this directive could not be
/// resolved.
Element get element;
/// Set the element associated with this directive to the given [element].
void set element(Element element);
/// Return the token representing the keyword that introduces this directive
/// ('import', 'export', 'library' or 'part').
Token get keyword;
}
/// A do statement.
///
/// doStatement ::=
/// 'do' [Statement] 'while' '(' [Expression] ')' ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class DoStatement implements Statement {
/// Return the body of the loop.
Statement get body;
/// Set the body of the loop to the given [statement].
void set body(Statement statement);
/// Return the condition that determines when the loop will terminate.
Expression get condition;
/// Set the condition that determines when the loop will terminate to the
/// given [expression].
void set condition(Expression expression);
/// Return the token representing the 'do' keyword.
Token get doKeyword;
/// Set the token representing the 'do' keyword to the given [token].
void set doKeyword(Token token);
/// Return the left parenthesis.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the right parenthesis.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
/// Return the semicolon terminating the statement.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
/// Return the token representing the 'while' keyword.
Token get whileKeyword;
/// Set the token representing the 'while' keyword to the given [token].
void set whileKeyword(Token token);
}
/// A dotted name, used in a configuration within an import or export directive.
///
/// dottedName ::=
/// [SimpleIdentifier] ('.' [SimpleIdentifier])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class DottedName implements AstNode {
/// Return the components of the identifier.
NodeList<SimpleIdentifier> get components;
}
/// A floating point literal expression.
///
/// doubleLiteral ::=
/// decimalDigit+ ('.' decimalDigit*)? exponent?
/// | '.' decimalDigit+ exponent?
///
/// exponent ::=
/// ('e' | 'E') ('+' | '-')? decimalDigit+
///
/// Clients may not extend, implement or mix-in this class.
abstract class DoubleLiteral implements Literal {
/// Return the token representing the literal.
Token get literal;
/// Set the token representing the literal to the given [token].
void set literal(Token token);
/// Return the value of the literal.
double get value;
/// Set the value of the literal to the given [value].
void set value(double value);
}
/// An empty function body, which can only appear in constructors or abstract
/// methods.
///
/// emptyFunctionBody ::=
/// ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class EmptyFunctionBody implements FunctionBody {
/// Return the token representing the semicolon that marks the end of the
/// function body.
Token get semicolon;
/// Set the token representing the semicolon that marks the end of the
/// function body to the given [token].
void set semicolon(Token token);
}
/// An empty statement.
///
/// emptyStatement ::=
/// ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class EmptyStatement implements Statement {
/// Return the semicolon terminating the statement.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
}
/// The declaration of an enum constant.
///
/// Clients may not extend, implement or mix-in this class.
abstract class EnumConstantDeclaration implements Declaration {
/// Return the name of the constant.
SimpleIdentifier get name;
/// Set the name of the constant to the given [name].
void set name(SimpleIdentifier name);
}
/// The declaration of an enumeration.
///
/// enumType ::=
/// metadata 'enum' [SimpleIdentifier] '{' [SimpleIdentifier] (',' [SimpleIdentifier])* (',')? '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class EnumDeclaration implements NamedCompilationUnitMember {
/// Return the enumeration constants being declared.
NodeList<EnumConstantDeclaration> get constants;
@override
ClassElement get declaredElement;
@deprecated
@override
ClassElement get element;
/// Return the 'enum' keyword.
Token get enumKeyword;
/// Set the 'enum' keyword to the given [token].
void set enumKeyword(Token token);
/// Return the left curly bracket.
Token get leftBracket;
/// Set the left curly bracket to the given [token].
void set leftBracket(Token token);
/// Return the right curly bracket.
Token get rightBracket;
/// Set the right curly bracket to the given [token].
void set rightBracket(Token token);
}
/// An export directive.
///
/// exportDirective ::=
/// [Annotation] 'export' [StringLiteral] [Combinator]* ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExportDirective implements NamespaceDirective {}
/// A node that represents an expression.
///
/// expression ::=
/// [AssignmentExpression]
/// | [ConditionalExpression] cascadeSection*
/// | [ThrowExpression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class Expression implements CollectionElement {
/// Return the best parameter element information available for this
/// expression. If type propagation was able to find a better parameter
/// element than static analysis, that type will be returned. Otherwise, the
/// result of static analysis will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticParameterElement] instead.
@deprecated
ParameterElement get bestParameterElement;
/// Return the best type information available for this expression. If type
/// propagation was able to find a better type than static analysis, that type
/// will be returned. Otherwise, the result of static analysis will be
/// returned. If no type analysis has been performed, then the type 'dynamic'
/// will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticType] instead, but be aware that [staticType] will return
/// `null` under some circumstances, while [bestType] did not.
@deprecated
DartType get bestType;
/// Return `true` if this expression is syntactically valid for the LHS of an
/// [AssignmentExpression].
bool get isAssignable;
/// Return the precedence of this expression. The precedence is a positive
/// integer value that defines how the source code is parsed into an AST. For
/// example `a * b + c` is parsed as `(a * b) + c` because the precedence of
/// `*` is greater than the precedence of `+`.
Precedence get precedence;
/// Return the precedence of this expression. The precedence is a positive
/// integer value that defines how the source code is parsed into an AST. For
/// example `a * b + c` is parsed as `(a * b) + c` because the precedence of
/// `*` is greater than the precedence of `+`.
@Deprecated('Use precedence')
Precedence get precedence2;
/// If this expression is an argument to an invocation, and the AST structure
/// has been resolved, and the function being invoked is known based on
/// propagated type information, and this expression corresponds to one of the
/// parameters of the function being invoked, then return the parameter
/// element representing the parameter to which the value of this expression
/// will be bound. Otherwise, return `null`.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticParameterElement] instead.
@deprecated
ParameterElement get propagatedParameterElement;
/// Return the propagated type of this expression, or `null` if type
/// propagation has not been performed on the AST structure.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticType] instead.
@deprecated
DartType get propagatedType;
/// Set the propagated type of this expression to the given [type].
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticType] instead.
@deprecated
void set propagatedType(DartType type);
/// If this expression is an argument to an invocation, and the AST structure
/// has been resolved, and the function being invoked is known based on static
/// type information, and this expression corresponds to one of the parameters
/// of the function being invoked, then return the parameter element
/// representing the parameter to which the value of this expression will be
/// bound. Otherwise, return `null`.
ParameterElement get staticParameterElement;
/// Return the static type of this expression, or `null` if the AST structure
/// has not been resolved.
DartType get staticType;
/// Set the static type of this expression to the given [type].
void set staticType(DartType type);
/// If this expression is a parenthesized expression, return the result of
/// unwrapping the expression inside the parentheses. Otherwise, return this
/// expression.
Expression get unParenthesized;
}
/// A function body consisting of a single expression.
///
/// expressionFunctionBody ::=
/// 'async'? '=>' [Expression] ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExpressionFunctionBody implements FunctionBody {
/// Return the expression representing the body of the function.
Expression get expression;
/// Set the expression representing the body of the function to the given
/// [expression].
void set expression(Expression expression);
/// Return the token introducing the expression that represents the body of the
/// function.
Token get functionDefinition;
/// Set the token introducing the expression that represents the body of the
/// function to the given [token].
void set functionDefinition(Token token);
/// Set token representing the 'async' or 'sync' keyword to the given [token].
void set keyword(Token token);
/// Return the semicolon terminating the statement.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
}
/// An expression used as a statement.
///
/// expressionStatement ::=
/// [Expression]? ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExpressionStatement implements Statement {
/// Return the expression that comprises the statement.
Expression get expression;
/// Set the expression that comprises the statement to the given [expression].
void set expression(Expression expression);
/// Return the semicolon terminating the statement, or `null` if the
/// expression is a function expression and therefore isn't followed by a
/// semicolon.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
}
/// The "extends" clause in a class declaration.
///
/// extendsClause ::=
/// 'extends' [TypeName]
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExtendsClause implements AstNode {
/// Return the token representing the 'extends' keyword.
Token get extendsKeyword;
/// Set the token representing the 'extends' keyword to the given [token].
void set extendsKeyword(Token token);
/// Return the name of the class that is being extended.
TypeName get superclass;
/// Set the name of the class that is being extended to the given [name].
void set superclass(TypeName name);
}
/// The declaration of an extension of a type.
///
/// extension ::=
/// 'extension' [SimpleIdentifier]? [TypeParameterList]?
/// 'on' [TypeAnnotation] '{' [ClassMember]* '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExtensionDeclaration implements CompilationUnitMember {
@override
ExtensionElement get declaredElement;
/// Return the type that is being extended.
TypeAnnotation get extendedType;
/// Return the token representing the 'extension' keyword.
Token get extensionKeyword;
/// Return the left curly bracket.
Token get leftBracket;
/// Return the members being added to the extended class.
NodeList<ClassMember> get members;
/// Return the name of the extension, or `null` if the extension does not have
/// a name.
SimpleIdentifier get name;
/// Return the token representing the 'on' keyword.
Token get onKeyword;
/// Return the right curly bracket.
Token get rightBracket;
/// Return the type parameters for the extension, or `null` if the extension
/// does not have any type parameters.
TypeParameterList get typeParameters;
}
/// An override to force resolution to choose a member from a specific
/// extension.
///
/// extensionOverride ::=
/// [Identifier] [TypeArgumentList]? [ArgumentList]
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExtensionOverride implements Expression {
/// Return the list of arguments to the override. In valid code this will
/// contain a single argument, which evaluates to the object being extended.
ArgumentList get argumentList;
/// Return the actual type extended by this override, produced by applying
/// [typeArgumentTypes] to the generic type extended by the extension.
///
/// Return `null` if the AST structure has not been resolved.
DartType get extendedType;
/// Return the name of the extension being selected.
Identifier get extensionName;
/// Return the forced extension element.
///
/// Return `null` if the AST structure has not been resolved.
ExtensionElement get staticElement;
/// Return the type arguments to be applied to the extension, or `null` if no
/// type arguments were provided.
TypeArgumentList get typeArguments;
/// Return the actual type arguments to be applied to the extension, either
/// explicitly specified in [typeArguments], or inferred.
///
/// If the AST has been resolved, never returns `null`, returns an empty list
/// if the extension does not have type parameters.
///
/// Return `null` if the AST structure has not been resolved.
List<DartType> get typeArgumentTypes;
}
/// The declaration of one or more fields of the same type.
///
/// fieldDeclaration ::=
/// 'static'? [VariableDeclarationList] ';'
///
/// Prior to the 'extension-methods' experiment, these nodes were always
/// children of a class declaration. When the experiment is enabled, these nodes
/// can also be children of an extension declaration.
///
/// Clients may not extend, implement or mix-in this class.
abstract class FieldDeclaration implements ClassMember {
/// The 'covariant' keyword, or `null` if the keyword was not used.
Token get covariantKeyword;
/// Set the token for the 'covariant' keyword to the given [token].
void set covariantKeyword(Token token);
/// Return the fields being declared.
VariableDeclarationList get fields;
/// Set the fields being declared to the given list of [fields].
void set fields(VariableDeclarationList fields);
/// Return `true` if the fields are declared to be static.
bool get isStatic;
/// Return the semicolon terminating the declaration.
Token get semicolon;
/// Set the semicolon terminating the declaration to the given [token].
void set semicolon(Token token);
/// Return the token representing the 'static' keyword, or `null` if the
/// fields are not static.
Token get staticKeyword;
/// Set the token representing the 'static' keyword to the given [token].
void set staticKeyword(Token token);
}
/// A field formal parameter.
///
/// fieldFormalParameter ::=
/// ('final' [TypeAnnotation] | 'const' [TypeAnnotation] | 'var' | [TypeAnnotation])?
/// 'this' '.' [SimpleIdentifier] ([TypeParameterList]? [FormalParameterList])?
///
/// Clients may not extend, implement or mix-in this class.
abstract class FieldFormalParameter implements NormalFormalParameter {
/// Return the token representing either the 'final', 'const' or 'var'
/// keyword, or `null` if no keyword was used.
Token get keyword;
/// Set the token representing either the 'final', 'const' or 'var' keyword to
/// the given [token].
void set keyword(Token token);
/// Return the parameters of the function-typed parameter, or `null` if this
/// is not a function-typed field formal parameter.
FormalParameterList get parameters;
/// Set the parameters of the function-typed parameter to the given
/// [parameters].
void set parameters(FormalParameterList parameters);
/// Return the token representing the period.
Token get period;
/// Set the token representing the period to the given [token].
void set period(Token token);
/// Return the token representing the 'this' keyword.
Token get thisKeyword;
/// Set the token representing the 'this' keyword to the given [token].
void set thisKeyword(Token token);
/// Return the declared type of the parameter, or `null` if the parameter does
/// not have a declared type. Note that if this is a function-typed field
/// formal parameter this is the return type of the function.
TypeAnnotation get type;
/// Set the declared type of the parameter to the given [type].
void set type(TypeAnnotation type);
/// Return the type parameters associated with this method, or `null` if this
/// method is not a generic method.
TypeParameterList get typeParameters;
/// Set the type parameters associated with this method to the given
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
}
/// The parts of a for-each loop that control the iteration.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForEachParts implements ForLoopParts {
/// Return the token representing the 'in' keyword.
Token get inKeyword;
/// Return the expression evaluated to produce the iterator.
Expression get iterable;
}
/// The parts of a for-each loop that control the iteration when the loop
/// variable is declared as part of the for loop.
///
/// forLoopParts ::=
/// [DeclaredIdentifier] 'in' [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForEachPartsWithDeclaration implements ForEachParts {
/// Return the declaration of the loop variable.
DeclaredIdentifier get loopVariable;
}
/// The parts of a for-each loop that control the iteration when the loop
/// variable is declared outside of the for loop.
///
/// forLoopParts ::=
/// [SimpleIdentifier] 'in' [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForEachPartsWithIdentifier implements ForEachParts {
/// Return the loop variable.
SimpleIdentifier get identifier;
}
/// The basic structure of a for element.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForElement implements CollectionElement {
/// Return the token representing the 'await' keyword, or `null` if there was
/// no 'await' keyword.
Token get awaitKeyword;
/// Return the body of the loop.
CollectionElement get body;
/// Return the token representing the 'for' keyword.
Token get forKeyword;
/// Return the parts of the for element that control the iteration.
ForLoopParts get forLoopParts;
/// Return the left parenthesis.
Token get leftParenthesis;
/// Return the right parenthesis.
Token get rightParenthesis;
}
/// The parts of a for or for-each loop that control the iteration.
///
/// forLoopParts ::=
/// [VariableDeclaration] ';' [Expression]? ';' expressionList?
/// | [Expression]? ';' [Expression]? ';' expressionList?
/// | [DeclaredIdentifier] 'in' [Expression]
/// | [SimpleIdentifier] 'in' [Expression]
///
/// expressionList ::=
/// [Expression] (',' [Expression])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForLoopParts implements AstNode {}
/// A node representing a parameter to a function.
///
/// formalParameter ::=
/// [NormalFormalParameter]
/// | [DefaultFormalParameter]
///
/// Clients may not extend, implement or mix-in this class.
abstract class FormalParameter implements AstNode {
/// The 'covariant' keyword, or `null` if the keyword was not used.
Token get covariantKeyword;
/// Return the element representing this parameter, or `null` if this
/// parameter has not been resolved.
ParameterElement get declaredElement;
/// Return the element representing this parameter, or `null` if this
/// parameter has not been resolved.
@deprecated
ParameterElement get element;
/// Return the name of the parameter being declared.
SimpleIdentifier get identifier;
/// Return `true` if this parameter was declared with the 'const' modifier.
bool get isConst;
/// Return `true` if this parameter was declared with the 'final' modifier.
/// Parameters that are declared with the 'const' modifier will return `false`
/// even though they are implicitly final.
bool get isFinal;
/// Return `true` if this parameter is a named parameter. Named parameters can
/// either be required or optional.
bool get isNamed;
/// Return `true` if this parameter is an optional parameter. Optional
/// parameters can either be positional or named.
bool get isOptional;
/// Return `true` if this parameter is both an optional and named parameter.
bool get isOptionalNamed;
/// Return `true` if this parameter is both an optional and positional
/// parameter.
bool get isOptionalPositional;
/// Return `true` if this parameter is a positional parameter. Positional
/// parameters can either be required or optional.
bool get isPositional;
/// Return `true` if this parameter is a required parameter. Required
/// parameters can either be positional or named.
///
/// Note: this will return `false` for a named parameter that is annotated
/// with the `@required` annotation.
bool get isRequired;
/// Return `true` if this parameter is both a required and named parameter.
///
/// Note: this will return `false` for a named parameter that is annotated
/// with the `@required` annotation.
bool get isRequiredNamed;
/// Return `true` if this parameter is both a required and positional
/// parameter.
bool get isRequiredPositional;
/// Return the kind of this parameter.
@deprecated
ParameterKind get kind;
/// Return the annotations associated with this parameter.
NodeList<Annotation> get metadata;
/// The 'required' keyword, or `null` if the keyword was not used.
Token get requiredKeyword;
}
/// The formal parameter list of a method declaration, function declaration, or
/// function type alias.
///
/// While the grammar requires all optional formal parameters to follow all of
/// the normal formal parameters and at most one grouping of optional formal
/// parameters, this class does not enforce those constraints. All parameters
/// are flattened into a single list, which can have any or all kinds of
/// parameters (normal, named, and positional) in any order.
///
/// formalParameterList ::=
/// '(' ')'
/// | '(' normalFormalParameters (',' optionalFormalParameters)? ')'
/// | '(' optionalFormalParameters ')'
///
/// normalFormalParameters ::=
/// [NormalFormalParameter] (',' [NormalFormalParameter])*
///
/// optionalFormalParameters ::=
/// optionalPositionalFormalParameters
/// | namedFormalParameters
///
/// optionalPositionalFormalParameters ::=
/// '[' [DefaultFormalParameter] (',' [DefaultFormalParameter])* ']'
///
/// namedFormalParameters ::=
/// '{' [DefaultFormalParameter] (',' [DefaultFormalParameter])* '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class FormalParameterList implements AstNode {
/// Return the left square bracket ('[') or left curly brace ('{') introducing
/// the optional parameters, or `null` if there are no optional parameters.
Token get leftDelimiter;
/// Set the left square bracket ('[') or left curly brace ('{') introducing
/// the optional parameters to the given [token].
void set leftDelimiter(Token token);
/// Return the left parenthesis.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return a list containing the elements representing the parameters in this
/// list. The list will contain `null`s if the parameters in this list have
/// not been resolved.
List<ParameterElement> get parameterElements;
/// Return the parameters associated with the method.
NodeList<FormalParameter> get parameters;
/// Return the right square bracket (']') or right curly brace ('}')
/// terminating the optional parameters, or `null` if there are no optional
/// parameters.
Token get rightDelimiter;
/// Set the right square bracket (']') or right curly brace ('}') terminating
/// the optional parameters to the given [token].
void set rightDelimiter(Token token);
/// Return the right parenthesis.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
}
/// The parts of a for loop that control the iteration.
///
/// forLoopParts ::=
/// [VariableDeclaration] ';' [Expression]? ';' expressionList?
/// | [Expression]? ';' [Expression]? ';' expressionList?
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForParts implements ForLoopParts {
/// Return the condition used to determine when to terminate the loop, or
/// `null` if there is no condition.
Expression get condition;
/// Return the semicolon separating the initializer and the condition.
Token get leftSeparator;
/// Return the semicolon separating the condition and the updater.
Token get rightSeparator;
/// Return the list of expressions run after each execution of the loop body.
NodeList<Expression> get updaters;
}
/// The parts of a for loop that control the iteration when there are one or
/// more variable declarations as part of the for loop.
///
/// forLoopParts ::=
/// [VariableDeclarationList] ';' [Expression]? ';' expressionList?
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForPartsWithDeclarations implements ForParts {
/// Return the declaration of the loop variables.
VariableDeclarationList get variables;
}
/// The parts of a for loop that control the iteration when there are no
/// variable declarations as part of the for loop.
///
/// forLoopParts ::=
/// [Expression]? ';' [Expression]? ';' expressionList?
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForPartsWithExpression implements ForParts {
/// Return the initialization expression, or `null` if there is no
/// initialization expression.
Expression get initialization;
}
/// A for or for-each statement.
///
/// forStatement ::=
/// 'for' '(' forLoopParts ')' [Statement]
///
/// forLoopParts ::=
/// [VariableDeclaration] ';' [Expression]? ';' expressionList?
/// | [Expression]? ';' [Expression]? ';' expressionList?
/// | [DeclaredIdentifier] 'in' [Expression]
/// | [SimpleIdentifier] 'in' [Expression]
///
/// This is the class that is used to represent a for loop when either the
/// 'control-flow-collections' or 'spread-collections' experiments are enabled.
/// If neither of those experiments are enabled, then either `ForStatement` or
/// `ForEachStatement` will be used.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ForStatement implements Statement {
/// Return the token representing the 'await' keyword, or `null` if there is
/// no 'await' keyword.
Token get awaitKeyword;
/// Return the body of the loop.
Statement get body;
/// Return the token representing the 'for' keyword.
Token get forKeyword;
/// Return the parts of the for element that control the iteration.
ForLoopParts get forLoopParts;
/// Return the left parenthesis.
Token get leftParenthesis;
/// Return the right parenthesis.
Token get rightParenthesis;
}
/// A node representing the body of a function or method.
///
/// functionBody ::=
/// [BlockFunctionBody]
/// | [EmptyFunctionBody]
/// | [ExpressionFunctionBody]
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionBody implements AstNode {
/// Return `true` if this function body is asynchronous.
bool get isAsynchronous;
/// Return `true` if this function body is a generator.
bool get isGenerator;
/// Return `true` if this function body is synchronous.
bool get isSynchronous;
/// Return the token representing the 'async' or 'sync' keyword, or `null` if
/// there is no such keyword.
Token get keyword;
/// Return the star following the 'async' or 'sync' keyword, or `null` if
/// there is no star.
Token get star;
/// If [variable] is a local variable or parameter declared anywhere within
/// the top level function or method containing this [FunctionBody], return a
/// boolean indicating whether [variable] is potentially mutated within a
/// local function other than the function in which it is declared.
///
/// If [variable] is not a local variable or parameter declared within the top
/// level function or method containing this [FunctionBody], return `false`.
///
/// Throws an exception if resolution has not yet been performed.
bool isPotentiallyMutatedInClosure(VariableElement variable);
/// If [variable] is a local variable or parameter declared anywhere within
/// the top level function or method containing this [FunctionBody], return a
/// boolean indicating whether [variable] is potentially mutated within the
/// scope of its declaration.
///
/// If [variable] is not a local variable or parameter declared within the top
/// level function or method containing this [FunctionBody], return `false`.
///
/// Throws an exception if resolution has not yet been performed.
bool isPotentiallyMutatedInScope(VariableElement variable);
}
/// A top-level function declaration.
///
/// functionDeclaration ::=
/// 'external' functionSignature
/// | functionSignature [FunctionBody]
///
/// functionSignature ::=
/// [Type]? ('get' | 'set')? [SimpleIdentifier] [FormalParameterList]
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionDeclaration implements NamedCompilationUnitMember {
@override
ExecutableElement get declaredElement;
@deprecated
@override
ExecutableElement get element;
/// Return the token representing the 'external' keyword, or `null` if this is
/// not an external function.
Token get externalKeyword;
/// Set the token representing the 'external' keyword to the given [token].
void set externalKeyword(Token token);
/// Return the function expression being wrapped.
FunctionExpression get functionExpression;
/// Set the function expression being wrapped to the given
/// [functionExpression].
void set functionExpression(FunctionExpression functionExpression);
/// Return `true` if this function declares a getter.
bool get isGetter;
/// Return `true` if this function declares a setter.
bool get isSetter;
/// Return the token representing the 'get' or 'set' keyword, or `null` if
/// this is a function declaration rather than a property declaration.
Token get propertyKeyword;
/// Set the token representing the 'get' or 'set' keyword to the given
/// [token].
void set propertyKeyword(Token token);
/// Return the return type of the function, or `null` if no return type was
/// declared.
TypeAnnotation get returnType;
/// Set the return type of the function to the given [type].
void set returnType(TypeAnnotation type);
}
/// A [FunctionDeclaration] used as a statement.
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionDeclarationStatement implements Statement {
/// Return the function declaration being wrapped.
FunctionDeclaration get functionDeclaration;
/// Set the function declaration being wrapped to the given
/// [functionDeclaration].
void set functionDeclaration(FunctionDeclaration functionDeclaration);
}
/// A function expression.
///
/// functionExpression ::=
/// [TypeParameterList]? [FormalParameterList] [FunctionBody]
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionExpression implements Expression {
/// Return the body of the function, or `null` if this is an external
/// function.
FunctionBody get body;
/// Set the body of the function to the given [functionBody].
void set body(FunctionBody functionBody);
/// Return the element associated with the function, or `null` if the AST
/// structure has not been resolved.
ExecutableElement get declaredElement;
/// Return the element associated with the function, or `null` if the AST
/// structure has not been resolved.
@deprecated
ExecutableElement get element;
/// Set the element associated with the function to the given [element].
void set element(ExecutableElement element);
/// Return the parameters associated with the function, or `null` if the
/// function is part of a top-level getter.
FormalParameterList get parameters;
/// Set the parameters associated with the function to the given list of
/// [parameters].
void set parameters(FormalParameterList parameters);
/// Return the type parameters associated with this method, or `null` if this
/// method is not a generic method.
TypeParameterList get typeParameters;
/// Set the type parameters associated with this method to the given
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
}
/// The invocation of a function resulting from evaluating an expression.
/// Invocations of methods and other forms of functions are represented by
/// [MethodInvocation] nodes. Invocations of getters and setters are represented
/// by either [PrefixedIdentifier] or [PropertyAccess] nodes.
///
/// functionExpressionInvocation ::=
/// [Expression] [TypeArgumentList]? [ArgumentList]
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionExpressionInvocation implements InvocationExpression {
/// Set the list of arguments to the method to the given [argumentList].
void set argumentList(ArgumentList argumentList);
/// Return the best element available for the function being invoked. If
/// resolution was able to find a better element based on type propagation,
/// that element will be returned. Otherwise, the element found using the
/// result of static analysis will be returned. If resolution has not been
/// performed, then `null` will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
ExecutableElement get bestElement;
/// Return the expression producing the function being invoked.
@override
Expression get function;
/// Set the expression producing the function being invoked to the given
/// [expression].
void set function(Expression expression);
/// Return the element associated with the function being invoked based on
/// propagated type information, or `null` if the AST structure has not been
/// resolved or the function could not be resolved.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
ExecutableElement get propagatedElement;
/// Set the element associated with the function being invoked based on
/// propagated type information to the given [element].
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
void set propagatedElement(ExecutableElement element);
/// Return the element associated with the function being invoked based on
/// static type information, or `null` if the AST structure has not been
/// resolved or the function could not be resolved.
ExecutableElement get staticElement;
/// Set the element associated with the function being invoked based on static
/// type information to the given [element].
void set staticElement(ExecutableElement element);
/// Set the type arguments to be applied to the method being invoked to the
/// given [typeArguments].
void set typeArguments(TypeArgumentList typeArguments);
}
/// A function type alias.
///
/// functionTypeAlias ::=
/// functionPrefix [TypeParameterList]? [FormalParameterList] ';'
///
/// functionPrefix ::=
/// [TypeAnnotation]? [SimpleIdentifier]
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionTypeAlias implements TypeAlias {
@override
FunctionTypeAliasElement get declaredElement;
/// Return the parameters associated with the function type.
FormalParameterList get parameters;
/// Set the parameters associated with the function type to the given list of
/// [parameters].
void set parameters(FormalParameterList parameters);
/// Return the return type of the function type being defined, or `null` if no
/// return type was given.
TypeAnnotation get returnType;
/// Set the return type of the function type being defined to the given
/// [type].
void set returnType(TypeAnnotation type);
/// Return the type parameters for the function type, or `null` if the
/// function type does not have any type parameters.
TypeParameterList get typeParameters;
/// Set the type parameters for the function type to the given list of
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
}
/// A function-typed formal parameter.
///
/// functionSignature ::=
/// [TypeAnnotation]? [SimpleIdentifier] [TypeParameterList]?
/// [FormalParameterList] '?'?
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionTypedFormalParameter implements NormalFormalParameter {
/// Return the parameters of the function-typed parameter.
FormalParameterList get parameters;
/// Set the parameters of the function-typed parameter to the given
/// [parameters].
void set parameters(FormalParameterList parameters);
/// Return the question mark indicating that the function type is nullable, or
/// `null` if there is no question mark. Having a nullable function type means
/// that the parameter can be null.
Token get question;
/// Return the return type of the function, or `null` if the function does not
/// have a return type.
TypeAnnotation get returnType;
/// Set the return type of the function to the given [type].
void set returnType(TypeAnnotation type);
/// Return the type parameters associated with this function, or `null` if
/// this function is not a generic function.
TypeParameterList get typeParameters;
/// Set the type parameters associated with this method to the given
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
}
/// An anonymous function type.
///
/// functionType ::=
/// [TypeAnnotation]? 'Function' [TypeParameterList]?
/// [FormalParameterList] '?'?
///
/// where the FormalParameterList is being used to represent the following
/// grammar, despite the fact that FormalParameterList can represent a much
/// larger grammar than the one below. This is done in order to simplify the
/// implementation.
///
/// parameterTypeList ::=
/// () |
/// ( normalParameterTypes ,? ) |
/// ( normalParameterTypes , optionalParameterTypes ) |
/// ( optionalParameterTypes )
/// namedParameterTypes ::=
/// { namedParameterType (, namedParameterType)* ,? }
/// namedParameterType ::=
/// [TypeAnnotation]? [SimpleIdentifier]
/// normalParameterTypes ::=
/// normalParameterType (, normalParameterType)*
/// normalParameterType ::=
/// [TypeAnnotation] [SimpleIdentifier]?
/// optionalParameterTypes ::=
/// optionalPositionalParameterTypes | namedParameterTypes
/// optionalPositionalParameterTypes ::=
/// [ normalParameterTypes ,? ]
///
/// Clients may not extend, implement or mix-in this class.
abstract class GenericFunctionType implements TypeAnnotation {
/// Return the keyword 'Function'.
Token get functionKeyword;
/// Set the keyword 'Function' to the given [token].
void set functionKeyword(Token token);
/// Return the parameters associated with the function type.
FormalParameterList get parameters;
/// Set the parameters associated with the function type to the given list of
/// [parameters].
void set parameters(FormalParameterList parameters);
/// Set the question mark indicating that the type is nullable to the given
/// [token].
void set question(Token token);
/// Return the return type of the function type being defined, or `null` if
/// no return type was given.
TypeAnnotation get returnType;
/// Set the return type of the function type being defined to the given[type].
void set returnType(TypeAnnotation type);
/// Return the type parameters for the function type, or `null` if the
/// function type does not have any type parameters.
TypeParameterList get typeParameters;
/// Set the type parameters for the function type to the given list of
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
}
/// A generic type alias.
///
/// functionTypeAlias ::=
/// metadata 'typedef' [SimpleIdentifier] [TypeParameterList]? = [FunctionType] ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class GenericTypeAlias implements TypeAlias {
/// Return the equal sign separating the name being defined from the function
/// type.
Token get equals;
/// Set the equal sign separating the name being defined from the function
/// type to the given [token].
void set equals(Token token);
/// Return the type of function being defined by the alias.
GenericFunctionType get functionType;
/// Set the type of function being defined by the alias to the given
/// [functionType].
void set functionType(GenericFunctionType functionType);
/// Return the type parameters for the function type, or `null` if the
/// function type does not have any type parameters.
TypeParameterList get typeParameters;
/// Set the type parameters for the function type to the given list of
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
}
/// A combinator that restricts the names being imported to those that are not
/// in a given list.
///
/// hideCombinator ::=
/// 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class HideCombinator implements Combinator {
/// Return the list of names from the library that are hidden by this
/// combinator.
NodeList<SimpleIdentifier> get hiddenNames;
}
/// A node that represents an identifier.
///
/// identifier ::=
/// [SimpleIdentifier]
/// | [PrefixedIdentifier]
///
/// Clients may not extend, implement or mix-in this class.
abstract class Identifier implements Expression {
/// Return the best element available for this operator. If resolution was
/// able to find a better element based on type propagation, that element will
/// be returned. Otherwise, the element found using the result of static
/// analysis will be returned. If resolution has not been performed, then
/// `null` will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
Element get bestElement;
/// Return the lexical representation of the identifier.
String get name;
/// Return the element associated with this identifier based on propagated
/// type information, or `null` if the AST structure has not been resolved or
/// if this identifier could not be resolved. One example of the latter case
/// is an identifier that is not defined within the scope in which it appears.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
Element get propagatedElement;
/// Return the element associated with this identifier based on static type
/// information, or `null` if the AST structure has not been resolved or if
/// this identifier could not be resolved. One example of the latter case is
/// an identifier that is not defined within the scope in which it appears.
Element get staticElement;
/// Return `true` if the given [name] is visible only within the library in
/// which it is declared.
static bool isPrivateName(String name) =>
StringUtilities.startsWithChar(name, 0x5F); // '_'
}
/// The basic structure of an if element.
///
/// Clients may not extend, implement or mix-in this class.
abstract class IfElement implements CollectionElement {
/// Return the condition used to determine which of the statements is executed
/// next.
Expression get condition;
/// Return the statement that is executed if the condition evaluates to
/// `false`, or `null` if there is no else statement.
CollectionElement get elseElement;
/// Return the token representing the 'else' keyword, or `null` if there is no
/// else statement.
Token get elseKeyword;
/// Return the token representing the 'if' keyword.
Token get ifKeyword;
/// Return the left parenthesis.
Token get leftParenthesis;
/// Return the right parenthesis.
Token get rightParenthesis;
/// Return the statement that is executed if the condition evaluates to
/// `true`.
CollectionElement get thenElement;
}
/// An if statement.
///
/// ifStatement ::=
/// 'if' '(' [Expression] ')' [Statement] ('else' [Statement])?
///
/// Clients may not extend, implement or mix-in this class.
abstract class IfStatement implements Statement {
/// Return the condition used to determine which of the statements is executed
/// next.
Expression get condition;
/// Set the condition used to determine which of the statements is executed
/// next to the given [expression].
void set condition(Expression expression);
/// Return the token representing the 'else' keyword, or `null` if there is no
/// else statement.
Token get elseKeyword;
/// Set the token representing the 'else' keyword to the given [token].
void set elseKeyword(Token token);
/// Return the statement that is executed if the condition evaluates to
/// `false`, or `null` if there is no else statement.
Statement get elseStatement;
/// Set the statement that is executed if the condition evaluates to `false`
/// to the given [statement].
void set elseStatement(Statement statement);
/// Return the token representing the 'if' keyword.
Token get ifKeyword;
/// Set the token representing the 'if' keyword to the given [token].
void set ifKeyword(Token token);
/// Return the left parenthesis.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the right parenthesis.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
/// Return the statement that is executed if the condition evaluates to
/// `true`.
Statement get thenStatement;
/// Set the statement that is executed if the condition evaluates to `true` to
/// the given [statement].
void set thenStatement(Statement statement);
}
/// The "implements" clause in an class declaration.
///
/// implementsClause ::=
/// 'implements' [TypeName] (',' [TypeName])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class ImplementsClause implements AstNode {
/// Return the token representing the 'implements' keyword.
Token get implementsKeyword;
/// Set the token representing the 'implements' keyword to the given [token].
void set implementsKeyword(Token token);
/// Return the list of the interfaces that are being implemented.
NodeList<TypeName> get interfaces;
}
/// An import directive.
///
/// importDirective ::=
/// [Annotation] 'import' [StringLiteral] ('as' identifier)? [Combinator]* ';'
/// | [Annotation] 'import' [StringLiteral] 'deferred' 'as' identifier [Combinator]* ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ImportDirective implements NamespaceDirective {
static Comparator<ImportDirective> COMPARATOR =
(ImportDirective import1, ImportDirective import2) {
//
// uri
//
StringLiteral uri1 = import1.uri;
StringLiteral uri2 = import2.uri;
String uriStr1 = uri1.stringValue;
String uriStr2 = uri2.stringValue;
if (uriStr1 != null || uriStr2 != null) {
if (uriStr1 == null) {
return -1;
} else if (uriStr2 == null) {
return 1;
} else {
int compare = uriStr1.compareTo(uriStr2);
if (compare != 0) {
return compare;
}
}
}
//
// as
//
SimpleIdentifier prefix1 = import1.prefix;
SimpleIdentifier prefix2 = import2.prefix;
String prefixStr1 = prefix1?.name;
String prefixStr2 = prefix2?.name;
if (prefixStr1 != null || prefixStr2 != null) {
if (prefixStr1 == null) {
return -1;
} else if (prefixStr2 == null) {
return 1;
} else {
int compare = prefixStr1.compareTo(prefixStr2);
if (compare != 0) {
return compare;
}
}
}
//
// hides and shows
//
NodeList<Combinator> combinators1 = import1.combinators;
List<String> allHides1 = new List<String>();
List<String> allShows1 = new List<String>();
int length1 = combinators1.length;
for (int i = 0; i < length1; i++) {
Combinator combinator = combinators1[i];
if (combinator is HideCombinator) {
NodeList<SimpleIdentifier> hides = combinator.hiddenNames;
int hideLength = hides.length;
for (int j = 0; j < hideLength; j++) {
SimpleIdentifier simpleIdentifier = hides[j];
allHides1.add(simpleIdentifier.name);
}
} else {
NodeList<SimpleIdentifier> shows =
(combinator as ShowCombinator).shownNames;
int showLength = shows.length;
for (int j = 0; j < showLength; j++) {
SimpleIdentifier simpleIdentifier = shows[j];
allShows1.add(simpleIdentifier.name);
}
}
}
NodeList<Combinator> combinators2 = import2.combinators;
List<String> allHides2 = new List<String>();
List<String> allShows2 = new List<String>();
int length2 = combinators2.length;
for (int i = 0; i < length2; i++) {
Combinator combinator = combinators2[i];
if (combinator is HideCombinator) {
NodeList<SimpleIdentifier> hides = combinator.hiddenNames;
int hideLength = hides.length;
for (int j = 0; j < hideLength; j++) {
SimpleIdentifier simpleIdentifier = hides[j];
allHides2.add(simpleIdentifier.name);
}
} else {
NodeList<SimpleIdentifier> shows =
(combinator as ShowCombinator).shownNames;
int showLength = shows.length;
for (int j = 0; j < showLength; j++) {
SimpleIdentifier simpleIdentifier = shows[j];
allShows2.add(simpleIdentifier.name);
}
}
}
// test lengths of combinator lists first
if (allHides1.length != allHides2.length) {
return allHides1.length - allHides2.length;
}
if (allShows1.length != allShows2.length) {
return allShows1.length - allShows2.length;
}
// next ensure that the lists are equivalent
if (!allHides1.toSet().containsAll(allHides2)) {
return -1;
}
if (!allShows1.toSet().containsAll(allShows2)) {
return -1;
}
return 0;
};
/// Return the token representing the 'as' keyword, or `null` if the imported
/// names are not prefixed.
Token get asKeyword;
/// Set the token representing the 'as' keyword to the given [token].
void set asKeyword(Token token);
/// Return the token representing the 'deferred' keyword, or `null` if the
/// imported URI is not deferred.
Token get deferredKeyword;
/// Set the token representing the 'deferred' keyword to the given [token].
void set deferredKeyword(Token token);
/// Return the prefix to be used with the imported names, or `null` if the
/// imported names are not prefixed.
SimpleIdentifier get prefix;
/// Set the prefix to be used with the imported names to the given
/// [identifier].
void set prefix(SimpleIdentifier identifier);
}
/// An index expression.
///
/// indexExpression ::=
/// [Expression] '[' [Expression] ']'
///
/// Clients may not extend, implement or mix-in this class.
abstract class IndexExpression
implements Expression, MethodReferenceExpression {
/// Return the auxiliary elements associated with this identifier, or `null`
/// if this identifier is not in both a getter and setter context. The
/// auxiliary elements hold the static and propagated elements associated with
/// the getter context.
// TODO(brianwilkerson) Replace this API.
AuxiliaryElements get auxiliaryElements;
/// Set the auxiliary elements associated with this identifier to the given
/// [elements].
// TODO(brianwilkerson) Replace this API.
void set auxiliaryElements(AuxiliaryElements elements);
/// Return the expression used to compute the index.
Expression get index;
/// Set the expression used to compute the index to the given [expression].
void set index(Expression expression);
/// Return `true` if this expression is cascaded. If it is, then the target of
/// this expression is not stored locally but is stored in the nearest
/// ancestor that is a [CascadeExpression].
bool get isCascaded;
/// Whether this index expression is null aware (as opposed to non-null).
bool get isNullAware;
/// Return the left square bracket.
Token get leftBracket;
/// Set the left square bracket to the given [token].
void set leftBracket(Token token);
/// Return the period ("..") before a cascaded index expression, or `null` if
/// this index expression is not part of a cascade expression.
Token get period;
/// Set the period ("..") before a cascaded index expression to the given
/// [token].
void set period(Token token);
/// Return the expression used to compute the object being indexed. If this
/// index expression is not part of a cascade expression, then this is the
/// same as [target]. If this index expression is part of a cascade
/// expression, then the target expression stored with the cascade expression
/// is returned.
Expression get realTarget;
/// Return the right square bracket.
Token get rightBracket;
/// Return the expression used to compute the object being indexed, or `null`
/// if this index expression is part of a cascade expression.
///
/// Use [realTarget] to get the target independent of whether this is part of
/// a cascade expression.
Expression get target;
/// Set the expression used to compute the object being indexed to the given
/// [expression].
void set target(Expression expression);
/// Return `true` if this expression is computing a right-hand value (that is,
/// if this expression is in a context where the operator '[]' will be
/// invoked).
///
/// Note that [inGetterContext] and [inSetterContext] are not opposites, nor
/// are they mutually exclusive. In other words, it is possible for both
/// methods to return `true` when invoked on the same node.
// TODO(brianwilkerson) Convert this to a getter.
bool inGetterContext();
/// Return `true` if this expression is computing a left-hand value (that is,
/// if this expression is in a context where the operator '[]=' will be
/// invoked).
///
/// Note that [inGetterContext] and [inSetterContext] are not opposites, nor
/// are they mutually exclusive. In other words, it is possible for both
/// methods to return `true` when invoked on the same node.
// TODO(brianwilkerson) Convert this to a getter.
bool inSetterContext();
}
/// An instance creation expression.
///
/// newExpression ::=
/// ('new' | 'const')? [TypeName] ('.' [SimpleIdentifier])? [ArgumentList]
///
/// Clients may not extend, implement or mix-in this class.
abstract class InstanceCreationExpression
implements Expression, ConstructorReferenceNode {
/// Return the list of arguments to the constructor.
ArgumentList get argumentList;
/// Set the list of arguments to the constructor to the given [argumentList].
void set argumentList(ArgumentList argumentList);
/// Return the name of the constructor to be invoked.
ConstructorName get constructorName;
/// Set the name of the constructor to be invoked to the given [name].
void set constructorName(ConstructorName name);
/// Return `true` if this creation expression is used to invoke a constant
/// constructor, either because the keyword `const` was explicitly provided or
/// because no keyword was provided and this expression is in a constant
/// context.
bool get isConst;
/// Return the 'new' or 'const' keyword used to indicate how an object should
/// be created, or `null` if the keyword was not explicitly provided.
Token get keyword;
/// Set the 'new' or 'const' keyword used to indicate how an object should be
/// created to the given [token].
void set keyword(Token token);
}
/// An integer literal expression.
///
/// integerLiteral ::=
/// decimalIntegerLiteral
/// | hexadecimalIntegerLiteral
///
/// decimalIntegerLiteral ::=
/// decimalDigit+
///
/// hexadecimalIntegerLiteral ::=
/// '0x' hexadecimalDigit+
/// | '0X' hexadecimalDigit+
///
/// Clients may not extend, implement or mix-in this class.
abstract class IntegerLiteral implements Literal {
/// Return the token representing the literal.
Token get literal;
/// Set the token representing the literal to the given [token].
void set literal(Token token);
/// Return the value of the literal.
int get value;
/// Set the value of the literal to the given [value].
void set value(int value);
}
/// A node within a [StringInterpolation].
///
/// interpolationElement ::=
/// [InterpolationExpression]
/// | [InterpolationString]
///
/// Clients may not extend, implement or mix-in this class.
abstract class InterpolationElement implements AstNode {}
/// An expression embedded in a string interpolation.
///
/// interpolationExpression ::=
/// '$' [SimpleIdentifier]
/// | '$' '{' [Expression] '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class InterpolationExpression implements InterpolationElement {
/// Return the expression to be evaluated for the value to be converted into a
/// string.
Expression get expression;
/// Set the expression to be evaluated for the value to be converted into a
/// string to the given [expression].
void set expression(Expression expression);
/// Return the token used to introduce the interpolation expression; either
/// '$' if the expression is a simple identifier or '${' if the expression is
/// a full expression.
Token get leftBracket;
/// Set the token used to introduce the interpolation expression; either '$'
/// if the expression is a simple identifier or '${' if the expression is a
/// full expression to the given [token].
void set leftBracket(Token token);
/// Return the right curly bracket, or `null` if the expression is an
/// identifier without brackets.
Token get rightBracket;
/// Set the right curly bracket to the given [token].
void set rightBracket(Token token);
}
/// A non-empty substring of an interpolated string.
///
/// interpolationString ::=
/// characters
///
/// Clients may not extend, implement or mix-in this class.
abstract class InterpolationString implements InterpolationElement {
/// Return the characters that will be added to the string.
Token get contents;
/// Set the characters that will be added to the string to the given [token].
void set contents(Token token);
/// Return the offset of the after-last contents character.
int get contentsEnd;
/// Return the offset of the first contents character.
int get contentsOffset;
/// Return the value of the literal.
String get value;
/// Set the value of the literal to the given [value].
void set value(String value);
}
/// The invocation of a function or method; either a
/// [FunctionExpressionInvocation] or a [MethodInvocation].
///
/// Clients may not extend, implement or mix-in this class.
abstract class InvocationExpression implements Expression {
/// Return the list of arguments to the method.
ArgumentList get argumentList;
/// The expression that identifies the function or method being invoked.
/// For example:
///
/// (o.m)<TArgs>(args); // target will be `o.m`
/// o.m<TArgs>(args); // target will be `m`
///
/// In either case, the [function.staticType] will be the
/// [staticInvokeType] before applying type arguments `TArgs`.
Expression get function;
/// Return the function type of the invocation based on the propagated type
/// information, or `null` if the AST structure has not been resolved, or if
/// the invoke could not be resolved.
///
/// This will usually be a [FunctionType], but it can also be an
/// [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
/// interface type that implements `Function`.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticInvokeType] instead.
@deprecated
DartType get propagatedInvokeType;
/// Sets the function type of the invocation based on the propagated type
/// information.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticInvokeType] instead.
@deprecated
void set propagatedInvokeType(DartType value);
/// Return the function type of the invocation based on the static type
/// information, or `null` if the AST structure has not been resolved, or if
/// the invoke could not be resolved.
///
/// This will usually be a [FunctionType], but it can also be `dynamic` or
/// `Function`. In the case of interface types that have a `call` method, we
/// store the type of that `call` method here as parameterized.
DartType get staticInvokeType;
/// Sets the function type of the invocation based on the static type
/// information.
void set staticInvokeType(DartType value);
/// Return the type arguments to be applied to the method being invoked, or
/// `null` if no type arguments were provided.
TypeArgumentList get typeArguments;
/// Return the actual type arguments of the invocation, either explicitly
/// specified in [typeArguments], or inferred.
///
/// If the AST has been resolved, never returns `null`, returns an empty list
/// if the [function] does not have type parameters.
///
/// Return `null` if the AST structure has not been resolved.
List<DartType> get typeArgumentTypes;
}
/// An is expression.
///
/// isExpression ::=
/// [Expression] 'is' '!'? [TypeAnnotation]
///
/// Clients may not extend, implement or mix-in this class.
abstract class IsExpression implements Expression {
/// Return the expression used to compute the value whose type is being
/// tested.
Expression get expression;
/// Set the expression used to compute the value whose type is being tested to
/// the given [expression].
void set expression(Expression expression);
/// Return the is operator.
Token get isOperator;
/// Set the is operator to the given [token].
void set isOperator(Token token);
/// Return the not operator, or `null` if the sense of the test is not
/// negated.
Token get notOperator;
/// Set the not operator to the given [token].
void set notOperator(Token token);
/// Return the type being tested for.
TypeAnnotation get type;
/// Set the type being tested for to the given [type].
void set type(TypeAnnotation type);
}
/// A label on either a [LabeledStatement] or a [NamedExpression].
///
/// label ::=
/// [SimpleIdentifier] ':'
///
/// Clients may not extend, implement or mix-in this class.
abstract class Label implements AstNode {
/// Return the colon that separates the label from the statement.
Token get colon;
/// Set the colon that separates the label from the statement to the given
/// [token].
void set colon(Token token);
/// Return the label being associated with the statement.
SimpleIdentifier get label;
/// Set the label being associated with the statement to the given [label].
void set label(SimpleIdentifier label);
}
/// A statement that has a label associated with them.
///
/// labeledStatement ::=
/// [Label]+ [Statement]
///
/// Clients may not extend, implement or mix-in this class.
abstract class LabeledStatement implements Statement {
/// Return the labels being associated with the statement.
NodeList<Label> get labels;
/// Return the statement with which the labels are being associated.
Statement get statement;
/// Set the statement with which the labels are being associated to the given
/// [statement].
void set statement(Statement statement);
}
/// A library directive.
///
/// libraryDirective ::=
/// [Annotation] 'library' [Identifier] ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class LibraryDirective implements Directive {
/// Return the token representing the 'library' keyword.
Token get libraryKeyword;
/// Set the token representing the 'library' keyword to the given [token].
void set libraryKeyword(Token token);
/// Return the name of the library being defined.
LibraryIdentifier get name;
/// Set the name of the library being defined to the given [name].
void set name(LibraryIdentifier name);
/// Return the semicolon terminating the directive.
Token get semicolon;
/// Set the semicolon terminating the directive to the given [token].
void set semicolon(Token token);
}
/// The identifier for a library.
///
/// libraryIdentifier ::=
/// [SimpleIdentifier] ('.' [SimpleIdentifier])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class LibraryIdentifier implements Identifier {
/// Return the components of the identifier.
NodeList<SimpleIdentifier> get components;
}
/// A list literal.
///
/// listLiteral ::=
/// 'const'? [TypeAnnotationList]? '[' elements? ']'
///
/// elements ::=
/// [CollectionElement] (',' [CollectionElement])* ','?
///
/// Clients may not extend, implement or mix-in this class.
abstract class ListLiteral implements TypedLiteral {
/// Return the syntactic elements used to compute the elements of the list.
NodeList<CollectionElement> get elements;
/// Return the left square bracket.
Token get leftBracket;
/// Set the left square bracket to the given [token].
void set leftBracket(Token token);
/// Return the right square bracket.
Token get rightBracket;
/// Set the right square bracket to the given [token].
void set rightBracket(Token token);
}
/// A node that represents a literal expression.
///
/// literal ::=
/// [BooleanLiteral]
/// | [DoubleLiteral]
/// | [IntegerLiteral]
/// | [ListLiteral]
/// | [NullLiteral]
/// | [SetOrMapLiteral]
/// | [StringLiteral]
///
/// Clients may not extend, implement or mix-in this class.
abstract class Literal implements Expression {}
/// A single key/value pair in a map literal.
///
/// mapLiteralEntry ::=
/// [Expression] ':' [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class MapLiteralEntry implements CollectionElement {
/// Return the expression computing the key with which the value will be
/// associated.
Expression get key;
/// Set the expression computing the key with which the value will be
/// associated to the given [string].
void set key(Expression string);
/// Return the colon that separates the key from the value.
Token get separator;
/// Set the colon that separates the key from the value to the given [token].
void set separator(Token token);
/// Return the expression computing the value that will be associated with the
/// key.
Expression get value;
/// Set the expression computing the value that will be associated with the
/// key to the given [expression].
void set value(Expression expression);
}
/// A method declaration.
///
/// methodDeclaration ::=
/// methodSignature [FunctionBody]
///
/// methodSignature ::=
/// 'external'? ('abstract' | 'static')? [Type]? ('get' | 'set')?
/// methodName [TypeParameterList] [FormalParameterList]
///
/// methodName ::=
/// [SimpleIdentifier]
/// | 'operator' [SimpleIdentifier]
///
/// Prior to the 'extension-methods' experiment, these nodes were always
/// children of a class declaration. When the experiment is enabled, these nodes
/// can also be children of an extension declaration.
///
/// Clients may not extend, implement or mix-in this class.
abstract class MethodDeclaration implements ClassMember {
/// Return the body of the method.
FunctionBody get body;
/// Set the body of the method to the given [functionBody].
void set body(FunctionBody functionBody);
@override
ExecutableElement get declaredElement;
@deprecated
@override
ExecutableElement get element;
/// Return the token for the 'external' keyword, or `null` if the constructor
/// is not external.
Token get externalKeyword;
/// Set the token for the 'external' keyword to the given [token].
void set externalKeyword(Token token);
/// Return `true` if this method is declared to be an abstract method.
bool get isAbstract;
/// Return `true` if this method declares a getter.
bool get isGetter;
/// Return `true` if this method declares an operator.
bool get isOperator;
/// Return `true` if this method declares a setter.
bool get isSetter;
/// Return `true` if this method is declared to be a static method.
bool get isStatic;
/// Return the token representing the 'abstract' or 'static' keyword, or
/// `null` if neither modifier was specified.
Token get modifierKeyword;
/// Set the token representing the 'abstract' or 'static' keyword to the given
/// [token].
void set modifierKeyword(Token token);
/// Return the name of the method.
SimpleIdentifier get name;
/// Set the name of the method to the given [identifier].
void set name(SimpleIdentifier identifier);
/// Return the token representing the 'operator' keyword, or `null` if this
/// method does not declare an operator.
Token get operatorKeyword;
/// Set the token representing the 'operator' keyword to the given [token].
void set operatorKeyword(Token token);
/// Return the parameters associated with the method, or `null` if this method
/// declares a getter.
FormalParameterList get parameters;
/// Set the parameters associated with the method to the given list of
/// [parameters].
void set parameters(FormalParameterList parameters);
/// Return the token representing the 'get' or 'set' keyword, or `null` if
/// this is a method declaration rather than a property declaration.
Token get propertyKeyword;
/// Set the token representing the 'get' or 'set' keyword to the given
/// [token].
void set propertyKeyword(Token token);
/// Return the return type of the method, or `null` if no return type was
/// declared.
TypeAnnotation get returnType;
/// Set the return type of the method to the given [type].
void set returnType(TypeAnnotation type);
/// Return the type parameters associated with this method, or `null` if this
/// method is not a generic method.
TypeParameterList get typeParameters;
/// Set the type parameters associated with this method to the given
/// [typeParameters].
void set typeParameters(TypeParameterList typeParameters);
}
/// The invocation of either a function or a method. Invocations of functions
/// resulting from evaluating an expression are represented by
/// [FunctionExpressionInvocation] nodes. Invocations of getters and setters are
/// represented by either [PrefixedIdentifier] or [PropertyAccess] nodes.
///
/// methodInvocation ::=
/// ([Expression] '.')? [SimpleIdentifier] [TypeArgumentList]? [ArgumentList]
///
/// Clients may not extend, implement or mix-in this class.
abstract class MethodInvocation implements InvocationExpression {
/// Set the list of arguments to the method to the given [argumentList].
void set argumentList(ArgumentList argumentList);
/// Return `true` if this expression is cascaded. If it is, then the target of
/// this expression is not stored locally but is stored in the nearest
/// ancestor that is a [CascadeExpression].
bool get isCascaded;
/// Whether this method invocation is null aware (as opposed to non-null).
bool get isNullAware;
/// Return the name of the method being invoked.
SimpleIdentifier get methodName;
/// Set the name of the method being invoked to the given [identifier].
void set methodName(SimpleIdentifier identifier);
/// Return the operator that separates the target from the method name, or
/// `null` if there is no target. In an ordinary method invocation this will
/// be period ('.'). In a cascade section this will be the cascade operator
/// ('..').
Token get operator;
/// Set the operator that separates the target from the method name to the
/// given [token].
void set operator(Token token);
/// Return the expression used to compute the receiver of the invocation. If
/// this invocation is not part of a cascade expression, then this is the same
/// as [target]. If this invocation is part of a cascade expression, then the
/// target stored with the cascade expression is returned.
Expression get realTarget;
/// Return the expression producing the object on which the method is defined,
/// or `null` if there is no target (that is, the target is implicitly `this`)
/// or if this method invocation is part of a cascade expression.
///
/// Use [realTarget] to get the target independent of whether this is part of
/// a cascade expression.
Expression get target;
/// Set the expression producing the object on which the method is defined to
/// the given [expression].
void set target(Expression expression);
/// Set the type arguments to be applied to the method being invoked to the
/// given [typeArguments].
void set typeArguments(TypeArgumentList typeArguments);
}
/// An expression that implicitly makes reference to a method.
///
/// Clients may not extend, implement or mix-in this class.
abstract class MethodReferenceExpression implements AstNode {
/// Return the best element available for this expression. If resolution was
/// able to find a better element based on type propagation, that element will
/// be returned. Otherwise, the element found using the result of static
/// analysis will be returned. If resolution has not been performed, then
/// `null` will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
MethodElement get bestElement;
/// Return the element associated with the expression based on propagated
/// types, or `null` if the AST structure has not been resolved, or there is
/// no meaningful propagated element to return (e.g. because this is a
/// non-compound assignment expression, or because the method referred to
/// could not be resolved).
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
MethodElement get propagatedElement;
/// Set the element associated with the expression based on propagated types
/// to the given [element].
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
void set propagatedElement(MethodElement element);
/// Return the element associated with the expression based on the static
/// types, or `null` if the AST structure has not been resolved, or there is
/// no meaningful static element to return (e.g. because this is a
/// non-compound assignment expression, or because the method referred to
/// could not be resolved).
MethodElement get staticElement;
/// Set the element associated with the expression based on static types to
/// the given [element].
void set staticElement(MethodElement element);
}
/// The declaration of a mixin.
///
/// mixinDeclaration ::=
/// metadata? 'mixin' [SimpleIdentifier] [TypeParameterList]?
/// [OnClause]? [ImplementsClause]? '{' [ClassMember]* '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class MixinDeclaration implements ClassOrMixinDeclaration {
/// Return the token representing the 'mixin' keyword.
Token get mixinKeyword;
/// Return the on clause for the mixin, or `null` if the mixin does not have
/// any superclass constraints.
OnClause get onClause;
}
/// A node that declares a single name within the scope of a compilation unit.
///
/// Clients may not extend, implement or mix-in this class.
abstract class NamedCompilationUnitMember implements CompilationUnitMember {
/// Return the name of the member being declared.
SimpleIdentifier get name;
/// Set the name of the member being declared to the given [identifier].
void set name(SimpleIdentifier identifier);
}
/// An expression that has a name associated with it. They are used in method
/// invocations when there are named parameters.
///
/// namedExpression ::=
/// [Label] [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class NamedExpression implements Expression {
/// Return the element representing the parameter being named by this
/// expression, or `null` if the AST structure has not been resolved or if
/// there is no parameter with the same name as this expression.
ParameterElement get element;
/// Return the expression with which the name is associated.
Expression get expression;
/// Set the expression with which the name is associated to the given
/// [expression].
void set expression(Expression expression);
/// Return the name associated with the expression.
Label get name;
/// Set the name associated with the expression to the given [identifier].
void set name(Label identifier);
}
/// A named type, which can optionally include type arguments.
///
/// namedType ::=
/// [Identifier] typeArguments?
///
/// Clients may not extend, implement or mix-in this class.
abstract class NamedType implements TypeAnnotation {
/// Return `true` if this type is a deferred type.
///
/// 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
/// </i>p.T</i> where <i>p</i> is a deferred prefix.
bool get isDeferred;
/// Return the name of the type.
Identifier get name;
/// Set the name of the type to the given [identifier].
void set name(Identifier identifier);
/// Set the question mark indicating that the type is nullable to the given
/// [token].
void set question(Token token);
/// Set the type being named to the given [type].
void set type(DartType type);
/// Return the type arguments associated with the type, or `null` if there are
/// no type arguments.
TypeArgumentList get typeArguments;
/// Set the type arguments associated with the type to the given
/// [typeArguments].
void set typeArguments(TypeArgumentList typeArguments);
}
/// A node that represents a directive that impacts the namespace of a library.
///
/// directive ::=
/// [ExportDirective]
/// | [ImportDirective]
///
/// Clients may not extend, implement or mix-in this class.
abstract class NamespaceDirective implements UriBasedDirective {
/// Return the combinators used to control how names are imported or exported.
NodeList<Combinator> get combinators;
/// Return the configurations used to control which library will actually be
/// loaded at run-time.
NodeList<Configuration> get configurations;
/// Set the token representing the keyword that introduces this directive
/// ('import', 'export', 'library' or 'part') to the given [token].
void set keyword(Token token);
/// Return the source that was selected based on the declared variables. This
/// will be the source from the first configuration whose condition is true,
/// or the [uriSource] if either there are no configurations or if there are
/// no configurations whose condition is true.
Source get selectedSource;
/// Return the content of the URI that was selected based on the declared
/// variables. This will be the URI from the first configuration whose
/// condition is true, or the [uriContent] if either there are no
/// configurations or if there are no configurations whose condition is true.
String get selectedUriContent;
/// Return the semicolon terminating the directive.
Token get semicolon;
/// Set the semicolon terminating the directive to the given [token].
void set semicolon(Token token);
}
/// The "native" clause in an class declaration.
///
/// nativeClause ::=
/// 'native' [StringLiteral]
///
/// Clients may not extend, implement or mix-in this class.
abstract class NativeClause implements AstNode {
/// Return the name of the native object that implements the class.
StringLiteral get name;
/// Set the name of the native object that implements the class to the given
/// [name].
void set name(StringLiteral name);
/// Return the token representing the 'native' keyword.
Token get nativeKeyword;
/// Set the token representing the 'native' keyword to the given [token].
void set nativeKeyword(Token token);
}
/// A function body that consists of a native keyword followed by a string
/// literal.
///
/// nativeFunctionBody ::=
/// 'native' [SimpleStringLiteral] ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class NativeFunctionBody implements FunctionBody {
/// Return the token representing 'native' that marks the start of the
/// function body.
Token get nativeKeyword;
/// Set the token representing 'native' that marks the start of the function
/// body to the given [token].
void set nativeKeyword(Token token);
/// Return the token representing the semicolon that marks the end of the
/// function body.
Token get semicolon;
/// Set the token representing the semicolon that marks the end of the
/// function body to the given [token].
void set semicolon(Token token);
/// Return the string literal representing the string after the 'native'
/// token.
StringLiteral get stringLiteral;
/// Set the string literal representing the string after the 'native' token to
/// the given [stringLiteral].
void set stringLiteral(StringLiteral stringLiteral);
}
/// A list of AST nodes that have a common parent.
///
/// Clients may not extend, implement or mix-in this class.
abstract class NodeList<E extends AstNode> implements List<E> {
/// Return the first token included in this node list's source range, or
/// `null` if the list is empty.
Token get beginToken;
/// Return the last token included in this node list's source range, or `null`
/// if the list is empty.
Token get endToken;
/// Return the node that is the parent of each of the elements in the list.
AstNode get owner;
/// Set the node that is the parent of each of the elements in the list to the
/// given [node].
@deprecated // Never intended for public use.
void set owner(AstNode node);
/// Return the node at the given [index] in the list or throw a [RangeError]
/// if [index] is out of bounds.
@override
E operator [](int index);
/// Set the node at the given [index] in the list to the given [node] or throw
/// a [RangeError] if [index] is out of bounds.
@override
void operator []=(int index, E node);
/// Use the given [visitor] to visit each of the nodes in this list.
accept(AstVisitor visitor);
}
/// A formal parameter that is required (is not optional).
///
/// normalFormalParameter ::=
/// [FunctionTypedFormalParameter]
/// | [FieldFormalParameter]
/// | [SimpleFormalParameter]
///
/// Clients may not extend, implement or mix-in this class.
abstract class NormalFormalParameter implements FormalParameter {
/// Set the token for the 'covariant' keyword to the given [token].
void set covariantKeyword(Token token);
/// Return the documentation comment associated with this parameter, or `null`
/// if this parameter does not have a documentation comment associated with
/// it.
Comment get documentationComment;
/// Set the documentation comment associated with this parameter to the given
/// [comment].
void set documentationComment(Comment comment);
/// Set the name of the parameter being declared to the given [identifier].
void set identifier(SimpleIdentifier identifier);
/// Set the metadata associated with this node to the given [metadata].
void set metadata(List<Annotation> metadata);
/// Return a list containing the comment and annotations associated with this
/// parameter, sorted in lexical order.
List<AstNode> get sortedCommentAndAnnotations;
}
/// A null literal expression.
///
/// nullLiteral ::=
/// 'null'
///
/// Clients may not extend, implement or mix-in this class.
abstract class NullLiteral implements Literal {
/// Return the token representing the literal.
Token get literal;
/// Set the token representing the literal to the given [token].
void set literal(Token token);
}
/// The "on" clause in a mixin declaration.
///
/// onClause ::=
/// 'on' [TypeName] (',' [TypeName])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class OnClause implements AstNode {
/// Return the token representing the 'on' keyword.
Token get onKeyword;
/// Return the list of the classes are superclass constraints for the mixin.
NodeList<TypeName> get superclassConstraints;
}
/// A parenthesized expression.
///
/// parenthesizedExpression ::=
/// '(' [Expression] ')'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ParenthesizedExpression implements Expression {
/// Return the expression within the parentheses.
Expression get expression;
/// Set the expression within the parentheses to the given [expression].
void set expression(Expression expression);
/// Return the left parenthesis.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the right parenthesis.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
}
/// A part directive.
///
/// partDirective ::=
/// [Annotation] 'part' [StringLiteral] ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class PartDirective implements UriBasedDirective {
/// Return the token representing the 'part' keyword.
Token get partKeyword;
/// Set the token representing the 'part' keyword to the given [token].
void set partKeyword(Token token);
/// Return the semicolon terminating the directive.
Token get semicolon;
/// Set the semicolon terminating the directive to the given [token].
void set semicolon(Token token);
}
/// A part-of directive.
///
/// partOfDirective ::=
/// [Annotation] 'part' 'of' [Identifier] ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class PartOfDirective implements Directive {
/// Return the name of the library that the containing compilation unit is
/// part of.
LibraryIdentifier get libraryName;
/// Set the name of the library that the containing compilation unit is part
/// of to the given [libraryName].
void set libraryName(LibraryIdentifier libraryName);
/// Return the token representing the 'of' keyword.
Token get ofKeyword;
/// Set the token representing the 'of' keyword to the given [token].
void set ofKeyword(Token token);
/// Return the token representing the 'part' keyword.
Token get partKeyword;
/// Set the token representing the 'part' keyword to the given [token].
void set partKeyword(Token token);
/// Return the semicolon terminating the directive.
Token get semicolon;
/// Set the semicolon terminating the directive to the given [token].
void set semicolon(Token token);
/// Return the URI of the library that the containing compilation unit is part
/// of, or `null` if no URI was given (typically because a library name was
/// provided).
StringLiteral get uri;
/// Return the URI of the library that the containing compilation unit is part
/// of, or `null` if no URI was given (typically because a library name was
/// provided).
void set uri(StringLiteral uri);
}
/// A postfix unary expression.
///
/// postfixExpression ::=
/// [Expression] [Token]
///
/// Clients may not extend, implement or mix-in this class.
abstract class PostfixExpression
implements Expression, MethodReferenceExpression {
/// Return the expression computing the operand for the operator.
Expression get operand;
/// Set the expression computing the operand for the operator to the given
/// [expression].
void set operand(Expression expression);
/// Return the postfix operator being applied to the operand.
Token get operator;
/// Set the postfix operator being applied to the operand to the given
/// [token].
void set operator(Token token);
}
/// An identifier that is prefixed or an access to an object property where the
/// target of the property access is a simple identifier.
///
/// prefixedIdentifier ::=
/// [SimpleIdentifier] '.' [SimpleIdentifier]
///
/// Clients may not extend, implement or mix-in this class.
abstract class PrefixedIdentifier implements Identifier {
/// Return the identifier being prefixed.
SimpleIdentifier get identifier;
/// Set the identifier being prefixed to the given [identifier].
void set identifier(SimpleIdentifier identifier);
/// Return `true` if this type is a deferred type. If the AST structure has
/// not been resolved, then return `false`.
///
/// 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
/// </i>p.T</i> where <i>p</i> is a deferred prefix.
bool get isDeferred;
/// Return the period used to separate the prefix from the identifier.
Token get period;
/// Set the period used to separate the prefix from the identifier to the
/// given [token].
void set period(Token token);
/// Return the prefix associated with the library in which the identifier is
/// defined.
SimpleIdentifier get prefix;
/// Set the prefix associated with the library in which the identifier is
/// defined to the given [identifier].
void set prefix(SimpleIdentifier identifier);
}
/// A prefix unary expression.
///
/// prefixExpression ::=
/// [Token] [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class PrefixExpression
implements Expression, MethodReferenceExpression {
/// Return the expression computing the operand for the operator.
Expression get operand;
/// Set the expression computing the operand for the operator to the given
/// [expression].
void set operand(Expression expression);
/// Return the prefix operator being applied to the operand.
Token get operator;
/// Set the prefix operator being applied to the operand to the given [token].
void set operator(Token token);
}
/// The access of a property of an object.
///
/// Note, however, that accesses to properties of objects can also be
/// represented as [PrefixedIdentifier] nodes in cases where the target is also
/// a simple identifier.
///
/// propertyAccess ::=
/// [Expression] '.' [SimpleIdentifier]
///
/// Clients may not extend, implement or mix-in this class.
abstract class PropertyAccess implements Expression {
/// Return `true` if this expression is cascaded. If it is, then the target of
/// this expression is not stored locally but is stored in the nearest
/// ancestor that is a [CascadeExpression].
bool get isCascaded;
/// Whether this property access is null aware (as opposed to non-null).
bool get isNullAware;
/// Return the property access operator.
Token get operator;
/// Set the property access operator to the given [token].
void set operator(Token token);
/// Return the name of the property being accessed.
SimpleIdentifier get propertyName;
/// Set the name of the property being accessed to the given [identifier].
void set propertyName(SimpleIdentifier identifier);
/// Return the expression used to compute the receiver of the invocation. If
/// this invocation is not part of a cascade expression, then this is the same
/// as [target]. If this invocation is part of a cascade expression, then the
/// target stored with the cascade expression is returned.
Expression get realTarget;
/// Return the expression computing the object defining the property being
/// accessed, or `null` if this property access is part of a cascade
/// expression.
///
/// Use [realTarget] to get the target independent of whether this is part of
/// a cascade expression.
Expression get target;
/// Set the expression computing the object defining the property being
/// accessed to the given [expression].
void set target(Expression expression);
}
/// The invocation of a constructor in the same class from within a
/// constructor's initialization list.
///
/// redirectingConstructorInvocation ::=
/// 'this' ('.' identifier)? arguments
///
/// Clients may not extend, implement or mix-in this class.
abstract class RedirectingConstructorInvocation
implements ConstructorInitializer, ConstructorReferenceNode {
/// Return the list of arguments to the constructor.
ArgumentList get argumentList;
/// Set the list of arguments to the constructor to the given [argumentList].
void set argumentList(ArgumentList argumentList);
/// Return the name of the constructor that is being invoked, or `null` if the
/// unnamed constructor is being invoked.
SimpleIdentifier get constructorName;
/// Set the name of the constructor that is being invoked to the given
/// [identifier].
void set constructorName(SimpleIdentifier identifier);
/// Return the token for the period before the name of the constructor that is
/// being invoked, or `null` if the unnamed constructor is being invoked.
Token get period;
/// Set the token for the period before the name of the constructor that is
/// being invoked to the given [token].
void set period(Token token);
/// Return the token for the 'this' keyword.
Token get thisKeyword;
/// Set the token for the 'this' keyword to the given [token].
void set thisKeyword(Token token);
}
/// A rethrow expression.
///
/// rethrowExpression ::=
/// 'rethrow'
///
/// Clients may not extend, implement or mix-in this class.
abstract class RethrowExpression implements Expression {
/// Return the token representing the 'rethrow' keyword.
Token get rethrowKeyword;
/// Set the token representing the 'rethrow' keyword to the given [token].
void set rethrowKeyword(Token token);
}
/// A return statement.
///
/// returnStatement ::=
/// 'return' [Expression]? ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ReturnStatement implements Statement {
/// Return the expression computing the value to be returned, or `null` if no
/// explicit value was provided.
Expression get expression;
/// Set the expression computing the value to be returned to the given
/// [expression].
void set expression(Expression expression);
/// Return the token representing the 'return' keyword.
Token get returnKeyword;
/// Set the token representing the 'return' keyword to the given [token].
void set returnKeyword(Token token);
/// Return the semicolon terminating the statement.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
}
/// A script tag that can optionally occur at the beginning of a compilation
/// unit.
///
/// scriptTag ::=
/// '#!' (~NEWLINE)* NEWLINE
///
/// Clients may not extend, implement or mix-in this class.
abstract class ScriptTag implements AstNode {
/// Return the token representing this script tag.
Token get scriptTag;
/// Set the token representing this script tag to the given [token].
void set scriptTag(Token token);
}
/// A set or map literal.
///
/// setOrMapLiteral ::=
/// 'const'? [TypeArgumentList]? '{' elements? '}'
///
/// elements ::=
/// [CollectionElement] ( ',' [CollectionElement] )* ','?
///
/// This is the class that is used to represent either a map or set literal when
/// either the 'control-flow-collections' or 'spread-collections' experiments
/// are enabled. If neither of those experiments are enabled, then `MapLiteral`
/// will be used to represent a map literal and `SetLiteral` will be used for
/// set literals.
///
/// Clients may not extend, implement or mix-in this class.
abstract class SetOrMapLiteral implements TypedLiteral {
/// Return the syntactic elements used to compute the elements of the set or
/// map.
NodeList<CollectionElement> get elements;
/// Return `true` if this literal represents a map literal.
///
/// This getter will always return `false` if [isSet] returns `true`.
///
/// However, this getter is _not_ the inverse of [isSet]. It is possible for
/// both getters to return `false` if
///
/// - the AST has not been resolved (because determining the kind of the
/// literal is done during resolution),
/// - the literal is ambiguous (contains one or more spread elements and none
/// of those elements can be used to determine the kind of the literal), or
/// - the literal is invalid because it contains both expressions (for sets)
/// and map entries (for maps).
///
/// In both of the latter two cases there will be compilation errors
/// associated with the literal.
bool get isMap;
/// Return `true` if this literal represents a set literal.
///
/// This getter will always return `false` if [isMap] returns `true`.
///
/// However, this getter is _not_ the inverse of [isMap]. It is possible for
/// both getters to return `false` if
///
/// - the AST has not been resolved (because determining the kind of the
/// literal is done during resolution),
/// - the literal is ambiguous (contains one or more spread elements and none
/// of those elements can be used to determine the kind of the literal), or
/// - the literal is invalid because it contains both expressions (for sets)
/// and map entries (for maps).
///
/// In both of the latter two cases there will be compilation errors
/// associated with the literal.
bool get isSet;
/// Return the left curly bracket.
Token get leftBracket;
/// Return the right curly bracket.
Token get rightBracket;
}
/// A combinator that restricts the names being imported to those in a given list.
///
/// showCombinator ::=
/// 'show' [SimpleIdentifier] (',' [SimpleIdentifier])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class ShowCombinator implements Combinator {
/// Return the list of names from the library that are made visible by this
/// combinator.
NodeList<SimpleIdentifier> get shownNames;
}
/// A simple formal parameter.
///
/// simpleFormalParameter ::=
/// ('final' [TypeAnnotation] | 'var' | [TypeAnnotation])? [SimpleIdentifier]
///
/// Clients may not extend, implement or mix-in this class.
abstract class SimpleFormalParameter implements NormalFormalParameter {
/// Return the token representing either the 'final', 'const' or 'var'
/// keyword, or `null` if no keyword was used.
Token get keyword;
/// Set the token representing either the 'final', 'const' or 'var' keyword to
/// the given [token].
void set keyword(Token token);
/// Return the declared type of the parameter, or `null` if the parameter does
/// not have a declared type.
TypeAnnotation get type;
/// Set the declared type of the parameter to the given [type].
void set type(TypeAnnotation type);
}
/// A simple identifier.
///
/// simpleIdentifier ::=
/// initialCharacter internalCharacter*
///
/// initialCharacter ::= '_' | '$' | letter
///
/// internalCharacter ::= '_' | '$' | letter | digit
///
/// Clients may not extend, implement or mix-in this class.
abstract class SimpleIdentifier implements Identifier {
/// Return the auxiliary elements associated with this identifier, or `null`
/// if this identifier is not in both a getter and setter context. The
/// auxiliary elements hold the static and propagated elements associated with
/// the getter context.
// TODO(brianwilkerson) Replace this API.
AuxiliaryElements get auxiliaryElements;
/// Set the auxiliary elements associated with this identifier to the given
/// [elements].
// TODO(brianwilkerson) Replace this API.
void set auxiliaryElements(AuxiliaryElements elements);
/// Return `true` if this identifier is the "name" part of a prefixed
/// identifier or a method invocation.
bool get isQualified;
/// Set the element associated with this identifier based on propagated type
/// information to the given [element].
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElement] instead.
@deprecated
void set propagatedElement(Element element);
/// Set the element associated with this identifier based on static type
/// information to the given [element].
void set staticElement(Element element);
/// If the identifier is a tear-off, return the inferred type arguments
/// applied to the function type of the element to produce its [staticType].
///
/// Return an empty list if the function type does not have type parameters.
///
/// Return an empty list if the context type has type parameters.
///
/// Return `null` if not a tear-off.
///
/// Return `null` if the AST structure has not been resolved.
List<DartType> get tearOffTypeArgumentTypes;
/// Return the token representing the identifier.
Token get token;
/// Set the token representing the identifier to the given [token].
void set token(Token token);
/// Return `true` if this identifier is the name being declared in a
/// declaration.
// TODO(brianwilkerson) Convert this to a getter.
bool inDeclarationContext();
/// Return `true` if this expression is computing a right-hand value.
///
/// Note that [inGetterContext] and [inSetterContext] are not opposites, nor
/// are they mutually exclusive. In other words, it is possible for both
/// methods to return `true` when invoked on the same node.
// TODO(brianwilkerson) Convert this to a getter.
bool inGetterContext();
/// Return `true` if this expression is computing a left-hand value.
///
/// Note that [inGetterContext] and [inSetterContext] are not opposites, nor
/// are they mutually exclusive. In other words, it is possible for both
/// methods to return `true` when invoked on the same node.
// TODO(brianwilkerson) Convert this to a getter.
bool inSetterContext();
}
/// A string literal expression that does not contain any interpolations.
///
/// simpleStringLiteral ::=
/// rawStringLiteral
/// | basicStringLiteral
///
/// rawStringLiteral ::=
/// 'r' basicStringLiteral
///
/// simpleStringLiteral ::=
/// multiLineStringLiteral
/// | singleLineStringLiteral
///
/// multiLineStringLiteral ::=
/// "'''" characters "'''"
/// | '"""' characters '"""'
///
/// singleLineStringLiteral ::=
/// "'" characters "'"
/// | '"' characters '"'
///
/// Clients may not extend, implement or mix-in this class.
abstract class SimpleStringLiteral implements SingleStringLiteral {
/// Return the token representing the literal.
Token get literal;
/// Set the token representing the literal to the given [token].
void set literal(Token token);
/// Return the value of the literal.
String get value;
/// Set the value of the literal to the given [string].
void set value(String string);
}
/// A single string literal expression.
///
/// singleStringLiteral ::=
/// [SimpleStringLiteral]
/// | [StringInterpolation]
///
/// Clients may not extend, implement or mix-in this class.
abstract class SingleStringLiteral implements StringLiteral {
/// Return the offset of the after-last contents character.
int get contentsEnd;
/// Return the offset of the first contents character. If the string is
/// multiline, then leading whitespaces are skipped.
int get contentsOffset;
/// Return `true` if this string literal is a multi-line string.
bool get isMultiline;
/// Return `true` if this string literal is a raw string.
bool get isRaw;
/// Return `true` if this string literal uses single quotes (' or '''), or
/// `false` if this string literal uses double quotes (" or """).
bool get isSingleQuoted;
}
/// A spread element.
///
/// spreadElement:
/// ( '...' | '...?' ) [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class SpreadElement implements CollectionElement {
/// The expression used to compute the collection being spread.
Expression get expression;
/// Whether this is a null-aware spread, as opposed to a non-null spread.
bool get isNullAware;
/// The spread operator, either '...' or '...?'.
Token get spreadOperator;
}
/// A node that represents a statement.
///
/// statement ::=
/// [Block]
/// | [VariableDeclarationStatement]
/// | [ForStatement]
/// | [ForEachStatement]
/// | [WhileStatement]
/// | [DoStatement]
/// | [SwitchStatement]
/// | [IfStatement]
/// | [TryStatement]
/// | [BreakStatement]
/// | [ContinueStatement]
/// | [ReturnStatement]
/// | [ExpressionStatement]
/// | [FunctionDeclarationStatement]
///
/// Clients may not extend, implement or mix-in this class.
abstract class Statement implements AstNode {
/// If this is a labeled statement, return the unlabeled portion of the
/// statement, otherwise return the statement itself.
Statement get unlabeled;
}
/// A string interpolation literal.
///
/// stringInterpolation ::=
/// ''' [InterpolationElement]* '''
/// | '"' [InterpolationElement]* '"'
///
/// Clients may not extend, implement or mix-in this class.
abstract class StringInterpolation implements SingleStringLiteral {
/// Return the elements that will be composed to produce the resulting string.
NodeList<InterpolationElement> get elements;
}
/// A string literal expression.
///
/// stringLiteral ::=
/// [SimpleStringLiteral]
/// | [AdjacentStrings]
/// | [StringInterpolation]
///
/// Clients may not extend, implement or mix-in this class.
abstract class StringLiteral implements Literal {
/// Return the value of the string literal, or `null` if the string is not a
/// constant string without any string interpolation.
String get stringValue;
}
/// The invocation of a superclass' constructor from within a constructor's
/// initialization list.
///
/// superInvocation ::=
/// 'super' ('.' [SimpleIdentifier])? [ArgumentList]
///
/// Clients may not extend, implement or mix-in this class.
abstract class SuperConstructorInvocation
implements ConstructorInitializer, ConstructorReferenceNode {
/// Return the list of arguments to the constructor.
ArgumentList get argumentList;
/// Set the list of arguments to the constructor to the given [argumentList].
void set argumentList(ArgumentList argumentList);
/// Return the name of the constructor that is being invoked, or `null` if the
/// unnamed constructor is being invoked.
SimpleIdentifier get constructorName;
/// Set the name of the constructor that is being invoked to the given
/// [identifier].
void set constructorName(SimpleIdentifier identifier);
/// Return the token for the period before the name of the constructor that is
/// being invoked, or `null` if the unnamed constructor is being invoked.
Token get period;
/// Set the token for the period before the name of the constructor that is
/// being invoked to the given [token].
void set period(Token token);
/// Return the token for the 'super' keyword.
Token get superKeyword;
/// Set the token for the 'super' keyword to the given [token].
void set superKeyword(Token token);
}
/// A super expression.
///
/// superExpression ::=
/// 'super'
///
/// Clients may not extend, implement or mix-in this class.
abstract class SuperExpression implements Expression {
/// Return the token representing the 'super' keyword.
Token get superKeyword;
/// Set the token representing the 'super' keyword to the given [token].
void set superKeyword(Token token);
}
/// A case in a switch statement.
///
/// switchCase ::=
/// [SimpleIdentifier]* 'case' [Expression] ':' [Statement]*
///
/// Clients may not extend, implement or mix-in this class.
abstract class SwitchCase implements SwitchMember {
/// Return the expression controlling whether the statements will be executed.
Expression get expression;
/// Set the expression controlling whether the statements will be executed to
/// the given [expression].
void set expression(Expression expression);
}
/// The default case in a switch statement.
///
/// switchDefault ::=
/// [SimpleIdentifier]* 'default' ':' [Statement]*
///
/// Clients may not extend, implement or mix-in this class.
abstract class SwitchDefault implements SwitchMember {}
/// An element within a switch statement.
///
/// switchMember ::=
/// switchCase
/// | switchDefault
///
/// Clients may not extend, implement or mix-in this class.
abstract class SwitchMember implements AstNode {
/// Return the colon separating the keyword or the expression from the
/// statements.
Token get colon;
/// Set the colon separating the keyword or the expression from the
/// statements to the given [token].
void set colon(Token token);
/// Return the token representing the 'case' or 'default' keyword.
Token get keyword;
/// Set the token representing the 'case' or 'default' keyword to the given
/// [token].
void set keyword(Token token);
/// Return the labels associated with the switch member.
NodeList<Label> get labels;
/// Return the statements that will be executed if this switch member is
/// selected.
NodeList<Statement> get statements;
}
/// A switch statement.
///
/// switchStatement ::=
/// 'switch' '(' [Expression] ')' '{' [SwitchCase]* [SwitchDefault]? '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class SwitchStatement implements Statement {
/// Return the expression used to determine which of the switch members will
/// be selected.
Expression get expression;
/// Set the expression used to determine which of the switch members will be
/// selected to the given [expression].
void set expression(Expression expression);
/// Return the left curly bracket.
Token get leftBracket;
/// Set the left curly bracket to the given [token].
void set leftBracket(Token token);
/// Return the left parenthesis.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the switch members that can be selected by the expression.
NodeList<SwitchMember> get members;
/// Return the right curly bracket.
Token get rightBracket;
/// Set the right curly bracket to the given [token].
void set rightBracket(Token token);
/// Return the right parenthesis.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
/// Return the token representing the 'switch' keyword.
Token get switchKeyword;
/// Set the token representing the 'switch' keyword to the given [token].
void set switchKeyword(Token token);
}
/// A symbol literal expression.
///
/// symbolLiteral ::=
/// '#' (operator | (identifier ('.' identifier)*))
///
/// Clients may not extend, implement or mix-in this class.
abstract class SymbolLiteral implements Literal {
/// Return the components of the literal.
List<Token> get components;
/// Return the token introducing the literal.
Token get poundSign;
/// Set the token introducing the literal to the given [token].
void set poundSign(Token token);
}
/// A this expression.
///
/// thisExpression ::=
/// 'this'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ThisExpression implements Expression {
/// Return the token representing the 'this' keyword.
Token get thisKeyword;
/// Set the token representing the 'this' keyword to the given [token].
void set thisKeyword(Token token);
}
/// A throw expression.
///
/// throwExpression ::=
/// 'throw' [Expression]
///
/// Clients may not extend, implement or mix-in this class.
abstract class ThrowExpression implements Expression {
/// Return the expression computing the exception to be thrown.
Expression get expression;
/// Set the expression computing the exception to be thrown to the given
/// [expression].
void set expression(Expression expression);
/// Return the token representing the 'throw' keyword.
Token get throwKeyword;
/// Set the token representing the 'throw' keyword to the given [token].
void set throwKeyword(Token token);
}
/// The declaration of one or more top-level variables of the same type.
///
/// topLevelVariableDeclaration ::=
/// ('final' | 'const') type? staticFinalDeclarationList ';'
/// | variableDeclaration ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class TopLevelVariableDeclaration implements CompilationUnitMember {
/// Return the semicolon terminating the declaration.
Token get semicolon;
/// Set the semicolon terminating the declaration to the given [token].
void set semicolon(Token token);
/// Return the top-level variables being declared.
VariableDeclarationList get variables;
/// Set the top-level variables being declared to the given list of
/// [variables].
void set variables(VariableDeclarationList variables);
}
/// A try statement.
///
/// tryStatement ::=
/// 'try' [Block] ([CatchClause]+ finallyClause? | finallyClause)
///
/// finallyClause ::=
/// 'finally' [Block]
///
/// Clients may not extend, implement or mix-in this class.
abstract class TryStatement implements Statement {
/// Return the body of the statement.
Block get body;
/// Set the body of the statement to the given [block].
void set body(Block block);
/// Return the catch clauses contained in the try statement.
NodeList<CatchClause> get catchClauses;
/// Return the finally block contained in the try statement, or `null` if the
/// statement does not contain a finally clause.
Block get finallyBlock;
/// Set the finally block contained in the try statement to the given [block].
void set finallyBlock(Block block);
/// Return the token representing the 'finally' keyword, or `null` if the
/// statement does not contain a finally clause.
Token get finallyKeyword;
/// Set the token representing the 'finally' keyword to the given [token].
void set finallyKeyword(Token token);
/// Return the token representing the 'try' keyword.
Token get tryKeyword;
/// Set the token representing the 'try' keyword to the given [token].
void set tryKeyword(Token token);
}
/// The declaration of a type alias.
///
/// typeAlias ::=
/// 'typedef' typeAliasBody
///
/// typeAliasBody ::=
/// classTypeAlias
/// | functionTypeAlias
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeAlias implements NamedCompilationUnitMember {
/// Return the semicolon terminating the declaration.
Token get semicolon;
/// Set the semicolon terminating the declaration to the given [token].
void set semicolon(Token token);
/// Return the token representing the 'typedef' keyword.
Token get typedefKeyword;
/// Set the token representing the 'typedef' keyword to the given [token].
void set typedefKeyword(Token token);
}
/// A type annotation.
///
/// type ::=
/// [NamedType]
/// | [GenericFunctionType]
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeAnnotation implements AstNode {
/// The question mark indicating that the type is nullable, or `null` if there
/// is no question mark.
Token get question;
/// Return the type being named, or `null` if the AST structure has not been
/// resolved.
DartType get type;
}
/// A list of type arguments.
///
/// typeArguments ::=
/// '<' typeName (',' typeName)* '>'
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeArgumentList implements AstNode {
/// Return the type arguments associated with the type.
NodeList<TypeAnnotation> get arguments;
/// Return the left bracket.
Token get leftBracket;
/// Set the left bracket to the given [token].
void set leftBracket(Token token);
/// Return the right bracket.
Token get rightBracket;
/// Set the right bracket to the given [token].
void set rightBracket(Token token);
}
/// A literal that has a type associated with it.
///
/// typedLiteral ::=
/// [ListLiteral]
/// | [SetOrMapLiteral]
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypedLiteral implements Literal {
/// Return the token representing the 'const' keyword, or `null` if the
/// literal is not a constant.
Token get constKeyword;
/// Set the token representing the 'const' keyword to the given [token].
void set constKeyword(Token token);
/// Return `true` if this literal is a constant expression, either because the
/// keyword `const` was explicitly provided or because no keyword was provided
/// and this expression is in a constant context.
bool get isConst;
/// Return the type argument associated with this literal, or `null` if no
/// type arguments were declared.
TypeArgumentList get typeArguments;
/// Set the type argument associated with this literal to the given
/// [typeArguments].
void set typeArguments(TypeArgumentList typeArguments);
}
/// The name of a type, which can optionally include type arguments.
///
/// typeName ::=
/// [Identifier] typeArguments?
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeName implements NamedType {}
/// A type parameter.
///
/// typeParameter ::=
/// [SimpleIdentifier] ('extends' [TypeAnnotation])?
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeParameter implements Declaration {
/// Return the upper bound for legal arguments, or `null` if there is no
/// explicit upper bound.
TypeAnnotation get bound;
/// Set the upper bound for legal arguments to the given [type].
void set bound(TypeAnnotation type);
@override
TypeParameterElement get declaredElement;
/// Return the token representing the 'extends' keyword, or `null` if there is
/// no explicit upper bound.
Token get extendsKeyword;
/// Set the token representing the 'extends' keyword to the given [token].
void set extendsKeyword(Token token);
/// Return the name of the type parameter.
SimpleIdentifier get name;
/// Set the name of the type parameter to the given [identifier].
void set name(SimpleIdentifier identifier);
}
/// Type parameters within a declaration.
///
/// typeParameterList ::=
/// '<' [TypeParameter] (',' [TypeParameter])* '>'
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeParameterList implements AstNode {
/// Return the left angle bracket.
Token get leftBracket;
/// Return the right angle bracket.
Token get rightBracket;
/// Return the type parameters for the type.
NodeList<TypeParameter> get typeParameters;
}
/// A directive that references a URI.
///
/// uriBasedDirective ::=
/// [ExportDirective]
/// | [ImportDirective]
/// | [PartDirective]
///
/// Clients may not extend, implement or mix-in this class.
abstract class UriBasedDirective implements Directive {
/// Return the source to which the URI was resolved.
@deprecated
Source get source;
/// Set the source to which the URI was resolved to the given [source].
@deprecated
void set source(Source source);
/// Return the URI referenced by this directive.
StringLiteral get uri;
/// Set the URI referenced by this directive to the given [uri].
void set uri(StringLiteral uri);
/// Return the content of the [uri].
String get uriContent;
/// Set the content of the [uri] to the given [content].
void set uriContent(String content);
/// Return the element associated with the [uri] of this directive, or `null`
/// if the AST structure has not been resolved or if the URI could not be
/// resolved. Examples of the latter case include a directive that contains an
/// invalid URL or a URL that does not exist.
Element get uriElement;
/// Return the source to which the [uri] was resolved.
Source get uriSource;
/// Set the source to which the [uri] was resolved to the given [source].
void set uriSource(Source source);
}
/// An identifier that has an initial value associated with it. Instances of
/// this class are always children of the class [VariableDeclarationList].
///
/// variableDeclaration ::=
/// [SimpleIdentifier] ('=' [Expression])?
///
/// TODO(paulberry): the grammar does not allow metadata to be associated with
/// a VariableDeclaration, and currently we don't record comments for it either.
/// Consider changing the class hierarchy so that [VariableDeclaration] does not
/// extend [Declaration].
///
/// Clients may not extend, implement or mix-in this class.
abstract class VariableDeclaration implements Declaration {
@override
VariableElement get declaredElement;
@deprecated
@override
VariableElement get element;
/// Return the equal sign separating the variable name from the initial value,
/// or `null` if the initial value was not specified.
Token get equals;
/// Set the equal sign separating the variable name from the initial value to
/// the given [token].
void set equals(Token token);
/// Return the expression used to compute the initial value for the variable,
/// or `null` if the initial value was not specified.
Expression get initializer;
/// Set the expression used to compute the initial value for the variable to
/// the given [expression].
void set initializer(Expression expression);
/// Return `true` if this variable was declared with the 'const' modifier.
bool get isConst;
/// Return `true` if this variable was declared with the 'final' modifier.
/// Variables that are declared with the 'const' modifier will return `false`
/// even though they are implicitly final.
bool get isFinal;
/// Return `true` if this variable was declared with the 'late' modifier.
bool get isLate;
/// Return the name of the variable being declared.
SimpleIdentifier get name;
/// Set the name of the variable being declared to the given [identifier].
void set name(SimpleIdentifier identifier);
}
/// The declaration of one or more variables of the same type.
///
/// variableDeclarationList ::=
/// finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])*
///
/// finalConstVarOrType ::=
/// 'final' 'late'? [TypeAnnotation]?
/// | 'const' [TypeAnnotation]?
/// | 'var'
/// | 'late'? [TypeAnnotation]
///
/// Clients may not extend, implement or mix-in this class.
abstract class VariableDeclarationList implements AnnotatedNode {
/// Return `true` if the variables in this list were declared with the 'const'
/// modifier.
bool get isConst;
/// Return `true` if the variables in this list were declared with the 'final'
/// modifier. Variables that are declared with the 'const' modifier will
/// return `false` even though they are implicitly final. (In other words,
/// this is a syntactic check rather than a semantic check.)
bool get isFinal;
/// Return `true` if the variables in this list were declared with the 'late'
/// modifier.
bool get isLate;
/// Return the token representing the 'final', 'const' or 'var' keyword, or
/// `null` if no keyword was included.
Token get keyword;
/// Set the token representing the 'final', 'const' or 'var' keyword to the
/// given [token].
void set keyword(Token token);
/// Return the token representing the 'late' keyword, or `null` if the late
/// modifier was not included.
Token get lateKeyword;
/// Return the type of the variables being declared, or `null` if no type was
/// provided.
TypeAnnotation get type;
/// Set the type of the variables being declared to the given [type].
void set type(TypeAnnotation type);
/// Return a list containing the individual variables being declared.
NodeList<VariableDeclaration> get variables;
}
/// A list of variables that are being declared in a context where a statement
/// is required.
///
/// variableDeclarationStatement ::=
/// [VariableDeclarationList] ';'
///
/// Clients may not extend, implement or mix-in this class.
abstract class VariableDeclarationStatement implements Statement {
/// Return the semicolon terminating the statement.
Token get semicolon;
/// Set the semicolon terminating the statement to the given [token].
void set semicolon(Token token);
/// Return the variables being declared.
VariableDeclarationList get variables;
/// Set the variables being declared to the given list of [variables].
void set variables(VariableDeclarationList variables);
}
/// A while statement.
///
/// whileStatement ::=
/// 'while' '(' [Expression] ')' [Statement]
///
/// Clients may not extend, implement or mix-in this class.
abstract class WhileStatement implements Statement {
/// Return the body of the loop.
Statement get body;
/// Set the body of the loop to the given [statement].
void set body(Statement statement);
/// Return the expression used to determine whether to execute the body of the
/// loop.
Expression get condition;
/// Set the expression used to determine whether to execute the body of the
/// loop to the given [expression].
void set condition(Expression expression);
/// Return the left parenthesis.
Token get leftParenthesis;
/// Set the left parenthesis to the given [token].
void set leftParenthesis(Token token);
/// Return the right parenthesis.
Token get rightParenthesis;
/// Set the right parenthesis to the given [token].
void set rightParenthesis(Token token);
/// Return the token representing the 'while' keyword.
Token get whileKeyword;
/// Set the token representing the 'while' keyword to the given [token].
void set whileKeyword(Token token);
}
/// The with clause in a class declaration.
///
/// withClause ::=
/// 'with' [TypeName] (',' [TypeName])*
///
/// Clients may not extend, implement or mix-in this class.
abstract class WithClause implements AstNode {
/// Return the names of the mixins that were specified.
NodeList<TypeName> get mixinTypes;
/// Return the token representing the 'with' keyword.
Token get withKeyword;
/// Set the token representing the 'with' keyword to the given [token].
void set withKeyword(Token token);
}
/// A yield statement.
///
/// yieldStatement ::=
/// 'yield' '*'? [Expression] ‘;’
///
/// Clients may not extend, implement or mix-in this class.
abstract class YieldStatement implements Statement {
/// Return the expression whose value will be yielded.
Expression get expression;
/// Set the expression whose value will be yielded to the given [expression].
void set expression(Expression expression);
/// Return the semicolon following the expression.
Token get semicolon;
/// Return the semicolon following the expression to the given [token].
void set semicolon(Token token);
/// Return the star optionally following the 'yield' keyword.
Token get star;
/// Return the star optionally following the 'yield' keyword to the given
/// [token].
void set star(Token token);
/// Return the 'yield' keyword.
Token get yieldKeyword;
/// Return the 'yield' keyword to the given [token].
void set yieldKeyword(Token token);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/resolution_map.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
/// A collection of methods which may be used to map from nodes in a resolved
/// AST to elements and types in the element model.
///
/// Clients should not extend, implement or mix-in this class.
// TODO(brianwilkerson) This was added for unifying with the front_end, and is
// no longer needed. It should be removed.
abstract class ResolutionMap {
/// Return the best element available for the function being invoked at
/// [node]. If resolution was able to find a better element based on type
/// propagation, that element will be returned. Otherwise, the element found
/// using the result of static analysis will be returned. If resolution has
/// not been performed, then `null` will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElementForFunctionExpressionInvocation] instead.
@deprecated
ExecutableElement bestElementForFunctionExpressionInvocation(
FunctionExpressionInvocation node);
/// Return the best element available for the identifier [node]. If resolution
/// was able to find a better element based on type propagation, that element
/// will be returned. Otherwise, the element found using the result of static
/// analysis will be returned. If resolution has not been performed, then
/// `null` will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElementForIdentifier] instead.
@deprecated
Element bestElementForIdentifier(Identifier node);
/// Return the best element available for the expression [node]. If resolution
/// was able to find a better element based on type propagation, that element
/// will be returned. Otherwise, the element found using the result of static
/// analysis will be returned. If resolution has not been performed, then
/// `null` will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElementForMethodReference] instead.
@deprecated
MethodElement bestElementForMethodReference(MethodReferenceExpression node);
/// Return the best parameter element information available for the expression
/// [node]. If type propagation was able to find a better parameter element
/// than static analysis, that type will be returned. Otherwise, the result of
/// static analysis will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticParameterElementForExpression] instead.
@deprecated
ParameterElement bestParameterElementForExpression(Expression node);
/// Return the best type information available for the expression [node]. If
/// type propagation was able to find a better type than static analysis, that
/// type will be returned. Otherwise, the result of static analysis will be
/// returned. If no type analysis has been performed, then the type 'dynamic'
/// will be returned.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticTypeForExpression] instead.
@deprecated
DartType bestTypeForExpression(Expression node);
/// Return the element annotation representing the annotation [node] in the
/// element model.
ElementAnnotation elementAnnotationForAnnotation(Annotation node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
ClassElement elementDeclaredByClassDeclaration(ClassDeclaration node);
/// Return the element associated with the compilation unit [node], or `null`
/// if the AST structure has not been resolved.
CompilationUnitElement elementDeclaredByCompilationUnit(CompilationUnit node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
ConstructorElement elementDeclaredByConstructorDeclaration(
ConstructorDeclaration node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
Element elementDeclaredByDeclaration(Declaration node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
LocalVariableElement elementDeclaredByDeclaredIdentifier(
DeclaredIdentifier node);
/// Return the element associated with the directive [node], or `null` if the
/// AST structure has not been resolved or if this directive could not be
/// resolved.
Element elementDeclaredByDirective(Directive node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
ClassElement elementDeclaredByEnumDeclaration(EnumDeclaration node);
/// Return the element representing the parameter [node], or `null` if this
/// parameter has not been resolved.
ParameterElement elementDeclaredByFormalParameter(FormalParameter node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
ExecutableElement elementDeclaredByFunctionDeclaration(
FunctionDeclaration node);
/// Return the element associated with the function expression [node], or
/// `null` if the AST structure has not been resolved.
ExecutableElement elementDeclaredByFunctionExpression(
FunctionExpression node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
ExecutableElement elementDeclaredByMethodDeclaration(MethodDeclaration node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
ClassElement elementDeclaredByMixinDeclaration(MixinDeclaration node);
/// Return the element associated with the declaration [node], or `null` if
/// either this node corresponds to a list of declarations or if the AST
/// structure has not been resolved.
VariableElement elementDeclaredByVariableDeclaration(
VariableDeclaration node);
/// Return the element associated with the annotation [node], or `null` if the
/// AST structure has not been resolved or if this annotation could not be
/// resolved.
Element elementForAnnotation(Annotation node);
/// Return the element representing the parameter being named by the
/// expression [node], or `null` if the AST structure has not been resolved or
/// if there is no parameter with the same name as this expression.
ParameterElement elementForNamedExpression(NamedExpression node);
/// Return a list containing the elements representing the parameters in the
/// list [node]. The list will contain `null`s if the parameters in this list
/// have not been resolved.
List<ParameterElement> parameterElementsForFormalParameterList(
FormalParameterList node);
/// Return the element associated with the function being invoked at [node]
/// based on propagated type information, or `null` if the AST structure has
/// not been resolved or the function could not be resolved.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElementForFunctionExpressionInvocation] instead.
@deprecated
ExecutableElement propagatedElementForFunctionExpressionInvocation(
FunctionExpressionInvocation node);
/// Return the element associated with the identifier [node] based on
/// propagated type information, or `null` if the AST structure has not been
/// resolved or if this identifier could not be resolved. One example of the
/// latter case is an identifier that is not defined within the scope in which
/// it appears.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElementForIdentifier] instead.
@deprecated
Element propagatedElementForIdentifier(Identifier node);
/// Return the element associated with the expression [node] based on
/// propagated types, or `null` if the AST structure has not been resolved, or
/// there is no meaningful propagated element to return (e.g. because this is
/// a non-compound assignment expression, or because the method referred to
/// could not be resolved).
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticElementForMethodReference] instead.
@deprecated
MethodElement propagatedElementForMethodReference(
MethodReferenceExpression node);
/// If the expression [node] is an argument to an invocation, and the AST
/// structure has been resolved, and the function being invoked is known based
/// on propagated type information, and [node] corresponds to one of the
/// parameters of the function being invoked, then return the parameter
/// element representing the parameter to which the value of [node] will be
/// bound. Otherwise, return `null`.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticParameterElementForExpression] instead.
@deprecated
ParameterElement propagatedParameterElementForExpression(Expression node);
/// Return the propagated type of the expression [node], or `null` if type
/// propagation has not been performed on the AST structure.
///
/// Deprecated: The analyzer no longer computes propagated type information.
/// Use [staticTypeForExpression] instead.
@deprecated
DartType propagatedTypeForExpression(Expression node);
/// Return the element associated with the constructor referenced by [node]
/// based on static type information, or `null` if the AST structure has not
/// been resolved or if the constructor could not be resolved.
ConstructorElement staticElementForConstructorReference(
ConstructorReferenceNode node);
/// Return the element associated with the function being invoked at [node]
/// based on static type information, or `null` if the AST structure has not
/// been resolved or the function could not be resolved.
ExecutableElement staticElementForFunctionExpressionInvocation(
FunctionExpressionInvocation node);
/// Return the element associated with the identifier [node] based on static
/// type information, or `null` if the AST structure has not been resolved or
/// if this identifier could not be resolved. One example of the latter case
/// is an identifier that is not defined within the scope in which it appears.
Element staticElementForIdentifier(Identifier node);
/// Return the element associated with the expression [node] based on the
/// static types, or `null` if the AST structure has not been resolved, or
/// there is no meaningful static element to return (e.g. because this is a
/// non-compound assignment expression, or because the method referred to
/// could not be resolved).
MethodElement staticElementForMethodReference(MethodReferenceExpression node);
/// Return the function type of the invocation [node] based on the static type
/// information, or `null` if the AST structure has not been resolved, or if
/// the invoke could not be resolved.
///
/// This will usually be a [FunctionType], but it can also be an
/// [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
/// interface type that implements `Function`.
DartType staticInvokeTypeForInvocationExpression(InvocationExpression node);
/// If the expression [node] is an argument to an invocation, and the AST
/// structure has been resolved, and the function being invoked is known based
/// on static type information, and [node] corresponds to one of the
/// parameters of the function being invoked, then return the parameter
/// element representing the parameter to which the value of [node] will be
/// bound. Otherwise, return `null`.
ParameterElement staticParameterElementForExpression(Expression node);
/// Return the static type of the expression [node], or `null` if the AST
/// structure has not been resolved.
DartType staticTypeForExpression(Expression node);
/// Return the type being named by [node], or `null` if the AST structure has
/// not been resolved.
DartType typeForTypeName(TypeAnnotation node);
/// Return the element associated with the uri of the directive [node], or
/// `null` if the AST structure has not been resolved or if the URI could not
/// be resolved. Examples of the latter case include a directive that contains
/// an invalid URL or a URL that does not exist.
Element uriElementForDirective(UriBasedDirective node);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/syntactic_entity.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
export 'package:front_end/src/base/syntactic_entity.dart' show SyntacticEntity;
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/standard_ast_factory.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast_factory.dart';
import 'package:analyzer/src/dart/ast/ast_factory.dart';
/// Gets an instance of [AstFactory] based on the standard AST implementation.
final AstFactory astFactory = new AstFactoryImpl();
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/precedence.dart | // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:front_end/src/scanner/token.dart';
/// Opaque representation of Dart expression precedence.
///
/// [Expression] classes return an instance of this class to represent a
/// particular row in the Dart expression precedence table. This allows clients
/// to determine when parentheses are needed (by comparing precedence values),
/// but ensures that the client does not become dependent on the particular
/// integers used by the analyzer to represent table rows, since we may need to
/// change these integers from time to time to accommodate new language
/// features.
class Precedence {
static const Precedence none = Precedence._(NO_PRECEDENCE);
static const Precedence assignment = Precedence._(ASSIGNMENT_PRECEDENCE);
static const Precedence cascade = Precedence._(CASCADE_PRECEDENCE);
static const Precedence conditional = Precedence._(CONDITIONAL_PRECEDENCE);
static const Precedence ifNull = Precedence._(IF_NULL_PRECEDENCE);
static const Precedence logicalOr = Precedence._(LOGICAL_OR_PRECEDENCE);
static const Precedence logicalAnd = Precedence._(LOGICAL_AND_PRECEDENCE);
static const Precedence equality = Precedence._(EQUALITY_PRECEDENCE);
static const Precedence relational = Precedence._(RELATIONAL_PRECEDENCE);
static const Precedence bitwiseOr = Precedence._(BITWISE_OR_PRECEDENCE);
static const Precedence bitwiseXor = Precedence._(BITWISE_XOR_PRECEDENCE);
static const Precedence bitwiseAnd = Precedence._(BITWISE_AND_PRECEDENCE);
static const Precedence shift = Precedence._(SHIFT_PRECEDENCE);
static const Precedence additive = Precedence._(ADDITIVE_PRECEDENCE);
static const Precedence multiplicative =
Precedence._(MULTIPLICATIVE_PRECEDENCE);
static const Precedence prefix = Precedence._(PREFIX_PRECEDENCE);
static const Precedence postfix = Precedence._(POSTFIX_PRECEDENCE);
static const Precedence primary = Precedence._(SELECTOR_PRECEDENCE);
final int _index;
/// Constructs the precedence for a unary or binary expression constructed
/// from an operator of the given [type].
Precedence.forTokenType(TokenType type) : this._(type.precedence);
const Precedence._(this._index);
int get hashCode => _index.hashCode;
/// Returns `true` if this precedence represents a looser binding than
/// [other]; that is, parsing ambiguities will be resolved in favor of
/// nesting the expression having precedence [other] within the expression
/// having precedence `this`.
bool operator <(Precedence other) => _index < other._index;
/// Returns `true` if this precedence represents a looser, or equal, binding
/// than [other]; that is, parsing ambiguities will be resolved in favor of
/// nesting the expression having precedence [other] within the expression
/// having precedence `this`, or, if the precedences are equal, parsing
/// ambiguities will be resolved according to the associativity of the
/// expression precedence.
bool operator <=(Precedence other) => _index <= other._index;
@override
bool operator ==(Object other) =>
other is Precedence && _index == other._index;
/// Returns `true` if this precedence represents a tighter binding than
/// [other]; that is, parsing ambiguities will be resolved in favor of
/// nesting the expression having precedence `this` within the expression
/// having precedence [other].
bool operator >(Precedence other) => _index > other._index;
/// Returns `true` if this precedence represents a tighter, or equal, binding
/// than [other]; that is, parsing ambiguities will be resolved in favor of
/// nesting the expression having precedence `this` within the expression
/// having precedence [other], or, if the precedences are equal, parsing
/// ambiguities will be resolved according to the associativity of the
/// expression precedence.
bool operator >=(Precedence other) => _index >= other._index;
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/ast_factory.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:front_end/src/scanner/token.dart';
import 'package:meta/meta.dart';
/// A collection of factory methods which may be used to create concrete
/// instances of the interfaces that constitute the AST.
///
/// Clients should not extend, implement or mix-in this class.
abstract class AstFactory {
/// Returns a newly created list of adjacent strings. To be syntactically
/// valid, the list of [strings] must contain at least two elements.
AdjacentStrings adjacentStrings(List<StringLiteral> strings);
/// Returns a newly created annotation. Both the [period] and the
/// [constructorName] can be `null` if the annotation is not referencing a
/// named constructor. The [arguments] can be `null` if the annotation is not
/// referencing a constructor.
Annotation annotation(Token atSign, Identifier name, Token period,
SimpleIdentifier constructorName, ArgumentList arguments);
/// Returns a newly created list of arguments. The list of [arguments] can
/// be `null` if there are no arguments.
ArgumentList argumentList(Token leftParenthesis, List<Expression> arguments,
Token rightParenthesis);
/// Returns a newly created as expression.
AsExpression asExpression(
Expression expression, Token asOperator, TypeAnnotation type);
/// Returns a newly created assert initializer. The [comma] and [message]
/// can be `null` if there is no message.
AssertInitializer assertInitializer(
Token assertKeyword,
Token leftParenthesis,
Expression condition,
Token comma,
Expression message,
Token rightParenthesis);
/// Returns a newly created assert statement. The [comma] and [message] can
/// be `null` if there is no message.
AssertStatement assertStatement(
Token assertKeyword,
Token leftParenthesis,
Expression condition,
Token comma,
Expression message,
Token rightParenthesis,
Token semicolon);
/// Returns a newly created assignment expression.
AssignmentExpression assignmentExpression(
Expression leftHandSide, Token operator, Expression rightHandSide);
/// Returns a newly created await expression.
AwaitExpression awaitExpression(Token awaitKeyword, Expression expression);
/// Returns a newly created binary expression.
BinaryExpression binaryExpression(
Expression leftOperand, Token operator, Expression rightOperand);
/// Returns a newly created block of code.
Block block(
Token leftBracket, List<Statement> statements, Token rightBracket);
/// Returns a block comment consisting of the given [tokens].
Comment blockComment(List<Token> tokens);
/// Returns a newly created function body consisting of a block of
/// statements. The [keyword] can be `null` if there is no keyword specified
/// for the block. The [star] can be `null` if there is no star following the
/// keyword (and must be `null` if there is no keyword).
BlockFunctionBody blockFunctionBody(Token keyword, Token star, Block block);
/// Returns a newly created boolean literal.
BooleanLiteral booleanLiteral(Token literal, bool value);
/// Returns a newly created break statement. The [label] can be `null` if
/// there is no label associated with the statement.
BreakStatement breakStatement(
Token breakKeyword, SimpleIdentifier label, Token semicolon);
/// Returns a newly created cascade expression. The list of
/// [cascadeSections] must contain at least one element.
CascadeExpression cascadeExpression(
Expression target, List<Expression> cascadeSections);
/// Returns a newly created catch clause. The [onKeyword] and [exceptionType]
/// can be `null` if the clause will catch all exceptions. The [comma] and
/// [stackTraceParameter] can be `null` if the stack trace parameter is not
/// defined.
CatchClause catchClause(
Token onKeyword,
TypeAnnotation exceptionType,
Token catchKeyword,
Token leftParenthesis,
SimpleIdentifier exceptionParameter,
Token comma,
SimpleIdentifier stackTraceParameter,
Token rightParenthesis,
Block body);
/// Returns a newly created class declaration. Either or both of the
/// [comment] and [metadata] can be `null` if the class does not have the
/// corresponding attribute. The [abstractKeyword] can be `null` if the class
/// is not abstract. The [typeParameters] can be `null` if the class does not
/// have any type parameters. Any or all of the [extendsClause], [withClause],
/// and [implementsClause] can be `null` if the class does not have the
/// corresponding clause. The list of [members] can be `null` if the class
/// does not have any members.
ClassDeclaration classDeclaration(
Comment comment,
List<Annotation> metadata,
Token abstractKeyword,
Token classKeyword,
SimpleIdentifier name,
TypeParameterList typeParameters,
ExtendsClause extendsClause,
WithClause withClause,
ImplementsClause implementsClause,
Token leftBracket,
List<ClassMember> members,
Token rightBracket);
/// Returns a newly created class type alias. Either or both of the [comment]
/// and [metadata] can be `null` if the class type alias does not have the
/// corresponding attribute. The [typeParameters] can be `null` if the class
/// does not have any type parameters. The [abstractKeyword] can be `null` if
/// the class is not abstract. The [implementsClause] can be `null` if the
/// class does not implement any interfaces.
ClassTypeAlias classTypeAlias(
Comment comment,
List<Annotation> metadata,
Token keyword,
SimpleIdentifier name,
TypeParameterList typeParameters,
Token equals,
Token abstractKeyword,
TypeName superclass,
WithClause withClause,
ImplementsClause implementsClause,
Token semicolon);
/// Returns a newly created reference to a Dart element. The [newKeyword]
/// can be `null` if the reference is not to a constructor.
CommentReference commentReference(Token newKeyword, Identifier identifier);
/// Returns a newly created compilation unit to have the given directives and
/// declarations. The [scriptTag] can be `null` (or omitted) if there is no
/// script tag in the compilation unit. The list of [declarations] can be
/// `null` (or omitted) if there are no directives in the compilation unit.
/// The list of `declarations` can be `null` (or omitted) if there are no
/// declarations in the compilation unit. The [featureSet] can be `null` if
/// the set of features for this compilation unit is not known (this
/// restricts what analysis can be done of the compilation unit).
CompilationUnit compilationUnit(
{@required Token beginToken,
ScriptTag scriptTag,
List<Directive> directives,
List<CompilationUnitMember> declarations,
@required Token endToken,
@required FeatureSet featureSet});
/// Returns a newly created conditional expression.
ConditionalExpression conditionalExpression(
Expression condition,
Token question,
Expression thenExpression,
Token colon,
Expression elseExpression);
/// Returns a newly created configuration.
Configuration configuration(
Token ifKeyword,
Token leftParenthesis,
DottedName name,
Token equalToken,
StringLiteral value,
Token rightParenthesis,
StringLiteral libraryUri);
/// Returns a newly created constructor declaration. The [externalKeyword]
/// can be `null` if the constructor is not external. Either or both of the
/// [comment] and [metadata] can be `null` if the constructor does not have
/// the corresponding attribute. The [constKeyword] can be `null` if the
/// constructor cannot be used to create a constant. The [factoryKeyword] can
/// be `null` if the constructor is not a factory. The [period] and [name] can
/// both be `null` if the constructor is not a named constructor. The
/// [separator] can be `null` if the constructor does not have any
/// initializers and does not redirect to a different constructor. The list of
/// [initializers] can be `null` if the constructor does not have any
/// initializers. The [redirectedConstructor] can be `null` if the constructor
/// does not redirect to a different constructor. The [body] can be `null` if
/// the constructor does not have a body.
ConstructorDeclaration constructorDeclaration(
Comment comment,
List<Annotation> metadata,
Token externalKeyword,
Token constKeyword,
Token factoryKeyword,
Identifier returnType,
Token period,
SimpleIdentifier name,
FormalParameterList parameters,
Token separator,
List<ConstructorInitializer> initializers,
ConstructorName redirectedConstructor,
FunctionBody body);
/// Returns a newly created field initializer to initialize the field with
/// the given name to the value of the given expression. The [thisKeyword] and
/// [period] can be `null` if the 'this' keyword was not specified.
ConstructorFieldInitializer constructorFieldInitializer(
Token thisKeyword,
Token period,
SimpleIdentifier fieldName,
Token equals,
Expression expression);
/// Returns a newly created constructor name. The [period] and [name] can be
/// `null` if the constructor being named is the unnamed constructor.
ConstructorName constructorName(
TypeName type, Token period, SimpleIdentifier name);
/// Returns a newly created continue statement. The [label] can be `null` if
/// there is no label associated with the statement.
ContinueStatement continueStatement(
Token continueKeyword, SimpleIdentifier label, Token semicolon);
/// Returns a newly created formal parameter. Either or both of the
/// [comment] and [metadata] can be `null` if the declaration does not have
/// the corresponding attribute. The [keyword] can be `null` if a type name is
/// given. The [type] must be `null` if the keyword is 'var'.
DeclaredIdentifier declaredIdentifier(
Comment comment,
List<Annotation> metadata,
Token keyword,
TypeAnnotation type,
SimpleIdentifier identifier);
/// Returns a newly created default formal parameter. The [separator] and
/// [defaultValue] can be `null` if there is no default value.
DefaultFormalParameter defaultFormalParameter(NormalFormalParameter parameter,
ParameterKind kind, Token separator, Expression defaultValue);
/// Returns a documentation comment consisting of the given [tokens] and
/// having the given [references] (if supplied) embedded within it.
Comment documentationComment(List<Token> tokens,
[List<CommentReference> references]);
/// Returns a newly created do loop.
DoStatement doStatement(
Token doKeyword,
Statement body,
Token whileKeyword,
Token leftParenthesis,
Expression condition,
Token rightParenthesis,
Token semicolon);
/// Returns a newly created dotted name.
DottedName dottedName(List<SimpleIdentifier> components);
/// Returns a newly created floating point literal.
DoubleLiteral doubleLiteral(Token literal, double value);
/// Returns a newly created function body.
EmptyFunctionBody emptyFunctionBody(Token semicolon);
/// Returns a newly created empty statement.
EmptyStatement emptyStatement(Token semicolon);
/// Returns an end-of-line comment consisting of the given [tokens].
Comment endOfLineComment(List<Token> tokens);
/// Returns a newly created enum constant declaration. Either or both of the
/// [comment] and [metadata] can be `null` if the constant does not have the
/// corresponding attribute. (Technically, enum constants cannot have
/// metadata, but we allow it for consistency.)
EnumConstantDeclaration enumConstantDeclaration(
Comment comment, List<Annotation> metadata, SimpleIdentifier name);
/// Returns a newly created enumeration declaration. Either or both of the
/// [comment] and [metadata] can be `null` if the declaration does not have
/// the corresponding attribute. The list of [constants] must contain at least
/// one value.
EnumDeclaration enumDeclaration(
Comment comment,
List<Annotation> metadata,
Token enumKeyword,
SimpleIdentifier name,
Token leftBracket,
List<EnumConstantDeclaration> constants,
Token rightBracket);
/// Returns a newly created export directive. Either or both of the
/// [comment] and [metadata] can be `null` if the directive does not have the
/// corresponding attribute. The list of [combinators] can be `null` if there
/// are no combinators.
ExportDirective exportDirective(
Comment comment,
List<Annotation> metadata,
Token keyword,
StringLiteral libraryUri,
List<Configuration> configurations,
List<Combinator> combinators,
Token semicolon);
/// Returns a newly created function body consisting of a block of statements.
/// The [keyword] can be `null` if the function body is not an async function
/// body.
ExpressionFunctionBody expressionFunctionBody(Token keyword,
Token functionDefinition, Expression expression, Token semicolon);
/// Returns a newly created expression statement.
ExpressionStatement expressionStatement(
Expression expression, Token semicolon);
/// Returns a newly created extends clause.
ExtendsClause extendsClause(Token extendsKeyword, TypeName superclass);
/// Return a newly created extension declaration. The list of [typeParameters]
/// can be `null` if there are no type parameters.
ExtensionDeclaration extensionDeclaration(
{Comment comment,
List<Annotation> metadata,
Token extensionKeyword,
@required SimpleIdentifier name,
TypeParameterList typeParameters,
Token onKeyword,
@required TypeAnnotation extendedType,
Token leftBracket,
List<ClassMember> members,
Token rightBracket});
/// Return a newly created extension override. The list of [typeArguments]
/// can be `null` if there are no type arguments.
ExtensionOverride extensionOverride(
{@required Identifier extensionName,
TypeArgumentList typeArguments,
@required ArgumentList argumentList});
/// Returns a newly created field declaration. Either or both of the [comment]
/// and [metadata] can be `null` if the declaration does not have the
/// corresponding attribute. The [staticKeyword] can be `null` if the field is
/// not a static field.
///
/// Use [fieldDeclaration2] instead.
@deprecated
FieldDeclaration fieldDeclaration(Comment comment, List<Annotation> metadata,
Token staticKeyword, VariableDeclarationList fieldList, Token semicolon);
/// Returns a newly created field declaration. Either or both of the
/// [comment] and [metadata] can be `null` if the declaration does not have
/// the corresponding attribute. The [staticKeyword] can be `null` if the
/// field is not a static field.
FieldDeclaration fieldDeclaration2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
Token staticKeyword,
@required VariableDeclarationList fieldList,
@required Token semicolon});
/// Returns a newly created formal parameter. Either or both of the [comment]
/// and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [keyword] can be `null` if there is a type.
/// The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
/// [period] can be `null` if the keyword 'this' was not provided. The
/// [parameters] can be `null` if this is not a function-typed field formal
/// parameter.
///
/// Use [fieldFormalParameter2] instead.
@deprecated
FieldFormalParameter fieldFormalParameter(
Comment comment,
List<Annotation> metadata,
Token keyword,
TypeAnnotation type,
Token thisKeyword,
Token period,
SimpleIdentifier identifier,
TypeParameterList typeParameters,
FormalParameterList parameters);
/// Returns a newly created formal parameter. Either or both of the [comment]
/// and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [keyword] can be `null` if there is a type.
/// The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
/// [period] can be `null` if the keyword 'this' was not provided. The
/// [parameters] can be `null` if this is not a function-typed field formal
/// parameter.
FieldFormalParameter fieldFormalParameter2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
Token requiredKeyword,
Token keyword,
TypeAnnotation type,
@required Token thisKeyword,
@required Token period,
@required SimpleIdentifier identifier,
TypeParameterList typeParameters,
FormalParameterList parameters});
/// Returns a newly created for each part that includes a declaration.
ForEachPartsWithDeclaration forEachPartsWithDeclaration(
{DeclaredIdentifier loopVariable, Token inKeyword, Expression iterable});
/// Returns a newly created for each part that includes an identifier that is
/// declared outside of the loop.
ForEachPartsWithIdentifier forEachPartsWithIdentifier(
{SimpleIdentifier identifier, Token inKeyword, Expression iterable});
/// Returns a newly created for element that can be part of a list, map or set
/// literal.
ForElement forElement(
{Token awaitKeyword,
Token forKeyword,
Token leftParenthesis,
ForLoopParts forLoopParts,
Token rightParenthesis,
CollectionElement body});
/// Returns a newly created parameter list. The list of [parameters] can be
/// `null` if there are no parameters. The [leftDelimiter] and
/// [rightDelimiter] can be `null` if there are no optional parameters.
FormalParameterList formalParameterList(
Token leftParenthesis,
List<FormalParameter> parameters,
Token leftDelimiter,
Token rightDelimiter,
Token rightParenthesis);
/// Returns a newly created for part that includes a declaration.
ForPartsWithDeclarations forPartsWithDeclarations(
{VariableDeclarationList variables,
Token leftSeparator,
Expression condition,
Token rightSeparator,
List<Expression> updaters});
/// Returns a newly created for part that includes an expression.
ForPartsWithExpression forPartsWithExpression(
{Expression initialization,
Token leftSeparator,
Expression condition,
Token rightSeparator,
List<Expression> updaters});
/// Returns a newly created for statement.
ForStatement forStatement(
{Token awaitKeyword,
Token forKeyword,
Token leftParenthesis,
ForLoopParts forLoopParts,
Token rightParenthesis,
Statement body});
/// Returns a newly created function declaration. Either or both of the
/// [comment] and [metadata] can be `null` if the function does not have the
/// corresponding attribute. The [externalKeyword] can be `null` if the
/// function is not an external function. The [returnType] can be `null` if no
/// return type was specified. The [propertyKeyword] can be `null` if the
/// function is neither a getter or a setter.
FunctionDeclaration functionDeclaration(
Comment comment,
List<Annotation> metadata,
Token externalKeyword,
TypeAnnotation returnType,
Token propertyKeyword,
SimpleIdentifier name,
FunctionExpression functionExpression);
/// Returns a newly created function declaration statement.
FunctionDeclarationStatement functionDeclarationStatement(
FunctionDeclaration functionDeclaration);
/// Returns a newly created function declaration.
FunctionExpression functionExpression(TypeParameterList typeParameters,
FormalParameterList parameters, FunctionBody body);
/// Returns a newly created function expression invocation.
FunctionExpressionInvocation functionExpressionInvocation(Expression function,
TypeArgumentList typeArguments, ArgumentList argumentList);
/// Returns a newly created function type alias. Either or both of the
/// [comment] and [metadata] can be `null` if the function does not have the
/// corresponding attribute. The [returnType] can be `null` if no return type
/// was specified. The [typeParameters] can be `null` if the function has no
/// type parameters.
FunctionTypeAlias functionTypeAlias(
Comment comment,
List<Annotation> metadata,
Token keyword,
TypeAnnotation returnType,
SimpleIdentifier name,
TypeParameterList typeParameters,
FormalParameterList parameters,
Token semicolon);
/// Returns a newly created formal parameter. Either or both of the
/// [comment] and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [returnType] can be `null` if no return type
/// was specified.
///
/// Use [functionTypedFormalParameter2] instead.
@deprecated
FunctionTypedFormalParameter functionTypedFormalParameter(
Comment comment,
List<Annotation> metadata,
TypeAnnotation returnType,
SimpleIdentifier identifier,
TypeParameterList typeParameters,
FormalParameterList parameters);
/// Returns a newly created formal parameter. Either or both of the
/// [comment] and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [returnType] can be `null` if no return type
/// was specified.
FunctionTypedFormalParameter functionTypedFormalParameter2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
Token requiredKeyword,
TypeAnnotation returnType,
@required SimpleIdentifier identifier,
TypeParameterList typeParameters,
@required FormalParameterList parameters,
Token question});
/// Initialize a newly created generic function type.
GenericFunctionType genericFunctionType(
TypeAnnotation returnType,
Token functionKeyword,
TypeParameterList typeParameters,
FormalParameterList parameters,
{Token question});
/// Returns a newly created generic type alias. Either or both of the
/// [comment] and [metadata] can be `null` if the variable list does not have
/// the corresponding attribute. The [typeParameters] can be `null` if there
/// are no type parameters.
GenericTypeAlias genericTypeAlias(
Comment comment,
List<Annotation> metadata,
Token typedefKeyword,
SimpleIdentifier name,
TypeParameterList typeParameters,
Token equals,
GenericFunctionType functionType,
Token semicolon);
/// Returns a newly created import show combinator.
HideCombinator hideCombinator(
Token keyword, List<SimpleIdentifier> hiddenNames);
/// Returns a newly created if element that can be part of a list, map or set
/// literal.
IfElement ifElement(
{Token ifKeyword,
Token leftParenthesis,
Expression condition,
Token rightParenthesis,
CollectionElement thenElement,
Token elseKeyword,
CollectionElement elseElement});
/// Returns a newly created if statement. The [elseKeyword] and
/// [elseStatement] can be `null` if there is no else clause.
IfStatement ifStatement(
Token ifKeyword,
Token leftParenthesis,
Expression condition,
Token rightParenthesis,
Statement thenStatement,
Token elseKeyword,
Statement elseStatement);
/// Returns a newly created implements clause.
ImplementsClause implementsClause(
Token implementsKeyword, List<TypeName> interfaces);
/// Returns a newly created import directive. Either or both of the
/// [comment] and [metadata] can be `null` if the function does not have the
/// corresponding attribute. The [deferredKeyword] can be `null` if the import
/// is not deferred. The [asKeyword] and [prefix] can be `null` if the import
/// does not specify a prefix. The list of [combinators] can be `null` if
/// there are no combinators.
ImportDirective importDirective(
Comment comment,
List<Annotation> metadata,
Token keyword,
StringLiteral libraryUri,
List<Configuration> configurations,
Token deferredKeyword,
Token asKeyword,
SimpleIdentifier prefix,
List<Combinator> combinators,
Token semicolon);
/// Returns a newly created index expression.
IndexExpression indexExpressionForCascade(
Token period, Token leftBracket, Expression index, Token rightBracket);
/// Returns a newly created index expression.
IndexExpression indexExpressionForTarget(Expression target, Token leftBracket,
Expression index, Token rightBracket);
/// Returns a newly created instance creation expression.
InstanceCreationExpression instanceCreationExpression(
Token keyword, ConstructorName constructorName, ArgumentList argumentList,
{TypeArgumentList typeArguments});
/// Returns a newly created integer literal.
IntegerLiteral integerLiteral(Token literal, int value);
/// Returns a newly created interpolation expression.
InterpolationExpression interpolationExpression(
Token leftBracket, Expression expression, Token rightBracket);
/// Returns a newly created string of characters that are part of a string
/// interpolation.
InterpolationString interpolationString(Token contents, String value);
/// Returns a newly created is expression. The [notOperator] can be `null`
/// if the sense of the test is not negated.
IsExpression isExpression(Expression expression, Token isOperator,
Token notOperator, TypeAnnotation type);
/// Returns a newly created label.
Label label(SimpleIdentifier label, Token colon);
/// Returns a newly created labeled statement.
LabeledStatement labeledStatement(List<Label> labels, Statement statement);
/// Returns a newly created library directive. Either or both of the
/// [comment] and [metadata] can be `null` if the directive does not have the
/// corresponding attribute.
LibraryDirective libraryDirective(Comment comment, List<Annotation> metadata,
Token libraryKeyword, LibraryIdentifier name, Token semicolon);
/// Returns a newly created prefixed identifier.
LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components);
/// Returns a newly created list literal. The [constKeyword] can be `null`
/// if the literal is not a constant. The [typeArguments] can be `null` if no
/// type arguments were declared. The list of [elements] can be `null` if the
/// list is empty.
ListLiteral listLiteral(Token constKeyword, TypeArgumentList typeArguments,
Token leftBracket, List<CollectionElement> elements, Token rightBracket);
/// Returns a newly created map literal entry.
MapLiteralEntry mapLiteralEntry(
Expression key, Token separator, Expression value);
/// Returns a newly created method declaration. Either or both of the
/// [comment] and [metadata] can be `null` if the declaration does not have
/// the corresponding attribute. The [externalKeyword] can be `null` if the
/// method is not external. The [modifierKeyword] can be `null` if the method
/// is neither abstract nor static. The [returnType] can be `null` if no
/// return type was specified. The [propertyKeyword] can be `null` if the
/// method is neither a getter or a setter. The [operatorKeyword] can be
/// `null` if the method does not implement an operator. The [parameters] must
/// be `null` if this method declares a getter.
MethodDeclaration methodDeclaration(
Comment comment,
List<Annotation> metadata,
Token externalKeyword,
Token modifierKeyword,
TypeAnnotation returnType,
Token propertyKeyword,
Token operatorKeyword,
SimpleIdentifier name,
TypeParameterList typeParameters,
FormalParameterList parameters,
FunctionBody body);
/// Returns a newly created method invocation. The [target] and [operator]
/// can be `null` if there is no target.
MethodInvocation methodInvocation(
Expression target,
Token operator,
SimpleIdentifier methodName,
TypeArgumentList typeArguments,
ArgumentList argumentList);
/// Return a newly created mixin declaration.
MixinDeclaration mixinDeclaration(
Comment comment,
List<Annotation> metadata,
Token mixinKeyword,
SimpleIdentifier name,
TypeParameterList typeParameters,
OnClause onClause,
ImplementsClause implementsClause,
Token leftBracket,
List<ClassMember> members,
Token rightBracket);
/// Returns a newly created named expression.
NamedExpression namedExpression(Label name, Expression expression);
/// Returns a newly created native clause.
NativeClause nativeClause(Token nativeKeyword, StringLiteral name);
/// Returns a newly created function body consisting of the 'native' token,
/// a string literal, and a semicolon.
NativeFunctionBody nativeFunctionBody(
Token nativeKeyword, StringLiteral stringLiteral, Token semicolon);
/// Returns a newly created list of nodes such that all of the nodes that
/// are added to the list will have their parent set to the given [owner]. The
/// list will initially be populated with the given [elements].
NodeList<E> nodeList<E extends AstNode>(AstNode owner, [List<E> elements]);
/// Returns a newly created null literal.
NullLiteral nullLiteral(Token literal);
/// Return a newly created on clause.
OnClause onClause(Token onKeyword, List<TypeName> superclassConstraints);
/// Returns a newly created parenthesized expression.
ParenthesizedExpression parenthesizedExpression(
Token leftParenthesis, Expression expression, Token rightParenthesis);
/// Returns a newly created part directive. Either or both of the [comment]
/// and [metadata] can be `null` if the directive does not have the
/// corresponding attribute.
PartDirective partDirective(Comment comment, List<Annotation> metadata,
Token partKeyword, StringLiteral partUri, Token semicolon);
/// Returns a newly created part-of directive. Either or both of the
/// [comment] and [metadata] can be `null` if the directive does not have the
/// corresponding attribute.
PartOfDirective partOfDirective(
Comment comment,
List<Annotation> metadata,
Token partKeyword,
Token ofKeyword,
StringLiteral uri,
LibraryIdentifier libraryName,
Token semicolon);
/// Returns a newly created postfix expression.
PostfixExpression postfixExpression(Expression operand, Token operator);
/// Returns a newly created prefixed identifier.
PrefixedIdentifier prefixedIdentifier(
SimpleIdentifier prefix, Token period, SimpleIdentifier identifier);
/// Returns a newly created prefix expression.
PrefixExpression prefixExpression(Token operator, Expression operand);
/// Returns a newly created property access expression.
PropertyAccess propertyAccess(
Expression target, Token operator, SimpleIdentifier propertyName);
/// Returns a newly created redirecting invocation to invoke the constructor
/// with the given name with the given arguments. The [constructorName] can be
/// `null` if the constructor being invoked is the unnamed constructor.
RedirectingConstructorInvocation redirectingConstructorInvocation(
Token thisKeyword,
Token period,
SimpleIdentifier constructorName,
ArgumentList argumentList);
/// Returns a newly created rethrow expression.
RethrowExpression rethrowExpression(Token rethrowKeyword);
/// Returns a newly created return statement. The [expression] can be `null`
/// if no explicit value was provided.
ReturnStatement returnStatement(
Token returnKeyword, Expression expression, Token semicolon);
/// Returns a newly created script tag.
ScriptTag scriptTag(Token scriptTag);
/// Returns a newly created set or map literal. The [constKeyword] can be
/// `null` if the literal is not a constant. The [typeArguments] can be `null`
/// if no type arguments were declared. The list of [elements] can be `null`
/// if the set or map is empty.
SetOrMapLiteral setOrMapLiteral(
{Token constKeyword,
TypeArgumentList typeArguments,
Token leftBracket,
List<CollectionElement> elements,
Token rightBracket});
/// Returns a newly created import show combinator.
ShowCombinator showCombinator(
Token keyword, List<SimpleIdentifier> shownNames);
/// Returns a newly created formal parameter. Either or both of the
/// [comment] and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [keyword] can be `null` if a type was
/// specified. The [type] must be `null` if the keyword is 'var'.
///
/// Use [simpleFormalParameter2] instead.
@deprecated
SimpleFormalParameter simpleFormalParameter(
Comment comment,
List<Annotation> metadata,
Token keyword,
TypeAnnotation type,
SimpleIdentifier identifier);
/// Returns a newly created formal parameter. Either or both of the
/// [comment] and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [keyword] can be `null` if a type was
/// specified. The [type] must be `null` if the keyword is 'var'.
SimpleFormalParameter simpleFormalParameter2(
{Comment comment,
List<Annotation> metadata,
Token covariantKeyword,
Token requiredKeyword,
Token keyword,
TypeAnnotation type,
@required SimpleIdentifier identifier});
/// Returns a newly created identifier.
SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false});
/// Returns a newly created simple string literal.
SimpleStringLiteral simpleStringLiteral(Token literal, String value);
/// Returns a newly created spread element.
SpreadElement spreadElement({Token spreadOperator, Expression expression});
/// Returns a newly created string interpolation expression.
StringInterpolation stringInterpolation(List<InterpolationElement> elements);
/// Returns a newly created super invocation to invoke the inherited
/// constructor with the given name with the given arguments. The [period] and
/// [constructorName] can be `null` if the constructor being invoked is the
/// unnamed constructor.
SuperConstructorInvocation superConstructorInvocation(
Token superKeyword,
Token period,
SimpleIdentifier constructorName,
ArgumentList argumentList);
/// Returns a newly created super expression.
SuperExpression superExpression(Token superKeyword);
/// Returns a newly created switch case. The list of [labels] can be `null`
/// if there are no labels.
SwitchCase switchCase(List<Label> labels, Token keyword,
Expression expression, Token colon, List<Statement> statements);
/// Returns a newly created switch default. The list of [labels] can be
/// `null` if there are no labels.
SwitchDefault switchDefault(List<Label> labels, Token keyword, Token colon,
List<Statement> statements);
/// Returns a newly created switch statement. The list of [members] can be
/// `null` if there are no switch members.
SwitchStatement switchStatement(
Token switchKeyword,
Token leftParenthesis,
Expression expression,
Token rightParenthesis,
Token leftBracket,
List<SwitchMember> members,
Token rightBracket);
/// Returns a newly created symbol literal.
SymbolLiteral symbolLiteral(Token poundSign, List<Token> components);
/// Returns a newly created this expression.
ThisExpression thisExpression(Token thisKeyword);
/// Returns a newly created throw expression.
ThrowExpression throwExpression(Token throwKeyword, Expression expression);
/// Returns a newly created top-level variable declaration. Either or both
/// of the [comment] and [metadata] can be `null` if the variable does not
/// have the corresponding attribute.
TopLevelVariableDeclaration topLevelVariableDeclaration(
Comment comment,
List<Annotation> metadata,
VariableDeclarationList variableList,
Token semicolon);
/// Returns a newly created try statement. The list of [catchClauses] can be
/// `null` if there are no catch clauses. The [finallyKeyword] and
/// [finallyBlock] can be `null` if there is no finally clause.
TryStatement tryStatement(Token tryKeyword, Block body,
List<CatchClause> catchClauses, Token finallyKeyword, Block finallyBlock);
/// Returns a newly created list of type arguments.
TypeArgumentList typeArgumentList(
Token leftBracket, List<TypeAnnotation> arguments, Token rightBracket);
/// Returns a newly created type name. The [typeArguments] can be `null` if
/// there are no type arguments. The [question] can be `null` if there is no
/// question mark.
TypeName typeName(Identifier name, TypeArgumentList typeArguments,
{Token question});
/// Returns a newly created type parameter. Either or both of the [comment]
/// and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
/// the parameter does not have an upper bound.
TypeParameter typeParameter(Comment comment, List<Annotation> metadata,
SimpleIdentifier name, Token extendsKeyword, TypeAnnotation bound);
/// Returns a newly created list of type parameters.
TypeParameterList typeParameterList(Token leftBracket,
List<TypeParameter> typeParameters, Token rightBracket);
/// Returns a newly created variable declaration. The [equals] and
/// [initializer] can be `null` if there is no initializer.
VariableDeclaration variableDeclaration(
SimpleIdentifier name, Token equals, Expression initializer);
/// Returns a newly created variable declaration list. Either or both of the
/// [comment] and [metadata] can be `null` if the variable list does not have
/// the corresponding attribute. The [keyword] can be `null` if a type was
/// specified. The [type] must be `null` if the keyword is 'var'.
///
/// Use [variableDeclarationList2] instead.
VariableDeclarationList variableDeclarationList(
Comment comment,
List<Annotation> metadata,
Token keyword,
TypeAnnotation type,
List<VariableDeclaration> variables);
/// Returns a newly created variable declaration list. Either or both of the
/// [comment] and [metadata] can be `null` if the variable list does not have
/// the corresponding attribute. The [keyword] can be `null` if a type was
/// specified. The [type] must be `null` if the keyword is 'var'.
VariableDeclarationList variableDeclarationList2(
{Comment comment,
List<Annotation> metadata,
Token lateKeyword,
Token keyword,
TypeAnnotation type,
List<VariableDeclaration> variables});
/// Returns a newly created variable declaration statement.
VariableDeclarationStatement variableDeclarationStatement(
VariableDeclarationList variableList, Token semicolon);
/// Returns a newly created while statement.
WhileStatement whileStatement(Token whileKeyword, Token leftParenthesis,
Expression condition, Token rightParenthesis, Statement body);
/// Returns a newly created with clause.
WithClause withClause(Token withKeyword, List<TypeName> mixinTypes);
/// Returns a newly created yield expression. The [star] can be `null` if no
/// star was provided.
YieldStatement yieldStatement(
Token yieldKeyword, Token star, Expression expression, Token semicolon);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/token.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Defines the tokens that are produced by the scanner, used by the parser, and
/// referenced from the [AST structure](ast.dart).
export 'package:front_end/src/scanner/token.dart'
show Keyword, Token, TokenType;
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/standard_resolution_map.dart | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/resolution_map.dart';
import 'package:analyzer/src/dart/ast/resolution_map.dart';
/// Gets an instance of [ResolutionMap] based on the standard AST
/// implementation.
final ResolutionMap resolutionMap = new ResolutionMapImpl();
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/ast/visitor.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Defines AST visitors that support useful patterns for visiting the nodes in
/// an [AST structure](ast.dart).
///
/// Dart is an evolving language, and the AST structure must evolved with it.
/// When the AST structure changes, the visitor interface will sometimes change
/// as well. If it is desirable to get a compilation error when the structure of
/// the AST has been modified, then you should consider implementing the
/// interface [AstVisitor] directly. Doing so will ensure that changes that
/// introduce new classes of nodes will be flagged. (Of course, not all changes
/// to the AST structure require the addition of a new class of node, and hence
/// cannot be caught this way.)
///
/// But if automatic detection of these kinds of changes is not necessary then
/// you will probably want to extend one of the classes in this library because
/// doing so will simplify the task of writing your visitor and guard against
/// future changes to the AST structure. For example, the [RecursiveAstVisitor]
/// automates the process of visiting all of the descendants of a node.
import 'dart:collection';
import 'package:analyzer/dart/ast/ast.dart';
/// An AST visitor that will recursively visit all of the nodes in an AST
/// structure, similar to [GeneralizingAstVisitor]. This visitor uses a
/// breadth-first ordering rather than the depth-first ordering of
/// [GeneralizingAstVisitor].
///
/// Subclasses that override a visit method must either invoke the overridden
/// visit method or explicitly invoke the more general visit method. Failure to
/// do so will cause the visit methods for superclasses of the node to not be
/// invoked and will cause the children of the visited node to not be visited.
///
/// In addition, subclasses should <b>not</b> explicitly visit the children of a
/// node, but should ensure that the method [visitNode] is used to visit the
/// children (either directly or indirectly). Failure to do will break the order
/// in which nodes are visited.
///
/// Note that, unlike other visitors that begin to visit a structure of nodes by
/// asking the root node in the structure to accept the visitor, this visitor
/// requires that clients start the visit by invoking the method [visitAllNodes]
/// defined on the visitor with the root node as the argument:
///
/// visitor.visitAllNodes(rootNode);
///
/// Clients may extend this class.
class BreadthFirstVisitor<R> extends GeneralizingAstVisitor<R> {
/// A queue holding the nodes that have not yet been visited in the order in
/// which they ought to be visited.
Queue<AstNode> _queue = new Queue<AstNode>();
/// A visitor, used to visit the children of the current node, that will add
/// the nodes it visits to the [_queue].
_BreadthFirstChildVisitor _childVisitor;
/// Initialize a newly created visitor.
BreadthFirstVisitor() {
_childVisitor = new _BreadthFirstChildVisitor(this);
}
/// Visit all nodes in the tree starting at the given [root] node, in
/// breadth-first order.
void visitAllNodes(AstNode root) {
_queue.add(root);
while (_queue.isNotEmpty) {
AstNode next = _queue.removeFirst();
next.accept(this);
}
}
@override
R visitNode(AstNode node) {
node.visitChildren(_childVisitor);
return null;
}
}
/// An AST visitor that will recursively visit all of the nodes in an AST
/// structure. For each node that is visited, the corresponding visit method on
/// one or more other visitors (the 'delegates') will be invoked.
///
/// For example, if an instance of this class is created with two delegates V1
/// and V2, and that instance is used to visit the expression 'x + 1', then the
/// following visit methods will be invoked:
/// 1. V1.visitBinaryExpression
/// 2. V2.visitBinaryExpression
/// 3. V1.visitSimpleIdentifier
/// 4. V2.visitSimpleIdentifier
/// 5. V1.visitIntegerLiteral
/// 6. V2.visitIntegerLiteral
///
/// Clients may not extend, implement or mix-in this class.
class DelegatingAstVisitor<T> extends UnifyingAstVisitor<T> {
/// The delegates whose visit methods will be invoked.
final Iterable<AstVisitor<T>> delegates;
/// Initialize a newly created visitor to use each of the given delegate
/// visitors to visit the nodes of an AST structure.
DelegatingAstVisitor(this.delegates);
@override
T visitNode(AstNode node) {
delegates.forEach((delegate) {
node.accept(delegate);
});
node.visitChildren(this);
return null;
}
}
/// An AST visitor that will recursively visit all of the nodes in an AST
/// structure (like instances of the class [RecursiveAstVisitor]). In addition,
/// when a node of a specific type is visited not only will the visit method for
/// that specific type of node be invoked, but additional methods for the
/// superclasses of that node will also be invoked. For example, using an
/// instance of this class to visit a [Block] will cause the method [visitBlock]
/// to be invoked but will also cause the methods [visitStatement] and
/// [visitNode] to be subsequently invoked. This allows visitors to be written
/// that visit all statements without needing to override the visit method for
/// each of the specific subclasses of [Statement].
///
/// Subclasses that override a visit method must either invoke the overridden
/// visit method or explicitly invoke the more general visit method. Failure to
/// do so will cause the visit methods for superclasses of the node to not be
/// invoked and will cause the children of the visited node to not be visited.
///
/// Clients may extend this class.
class GeneralizingAstVisitor<R> implements AstVisitor<R> {
@override
R visitAdjacentStrings(AdjacentStrings node) => visitStringLiteral(node);
R visitAnnotatedNode(AnnotatedNode node) => visitNode(node);
@override
R visitAnnotation(Annotation node) => visitNode(node);
@override
R visitArgumentList(ArgumentList node) => visitNode(node);
@override
R visitAsExpression(AsExpression node) => visitExpression(node);
@override
R visitAssertInitializer(AssertInitializer node) => visitNode(node);
@override
R visitAssertStatement(AssertStatement node) => visitStatement(node);
@override
R visitAssignmentExpression(AssignmentExpression node) =>
visitExpression(node);
@override
R visitAwaitExpression(AwaitExpression node) => visitExpression(node);
@override
R visitBinaryExpression(BinaryExpression node) => visitExpression(node);
@override
R visitBlock(Block node) => visitStatement(node);
@override
R visitBlockFunctionBody(BlockFunctionBody node) => visitFunctionBody(node);
@override
R visitBooleanLiteral(BooleanLiteral node) => visitLiteral(node);
@override
R visitBreakStatement(BreakStatement node) => visitStatement(node);
@override
R visitCascadeExpression(CascadeExpression node) => visitExpression(node);
@override
R visitCatchClause(CatchClause node) => visitNode(node);
@override
R visitClassDeclaration(ClassDeclaration node) =>
visitNamedCompilationUnitMember(node);
R visitClassMember(ClassMember node) => visitDeclaration(node);
@override
R visitClassTypeAlias(ClassTypeAlias node) => visitTypeAlias(node);
R visitCollectionElement(CollectionElement node) => visitNode(node);
R visitCombinator(Combinator node) => visitNode(node);
@override
R visitComment(Comment node) => visitNode(node);
@override
R visitCommentReference(CommentReference node) => visitNode(node);
@override
R visitCompilationUnit(CompilationUnit node) => visitNode(node);
R visitCompilationUnitMember(CompilationUnitMember node) =>
visitDeclaration(node);
@override
R visitConditionalExpression(ConditionalExpression node) =>
visitExpression(node);
@override
R visitConfiguration(Configuration node) => visitNode(node);
@override
R visitConstructorDeclaration(ConstructorDeclaration node) =>
visitClassMember(node);
@override
R visitConstructorFieldInitializer(ConstructorFieldInitializer node) =>
visitConstructorInitializer(node);
R visitConstructorInitializer(ConstructorInitializer node) => visitNode(node);
@override
R visitConstructorName(ConstructorName node) => visitNode(node);
@override
R visitContinueStatement(ContinueStatement node) => visitStatement(node);
R visitDeclaration(Declaration node) => visitAnnotatedNode(node);
@override
R visitDeclaredIdentifier(DeclaredIdentifier node) => visitDeclaration(node);
@override
R visitDefaultFormalParameter(DefaultFormalParameter node) =>
visitFormalParameter(node);
R visitDirective(Directive node) => visitAnnotatedNode(node);
@override
R visitDoStatement(DoStatement node) => visitStatement(node);
@override
R visitDottedName(DottedName node) => visitNode(node);
@override
R visitDoubleLiteral(DoubleLiteral node) => visitLiteral(node);
@override
R visitEmptyFunctionBody(EmptyFunctionBody node) => visitFunctionBody(node);
@override
R visitEmptyStatement(EmptyStatement node) => visitStatement(node);
@override
R visitEnumConstantDeclaration(EnumConstantDeclaration node) =>
visitDeclaration(node);
@override
R visitEnumDeclaration(EnumDeclaration node) =>
visitNamedCompilationUnitMember(node);
@override
R visitExportDirective(ExportDirective node) => visitNamespaceDirective(node);
R visitExpression(Expression node) => visitCollectionElement(node);
@override
R visitExpressionFunctionBody(ExpressionFunctionBody node) =>
visitFunctionBody(node);
@override
R visitExpressionStatement(ExpressionStatement node) => visitStatement(node);
@override
R visitExtendsClause(ExtendsClause node) => visitNode(node);
@override
R visitExtensionDeclaration(ExtensionDeclaration node) =>
visitCompilationUnitMember(node);
@override
R visitExtensionOverride(ExtensionOverride node) => visitExpression(node);
@override
R visitFieldDeclaration(FieldDeclaration node) => visitClassMember(node);
@override
R visitFieldFormalParameter(FieldFormalParameter node) =>
visitNormalFormalParameter(node);
R visitForEachParts(ForEachParts node) => visitNode(node);
@override
R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) =>
visitForEachParts(node);
@override
R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) =>
visitForEachParts(node);
@override
R visitForElement(ForElement node) => visitCollectionElement(node);
R visitFormalParameter(FormalParameter node) => visitNode(node);
@override
R visitFormalParameterList(FormalParameterList node) => visitNode(node);
R visitForParts(ForParts node) => visitNode(node);
@override
R visitForPartsWithDeclarations(ForPartsWithDeclarations node) =>
visitForParts(node);
@override
R visitForPartsWithExpression(ForPartsWithExpression node) =>
visitForParts(node);
@override
R visitForStatement(ForStatement node) => visitStatement(node);
R visitFunctionBody(FunctionBody node) => visitNode(node);
@override
R visitFunctionDeclaration(FunctionDeclaration node) =>
visitNamedCompilationUnitMember(node);
@override
R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) =>
visitStatement(node);
@override
R visitFunctionExpression(FunctionExpression node) => visitExpression(node);
@override
R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
visitInvocationExpression(node);
@override
R visitFunctionTypeAlias(FunctionTypeAlias node) => visitTypeAlias(node);
@override
R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) =>
visitNormalFormalParameter(node);
@override
R visitGenericFunctionType(GenericFunctionType node) =>
visitTypeAnnotation(node);
@override
R visitGenericTypeAlias(GenericTypeAlias node) => visitTypeAlias(node);
@override
R visitHideCombinator(HideCombinator node) => visitCombinator(node);
R visitIdentifier(Identifier node) => visitExpression(node);
@override
R visitIfElement(IfElement node) => visitCollectionElement(node);
@override
R visitIfStatement(IfStatement node) => visitStatement(node);
@override
R visitImplementsClause(ImplementsClause node) => visitNode(node);
@override
R visitImportDirective(ImportDirective node) => visitNamespaceDirective(node);
@override
R visitIndexExpression(IndexExpression node) => visitExpression(node);
@override
R visitInstanceCreationExpression(InstanceCreationExpression node) =>
visitExpression(node);
@override
R visitIntegerLiteral(IntegerLiteral node) => visitLiteral(node);
R visitInterpolationElement(InterpolationElement node) => visitNode(node);
@override
R visitInterpolationExpression(InterpolationExpression node) =>
visitInterpolationElement(node);
@override
R visitInterpolationString(InterpolationString node) =>
visitInterpolationElement(node);
R visitInvocationExpression(InvocationExpression node) =>
visitExpression(node);
@override
R visitIsExpression(IsExpression node) => visitExpression(node);
@override
R visitLabel(Label node) => visitNode(node);
@override
R visitLabeledStatement(LabeledStatement node) => visitStatement(node);
@override
R visitLibraryDirective(LibraryDirective node) => visitDirective(node);
@override
R visitLibraryIdentifier(LibraryIdentifier node) => visitIdentifier(node);
@override
R visitListLiteral(ListLiteral node) => visitTypedLiteral(node);
R visitLiteral(Literal node) => visitExpression(node);
@override
R visitMapLiteralEntry(MapLiteralEntry node) => visitCollectionElement(node);
@override
R visitMethodDeclaration(MethodDeclaration node) => visitClassMember(node);
@override
R visitMethodInvocation(MethodInvocation node) =>
visitInvocationExpression(node);
@override
R visitMixinDeclaration(MixinDeclaration node) =>
visitNamedCompilationUnitMember(node);
R visitNamedCompilationUnitMember(NamedCompilationUnitMember node) =>
visitCompilationUnitMember(node);
@override
R visitNamedExpression(NamedExpression node) => visitExpression(node);
R visitNamespaceDirective(NamespaceDirective node) =>
visitUriBasedDirective(node);
@override
R visitNativeClause(NativeClause node) => visitNode(node);
@override
R visitNativeFunctionBody(NativeFunctionBody node) => visitFunctionBody(node);
R visitNode(AstNode node) {
node.visitChildren(this);
return null;
}
R visitNormalFormalParameter(NormalFormalParameter node) =>
visitFormalParameter(node);
@override
R visitNullLiteral(NullLiteral node) => visitLiteral(node);
@override
R visitOnClause(OnClause node) => visitNode(node);
@override
R visitParenthesizedExpression(ParenthesizedExpression node) =>
visitExpression(node);
@override
R visitPartDirective(PartDirective node) => visitUriBasedDirective(node);
@override
R visitPartOfDirective(PartOfDirective node) => visitDirective(node);
@override
R visitPostfixExpression(PostfixExpression node) => visitExpression(node);
@override
R visitPrefixedIdentifier(PrefixedIdentifier node) => visitIdentifier(node);
@override
R visitPrefixExpression(PrefixExpression node) => visitExpression(node);
@override
R visitPropertyAccess(PropertyAccess node) => visitExpression(node);
@override
R visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) =>
visitConstructorInitializer(node);
@override
R visitRethrowExpression(RethrowExpression node) => visitExpression(node);
@override
R visitReturnStatement(ReturnStatement node) => visitStatement(node);
@override
R visitScriptTag(ScriptTag scriptTag) => visitNode(scriptTag);
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) => visitTypedLiteral(node);
@override
R visitShowCombinator(ShowCombinator node) => visitCombinator(node);
@override
R visitSimpleFormalParameter(SimpleFormalParameter node) =>
visitNormalFormalParameter(node);
@override
R visitSimpleIdentifier(SimpleIdentifier node) => visitIdentifier(node);
@override
R visitSimpleStringLiteral(SimpleStringLiteral node) =>
visitSingleStringLiteral(node);
R visitSingleStringLiteral(SingleStringLiteral node) =>
visitStringLiteral(node);
@override
R visitSpreadElement(SpreadElement node) => visitCollectionElement(node);
R visitStatement(Statement node) => visitNode(node);
@override
R visitStringInterpolation(StringInterpolation node) =>
visitSingleStringLiteral(node);
R visitStringLiteral(StringLiteral node) => visitLiteral(node);
@override
R visitSuperConstructorInvocation(SuperConstructorInvocation node) =>
visitConstructorInitializer(node);
@override
R visitSuperExpression(SuperExpression node) => visitExpression(node);
@override
R visitSwitchCase(SwitchCase node) => visitSwitchMember(node);
@override
R visitSwitchDefault(SwitchDefault node) => visitSwitchMember(node);
R visitSwitchMember(SwitchMember node) => visitNode(node);
@override
R visitSwitchStatement(SwitchStatement node) => visitStatement(node);
@override
R visitSymbolLiteral(SymbolLiteral node) => visitLiteral(node);
@override
R visitThisExpression(ThisExpression node) => visitExpression(node);
@override
R visitThrowExpression(ThrowExpression node) => visitExpression(node);
@override
R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) =>
visitCompilationUnitMember(node);
@override
R visitTryStatement(TryStatement node) => visitStatement(node);
R visitTypeAlias(TypeAlias node) => visitNamedCompilationUnitMember(node);
R visitTypeAnnotation(TypeAnnotation node) => visitNode(node);
@override
R visitTypeArgumentList(TypeArgumentList node) => visitNode(node);
R visitTypedLiteral(TypedLiteral node) => visitLiteral(node);
@override
R visitTypeName(TypeName node) => visitNode(node);
@override
R visitTypeParameter(TypeParameter node) => visitNode(node);
@override
R visitTypeParameterList(TypeParameterList node) => visitNode(node);
R visitUriBasedDirective(UriBasedDirective node) => visitDirective(node);
@override
R visitVariableDeclaration(VariableDeclaration node) =>
visitDeclaration(node);
@override
R visitVariableDeclarationList(VariableDeclarationList node) =>
visitNode(node);
@override
R visitVariableDeclarationStatement(VariableDeclarationStatement node) =>
visitStatement(node);
@override
R visitWhileStatement(WhileStatement node) => visitStatement(node);
@override
R visitWithClause(WithClause node) => visitNode(node);
@override
R visitYieldStatement(YieldStatement node) => visitStatement(node);
}
/// An AST visitor that will recursively visit all of the nodes in an AST
/// structure. For example, using an instance of this class to visit a [Block]
/// will also cause all of the statements in the block to be visited.
///
/// Subclasses that override a visit method must either invoke the overridden
/// visit method or must explicitly ask the visited node to visit its children.
/// Failure to do so will cause the children of the visited node to not be
/// visited.
///
/// Clients may extend this class.
class RecursiveAstVisitor<R> implements AstVisitor<R> {
@override
R visitAdjacentStrings(AdjacentStrings node) {
node.visitChildren(this);
return null;
}
@override
R visitAnnotation(Annotation node) {
node.visitChildren(this);
return null;
}
@override
R visitArgumentList(ArgumentList node) {
node.visitChildren(this);
return null;
}
@override
R visitAsExpression(AsExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitAssertInitializer(AssertInitializer node) {
node.visitChildren(this);
return null;
}
@override
R visitAssertStatement(AssertStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitAssignmentExpression(AssignmentExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitAwaitExpression(AwaitExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitBinaryExpression(BinaryExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitBlock(Block node) {
node.visitChildren(this);
return null;
}
@override
R visitBlockFunctionBody(BlockFunctionBody node) {
node.visitChildren(this);
return null;
}
@override
R visitBooleanLiteral(BooleanLiteral node) {
node.visitChildren(this);
return null;
}
@override
R visitBreakStatement(BreakStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitCascadeExpression(CascadeExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitCatchClause(CatchClause node) {
node.visitChildren(this);
return null;
}
@override
R visitClassDeclaration(ClassDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitClassTypeAlias(ClassTypeAlias node) {
node.visitChildren(this);
return null;
}
@override
R visitComment(Comment node) {
node.visitChildren(this);
return null;
}
@override
R visitCommentReference(CommentReference node) {
node.visitChildren(this);
return null;
}
@override
R visitCompilationUnit(CompilationUnit node) {
node.visitChildren(this);
return null;
}
@override
R visitConditionalExpression(ConditionalExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitConfiguration(Configuration node) {
node.visitChildren(this);
return null;
}
@override
R visitConstructorDeclaration(ConstructorDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
node.visitChildren(this);
return null;
}
@override
R visitConstructorName(ConstructorName node) {
node.visitChildren(this);
return null;
}
@override
R visitContinueStatement(ContinueStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitDeclaredIdentifier(DeclaredIdentifier node) {
node.visitChildren(this);
return null;
}
@override
R visitDefaultFormalParameter(DefaultFormalParameter node) {
node.visitChildren(this);
return null;
}
@override
R visitDoStatement(DoStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitDottedName(DottedName node) {
node.visitChildren(this);
return null;
}
@override
R visitDoubleLiteral(DoubleLiteral node) {
node.visitChildren(this);
return null;
}
@override
R visitEmptyFunctionBody(EmptyFunctionBody node) {
node.visitChildren(this);
return null;
}
@override
R visitEmptyStatement(EmptyStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitEnumConstantDeclaration(EnumConstantDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitEnumDeclaration(EnumDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitExportDirective(ExportDirective node) {
node.visitChildren(this);
return null;
}
@override
R visitExpressionFunctionBody(ExpressionFunctionBody node) {
node.visitChildren(this);
return null;
}
@override
R visitExpressionStatement(ExpressionStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitExtendsClause(ExtendsClause node) {
node.visitChildren(this);
return null;
}
@override
R visitExtensionDeclaration(ExtensionDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitExtensionOverride(ExtensionOverride node) {
node.visitChildren(this);
return null;
}
@override
R visitFieldDeclaration(FieldDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitFieldFormalParameter(FieldFormalParameter node) {
node.visitChildren(this);
return null;
}
@override
R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
node.visitChildren(this);
return null;
}
@override
R visitForElement(ForElement node) {
node.visitChildren(this);
return null;
}
@override
R visitFormalParameterList(FormalParameterList node) {
node.visitChildren(this);
return null;
}
@override
R visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
node.visitChildren(this);
return null;
}
@override
R visitForPartsWithExpression(ForPartsWithExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitForStatement(ForStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitFunctionDeclaration(FunctionDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitFunctionExpression(FunctionExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
node.visitChildren(this);
return null;
}
@override
R visitFunctionTypeAlias(FunctionTypeAlias node) {
node.visitChildren(this);
return null;
}
@override
R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
node.visitChildren(this);
return null;
}
@override
R visitGenericFunctionType(GenericFunctionType node) {
node.visitChildren(this);
return null;
}
@override
R visitGenericTypeAlias(GenericTypeAlias node) {
node.visitChildren(this);
return null;
}
@override
R visitHideCombinator(HideCombinator node) {
node.visitChildren(this);
return null;
}
@override
R visitIfElement(IfElement node) {
node.visitChildren(this);
return null;
}
@override
R visitIfStatement(IfStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitImplementsClause(ImplementsClause node) {
node.visitChildren(this);
return null;
}
@override
R visitImportDirective(ImportDirective node) {
node.visitChildren(this);
return null;
}
@override
R visitIndexExpression(IndexExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitInstanceCreationExpression(InstanceCreationExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitIntegerLiteral(IntegerLiteral node) {
node.visitChildren(this);
return null;
}
@override
R visitInterpolationExpression(InterpolationExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitInterpolationString(InterpolationString node) {
node.visitChildren(this);
return null;
}
@override
R visitIsExpression(IsExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitLabel(Label node) {
node.visitChildren(this);
return null;
}
@override
R visitLabeledStatement(LabeledStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitLibraryDirective(LibraryDirective node) {
node.visitChildren(this);
return null;
}
@override
R visitLibraryIdentifier(LibraryIdentifier node) {
node.visitChildren(this);
return null;
}
@override
R visitListLiteral(ListLiteral node) {
node.visitChildren(this);
return null;
}
@override
R visitMapLiteralEntry(MapLiteralEntry node) {
node.visitChildren(this);
return null;
}
@override
R visitMethodDeclaration(MethodDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitMethodInvocation(MethodInvocation node) {
node.visitChildren(this);
return null;
}
@override
R visitMixinDeclaration(MixinDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitNamedExpression(NamedExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitNativeClause(NativeClause node) {
node.visitChildren(this);
return null;
}
@override
R visitNativeFunctionBody(NativeFunctionBody node) {
node.visitChildren(this);
return null;
}
@override
R visitNullLiteral(NullLiteral node) {
node.visitChildren(this);
return null;
}
@override
R visitOnClause(OnClause node) {
node.visitChildren(this);
return null;
}
@override
R visitParenthesizedExpression(ParenthesizedExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitPartDirective(PartDirective node) {
node.visitChildren(this);
return null;
}
@override
R visitPartOfDirective(PartOfDirective node) {
node.visitChildren(this);
return null;
}
@override
R visitPostfixExpression(PostfixExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitPrefixedIdentifier(PrefixedIdentifier node) {
node.visitChildren(this);
return null;
}
@override
R visitPrefixExpression(PrefixExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitPropertyAccess(PropertyAccess node) {
node.visitChildren(this);
return null;
}
@override
R visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) {
node.visitChildren(this);
return null;
}
@override
R visitRethrowExpression(RethrowExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitReturnStatement(ReturnStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitScriptTag(ScriptTag node) {
node.visitChildren(this);
return null;
}
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) {
node.visitChildren(this);
return null;
}
@override
R visitShowCombinator(ShowCombinator node) {
node.visitChildren(this);
return null;
}
@override
R visitSimpleFormalParameter(SimpleFormalParameter node) {
node.visitChildren(this);
return null;
}
@override
R visitSimpleIdentifier(SimpleIdentifier node) {
node.visitChildren(this);
return null;
}
@override
R visitSimpleStringLiteral(SimpleStringLiteral node) {
node.visitChildren(this);
return null;
}
@override
R visitSpreadElement(SpreadElement node) {
node.visitChildren(this);
return null;
}
@override
R visitStringInterpolation(StringInterpolation node) {
node.visitChildren(this);
return null;
}
@override
R visitSuperConstructorInvocation(SuperConstructorInvocation node) {
node.visitChildren(this);
return null;
}
@override
R visitSuperExpression(SuperExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitSwitchCase(SwitchCase node) {
node.visitChildren(this);
return null;
}
@override
R visitSwitchDefault(SwitchDefault node) {
node.visitChildren(this);
return null;
}
@override
R visitSwitchStatement(SwitchStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitSymbolLiteral(SymbolLiteral node) {
node.visitChildren(this);
return null;
}
@override
R visitThisExpression(ThisExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitThrowExpression(ThrowExpression node) {
node.visitChildren(this);
return null;
}
@override
R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitTryStatement(TryStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitTypeArgumentList(TypeArgumentList node) {
node.visitChildren(this);
return null;
}
@override
R visitTypeName(TypeName node) {
node.visitChildren(this);
return null;
}
@override
R visitTypeParameter(TypeParameter node) {
node.visitChildren(this);
return null;
}
@override
R visitTypeParameterList(TypeParameterList node) {
node.visitChildren(this);
return null;
}
@override
R visitVariableDeclaration(VariableDeclaration node) {
node.visitChildren(this);
return null;
}
@override
R visitVariableDeclarationList(VariableDeclarationList node) {
node.visitChildren(this);
return null;
}
@override
R visitVariableDeclarationStatement(VariableDeclarationStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitWhileStatement(WhileStatement node) {
node.visitChildren(this);
return null;
}
@override
R visitWithClause(WithClause node) {
node.visitChildren(this);
return null;
}
@override
R visitYieldStatement(YieldStatement node) {
node.visitChildren(this);
return null;
}
}
/// An AST visitor that will do nothing when visiting an AST node. It is
/// intended to be a superclass for classes that use the visitor pattern
/// primarily as a dispatch mechanism (and hence don't need to recursively visit
/// a whole structure) and that only need to visit a small number of node types.
///
/// Clients may extend this class.
class SimpleAstVisitor<R> implements AstVisitor<R> {
@override
R visitAdjacentStrings(AdjacentStrings node) => null;
@override
R visitAnnotation(Annotation node) => null;
@override
R visitArgumentList(ArgumentList node) => null;
@override
R visitAsExpression(AsExpression node) => null;
@override
R visitAssertInitializer(AssertInitializer node) => null;
@override
R visitAssertStatement(AssertStatement node) => null;
@override
R visitAssignmentExpression(AssignmentExpression node) => null;
@override
R visitAwaitExpression(AwaitExpression node) => null;
@override
R visitBinaryExpression(BinaryExpression node) => null;
@override
R visitBlock(Block node) => null;
@override
R visitBlockFunctionBody(BlockFunctionBody node) => null;
@override
R visitBooleanLiteral(BooleanLiteral node) => null;
@override
R visitBreakStatement(BreakStatement node) => null;
@override
R visitCascadeExpression(CascadeExpression node) => null;
@override
R visitCatchClause(CatchClause node) => null;
@override
R visitClassDeclaration(ClassDeclaration node) => null;
@override
R visitClassTypeAlias(ClassTypeAlias node) => null;
@override
R visitComment(Comment node) => null;
@override
R visitCommentReference(CommentReference node) => null;
@override
R visitCompilationUnit(CompilationUnit node) => null;
@override
R visitConditionalExpression(ConditionalExpression node) => null;
@override
R visitConfiguration(Configuration node) => null;
@override
R visitConstructorDeclaration(ConstructorDeclaration node) => null;
@override
R visitConstructorFieldInitializer(ConstructorFieldInitializer node) => null;
@override
R visitConstructorName(ConstructorName node) => null;
@override
R visitContinueStatement(ContinueStatement node) => null;
@override
R visitDeclaredIdentifier(DeclaredIdentifier node) => null;
@override
R visitDefaultFormalParameter(DefaultFormalParameter node) => null;
@override
R visitDoStatement(DoStatement node) => null;
@override
R visitDottedName(DottedName node) => null;
@override
R visitDoubleLiteral(DoubleLiteral node) => null;
@override
R visitEmptyFunctionBody(EmptyFunctionBody node) => null;
@override
R visitEmptyStatement(EmptyStatement node) => null;
@override
R visitEnumConstantDeclaration(EnumConstantDeclaration node) => null;
@override
R visitEnumDeclaration(EnumDeclaration node) => null;
@override
R visitExportDirective(ExportDirective node) => null;
@override
R visitExpressionFunctionBody(ExpressionFunctionBody node) => null;
@override
R visitExpressionStatement(ExpressionStatement node) => null;
@override
R visitExtendsClause(ExtendsClause node) => null;
@override
R visitExtensionDeclaration(ExtensionDeclaration node) => null;
@override
R visitExtensionOverride(ExtensionOverride node) => null;
@override
R visitFieldDeclaration(FieldDeclaration node) => null;
@override
R visitFieldFormalParameter(FieldFormalParameter node) => null;
@override
R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) => null;
@override
R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) => null;
@override
R visitForElement(ForElement node) => null;
@override
R visitFormalParameterList(FormalParameterList node) => null;
@override
R visitForPartsWithDeclarations(ForPartsWithDeclarations node) => null;
@override
R visitForPartsWithExpression(ForPartsWithExpression node) => null;
@override
R visitForStatement(ForStatement node) => null;
@override
R visitFunctionDeclaration(FunctionDeclaration node) => null;
@override
R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) =>
null;
@override
R visitFunctionExpression(FunctionExpression node) => null;
@override
R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
null;
@override
R visitFunctionTypeAlias(FunctionTypeAlias node) => null;
@override
R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) =>
null;
@override
R visitGenericFunctionType(GenericFunctionType node) => null;
@override
R visitGenericTypeAlias(GenericTypeAlias node) => null;
@override
R visitHideCombinator(HideCombinator node) => null;
@override
R visitIfElement(IfElement node) => null;
@override
R visitIfStatement(IfStatement node) => null;
@override
R visitImplementsClause(ImplementsClause node) => null;
@override
R visitImportDirective(ImportDirective node) => null;
@override
R visitIndexExpression(IndexExpression node) => null;
@override
R visitInstanceCreationExpression(InstanceCreationExpression node) => null;
@override
R visitIntegerLiteral(IntegerLiteral node) => null;
@override
R visitInterpolationExpression(InterpolationExpression node) => null;
@override
R visitInterpolationString(InterpolationString node) => null;
@override
R visitIsExpression(IsExpression node) => null;
@override
R visitLabel(Label node) => null;
@override
R visitLabeledStatement(LabeledStatement node) => null;
@override
R visitLibraryDirective(LibraryDirective node) => null;
@override
R visitLibraryIdentifier(LibraryIdentifier node) => null;
@override
R visitListLiteral(ListLiteral node) => null;
@override
R visitMapLiteralEntry(MapLiteralEntry node) => null;
@override
R visitMethodDeclaration(MethodDeclaration node) => null;
@override
R visitMethodInvocation(MethodInvocation node) => null;
@override
R visitMixinDeclaration(MixinDeclaration node) => null;
@override
R visitNamedExpression(NamedExpression node) => null;
@override
R visitNativeClause(NativeClause node) => null;
@override
R visitNativeFunctionBody(NativeFunctionBody node) => null;
@override
R visitNullLiteral(NullLiteral node) => null;
@override
R visitOnClause(OnClause node) => null;
@override
R visitParenthesizedExpression(ParenthesizedExpression node) => null;
@override
R visitPartDirective(PartDirective node) => null;
@override
R visitPartOfDirective(PartOfDirective node) => null;
@override
R visitPostfixExpression(PostfixExpression node) => null;
@override
R visitPrefixedIdentifier(PrefixedIdentifier node) => null;
@override
R visitPrefixExpression(PrefixExpression node) => null;
@override
R visitPropertyAccess(PropertyAccess node) => null;
@override
R visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) =>
null;
@override
R visitRethrowExpression(RethrowExpression node) => null;
@override
R visitReturnStatement(ReturnStatement node) => null;
@override
R visitScriptTag(ScriptTag node) => null;
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) => null;
@override
R visitShowCombinator(ShowCombinator node) => null;
@override
R visitSimpleFormalParameter(SimpleFormalParameter node) => null;
@override
R visitSimpleIdentifier(SimpleIdentifier node) => null;
@override
R visitSimpleStringLiteral(SimpleStringLiteral node) => null;
@override
R visitSpreadElement(SpreadElement node) => null;
@override
R visitStringInterpolation(StringInterpolation node) => null;
@override
R visitSuperConstructorInvocation(SuperConstructorInvocation node) => null;
@override
R visitSuperExpression(SuperExpression node) => null;
@override
R visitSwitchCase(SwitchCase node) => null;
@override
R visitSwitchDefault(SwitchDefault node) => null;
@override
R visitSwitchStatement(SwitchStatement node) => null;
@override
R visitSymbolLiteral(SymbolLiteral node) => null;
@override
R visitThisExpression(ThisExpression node) => null;
@override
R visitThrowExpression(ThrowExpression node) => null;
@override
R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => null;
@override
R visitTryStatement(TryStatement node) => null;
@override
R visitTypeArgumentList(TypeArgumentList node) => null;
@override
R visitTypeName(TypeName node) => null;
@override
R visitTypeParameter(TypeParameter node) => null;
@override
R visitTypeParameterList(TypeParameterList node) => null;
@override
R visitVariableDeclaration(VariableDeclaration node) => null;
@override
R visitVariableDeclarationList(VariableDeclarationList node) => null;
@override
R visitVariableDeclarationStatement(VariableDeclarationStatement node) =>
null;
@override
R visitWhileStatement(WhileStatement node) => null;
@override
R visitWithClause(WithClause node) => null;
@override
R visitYieldStatement(YieldStatement node) => null;
}
/// An AST visitor that will throw an exception if any of the visit methods that
/// are invoked have not been overridden. It is intended to be a superclass for
/// classes that implement the visitor pattern and need to (a) override all of
/// the visit methods or (b) need to override a subset of the visit method and
/// want to catch when any other visit methods have been invoked.
///
/// Clients may extend this class.
class ThrowingAstVisitor<R> implements AstVisitor<R> {
@override
R visitAdjacentStrings(AdjacentStrings node) => _throw(node);
@override
R visitAnnotation(Annotation node) => _throw(node);
@override
R visitArgumentList(ArgumentList node) => _throw(node);
@override
R visitAsExpression(AsExpression node) => _throw(node);
@override
R visitAssertInitializer(AssertInitializer node) => _throw(node);
@override
R visitAssertStatement(AssertStatement node) => _throw(node);
@override
R visitAssignmentExpression(AssignmentExpression node) => _throw(node);
@override
R visitAwaitExpression(AwaitExpression node) => _throw(node);
@override
R visitBinaryExpression(BinaryExpression node) => _throw(node);
@override
R visitBlock(Block node) => _throw(node);
@override
R visitBlockFunctionBody(BlockFunctionBody node) => _throw(node);
@override
R visitBooleanLiteral(BooleanLiteral node) => _throw(node);
@override
R visitBreakStatement(BreakStatement node) => _throw(node);
@override
R visitCascadeExpression(CascadeExpression node) => _throw(node);
@override
R visitCatchClause(CatchClause node) => _throw(node);
@override
R visitClassDeclaration(ClassDeclaration node) => _throw(node);
@override
R visitClassTypeAlias(ClassTypeAlias node) => _throw(node);
@override
R visitComment(Comment node) => _throw(node);
@override
R visitCommentReference(CommentReference node) => _throw(node);
@override
R visitCompilationUnit(CompilationUnit node) => _throw(node);
@override
R visitConditionalExpression(ConditionalExpression node) => _throw(node);
@override
R visitConfiguration(Configuration node) => _throw(node);
@override
R visitConstructorDeclaration(ConstructorDeclaration node) => _throw(node);
@override
R visitConstructorFieldInitializer(ConstructorFieldInitializer node) =>
_throw(node);
@override
R visitConstructorName(ConstructorName node) => _throw(node);
@override
R visitContinueStatement(ContinueStatement node) => _throw(node);
@override
R visitDeclaredIdentifier(DeclaredIdentifier node) => _throw(node);
@override
R visitDefaultFormalParameter(DefaultFormalParameter node) => _throw(node);
@override
R visitDoStatement(DoStatement node) => _throw(node);
@override
R visitDottedName(DottedName node) => _throw(node);
@override
R visitDoubleLiteral(DoubleLiteral node) => _throw(node);
@override
R visitEmptyFunctionBody(EmptyFunctionBody node) => _throw(node);
@override
R visitEmptyStatement(EmptyStatement node) => _throw(node);
@override
R visitEnumConstantDeclaration(EnumConstantDeclaration node) => _throw(node);
@override
R visitEnumDeclaration(EnumDeclaration node) => _throw(node);
@override
R visitExportDirective(ExportDirective node) => _throw(node);
@override
R visitExpressionFunctionBody(ExpressionFunctionBody node) => _throw(node);
@override
R visitExpressionStatement(ExpressionStatement node) => _throw(node);
@override
R visitExtendsClause(ExtendsClause node) => _throw(node);
@override
R visitExtensionDeclaration(ExtensionDeclaration node) => _throw(node);
@override
R visitExtensionOverride(ExtensionOverride node) => _throw(node);
@override
R visitFieldDeclaration(FieldDeclaration node) => _throw(node);
@override
R visitFieldFormalParameter(FieldFormalParameter node) => _throw(node);
@override
R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) =>
_throw(node);
@override
R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) =>
_throw(node);
@override
R visitForElement(ForElement node) => _throw(node);
@override
R visitFormalParameterList(FormalParameterList node) => _throw(node);
@override
R visitForPartsWithDeclarations(ForPartsWithDeclarations node) =>
_throw(node);
@override
R visitForPartsWithExpression(ForPartsWithExpression node) => _throw(node);
@override
R visitForStatement(ForStatement node) => _throw(node);
@override
R visitFunctionDeclaration(FunctionDeclaration node) => _throw(node);
@override
R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) =>
_throw(node);
@override
R visitFunctionExpression(FunctionExpression node) => _throw(node);
@override
R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
_throw(node);
@override
R visitFunctionTypeAlias(FunctionTypeAlias node) => _throw(node);
@override
R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) =>
_throw(node);
@override
R visitGenericFunctionType(GenericFunctionType node) => _throw(node);
@override
R visitGenericTypeAlias(GenericTypeAlias node) => _throw(node);
@override
R visitHideCombinator(HideCombinator node) => _throw(node);
@override
R visitIfElement(IfElement node) => _throw(node);
@override
R visitIfStatement(IfStatement node) => _throw(node);
@override
R visitImplementsClause(ImplementsClause node) => _throw(node);
@override
R visitImportDirective(ImportDirective node) => _throw(node);
@override
R visitIndexExpression(IndexExpression node) => _throw(node);
@override
R visitInstanceCreationExpression(InstanceCreationExpression node) =>
_throw(node);
@override
R visitIntegerLiteral(IntegerLiteral node) => _throw(node);
@override
R visitInterpolationExpression(InterpolationExpression node) => _throw(node);
@override
R visitInterpolationString(InterpolationString node) => _throw(node);
@override
R visitIsExpression(IsExpression node) => _throw(node);
@override
R visitLabel(Label node) => _throw(node);
@override
R visitLabeledStatement(LabeledStatement node) => _throw(node);
@override
R visitLibraryDirective(LibraryDirective node) => _throw(node);
@override
R visitLibraryIdentifier(LibraryIdentifier node) => _throw(node);
@override
R visitListLiteral(ListLiteral node) => _throw(node);
@override
R visitMapLiteralEntry(MapLiteralEntry node) => _throw(node);
@override
R visitMethodDeclaration(MethodDeclaration node) => _throw(node);
@override
R visitMethodInvocation(MethodInvocation node) => _throw(node);
@override
R visitMixinDeclaration(MixinDeclaration node) => _throw(node);
@override
R visitNamedExpression(NamedExpression node) => _throw(node);
@override
R visitNativeClause(NativeClause node) => _throw(node);
@override
R visitNativeFunctionBody(NativeFunctionBody node) => _throw(node);
@override
R visitNullLiteral(NullLiteral node) => _throw(node);
@override
R visitOnClause(OnClause node) => _throw(node);
@override
R visitParenthesizedExpression(ParenthesizedExpression node) => _throw(node);
@override
R visitPartDirective(PartDirective node) => _throw(node);
@override
R visitPartOfDirective(PartOfDirective node) => _throw(node);
@override
R visitPostfixExpression(PostfixExpression node) => _throw(node);
@override
R visitPrefixedIdentifier(PrefixedIdentifier node) => _throw(node);
@override
R visitPrefixExpression(PrefixExpression node) => _throw(node);
@override
R visitPropertyAccess(PropertyAccess node) => _throw(node);
@override
R visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) =>
_throw(node);
@override
R visitRethrowExpression(RethrowExpression node) => _throw(node);
@override
R visitReturnStatement(ReturnStatement node) => _throw(node);
@override
R visitScriptTag(ScriptTag node) => _throw(node);
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) => _throw(node);
@override
R visitShowCombinator(ShowCombinator node) => _throw(node);
@override
R visitSimpleFormalParameter(SimpleFormalParameter node) => _throw(node);
@override
R visitSimpleIdentifier(SimpleIdentifier node) => _throw(node);
@override
R visitSimpleStringLiteral(SimpleStringLiteral node) => _throw(node);
@override
R visitSpreadElement(SpreadElement node) => _throw(node);
@override
R visitStringInterpolation(StringInterpolation node) => _throw(node);
@override
R visitSuperConstructorInvocation(SuperConstructorInvocation node) =>
_throw(node);
@override
R visitSuperExpression(SuperExpression node) => _throw(node);
@override
R visitSwitchCase(SwitchCase node) => _throw(node);
@override
R visitSwitchDefault(SwitchDefault node) => _throw(node);
@override
R visitSwitchStatement(SwitchStatement node) => _throw(node);
@override
R visitSymbolLiteral(SymbolLiteral node) => _throw(node);
@override
R visitThisExpression(ThisExpression node) => _throw(node);
@override
R visitThrowExpression(ThrowExpression node) => _throw(node);
@override
R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) =>
_throw(node);
@override
R visitTryStatement(TryStatement node) => _throw(node);
@override
R visitTypeArgumentList(TypeArgumentList node) => _throw(node);
@override
R visitTypeName(TypeName node) => _throw(node);
@override
R visitTypeParameter(TypeParameter node) => _throw(node);
@override
R visitTypeParameterList(TypeParameterList node) => _throw(node);
@override
R visitVariableDeclaration(VariableDeclaration node) => _throw(node);
@override
R visitVariableDeclarationList(VariableDeclarationList node) => _throw(node);
@override
R visitVariableDeclarationStatement(VariableDeclarationStatement node) =>
_throw(node);
@override
R visitWhileStatement(WhileStatement node) => _throw(node);
@override
R visitWithClause(WithClause node) => _throw(node);
@override
R visitYieldStatement(YieldStatement node) => _throw(node);
R _throw(AstNode node) {
throw new Exception('Missing implementation of visit${node.runtimeType}');
}
}
/// An AST visitor that captures visit call timings.
///
/// Clients may not extend, implement or mix-in this class.
class TimedAstVisitor<T> implements AstVisitor<T> {
/// The base visitor whose visit methods will be timed.
final AstVisitor<T> _baseVisitor;
/// Collects elapsed time for visit calls.
final Stopwatch stopwatch;
/// Initialize a newly created visitor to time calls to the given base
/// visitor's visits.
TimedAstVisitor(this._baseVisitor, [Stopwatch watch])
: stopwatch = watch ?? new Stopwatch();
@override
T visitAdjacentStrings(AdjacentStrings node) {
stopwatch.start();
T result = _baseVisitor.visitAdjacentStrings(node);
stopwatch.stop();
return result;
}
@override
T visitAnnotation(Annotation node) {
stopwatch.start();
T result = _baseVisitor.visitAnnotation(node);
stopwatch.stop();
return result;
}
@override
T visitArgumentList(ArgumentList node) {
stopwatch.start();
T result = _baseVisitor.visitArgumentList(node);
stopwatch.stop();
return result;
}
@override
T visitAsExpression(AsExpression node) {
stopwatch.start();
T result = _baseVisitor.visitAsExpression(node);
stopwatch.stop();
return result;
}
@override
T visitAssertInitializer(AssertInitializer node) {
stopwatch.start();
T result = _baseVisitor.visitAssertInitializer(node);
stopwatch.stop();
return result;
}
@override
T visitAssertStatement(AssertStatement node) {
stopwatch.start();
T result = _baseVisitor.visitAssertStatement(node);
stopwatch.stop();
return result;
}
@override
T visitAssignmentExpression(AssignmentExpression node) {
stopwatch.start();
T result = _baseVisitor.visitAssignmentExpression(node);
stopwatch.stop();
return result;
}
@override
T visitAwaitExpression(AwaitExpression node) {
stopwatch.start();
T result = _baseVisitor.visitAwaitExpression(node);
stopwatch.stop();
return result;
}
@override
T visitBinaryExpression(BinaryExpression node) {
stopwatch.start();
T result = _baseVisitor.visitBinaryExpression(node);
stopwatch.stop();
return result;
}
@override
T visitBlock(Block node) {
stopwatch.start();
T result = _baseVisitor.visitBlock(node);
stopwatch.stop();
return result;
}
@override
T visitBlockFunctionBody(BlockFunctionBody node) {
stopwatch.start();
T result = _baseVisitor.visitBlockFunctionBody(node);
stopwatch.stop();
return result;
}
@override
T visitBooleanLiteral(BooleanLiteral node) {
stopwatch.start();
T result = _baseVisitor.visitBooleanLiteral(node);
stopwatch.stop();
return result;
}
@override
T visitBreakStatement(BreakStatement node) {
stopwatch.start();
T result = _baseVisitor.visitBreakStatement(node);
stopwatch.stop();
return result;
}
@override
T visitCascadeExpression(CascadeExpression node) {
stopwatch.start();
T result = _baseVisitor.visitCascadeExpression(node);
stopwatch.stop();
return result;
}
@override
T visitCatchClause(CatchClause node) {
stopwatch.start();
T result = _baseVisitor.visitCatchClause(node);
stopwatch.stop();
return result;
}
@override
T visitClassDeclaration(ClassDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitClassDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitClassTypeAlias(ClassTypeAlias node) {
stopwatch.start();
T result = _baseVisitor.visitClassTypeAlias(node);
stopwatch.stop();
return result;
}
@override
T visitComment(Comment node) {
stopwatch.start();
T result = _baseVisitor.visitComment(node);
stopwatch.stop();
return result;
}
@override
T visitCommentReference(CommentReference node) {
stopwatch.start();
T result = _baseVisitor.visitCommentReference(node);
stopwatch.stop();
return result;
}
@override
T visitCompilationUnit(CompilationUnit node) {
stopwatch.start();
T result = _baseVisitor.visitCompilationUnit(node);
stopwatch.stop();
return result;
}
@override
T visitConditionalExpression(ConditionalExpression node) {
stopwatch.start();
T result = _baseVisitor.visitConditionalExpression(node);
stopwatch.stop();
return result;
}
@override
T visitConfiguration(Configuration node) {
stopwatch.start();
T result = _baseVisitor.visitConfiguration(node);
stopwatch.stop();
return result;
}
@override
T visitConstructorDeclaration(ConstructorDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitConstructorDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
stopwatch.start();
T result = _baseVisitor.visitConstructorFieldInitializer(node);
stopwatch.stop();
return result;
}
@override
T visitConstructorName(ConstructorName node) {
stopwatch.start();
T result = _baseVisitor.visitConstructorName(node);
stopwatch.stop();
return result;
}
@override
T visitContinueStatement(ContinueStatement node) {
stopwatch.start();
T result = _baseVisitor.visitContinueStatement(node);
stopwatch.stop();
return result;
}
@override
T visitDeclaredIdentifier(DeclaredIdentifier node) {
stopwatch.start();
T result = _baseVisitor.visitDeclaredIdentifier(node);
stopwatch.stop();
return result;
}
@override
T visitDefaultFormalParameter(DefaultFormalParameter node) {
stopwatch.start();
T result = _baseVisitor.visitDefaultFormalParameter(node);
stopwatch.stop();
return result;
}
@override
T visitDoStatement(DoStatement node) {
stopwatch.start();
T result = _baseVisitor.visitDoStatement(node);
stopwatch.stop();
return result;
}
@override
T visitDottedName(DottedName node) {
stopwatch.start();
T result = _baseVisitor.visitDottedName(node);
stopwatch.stop();
return result;
}
@override
T visitDoubleLiteral(DoubleLiteral node) {
stopwatch.start();
T result = _baseVisitor.visitDoubleLiteral(node);
stopwatch.stop();
return result;
}
@override
T visitEmptyFunctionBody(EmptyFunctionBody node) {
stopwatch.start();
T result = _baseVisitor.visitEmptyFunctionBody(node);
stopwatch.stop();
return result;
}
@override
T visitEmptyStatement(EmptyStatement node) {
stopwatch.start();
T result = _baseVisitor.visitEmptyStatement(node);
stopwatch.stop();
return result;
}
@override
T visitEnumConstantDeclaration(EnumConstantDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitEnumConstantDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitEnumDeclaration(EnumDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitEnumDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitExportDirective(ExportDirective node) {
stopwatch.start();
T result = _baseVisitor.visitExportDirective(node);
stopwatch.stop();
return result;
}
@override
T visitExpressionFunctionBody(ExpressionFunctionBody node) {
stopwatch.start();
T result = _baseVisitor.visitExpressionFunctionBody(node);
stopwatch.stop();
return result;
}
@override
T visitExpressionStatement(ExpressionStatement node) {
stopwatch.start();
T result = _baseVisitor.visitExpressionStatement(node);
stopwatch.stop();
return result;
}
@override
T visitExtendsClause(ExtendsClause node) {
stopwatch.start();
T result = _baseVisitor.visitExtendsClause(node);
stopwatch.stop();
return result;
}
@override
T visitExtensionDeclaration(ExtensionDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitExtensionDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitExtensionOverride(ExtensionOverride node) {
stopwatch.start();
T result = _baseVisitor.visitExtensionOverride(node);
stopwatch.stop();
return result;
}
@override
T visitFieldDeclaration(FieldDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitFieldDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitFieldFormalParameter(FieldFormalParameter node) {
stopwatch.start();
T result = _baseVisitor.visitFieldFormalParameter(node);
stopwatch.stop();
return result;
}
@override
T visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitForEachPartsWithDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
stopwatch.start();
T result = _baseVisitor.visitForEachPartsWithIdentifier(node);
stopwatch.stop();
return result;
}
@override
T visitForElement(ForElement node) {
stopwatch.start();
T result = _baseVisitor.visitForElement(node);
stopwatch.stop();
return result;
}
@override
T visitFormalParameterList(FormalParameterList node) {
stopwatch.start();
T result = _baseVisitor.visitFormalParameterList(node);
stopwatch.stop();
return result;
}
@override
T visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
stopwatch.start();
T result = _baseVisitor.visitForPartsWithDeclarations(node);
stopwatch.stop();
return result;
}
@override
T visitForPartsWithExpression(ForPartsWithExpression node) {
stopwatch.start();
T result = _baseVisitor.visitForPartsWithExpression(node);
stopwatch.stop();
return result;
}
@override
T visitForStatement(ForStatement node) {
stopwatch.start();
T result = _baseVisitor.visitForStatement(node);
stopwatch.stop();
return result;
}
@override
T visitFunctionDeclaration(FunctionDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitFunctionDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitFunctionDeclarationStatement(FunctionDeclarationStatement node) {
stopwatch.start();
T result = _baseVisitor.visitFunctionDeclarationStatement(node);
stopwatch.stop();
return result;
}
@override
T visitFunctionExpression(FunctionExpression node) {
stopwatch.start();
T result = _baseVisitor.visitFunctionExpression(node);
stopwatch.stop();
return result;
}
@override
T visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
stopwatch.start();
T result = _baseVisitor.visitFunctionExpressionInvocation(node);
stopwatch.stop();
return result;
}
@override
T visitFunctionTypeAlias(FunctionTypeAlias node) {
stopwatch.start();
T result = _baseVisitor.visitFunctionTypeAlias(node);
stopwatch.stop();
return result;
}
@override
T visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
stopwatch.start();
T result = _baseVisitor.visitFunctionTypedFormalParameter(node);
stopwatch.stop();
return result;
}
@override
T visitGenericFunctionType(GenericFunctionType node) {
stopwatch.start();
T result = _baseVisitor.visitGenericFunctionType(node);
stopwatch.stop();
return result;
}
@override
T visitGenericTypeAlias(GenericTypeAlias node) {
stopwatch.start();
T result = _baseVisitor.visitGenericTypeAlias(node);
stopwatch.stop();
return result;
}
@override
T visitHideCombinator(HideCombinator node) {
stopwatch.start();
T result = _baseVisitor.visitHideCombinator(node);
stopwatch.stop();
return result;
}
@override
T visitIfElement(IfElement node) {
stopwatch.start();
T result = _baseVisitor.visitIfElement(node);
stopwatch.stop();
return result;
}
@override
T visitIfStatement(IfStatement node) {
stopwatch.start();
T result = _baseVisitor.visitIfStatement(node);
stopwatch.stop();
return result;
}
@override
T visitImplementsClause(ImplementsClause node) {
stopwatch.start();
T result = _baseVisitor.visitImplementsClause(node);
stopwatch.stop();
return result;
}
@override
T visitImportDirective(ImportDirective node) {
stopwatch.start();
T result = _baseVisitor.visitImportDirective(node);
stopwatch.stop();
return result;
}
@override
T visitIndexExpression(IndexExpression node) {
stopwatch.start();
T result = _baseVisitor.visitIndexExpression(node);
stopwatch.stop();
return result;
}
@override
T visitInstanceCreationExpression(InstanceCreationExpression node) {
stopwatch.start();
T result = _baseVisitor.visitInstanceCreationExpression(node);
stopwatch.stop();
return result;
}
@override
T visitIntegerLiteral(IntegerLiteral node) {
stopwatch.start();
T result = _baseVisitor.visitIntegerLiteral(node);
stopwatch.stop();
return result;
}
@override
T visitInterpolationExpression(InterpolationExpression node) {
stopwatch.start();
T result = _baseVisitor.visitInterpolationExpression(node);
stopwatch.stop();
return result;
}
@override
T visitInterpolationString(InterpolationString node) {
stopwatch.start();
T result = _baseVisitor.visitInterpolationString(node);
stopwatch.stop();
return result;
}
@override
T visitIsExpression(IsExpression node) {
stopwatch.start();
T result = _baseVisitor.visitIsExpression(node);
stopwatch.stop();
return result;
}
@override
T visitLabel(Label node) {
stopwatch.start();
T result = _baseVisitor.visitLabel(node);
stopwatch.stop();
return result;
}
@override
T visitLabeledStatement(LabeledStatement node) {
stopwatch.start();
T result = _baseVisitor.visitLabeledStatement(node);
stopwatch.stop();
return result;
}
@override
T visitLibraryDirective(LibraryDirective node) {
stopwatch.start();
T result = _baseVisitor.visitLibraryDirective(node);
stopwatch.stop();
return result;
}
@override
T visitLibraryIdentifier(LibraryIdentifier node) {
stopwatch.start();
T result = _baseVisitor.visitLibraryIdentifier(node);
stopwatch.stop();
return result;
}
@override
T visitListLiteral(ListLiteral node) {
stopwatch.start();
T result = _baseVisitor.visitListLiteral(node);
stopwatch.stop();
return result;
}
@override
T visitMapLiteralEntry(MapLiteralEntry node) {
stopwatch.start();
T result = _baseVisitor.visitMapLiteralEntry(node);
stopwatch.stop();
return result;
}
@override
T visitMethodDeclaration(MethodDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitMethodDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitMethodInvocation(MethodInvocation node) {
stopwatch.start();
T result = _baseVisitor.visitMethodInvocation(node);
stopwatch.stop();
return result;
}
@override
T visitMixinDeclaration(MixinDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitMixinDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitNamedExpression(NamedExpression node) {
stopwatch.start();
T result = _baseVisitor.visitNamedExpression(node);
stopwatch.stop();
return result;
}
@override
T visitNativeClause(NativeClause node) {
stopwatch.start();
T result = _baseVisitor.visitNativeClause(node);
stopwatch.stop();
return result;
}
@override
T visitNativeFunctionBody(NativeFunctionBody node) {
stopwatch.start();
T result = _baseVisitor.visitNativeFunctionBody(node);
stopwatch.stop();
return result;
}
@override
T visitNullLiteral(NullLiteral node) {
stopwatch.start();
T result = _baseVisitor.visitNullLiteral(node);
stopwatch.stop();
return result;
}
@override
T visitOnClause(OnClause node) {
stopwatch.start();
T result = _baseVisitor.visitOnClause(node);
stopwatch.stop();
return result;
}
@override
T visitParenthesizedExpression(ParenthesizedExpression node) {
stopwatch.start();
T result = _baseVisitor.visitParenthesizedExpression(node);
stopwatch.stop();
return result;
}
@override
T visitPartDirective(PartDirective node) {
stopwatch.start();
T result = _baseVisitor.visitPartDirective(node);
stopwatch.stop();
return result;
}
@override
T visitPartOfDirective(PartOfDirective node) {
stopwatch.start();
T result = _baseVisitor.visitPartOfDirective(node);
stopwatch.stop();
return result;
}
@override
T visitPostfixExpression(PostfixExpression node) {
stopwatch.start();
T result = _baseVisitor.visitPostfixExpression(node);
stopwatch.stop();
return result;
}
@override
T visitPrefixedIdentifier(PrefixedIdentifier node) {
stopwatch.start();
T result = _baseVisitor.visitPrefixedIdentifier(node);
stopwatch.stop();
return result;
}
@override
T visitPrefixExpression(PrefixExpression node) {
stopwatch.start();
T result = _baseVisitor.visitPrefixExpression(node);
stopwatch.stop();
return result;
}
@override
T visitPropertyAccess(PropertyAccess node) {
stopwatch.start();
T result = _baseVisitor.visitPropertyAccess(node);
stopwatch.stop();
return result;
}
@override
T visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) {
stopwatch.start();
T result = _baseVisitor.visitRedirectingConstructorInvocation(node);
stopwatch.stop();
return result;
}
@override
T visitRethrowExpression(RethrowExpression node) {
stopwatch.start();
T result = _baseVisitor.visitRethrowExpression(node);
stopwatch.stop();
return result;
}
@override
T visitReturnStatement(ReturnStatement node) {
stopwatch.start();
T result = _baseVisitor.visitReturnStatement(node);
stopwatch.stop();
return result;
}
@override
T visitScriptTag(ScriptTag node) {
stopwatch.start();
T result = _baseVisitor.visitScriptTag(node);
stopwatch.stop();
return result;
}
@override
T visitSetOrMapLiteral(SetOrMapLiteral node) {
stopwatch.start();
T result = _baseVisitor.visitSetOrMapLiteral(node);
stopwatch.stop();
return result;
}
@override
T visitShowCombinator(ShowCombinator node) {
stopwatch.start();
T result = _baseVisitor.visitShowCombinator(node);
stopwatch.stop();
return result;
}
@override
T visitSimpleFormalParameter(SimpleFormalParameter node) {
stopwatch.start();
T result = _baseVisitor.visitSimpleFormalParameter(node);
stopwatch.stop();
return result;
}
@override
T visitSimpleIdentifier(SimpleIdentifier node) {
stopwatch.start();
T result = _baseVisitor.visitSimpleIdentifier(node);
stopwatch.stop();
return result;
}
@override
T visitSimpleStringLiteral(SimpleStringLiteral node) {
stopwatch.start();
T result = _baseVisitor.visitSimpleStringLiteral(node);
stopwatch.stop();
return result;
}
@override
T visitSpreadElement(SpreadElement node) {
stopwatch.start();
T result = _baseVisitor.visitSpreadElement(node);
stopwatch.stop();
return result;
}
@override
T visitStringInterpolation(StringInterpolation node) {
stopwatch.start();
T result = _baseVisitor.visitStringInterpolation(node);
stopwatch.stop();
return result;
}
@override
T visitSuperConstructorInvocation(SuperConstructorInvocation node) {
stopwatch.start();
T result = _baseVisitor.visitSuperConstructorInvocation(node);
stopwatch.stop();
return result;
}
@override
T visitSuperExpression(SuperExpression node) {
stopwatch.start();
T result = _baseVisitor.visitSuperExpression(node);
stopwatch.stop();
return result;
}
@override
T visitSwitchCase(SwitchCase node) {
stopwatch.start();
T result = _baseVisitor.visitSwitchCase(node);
stopwatch.stop();
return result;
}
@override
T visitSwitchDefault(SwitchDefault node) {
stopwatch.start();
T result = _baseVisitor.visitSwitchDefault(node);
stopwatch.stop();
return result;
}
@override
T visitSwitchStatement(SwitchStatement node) {
stopwatch.start();
T result = _baseVisitor.visitSwitchStatement(node);
stopwatch.stop();
return result;
}
@override
T visitSymbolLiteral(SymbolLiteral node) {
stopwatch.start();
T result = _baseVisitor.visitSymbolLiteral(node);
stopwatch.stop();
return result;
}
@override
T visitThisExpression(ThisExpression node) {
stopwatch.start();
T result = _baseVisitor.visitThisExpression(node);
stopwatch.stop();
return result;
}
@override
T visitThrowExpression(ThrowExpression node) {
stopwatch.start();
T result = _baseVisitor.visitThrowExpression(node);
stopwatch.stop();
return result;
}
@override
T visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitTopLevelVariableDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitTryStatement(TryStatement node) {
stopwatch.start();
T result = _baseVisitor.visitTryStatement(node);
stopwatch.stop();
return result;
}
@override
T visitTypeArgumentList(TypeArgumentList node) {
stopwatch.start();
T result = _baseVisitor.visitTypeArgumentList(node);
stopwatch.stop();
return result;
}
@override
T visitTypeName(TypeName node) {
stopwatch.start();
T result = _baseVisitor.visitTypeName(node);
stopwatch.stop();
return result;
}
@override
T visitTypeParameter(TypeParameter node) {
stopwatch.start();
T result = _baseVisitor.visitTypeParameter(node);
stopwatch.stop();
return result;
}
@override
T visitTypeParameterList(TypeParameterList node) {
stopwatch.start();
T result = _baseVisitor.visitTypeParameterList(node);
stopwatch.stop();
return result;
}
@override
T visitVariableDeclaration(VariableDeclaration node) {
stopwatch.start();
T result = _baseVisitor.visitVariableDeclaration(node);
stopwatch.stop();
return result;
}
@override
T visitVariableDeclarationList(VariableDeclarationList node) {
stopwatch.start();
T result = _baseVisitor.visitVariableDeclarationList(node);
stopwatch.stop();
return result;
}
@override
T visitVariableDeclarationStatement(VariableDeclarationStatement node) {
stopwatch.start();
T result = _baseVisitor.visitVariableDeclarationStatement(node);
stopwatch.stop();
return result;
}
@override
T visitWhileStatement(WhileStatement node) {
stopwatch.start();
T result = _baseVisitor.visitWhileStatement(node);
stopwatch.stop();
return result;
}
@override
T visitWithClause(WithClause node) {
stopwatch.start();
T result = _baseVisitor.visitWithClause(node);
stopwatch.stop();
return result;
}
@override
T visitYieldStatement(YieldStatement node) {
stopwatch.start();
T result = _baseVisitor.visitYieldStatement(node);
stopwatch.stop();
return result;
}
}
/// An AST visitor that will recursively visit all of the nodes in an AST
/// structure (like instances of the class [RecursiveAstVisitor]). In addition,
/// every node will also be visited by using a single unified [visitNode]
/// method.
///
/// Subclasses that override a visit method must either invoke the overridden
/// visit method or explicitly invoke the more general [visitNode] method.
/// Failure to do so will cause the children of the visited node to not be
/// visited.
///
/// Clients may extend this class.
class UnifyingAstVisitor<R> implements AstVisitor<R> {
@override
R visitAdjacentStrings(AdjacentStrings node) => visitNode(node);
@override
R visitAnnotation(Annotation node) => visitNode(node);
@override
R visitArgumentList(ArgumentList node) => visitNode(node);
@override
R visitAsExpression(AsExpression node) => visitNode(node);
@override
R visitAssertInitializer(AssertInitializer node) => visitNode(node);
@override
R visitAssertStatement(AssertStatement node) => visitNode(node);
@override
R visitAssignmentExpression(AssignmentExpression node) => visitNode(node);
@override
R visitAwaitExpression(AwaitExpression node) => visitNode(node);
@override
R visitBinaryExpression(BinaryExpression node) => visitNode(node);
@override
R visitBlock(Block node) => visitNode(node);
@override
R visitBlockFunctionBody(BlockFunctionBody node) => visitNode(node);
@override
R visitBooleanLiteral(BooleanLiteral node) => visitNode(node);
@override
R visitBreakStatement(BreakStatement node) => visitNode(node);
@override
R visitCascadeExpression(CascadeExpression node) => visitNode(node);
@override
R visitCatchClause(CatchClause node) => visitNode(node);
@override
R visitClassDeclaration(ClassDeclaration node) => visitNode(node);
@override
R visitClassTypeAlias(ClassTypeAlias node) => visitNode(node);
@override
R visitComment(Comment node) => visitNode(node);
@override
R visitCommentReference(CommentReference node) => visitNode(node);
@override
R visitCompilationUnit(CompilationUnit node) => visitNode(node);
@override
R visitConditionalExpression(ConditionalExpression node) => visitNode(node);
@override
R visitConfiguration(Configuration node) => visitNode(node);
@override
R visitConstructorDeclaration(ConstructorDeclaration node) => visitNode(node);
@override
R visitConstructorFieldInitializer(ConstructorFieldInitializer node) =>
visitNode(node);
@override
R visitConstructorName(ConstructorName node) => visitNode(node);
@override
R visitContinueStatement(ContinueStatement node) => visitNode(node);
@override
R visitDeclaredIdentifier(DeclaredIdentifier node) => visitNode(node);
@override
R visitDefaultFormalParameter(DefaultFormalParameter node) => visitNode(node);
@override
R visitDoStatement(DoStatement node) => visitNode(node);
@override
R visitDottedName(DottedName node) => visitNode(node);
@override
R visitDoubleLiteral(DoubleLiteral node) => visitNode(node);
@override
R visitEmptyFunctionBody(EmptyFunctionBody node) => visitNode(node);
@override
R visitEmptyStatement(EmptyStatement node) => visitNode(node);
@override
R visitEnumConstantDeclaration(EnumConstantDeclaration node) =>
visitNode(node);
@override
R visitEnumDeclaration(EnumDeclaration node) => visitNode(node);
@override
R visitExportDirective(ExportDirective node) => visitNode(node);
@override
R visitExpressionFunctionBody(ExpressionFunctionBody node) => visitNode(node);
@override
R visitExpressionStatement(ExpressionStatement node) => visitNode(node);
@override
R visitExtendsClause(ExtendsClause node) => visitNode(node);
@override
R visitExtensionDeclaration(ExtensionDeclaration node) => visitNode(node);
@override
R visitExtensionOverride(ExtensionOverride node) => visitNode(node);
@override
R visitFieldDeclaration(FieldDeclaration node) => visitNode(node);
@override
R visitFieldFormalParameter(FieldFormalParameter node) => visitNode(node);
@override
R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) =>
visitNode(node);
@override
R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) =>
visitNode(node);
@override
R visitForElement(ForElement node) => visitNode(node);
@override
R visitFormalParameterList(FormalParameterList node) => visitNode(node);
@override
R visitForPartsWithDeclarations(ForPartsWithDeclarations node) =>
visitNode(node);
@override
R visitForPartsWithExpression(ForPartsWithExpression node) => visitNode(node);
@override
R visitForStatement(ForStatement node) => visitNode(node);
@override
R visitFunctionDeclaration(FunctionDeclaration node) => visitNode(node);
@override
R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) =>
visitNode(node);
@override
R visitFunctionExpression(FunctionExpression node) => visitNode(node);
@override
R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
visitNode(node);
@override
R visitFunctionTypeAlias(FunctionTypeAlias node) => visitNode(node);
@override
R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) =>
visitNode(node);
@override
R visitGenericFunctionType(GenericFunctionType node) => visitNode(node);
@override
R visitGenericTypeAlias(GenericTypeAlias node) => visitNode(node);
@override
R visitHideCombinator(HideCombinator node) => visitNode(node);
@override
R visitIfElement(IfElement node) => visitNode(node);
@override
R visitIfStatement(IfStatement node) => visitNode(node);
@override
R visitImplementsClause(ImplementsClause node) => visitNode(node);
@override
R visitImportDirective(ImportDirective node) => visitNode(node);
@override
R visitIndexExpression(IndexExpression node) => visitNode(node);
@override
R visitInstanceCreationExpression(InstanceCreationExpression node) =>
visitNode(node);
@override
R visitIntegerLiteral(IntegerLiteral node) => visitNode(node);
@override
R visitInterpolationExpression(InterpolationExpression node) =>
visitNode(node);
@override
R visitInterpolationString(InterpolationString node) => visitNode(node);
@override
R visitIsExpression(IsExpression node) => visitNode(node);
@override
R visitLabel(Label node) => visitNode(node);
@override
R visitLabeledStatement(LabeledStatement node) => visitNode(node);
@override
R visitLibraryDirective(LibraryDirective node) => visitNode(node);
@override
R visitLibraryIdentifier(LibraryIdentifier node) => visitNode(node);
@override
R visitListLiteral(ListLiteral node) => visitNode(node);
@override
R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node);
@override
R visitMethodDeclaration(MethodDeclaration node) => visitNode(node);
@override
R visitMethodInvocation(MethodInvocation node) => visitNode(node);
@override
R visitMixinDeclaration(MixinDeclaration node) => visitNode(node);
@override
R visitNamedExpression(NamedExpression node) => visitNode(node);
@override
R visitNativeClause(NativeClause node) => visitNode(node);
@override
R visitNativeFunctionBody(NativeFunctionBody node) => visitNode(node);
R visitNode(AstNode node) {
node.visitChildren(this);
return null;
}
@override
R visitNullLiteral(NullLiteral node) => visitNode(node);
@override
R visitOnClause(OnClause node) => visitNode(node);
@override
R visitParenthesizedExpression(ParenthesizedExpression node) =>
visitNode(node);
@override
R visitPartDirective(PartDirective node) => visitNode(node);
@override
R visitPartOfDirective(PartOfDirective node) => visitNode(node);
@override
R visitPostfixExpression(PostfixExpression node) => visitNode(node);
@override
R visitPrefixedIdentifier(PrefixedIdentifier node) => visitNode(node);
@override
R visitPrefixExpression(PrefixExpression node) => visitNode(node);
@override
R visitPropertyAccess(PropertyAccess node) => visitNode(node);
@override
R visitRedirectingConstructorInvocation(
RedirectingConstructorInvocation node) =>
visitNode(node);
@override
R visitRethrowExpression(RethrowExpression node) => visitNode(node);
@override
R visitReturnStatement(ReturnStatement node) => visitNode(node);
@override
R visitScriptTag(ScriptTag scriptTag) => visitNode(scriptTag);
@override
R visitSetOrMapLiteral(SetOrMapLiteral node) => visitNode(node);
@override
R visitShowCombinator(ShowCombinator node) => visitNode(node);
@override
R visitSimpleFormalParameter(SimpleFormalParameter node) => visitNode(node);
@override
R visitSimpleIdentifier(SimpleIdentifier node) => visitNode(node);
@override
R visitSimpleStringLiteral(SimpleStringLiteral node) => visitNode(node);
@override
R visitSpreadElement(SpreadElement node) => visitNode(node);
@override
R visitStringInterpolation(StringInterpolation node) => visitNode(node);
@override
R visitSuperConstructorInvocation(SuperConstructorInvocation node) =>
visitNode(node);
@override
R visitSuperExpression(SuperExpression node) => visitNode(node);
@override
R visitSwitchCase(SwitchCase node) => visitNode(node);
@override
R visitSwitchDefault(SwitchDefault node) => visitNode(node);
@override
R visitSwitchStatement(SwitchStatement node) => visitNode(node);
@override
R visitSymbolLiteral(SymbolLiteral node) => visitNode(node);
@override
R visitThisExpression(ThisExpression node) => visitNode(node);
@override
R visitThrowExpression(ThrowExpression node) => visitNode(node);
@override
R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) =>
visitNode(node);
@override
R visitTryStatement(TryStatement node) => visitNode(node);
@override
R visitTypeArgumentList(TypeArgumentList node) => visitNode(node);
@override
R visitTypeName(TypeName node) => visitNode(node);
@override
R visitTypeParameter(TypeParameter node) => visitNode(node);
@override
R visitTypeParameterList(TypeParameterList node) => visitNode(node);
@override
R visitVariableDeclaration(VariableDeclaration node) => visitNode(node);
@override
R visitVariableDeclarationList(VariableDeclarationList node) =>
visitNode(node);
@override
R visitVariableDeclarationStatement(VariableDeclarationStatement node) =>
visitNode(node);
@override
R visitWhileStatement(WhileStatement node) => visitNode(node);
@override
R visitWithClause(WithClause node) => visitNode(node);
@override
R visitYieldStatement(YieldStatement node) => visitNode(node);
}
/// A helper class used to implement the correct order of visits for a
/// [BreadthFirstVisitor].
class _BreadthFirstChildVisitor extends UnifyingAstVisitor<void> {
/// The [BreadthFirstVisitor] being helped by this visitor.
final BreadthFirstVisitor outerVisitor;
/// Initialize a newly created visitor to help the [outerVisitor].
_BreadthFirstChildVisitor(this.outerVisitor);
@override
void visitNode(AstNode node) {
outerVisitor._queue.add(node);
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/element/type_system.dart | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/element/type.dart';
import 'package:meta/meta.dart';
/// A representation of the operations defined for the type system.
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeSystem {
/// Return the result of applying the function "flatten" to the given [type].
///
/// For the Dart 2.0 type system, the function is defined in the Dart Language
/// Specification, section 16.11 Function Expressions:
///
/// > We define the auxiliary function _flatten(T)_, which is used below and
/// > in other sections, as follows:
/// >
/// > * If _T_ is `FutureOr<`_S_`>` for some _S_ then _flatten(T)_ = _S_.
/// >
/// > * Otherwise if _T_ <: `Future` then let _S_ be a type such that _T_ <:
/// > `Future<`_S_`>` and for all _R_, if _T_ <: `Future<`_R_`>` then _S_ <:
/// > _R_. This ensures that `Future<`_S_`>` is the most specific generic
/// > instantiation of `Future` that is a supertype of _T_. Note that _S_ is
/// > well-defined because of the requirements on superinterfaces. Then
/// > _flatten(T)_ = _S_.
/// >
/// > * In any other circumstance, _flatten(T)_ = _T_.
///
/// The subtype relationship (<:) can be tested using [isSubtypeOf].
///
/// Other type systems may define this operation differently.
DartType flatten(DartType type);
/// Return `true` if the [leftType] is assignable to the [rightType].
///
/// For the Dart 2.0 type system, the definition of this relationship is given
/// in the Dart Language Specification, section 19.4 Subtypes:
///
/// > A type _T_ may be assigned to a type _S_ in an environment Γ,
/// > written Γ ⊢ _T_ ⇔ _S_, iff either Γ ⊢ _S_
/// > <: _T_ or Γ ⊢ _T_ <: _S_. In this case we say that the types
/// > _S_ and _T_ are assignable.
///
/// The subtype relationship (<:) can be tested using [isSubtypeOf].
///
/// Other type systems may define this operation differently. In particular,
/// while the operation is commutative in the Dart 2.0 type system, it will
/// not be commutative when NNBD is enabled, so the order of the arguments is
/// important.
bool isAssignableTo(DartType leftType, DartType rightType);
/// Return `true` if the [type] is a non-nullable type.
///
/// We say that a type `T` is non-nullable if `T <: Object`. This is
/// equivalent to the syntactic criterion that `T` is any of:
/// - `Object`, `int`, `bool`, `Never`, `Function`
/// - Any function type
/// - Any class type or generic class type
/// - `FutureOr<S>` where `S` is non-nullable
/// - `X extends S` where `S` is non-nullable
/// - `X & S` where `S` is non-nullable
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
@experimental
bool isNonNullable(DartType type);
/// Return `true` if the [type] is a nullable type.
///
/// We say that a type `T` is nullable if `Null <: T`. This is equivalent to
/// the syntactic criterion that `T` is any of:
/// - `Null`
/// - `S?` for some `S`
/// - `FutureOr<S>` for some `S` where `S` is nullable
/// - `dynamic`
/// - `void`
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
@experimental
bool isNullable(DartType type);
/// Return `true` if the [type] is a potentially non-nullable type.
///
/// We say that a type `T` is potentially non-nullable if `T` is not nullable.
/// Note that this is different from saying that `T` is non-nullable. For
/// example, a type variable `X extends Object?` is a type which is
/// potentially non-nullable but not non-nullable.
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
@experimental
bool isPotentiallyNonNullable(DartType type);
/// Return `true` if the [type] is a potentially nullable type.
///
/// We say that a type `T` is potentially nullable if `T` is not non-nullable.
/// Note that this is different from saying that `T` is nullable. For example,
/// a type variable `X extends Object?` is a type which is potentially
/// nullable but not nullable.
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
@experimental
bool isPotentiallyNullable(DartType type);
/// Return `true` if the [leftType] is a subtype of the [rightType].
///
/// For the Dart 2.0 type system, the rules governing the subtype relationship
/// are given in the Dart Language Specification, section 19.4 Subtypes.
///
/// Other type systems may define this operation differently.
bool isSubtypeOf(DartType leftType, DartType rightType);
/// Compute the least upper bound of two types. This operation if commutative,
/// meaning that `leastUpperBound(t, s) == leastUpperBound(s, t)` for all `t`
/// and `s`.
///
/// For the Dart 2.0 type system, the definition of the least upper bound is
/// given in the Dart Language Specification, section 19.9.2 Least Upper
/// Bounds.
///
/// Other type systems may define this operation differently.
DartType leastUpperBound(DartType leftType, DartType rightType);
/// Returns a non-nullable version of [type]. This is equivalent to the
/// operation `NonNull` defined in the spec.
DartType promoteToNonNull(DartType type);
/// Return the result of resolving the bounds of the given [type].
///
/// For the Dart 2.0 type system, the definition of resolving to bounds is
/// defined by the following. If the given [type] is a [TypeParameterType] and
/// it has a bound, return the result of resolving its bound (as per this
/// method). If the [type] is a [TypeParameterType] and it does not have a
/// bound, return the type `Object`. For any other type, return the given
/// type.
///
/// Other type systems may define this operation differently.
DartType resolveToBound(DartType type);
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/element/element.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Defines the element model. The element model describes the semantic (as
/// opposed to syntactic) structure of Dart code. The syntactic structure of the
/// code is modeled by the [AST
/// structure](../analyzer.dart.ast.ast/analyzer.dart.ast.ast-library.html).
///
/// The element model consists of two closely related kinds of objects: elements
/// (instances of a subclass of [Element]) and types. This library defines the
/// elements, the types are defined in
/// [type.dart](../dart_element_type/dart_element_type-library.html).
///
/// Generally speaking, an element represents something that is declared in the
/// code, such as a class, method, or variable. Elements are organized in a tree
/// structure in which the children of an element are the elements that are
/// logically (and often syntactically) part of the declaration of the parent.
/// For example, the elements representing the methods and fields in a class are
/// children of the element representing the class.
///
/// Every complete element structure is rooted by an instance of the class
/// [LibraryElement]. A library element represents a single Dart library. Every
/// library is defined by one or more compilation units (the library and all of
/// its parts). The compilation units are represented by the class
/// [CompilationUnitElement] and are children of the library that is defined by
/// them. Each compilation unit can contain zero or more top-level declarations,
/// such as classes, functions, and variables. Each of these is in turn
/// represented as an element that is a child of the compilation unit. Classes
/// contain methods and fields, methods can contain local variables, etc.
///
/// The element model does not contain everything in the code, only those things
/// that are declared by the code. For example, it does not include any
/// representation of the statements in a method body, but if one of those
/// statements declares a local variable then the local variable will be
/// represented by an element.
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/constant/value.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/constant/evaluation.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
import 'package:meta/meta.dart';
/// An element that represents a class or a mixin. The class can be defined by
/// either a class declaration (with a class body), a mixin application (without
/// a class body), a mixin declaration, or an enum declaration.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ClassElement
implements TypeDefiningElement, TypeParameterizedElement {
/// Return a list containing all of the accessors (getters and setters)
/// declared in this class.
List<PropertyAccessorElement> get accessors;
/// Return a list containing all the supertypes defined for this class and its
/// supertypes. This includes superclasses, mixins, interfaces and superclass
/// constraints.
List<InterfaceType> get allSupertypes;
/// Return a list containing all of the constructors declared in this class.
/// The list will be empty if there are no constructors defined for this
/// class, as is the case when this element represents an enum or a mixin.
List<ConstructorElement> get constructors;
/// Return a list containing all of the fields declared in this class.
List<FieldElement> get fields;
/// Return `true` if this class or its superclass declares a non-final
/// instance field.
bool get hasNonFinalField;
/// Return `true` if this class has at least one reference to `super` (and
/// hence cannot be used as a mixin), or `false` if this element represents a
/// mixin, even if the mixin has a reference to `super`, because it is allowed
/// to be used as a mixin.
bool get hasReferenceToSuper;
/// Return `true` if this class declares a static member.
bool get hasStaticMember;
/// Return a list containing all of the interfaces that are implemented by
/// this class.
///
/// <b>Note:</b> Because the element model represents the state of the code,
/// it is possible for it to be semantically invalid. In particular, it is not
/// safe to assume that the inheritance structure of a class does not contain
/// a cycle. Clients that traverse the inheritance structure must explicitly
/// guard against infinite loops.
List<InterfaceType> get interfaces;
/// Return `true` if this class is abstract. A class is abstract if it has an
/// explicit `abstract` modifier or if it is implicitly abstract, such as a
/// class defined by a mixin declaration. Note, that this definition of
/// <i>abstract</i> is different from <i>has unimplemented members</i>.
bool get isAbstract;
/// Return `true` if this class represents the class 'Object' defined in the
/// dart:core library.
bool get isDartCoreObject;
/// Return `true` if this class is defined by an enum declaration.
bool get isEnum;
/// Return `true` if this class is defined by a mixin declaration.
bool get isMixin;
/// Return `true` if this class is a mixin application. A class is a mixin
/// application if it was declared using the syntax "class A = B with C;".
bool get isMixinApplication;
/// Return `true` if this class [isProxy], or if it inherits the proxy
/// annotation from a supertype.
bool get isOrInheritsProxy;
/// Return `true` if this element has an annotation of the form '@proxy'.
bool get isProxy;
/// Return `true` if this class can validly be used as a mixin when defining
/// another class. For classes defined by a mixin declaration, the result is
/// always `true`. For classes defined by a class declaration or a mixin
/// application, the behavior of this method is defined by the Dart Language
/// Specification in section 9:
/// <blockquote>
/// It is a compile-time error if a declared or derived mixin refers to super.
/// It is a compile-time error if a declared or derived mixin explicitly
/// declares a constructor. It is a compile-time error if a mixin is derived
/// from a class whose superclass is not Object.
/// </blockquote>
bool get isValidMixin;
/// Return a list containing all of the methods declared in this class.
List<MethodElement> get methods;
/// Return a list containing all of the mixins that are applied to the class
/// being extended in order to derive the superclass of this class.
///
/// <b>Note:</b> Because the element model represents the state of the code,
/// it is possible for it to be semantically invalid. In particular, it is not
/// safe to assume that the inheritance structure of a class does not contain
/// a cycle. Clients that traverse the inheritance structure must explicitly
/// guard against infinite loops.
List<InterfaceType> get mixins;
/// Return a list containing all of the superclass constraints defined for
/// this class. The list will be empty if this class does not represent a
/// mixin declaration. If this class _does_ represent a mixin declaration but
/// the declaration does not have an `on` clause, then the list will contain
/// the type for the class `Object`.
///
/// <b>Note:</b> Because the element model represents the state of the code,
/// it is possible for it to be semantically invalid. In particular, it is not
/// safe to assume that the inheritance structure of a class does not contain
/// a cycle. Clients that traverse the inheritance structure must explicitly
/// guard against infinite loops.
List<InterfaceType> get superclassConstraints;
/// Return the superclass of this class, or `null` if either the class
/// represents the class 'Object' or if the class represents a mixin
/// declaration. All other classes will have a non-`null` superclass. If the
/// superclass was not explicitly declared then the implicit superclass
/// 'Object' will be returned.
///
/// <b>Note:</b> Because the element model represents the state of the code,
/// it is possible for it to be semantically invalid. In particular, it is not
/// safe to assume that the inheritance structure of a class does not contain
/// a cycle. Clients that traverse the inheritance structure must explicitly
/// guard against infinite loops.
InterfaceType get supertype;
/// Return the type of `this` expression for this class.
///
/// For a class like `class MyClass<T, U> {}` the returned type is equivalent
/// to the type `MyClass<T, U>`. So, the type arguments are the types of the
/// type parameters, and either `none` or `star` nullability suffix is used
/// for the type arguments, and the returned type depending on the
/// nullability status of the declaring library.
InterfaceType get thisType;
@override
InterfaceType get type;
/// Return the unnamed constructor declared in this class, or `null` if either
/// this class does not declare an unnamed constructor but does declare named
/// constructors or if this class represents a mixin declaration. The returned
/// constructor will be synthetic if this class does not declare any
/// constructors, in which case it will represent the default constructor for
/// the class.
ConstructorElement get unnamedConstructor;
@deprecated
@override
NamedCompilationUnitMember computeNode();
/// Return the field (synthetic or explicit) defined in this class that has
/// the given [name], or `null` if this class does not define a field with the
/// given name.
FieldElement getField(String name);
/// Return the element representing the getter with the given [name] that is
/// declared in this class, or `null` if this class does not declare a getter
/// with the given name.
PropertyAccessorElement getGetter(String name);
/// Return the element representing the method with the given [name] that is
/// declared in this class, or `null` if this class does not declare a method
/// with the given name.
MethodElement getMethod(String name);
/// Return the named constructor declared in this class with the given [name],
/// or `null` if this class does not declare a named constructor with the
/// given name.
ConstructorElement getNamedConstructor(String name);
/// Return the element representing the setter with the given [name] that is
/// declared in this class, or `null` if this class does not declare a setter
/// with the given name.
PropertyAccessorElement getSetter(String name);
/// Create the [InterfaceType] for this class with the given [typeArguments]
/// and [nullabilitySuffix].
InterfaceType instantiate({
@required List<DartType> typeArguments,
@required NullabilitySuffix nullabilitySuffix,
});
/// Return the element representing the method that results from looking up
/// the given [methodName] in this class with respect to the given [library],
/// ignoring abstract methods, or `null` if the look up fails. The behavior of
/// this method is defined by the Dart Language Specification in section
/// 16.15.1:
/// <blockquote>
/// The result of looking up method <i>m</i> in class <i>C</i> with respect to
/// library <i>L</i> is: If <i>C</i> declares an instance method named
/// <i>m</i> that is accessible to <i>L</i>, then that method is the result of
/// the lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then the
/// result of the lookup is the result of looking up method <i>m</i> in
/// <i>S</i> with respect to <i>L</i>. Otherwise, we say that the lookup has
/// failed.
/// </blockquote>
MethodElement lookUpConcreteMethod(String methodName, LibraryElement library);
/// Return the element representing the getter that results from looking up
/// the given [getterName] in this class with respect to the given [library],
/// or `null` if the look up fails. The behavior of this method is defined by
/// the Dart Language Specification in section 16.15.2:
/// <blockquote>
/// The result of looking up getter (respectively setter) <i>m</i> in class
/// <i>C</i> with respect to library <i>L</i> is: If <i>C</i> declares an
/// instance getter (respectively setter) named <i>m</i> that is accessible to
/// <i>L</i>, then that getter (respectively setter) is the result of the
/// lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result
/// of the lookup is the result of looking up getter (respectively setter)
/// <i>m</i> in <i>S</i> with respect to <i>L</i>. Otherwise, we say that the
/// lookup has failed.
/// </blockquote>
PropertyAccessorElement lookUpGetter(
String getterName, LibraryElement library);
/// Return the element representing the getter that results from looking up
/// the given [getterName] in the superclass of this class with respect to the
/// given [library], ignoring abstract getters, or `null` if the look up
/// fails. The behavior of this method is defined by the Dart Language
/// Specification in section 16.15.2:
/// <blockquote>
/// The result of looking up getter (respectively setter) <i>m</i> in class
/// <i>C</i> with respect to library <i>L</i> is: If <i>C</i> declares an
/// instance getter (respectively setter) named <i>m</i> that is accessible to
/// <i>L</i>, then that getter (respectively setter) is the result of the
/// lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result
/// of the lookup is the result of looking up getter (respectively setter)
/// <i>m</i> in <i>S</i> with respect to <i>L</i>. Otherwise, we say that the
/// lookup has failed.
/// </blockquote>
PropertyAccessorElement lookUpInheritedConcreteGetter(
String getterName, LibraryElement library);
/// Return the element representing the method that results from looking up
/// the given [methodName] in the superclass of this class with respect to the
/// given [library], ignoring abstract methods, or `null` if the look up
/// fails. The behavior of this method is defined by the Dart Language
/// Specification in section 16.15.1:
/// <blockquote>
/// The result of looking up method <i>m</i> in class <i>C</i> with respect to
/// library <i>L</i> is: If <i>C</i> declares an instance method named
/// <i>m</i> that is accessible to <i>L</i>, then that method is the result of
/// the lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then the
/// result of the lookup is the result of looking up method <i>m</i> in
/// <i>S</i> with respect to <i>L</i>. Otherwise, we say that the lookup has
/// failed.
/// </blockquote>
MethodElement lookUpInheritedConcreteMethod(
String methodName, LibraryElement library);
/// Return the element representing the setter that results from looking up
/// the given [setterName] in the superclass of this class with respect to the
/// given [library], ignoring abstract setters, or `null` if the look up
/// fails. The behavior of this method is defined by the Dart Language
/// Specification in section 16.15.2:
/// <blockquote>
/// The result of looking up getter (respectively setter) <i>m</i> in class
/// <i>C</i> with respect to library <i>L</i> is: If <i>C</i> declares an
/// instance getter (respectively setter) named <i>m</i> that is accessible to
/// <i>L</i>, then that getter (respectively setter) is the result of the
/// lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result
/// of the lookup is the result of looking up getter (respectively setter)
/// <i>m</i> in <i>S</i> with respect to <i>L</i>. Otherwise, we say that the
/// lookup has failed.
/// </blockquote>
PropertyAccessorElement lookUpInheritedConcreteSetter(
String setterName, LibraryElement library);
/// Return the element representing the method that results from looking up
/// the given [methodName] in the superclass of this class with respect to the
/// given [library], or `null` if the look up fails. The behavior of this
/// method is defined by the Dart Language Specification in section 16.15.1:
/// <blockquote>
/// The result of looking up method <i>m</i> in class <i>C</i> with respect to
/// library <i>L</i> is: If <i>C</i> declares an instance method named
/// <i>m</i> that is accessible to <i>L</i>, then that method is the result of
/// the lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then the
/// result of the lookup is the result of looking up method <i>m</i> in
/// <i>S</i> with respect to <i>L</i>. Otherwise, we say that the lookup has
/// failed.
/// </blockquote>
MethodElement lookUpInheritedMethod(
String methodName, LibraryElement library);
/// Return the element representing the method that results from looking up
/// the given [methodName] in this class with respect to the given [library],
/// or `null` if the look up fails. The behavior of this method is defined by
/// the Dart Language Specification in section 16.15.1:
/// <blockquote>
/// The result of looking up method <i>m</i> in class <i>C</i> with respect to
/// library <i>L</i> is: If <i>C</i> declares an instance method named
/// <i>m</i> that is accessible to <i>L</i>, then that method is the result of
/// the lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then the
/// result of the lookup is the result of looking up method <i>m</i> in
/// <i>S</i> with respect to <i>L</i>. Otherwise, we say that the lookup has
/// failed.
/// </blockquote>
MethodElement lookUpMethod(String methodName, LibraryElement library);
/// Return the element representing the setter that results from looking up
/// the given [setterName] in this class with respect to the given [library],
/// or `null` if the look up fails. The behavior of this method is defined by
/// the Dart Language Specification in section 16.15.2:
/// <blockquote>
/// The result of looking up getter (respectively setter) <i>m</i> in class
/// <i>C</i> with respect to library <i>L</i> is: If <i>C</i> declares an
/// instance getter (respectively setter) named <i>m</i> that is accessible to
/// <i>L</i>, then that getter (respectively setter) is the result of the
/// lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result
/// of the lookup is the result of looking up getter (respectively setter)
/// <i>m</i> in <i>S</i> with respect to <i>L</i>. Otherwise, we say that the
/// lookup has failed.
/// </blockquote>
PropertyAccessorElement lookUpSetter(
String setterName, LibraryElement library);
}
/// An element that is contained within a [ClassElement].
///
/// When the 'extension-methods' experiment is enabled, these elements can also
/// be contained within an extension element.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ClassMemberElement implements Element {
// TODO(brianwilkerson) Either remove this class or rename it to something
// more correct.
/// Return `true` if this element is a static element. A static element is an
/// element that is not associated with a particular instance, but rather with
/// an entire library or class.
bool get isStatic;
}
/// An element representing a compilation unit.
///
/// Clients may not extend, implement or mix-in this class.
abstract class CompilationUnitElement implements Element, UriReferencedElement {
/// Return a list containing all of the top-level accessors (getters and
/// setters) contained in this compilation unit.
List<PropertyAccessorElement> get accessors;
@override
LibraryElement get enclosingElement;
/// Return a list containing all of the enums contained in this compilation
/// unit.
List<ClassElement> get enums;
/// Return a list containing all of the extensions contained in this
/// compilation unit.
List<ExtensionElement> get extensions;
/// Return a list containing all of the top-level functions contained in this
/// compilation unit.
List<FunctionElement> get functions;
/// Return a list containing all of the function type aliases contained in
/// this compilation unit.
List<FunctionTypeAliasElement> get functionTypeAliases;
/// Return `true` if this compilation unit defines a top-level function named
/// `loadLibrary`.
bool get hasLoadLibraryFunction;
/// Return the [LineInfo] for the [source], or `null` if not computed yet.
LineInfo get lineInfo;
/// Return a list containing all of the mixins contained in this compilation
/// unit.
List<ClassElement> get mixins;
/// Return a list containing all of the top-level variables contained in this
/// compilation unit.
List<TopLevelVariableElement> get topLevelVariables;
/// Return a list containing all of the classes contained in this compilation
/// unit.
List<ClassElement> get types;
@deprecated
@override
CompilationUnit computeNode();
/// Return the enum defined in this compilation unit that has the given
/// [name], or `null` if this compilation unit does not define an enum with
/// the given name.
ClassElement getEnum(String name);
/// Return the class defined in this compilation unit that has the given
/// [name], or `null` if this compilation unit does not define a class with
/// the given name.
ClassElement getType(String name);
}
/// An element representing a constructor or a factory method defined within a
/// class.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ConstructorElement
implements ClassMemberElement, ExecutableElement, ConstantEvaluationTarget {
@override
ClassElement get enclosingElement;
/// Return `true` if this constructor is a const constructor.
bool get isConst;
/// Return `true` if this constructor can be used as a default constructor -
/// unnamed and has no required parameters.
bool get isDefaultConstructor;
/// Return `true` if this constructor represents a factory constructor.
bool get isFactory;
/// Return the offset of the character immediately following the last
/// character of this constructor's name, or `null` if not named.
int get nameEnd;
/// Return the offset of the `.` before this constructor name, or `null` if
/// not named.
int get periodOffset;
/// Return the constructor to which this constructor is redirecting, or `null`
/// if this constructor does not redirect to another constructor or if the
/// library containing this constructor has not yet been resolved.
ConstructorElement get redirectedConstructor;
@deprecated
@override
ConstructorDeclaration computeNode();
}
/// The base class for all of the elements in the element model. Generally
/// speaking, the element model is a semantic model of the program that
/// represents things that are declared with a name and hence can be referenced
/// elsewhere in the code.
///
/// There are two exceptions to the general case. First, there are elements in
/// the element model that are created for the convenience of various kinds of
/// analysis but that do not have any corresponding declaration within the
/// source code. Such elements are marked as being <i>synthetic</i>. Examples of
/// synthetic elements include
/// * default constructors in classes that do not define any explicit
/// constructors,
/// * getters and setters that are induced by explicit field declarations,
/// * fields that are induced by explicit declarations of getters and setters,
/// and
/// * functions representing the initialization expression for a variable.
///
/// Second, there are elements in the element model that do not have a name.
/// These correspond to unnamed functions and exist in order to more accurately
/// represent the semantic structure of the program.
///
/// Clients may not extend, implement or mix-in this class.
abstract class Element implements AnalysisTarget {
/// A comparator that can be used to sort elements by their name offset.
/// Elements with a smaller offset will be sorted to be before elements with a
/// larger name offset.
static final Comparator<Element> SORT_BY_OFFSET =
(Element firstElement, Element secondElement) =>
firstElement.nameOffset - secondElement.nameOffset;
/// Return the analysis context in which this element is defined.
AnalysisContext get context;
/// Return the display name of this element, or `null` if this element does
/// not have a name.
///
/// In most cases the name and the display name are the same. Differences
/// though are cases such as setters where the name of some setter `set f(x)`
/// is `f=`, instead of `f`.
String get displayName;
/// Return the content of the documentation comment (including delimiters) for
/// this element, or `null` if this element does not or cannot have
/// documentation.
String get documentationComment;
/// Return the element that either physically or logically encloses this
/// element. This will be `null` if this element is a library because
/// libraries are the top-level elements in the model.
Element get enclosingElement;
/// Return `true` if this element has an annotation of the form
/// `@alwaysThrows`.
bool get hasAlwaysThrows;
/// Return `true` if this element has an annotation of the form `@deprecated`
/// or `@Deprecated('..')`.
bool get hasDeprecated;
/// Return `true` if this element has an annotation of the form `@factory`.
bool get hasFactory;
/// Return `true` if this element has an annotation of the form `@isTest`.
bool get hasIsTest;
/// Return `true` if this element has an annotation of the form
/// `@isTestGroup`.
bool get hasIsTestGroup;
/// Return `true` if this element has an annotation of the form `@JS(..)`.
bool get hasJS;
/// Return `true` if this element has an annotation of the form `@literal`.
bool get hasLiteral;
/// Return `true` if this element has an annotation of the form `@mustCallSuper`.
bool get hasMustCallSuper;
/// Return `true` if this element has an annotation of the form
/// `@optionalTypeArgs`.
bool get hasOptionalTypeArgs;
/// Return `true` if this element has an annotation of the form `@override`.
bool get hasOverride;
/// Return `true` if this element has an annotation of the form `@protected`.
bool get hasProtected;
/// Return `true` if this element has an annotation of the form `@required`.
bool get hasRequired;
/// Return `true` if this element has an annotation of the form `@sealed`.
bool get hasSealed;
/// Return `true` if this element has an annotation of the form
/// `@visibleForTemplate`.
bool get hasVisibleForTemplate;
/// Return `true` if this element has an annotation of the form
/// `@visibleForTesting`.
bool get hasVisibleForTesting;
/// The unique integer identifier of this element.
int get id;
/// Return `true` if this element has an annotation of the form
/// '@alwaysThrows'.
@deprecated
bool get isAlwaysThrows;
/// Return `true` if this element has an annotation of the form '@deprecated'
/// or '@Deprecated('..')'.
@deprecated
bool get isDeprecated;
/// Return `true` if this element has an annotation of the form '@factory'.
@deprecated
bool get isFactory;
/// Return `true` if this element has an annotation of the form '@JS(..)'.
@deprecated
bool get isJS;
/// Return `true` if this element has an annotation of the form '@override'.
@deprecated
bool get isOverride;
/// Return `true` if this element is private. Private elements are visible
/// only within the library in which they are declared.
bool get isPrivate;
/// Return `true` if this element has an annotation of the form '@protected'.
@deprecated
bool get isProtected;
/// Return `true` if this element is public. Public elements are visible
/// within any library that imports the library in which they are declared.
bool get isPublic;
/// Return `true` if this element has an annotation of the form '@required'.
@deprecated
bool get isRequired;
/// Return `true` if this element is synthetic. A synthetic element is an
/// element that is not represented in the source code explicitly, but is
/// implied by the source code, such as the default constructor for a class
/// that does not explicitly define any constructors.
bool get isSynthetic;
/// Return `true` if this element has an annotation of the form
/// '@visibleForTesting'.
@deprecated
bool get isVisibleForTesting;
/// Return the kind of element that this is.
ElementKind get kind;
/// Return the library that contains this element. This will be the element
/// itself if it is a library element. This will be `null` if this element is
/// an HTML file because HTML files are not contained in libraries.
LibraryElement get library;
/// Return an object representing the location of this element in the element
/// model. The object can be used to locate this element at a later time.
ElementLocation get location;
/// Return a list containing all of the metadata associated with this element.
/// The array will be empty if the element does not have any metadata or if
/// the library containing this element has not yet been resolved.
List<ElementAnnotation> get metadata;
/// Return the name of this element, or `null` if this element does not have a
/// name.
String get name;
/// Return the length of the name of this element in the file that contains
/// the declaration of this element, or `0` if this element does not have a
/// name.
int get nameLength;
/// Return the offset of the name of this element in the file that contains
/// the declaration of this element, or `-1` if this element is synthetic,
/// does not have a name, or otherwise does not have an offset.
int get nameOffset;
/// Return the analysis session in which this element is defined.
AnalysisSession get session;
@override
Source get source;
/// Return the resolved [CompilationUnit] that declares this element, or
/// `null` if this element is synthetic.
///
/// This method is expensive, because resolved AST might have been already
/// evicted from cache, so parsing and resolving will be performed.
@deprecated
CompilationUnit get unit;
/// Use the given [visitor] to visit this element. Return the value returned
/// by the visitor as a result of visiting this element.
T accept<T>(ElementVisitor<T> visitor);
/// Return the documentation comment for this element as it appears in the
/// original source (complete with the beginning and ending delimiters), or
/// `null` if this element does not have a documentation comment associated
/// with it. This can be a long-running operation if the information needed to
/// access the comment is not cached.
///
/// Throws [AnalysisException] if the documentation comment could not be
/// determined because the analysis could not be performed
///
/// Deprecated. Use [documentationComment] instead.
@deprecated
String computeDocumentationComment();
/// Return the resolved [AstNode] node that declares this element, or `null`
/// if this element is synthetic or isn't contained in a compilation unit,
/// such as a [LibraryElement].
///
/// This method is expensive, because resolved AST might be evicted from
/// cache, so parsing and resolving will be performed.
///
/// <b>Note:</b> This method cannot be used in an async environment.
@deprecated
AstNode computeNode();
/// Return the most immediate ancestor of this element for which the
/// [predicate] returns `true`, or `null` if there is no such ancestor. Note
/// that this element will never be returned.
E getAncestor<E extends Element>(Predicate<Element> predicate);
/// Return a display name for the given element that includes the path to the
/// compilation unit in which the type is defined. If [shortName] is `null`
/// then [displayName] will be used as the name of this element. Otherwise
/// the provided name will be used.
// TODO(brianwilkerson) Make the parameter optional.
String getExtendedDisplayName(String shortName);
/// Return `true` if this element, assuming that it is within scope, is
/// accessible to code in the given [library]. This is defined by the Dart
/// Language Specification in section 3.2:
/// <blockquote>
/// A declaration <i>m</i> is accessible to library <i>L</i> if <i>m</i> is
/// declared in <i>L</i> or if <i>m</i> is public.
/// </blockquote>
bool isAccessibleIn(LibraryElement library);
/// Use the given [visitor] to visit all of the children of this element.
/// There is no guarantee of the order in which the children will be visited.
void visitChildren(ElementVisitor visitor);
}
/// A single annotation associated with an element.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ElementAnnotation implements ConstantEvaluationTarget {
/// Return the errors that were produced while computing a value for this
/// annotation, or `null` if no value has been computed. If a value has been
/// produced but no errors were generated, then the list will be empty.
List<AnalysisError> get constantEvaluationErrors;
/// Return a representation of the value of this annotation, or `null` if the
/// value of this annotation has not been computed or if the value could not
/// be computed because of errors.
DartObject get constantValue;
/// Return the element representing the field, variable, or const constructor
/// being used as an annotation.
Element get element;
/// Return `true` if this annotation marks the associated function as always
/// throwing.
bool get isAlwaysThrows;
/// Return `true` if this annotation marks the associated element as being
/// deprecated.
bool get isDeprecated;
/// Return `true` if this annotation marks the associated member as a factory.
bool get isFactory;
/// Return `true` if this annotation marks the associated class and its
/// subclasses as being immutable.
bool get isImmutable;
/// Return `true` if this annotation marks the associated member as running
/// a single test.
bool get isIsTest;
/// Return `true` if this annotation marks the associated member as running
/// a test group.
bool get isIsTestGroup;
/// Return `true` if this annotation marks the associated element with the
/// `JS` annotation.
bool get isJS;
/// Return `true` if this annotation marks the associated constructor as
/// being literal.
bool get isLiteral;
/// Return `true` if this annotation marks the associated member as requiring
/// overriding methods to call super.
bool get isMustCallSuper;
/// Return `true` if this annotation marks the associated type as
/// having "optional" type arguments.
bool get isOptionalTypeArgs;
/// Return `true` if this annotation marks the associated method as being
/// expected to override an inherited method.
bool get isOverride;
/// Return `true` if this annotation marks the associated member as being
/// protected.
bool get isProtected;
/// Return `true` if this annotation marks the associated class as
/// implementing a proxy object.
bool get isProxy;
/// Return `true` if this annotation marks the associated member as being
/// required.
bool get isRequired;
/// Return `true` if this annotation marks the associated class as being
/// sealed.
bool get isSealed;
/// Return `true` if this annotation marks the associated member as being
/// visible for template files.
bool get isVisibleForTemplate;
/// Return `true` if this annotation marks the associated member as being
/// visible for testing.
bool get isVisibleForTesting;
/// Return a representation of the value of this annotation, forcing the value
/// to be computed if it had not previously been computed, or `null` if the
/// value of this annotation could not be computed because of errors.
DartObject computeConstantValue();
/// Return a textual description of this annotation in a form approximating
/// valid source. The returned string will not be valid source primarily in
/// the case where the annotation itself is not well-formed.
String toSource();
}
/// The kind of elements in the element model.
///
/// Clients may not extend, implement or mix-in this class.
class ElementKind implements Comparable<ElementKind> {
static const ElementKind CLASS = const ElementKind('CLASS', 0, "class");
static const ElementKind COMPILATION_UNIT =
const ElementKind('COMPILATION_UNIT', 1, "compilation unit");
static const ElementKind CONSTRUCTOR =
const ElementKind('CONSTRUCTOR', 2, "constructor");
static const ElementKind DYNAMIC =
const ElementKind('DYNAMIC', 3, "<dynamic>");
static const ElementKind ERROR = const ElementKind('ERROR', 4, "<error>");
static const ElementKind EXPORT =
const ElementKind('EXPORT', 5, "export directive");
static const ElementKind EXTENSION =
const ElementKind('EXTENSION', 24, "extension");
static const ElementKind FIELD = const ElementKind('FIELD', 6, "field");
static const ElementKind FUNCTION =
const ElementKind('FUNCTION', 7, "function");
static const ElementKind GENERIC_FUNCTION_TYPE =
const ElementKind('GENERIC_FUNCTION_TYPE', 8, 'generic function type');
static const ElementKind GETTER = const ElementKind('GETTER', 9, "getter");
static const ElementKind IMPORT =
const ElementKind('IMPORT', 10, "import directive");
static const ElementKind LABEL = const ElementKind('LABEL', 11, "label");
static const ElementKind LIBRARY =
const ElementKind('LIBRARY', 12, "library");
static const ElementKind LOCAL_VARIABLE =
const ElementKind('LOCAL_VARIABLE', 13, "local variable");
static const ElementKind METHOD = const ElementKind('METHOD', 14, "method");
static const ElementKind NAME = const ElementKind('NAME', 15, "<name>");
static const ElementKind NEVER = const ElementKind('NEVER', 16, "<never>");
static const ElementKind PARAMETER =
const ElementKind('PARAMETER', 17, "parameter");
static const ElementKind PREFIX =
const ElementKind('PREFIX', 18, "import prefix");
static const ElementKind SETTER = const ElementKind('SETTER', 19, "setter");
static const ElementKind TOP_LEVEL_VARIABLE =
const ElementKind('TOP_LEVEL_VARIABLE', 20, "top level variable");
static const ElementKind FUNCTION_TYPE_ALIAS =
const ElementKind('FUNCTION_TYPE_ALIAS', 21, "function type alias");
static const ElementKind TYPE_PARAMETER =
const ElementKind('TYPE_PARAMETER', 22, "type parameter");
static const ElementKind UNIVERSE =
const ElementKind('UNIVERSE', 23, "<universe>");
static const List<ElementKind> values = const [
CLASS,
COMPILATION_UNIT,
CONSTRUCTOR,
DYNAMIC,
ERROR,
EXPORT,
FIELD,
FUNCTION,
GENERIC_FUNCTION_TYPE,
GETTER,
IMPORT,
LABEL,
LIBRARY,
LOCAL_VARIABLE,
METHOD,
NAME,
NEVER,
PARAMETER,
PREFIX,
SETTER,
TOP_LEVEL_VARIABLE,
FUNCTION_TYPE_ALIAS,
TYPE_PARAMETER,
UNIVERSE
];
/// The name of this element kind.
final String name;
/// The ordinal value of the element kind.
final int ordinal;
/// The name displayed in the UI for this kind of element.
final String displayName;
/// Initialize a newly created element kind to have the given [displayName].
const ElementKind(this.name, this.ordinal, this.displayName);
@override
int get hashCode => ordinal;
@override
int compareTo(ElementKind other) => ordinal - other.ordinal;
@override
String toString() => name;
/// Return the kind of the given [element], or [ERROR] if the element is
/// `null`. This is a utility method that can reduce the need for null checks
/// in other places.
static ElementKind of(Element element) {
if (element == null) {
return ERROR;
}
return element.kind;
}
}
/// The location of an element within the element model.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ElementLocation {
/// Return the path to the element whose location is represented by this
/// object. Clients must not modify the returned array.
List<String> get components;
/// Return an encoded representation of this location that can be used to
/// create a location that is equal to this location.
String get encoding;
}
/// An object that can be used to visit an element structure.
///
/// Clients may not extend, implement or mix-in this class. There are classes
/// that implement this interface that provide useful default behaviors in
/// `package:analyzer/dart/element/visitor.dart`. A couple of the most useful
/// include
/// * SimpleElementVisitor which implements every visit method by doing nothing,
/// * RecursiveElementVisitor which will cause every node in a structure to be
/// visited, and
/// * ThrowingElementVisitor which implements every visit method by throwing an
/// exception.
abstract class ElementVisitor<R> {
R visitClassElement(ClassElement element);
R visitCompilationUnitElement(CompilationUnitElement element);
R visitConstructorElement(ConstructorElement element);
R visitExportElement(ExportElement element);
R visitExtensionElement(ExtensionElement element);
R visitFieldElement(FieldElement element);
R visitFieldFormalParameterElement(FieldFormalParameterElement element);
R visitFunctionElement(FunctionElement element);
R visitFunctionTypeAliasElement(FunctionTypeAliasElement element);
R visitGenericFunctionTypeElement(GenericFunctionTypeElement element);
R visitImportElement(ImportElement element);
R visitLabelElement(LabelElement element);
R visitLibraryElement(LibraryElement element);
R visitLocalVariableElement(LocalVariableElement element);
R visitMethodElement(MethodElement element);
R visitMultiplyDefinedElement(MultiplyDefinedElement element);
R visitParameterElement(ParameterElement element);
R visitPrefixElement(PrefixElement element);
R visitPropertyAccessorElement(PropertyAccessorElement element);
R visitTopLevelVariableElement(TopLevelVariableElement element);
R visitTypeParameterElement(TypeParameterElement element);
}
/// An element representing an executable object, including functions, methods,
/// constructors, getters, and setters.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExecutableElement implements FunctionTypedElement {
/// Return `true` if this executable element did not have an explicit return
/// type specified for it in the original source. Note that if there was no
/// explicit return type, and if the element model is fully populated, then
/// the [returnType] will not be `null`.
bool get hasImplicitReturnType;
/// Return `true` if this executable element is abstract. Executable elements
/// are abstract if they are not external and have no body.
bool get isAbstract;
/// Return `true` if this executable element has body marked as being
/// asynchronous.
bool get isAsynchronous;
/// Return `true` if this executable element is external. Executable elements
/// are external if they are explicitly marked as such using the 'external'
/// keyword.
bool get isExternal;
/// Return `true` if this executable element has a body marked as being a
/// generator.
bool get isGenerator;
/// Return `true` if this executable element is an operator. The test may be
/// based on the name of the executable element, in which case the result will
/// be correct when the name is legal.
bool get isOperator;
/// Return `true` if this element is a static element. A static element is an
/// element that is not associated with a particular instance, but rather with
/// an entire library or class.
bool get isStatic;
/// Return `true` if this executable element has a body marked as being
/// synchronous.
bool get isSynchronous;
}
/// An export directive within a library.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExportElement implements Element, UriReferencedElement {
/// Return a list containing the combinators that were specified as part of
/// the export directive in the order in which they were specified.
List<NamespaceCombinator> get combinators;
/// Return the library that is exported from this library by this export
/// directive.
LibraryElement get exportedLibrary;
}
/// An element that represents an extension.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExtensionElement implements TypeParameterizedElement {
/// Return a list containing all of the accessors (getters and setters)
/// declared in this extension.
List<PropertyAccessorElement> get accessors;
/// Return the type that is extended by this extension.
DartType get extendedType;
/// Return a list containing all of the fields declared in this extension.
List<FieldElement> get fields;
/// Return a list containing all of the methods declared in this extension.
List<MethodElement> get methods;
/// Return the element representing the getter with the given [name] that is
/// declared in this extension, or `null` if this extension does not declare a
/// getter with the given name.
PropertyAccessorElement /*?*/ getGetter(String name);
/// Return the element representing the method with the given [name] that is
/// declared in this extension, or `null` if this extension does not declare a
/// method with the given name.
MethodElement /*?*/ getMethod(String name);
/// Return the element representing the setter with the given [name] that is
/// declared in this extension, or `null` if this extension does not declare a
/// setter with the given name.
PropertyAccessorElement /*?*/ getSetter(String name);
}
/// A field defined within a class.
///
/// When the 'extension-methods' experiment is enabled, these elements can also
/// be contained within an extension element.
///
/// Clients may not extend, implement or mix-in this class.
abstract class FieldElement
implements ClassMemberElement, PropertyInducingElement {
/// Return `true` if this field was explicitly marked as being covariant.
bool get isCovariant;
/// Return `true` if this element is an enum constant.
bool get isEnumConstant;
/// Return `true` if this element is a static element. A static element is an
/// element that is not associated with a particular instance, but rather with
/// an entire library or class.
bool get isStatic;
/// Returns `true` if this field can be overridden in strong mode.
@deprecated
bool get isVirtual;
@deprecated
@override
AstNode computeNode();
}
/// A field formal parameter defined within a constructor element.
///
/// Clients may not extend, implement or mix-in this class.
abstract class FieldFormalParameterElement implements ParameterElement {
/// Return the field element associated with this field formal parameter, or
/// `null` if the parameter references a field that doesn't exist.
FieldElement get field;
}
/// A (non-method) function. This can be either a top-level function, a local
/// function, a closure, or the initialization expression for a field or
/// variable.
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionElement implements ExecutableElement, LocalElement {
/// The name of the method that can be implemented by a class to allow its
/// instances to be invoked as if they were a function.
static final String CALL_METHOD_NAME = "call";
/// The name of the synthetic function defined for libraries that are
/// deferred.
static final String LOAD_LIBRARY_NAME = "loadLibrary";
/// The name of the function used as an entry point.
static const String MAIN_FUNCTION_NAME = "main";
/// The name of the method that will be invoked if an attempt is made to
/// invoke an undefined method on an object.
static final String NO_SUCH_METHOD_METHOD_NAME = "noSuchMethod";
/// Return `true` if the function is an entry point, i.e. a top-level function
/// and has the name `main`.
bool get isEntryPoint;
@deprecated
@override
FunctionDeclaration computeNode();
}
/// A function type alias (`typedef`).
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionTypeAliasElement
implements FunctionTypedElement, TypeDefiningElement {
@override
CompilationUnitElement get enclosingElement;
/// Return the generic function type element representing the generic function
/// type on the right side of the equals.
GenericFunctionTypeElement get function;
@deprecated
@override
TypeAlias computeNode();
/// Produces the function type resulting from instantiating this typedef with
/// the given type arguments.
///
/// Note that for a generic typedef, this instantiates the typedef, not the
/// generic function type associated with it. So, for example, if the typedef
/// is:
/// typedef F<T> = void Function<U>(T, U);
/// then a single type argument should be provided, and it will be substituted
/// for T.
FunctionType instantiate(List<DartType> argumentTypes);
/// Produces the function type resulting from instantiating this typedef with
/// the given [typeArguments] and [nullabilitySuffix].
///
/// Note that this always instantiates the typedef itself, so for a
/// [GenericTypeAliasElement] the returned [FunctionType] might still be a
/// generic function, with type formals. For example, if the typedef is:
/// typedef F<T> = void Function<U>(T, U);
/// then `F<int>` will produce `void Function<U>(int, U)`.
FunctionType instantiate2({
@required List<DartType> typeArguments,
@required NullabilitySuffix nullabilitySuffix,
});
}
/// An element that has a [FunctionType] as its [type].
///
/// This also provides convenient access to the parameters and return type.
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionTypedElement implements TypeParameterizedElement {
/// Return a list containing all of the parameters defined by this executable
/// element.
List<ParameterElement> get parameters;
/// Return the return type defined by this element. If the element model is
/// fully populated, then the [returnType] will not be `null`, even if no
/// return type was explicitly specified.
DartType get returnType;
/// Return the type defined by this element.
FunctionType get type;
}
/// The pseudo-declaration that defines a generic function type.
///
/// Clients may not extend, implement, or mix-in this class.
abstract class GenericFunctionTypeElement implements FunctionTypedElement {}
/// A [FunctionTypeAliasElement] whose returned function type has a [type]
/// parameter.
///
/// Clients may not extend, implement, or mix-in this class.
abstract class GenericTypeAliasElement implements FunctionTypeAliasElement {}
/// A combinator that causes some of the names in a namespace to be hidden when
/// being imported.
///
/// Clients may not extend, implement or mix-in this class.
abstract class HideElementCombinator implements NamespaceCombinator {
/// Return a list containing the names that are not to be made visible in the
/// importing library even if they are defined in the imported library.
List<String> get hiddenNames;
}
/// A single import directive within a library.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ImportElement implements Element, UriReferencedElement {
/// Return a list containing the combinators that were specified as part of
/// the import directive in the order in which they were specified.
List<NamespaceCombinator> get combinators;
/// Return the library that is imported into this library by this import
/// directive.
LibraryElement get importedLibrary;
/// Return `true` if this import is for a deferred library.
bool get isDeferred;
/// The [Namespace] that this directive contributes to the containing library.
Namespace get namespace;
/// Return the prefix that was specified as part of the import directive, or
/// `null` if there was no prefix specified.
PrefixElement get prefix;
/// Return the offset of the prefix of this import in the file that contains
/// this import directive, or `-1` if this import is synthetic, does not have
/// a prefix, or otherwise does not have an offset.
int get prefixOffset;
}
/// A label associated with a statement.
///
/// Clients may not extend, implement or mix-in this class.
abstract class LabelElement implements Element {
@override
ExecutableElement get enclosingElement;
}
/// A library.
///
/// Clients may not extend, implement or mix-in this class.
abstract class LibraryElement implements Element {
/// Return the compilation unit that defines this library.
CompilationUnitElement get definingCompilationUnit;
/// Return the entry point for this library, or `null` if this library does
/// not have an entry point. The entry point is defined to be a zero argument
/// top-level function whose name is `main`.
FunctionElement get entryPoint;
/// Return a list containing all of the libraries that are exported from this
/// library.
List<LibraryElement> get exportedLibraries;
/// The export [Namespace] of this library, `null` if it has not been
/// computed yet.
Namespace get exportNamespace;
/// Return a list containing all of the exports defined in this library.
List<ExportElement> get exports;
/// Return `true` if the defining compilation unit of this library contains at
/// least one import directive whose URI uses the "dart-ext" scheme.
bool get hasExtUri;
/// Return `true` if this library defines a top-level function named
/// `loadLibrary`.
bool get hasLoadLibraryFunction;
/// Return an identifier that uniquely identifies this element among the
/// children of this element's parent.
String get identifier;
/// Return a list containing all of the libraries that are imported into this
/// library. This includes all of the libraries that are imported using a
/// prefix (also available through the prefixes returned by [getPrefixes]) and
/// those that are imported without a prefix.
List<LibraryElement> get importedLibraries;
/// Return a list containing all of the imports defined in this library.
List<ImportElement> get imports;
/// Return `true` if this library is an application that can be run in the
/// browser.
bool get isBrowserApplication;
/// Return `true` if this library is the dart:async library.
bool get isDartAsync;
/// Return `true` if this library is the dart:core library.
bool get isDartCore;
/// Return `true` if this library is part of the SDK.
bool get isInSdk;
bool get isNonNullableByDefault;
/// Return a list containing the strongly connected component in the
/// import/export graph in which the current library resides.
List<LibraryElement> get libraryCycle;
/// Return the element representing the synthetic function `loadLibrary` that
/// is implicitly defined for this library if the library is imported using a
/// deferred import.
FunctionElement get loadLibraryFunction;
/// Return a list containing all of the compilation units that are included in
/// this library using a `part` directive. This does not include the defining
/// compilation unit that contains the `part` directives.
List<CompilationUnitElement> get parts;
/// Return a list containing elements for each of the prefixes used to
/// `import` libraries into this library. Each prefix can be used in more
/// than one `import` directive.
List<PrefixElement> get prefixes;
/// The public [Namespace] of this library, `null` if it has not been
/// computed yet.
Namespace get publicNamespace;
/// Return the top-level elements defined in each of the compilation units
/// that are included in this library. This includes both public and private
/// elements, but does not include imports, exports, or synthetic elements.
Iterable<Element> get topLevelElements;
/// Return a list containing all of the compilation units this library
/// consists of. This includes the defining compilation unit and units
/// included using the `part` directive.
List<CompilationUnitElement> get units;
/// Return a list containing all of the imports that share the given [prefix],
/// or an empty array if there are no such imports.
List<ImportElement> getImportsWithPrefix(PrefixElement prefix);
/// Return the class defined in this library that has the given [name], or
/// `null` if this library does not define a class with the given name.
ClassElement getType(String className);
}
/// An element that can be (but is not required to be) defined within a method
/// or function (an [ExecutableElement]).
///
/// Clients may not extend, implement or mix-in this class.
abstract class LocalElement implements Element {
/// Return a source range that covers the approximate portion of the source in
/// which the name of this element is visible, or `null` if there is no single
/// range of characters within which the element name is visible.
///
/// * For a local variable, this is the source range of the block that
/// encloses the variable declaration.
/// * For a parameter, this includes the body of the method or function that
/// declares the parameter.
/// * For a local function, this is the source range of the block that
/// encloses the variable declaration.
/// * For top-level functions, `null` will be returned because they are
/// potentially visible in multiple sources.
SourceRange get visibleRange;
}
/// A local variable.
///
/// Clients may not extend, implement or mix-in this class.
abstract class LocalVariableElement implements PromotableElement {}
/// An element that represents a method defined within a class.
///
/// When the 'extension-methods' experiment is enabled, these elements can also
/// be contained within an extension element.
///
/// Clients may not extend, implement or mix-in this class.
abstract class MethodElement implements ClassMemberElement, ExecutableElement {
@deprecated
@override
MethodDeclaration computeNode();
}
/// A pseudo-element that represents multiple elements defined within a single
/// scope that have the same name. This situation is not allowed by the
/// language, so objects implementing this interface always represent an error.
/// As a result, most of the normal operations on elements do not make sense
/// and will return useless results.
///
/// Clients may not extend, implement or mix-in this class.
abstract class MultiplyDefinedElement implements Element {
/// Return a list containing all of the elements that were defined within the
/// scope to have the same name.
List<Element> get conflictingElements;
/// Return the type of this element as the dynamic type.
DartType get type;
}
/// An [ExecutableElement], with the additional information of a list of
/// [ExecutableElement]s from which this element was composed.
///
/// Clients may not extend, implement or mix-in this class.
abstract class MultiplyInheritedExecutableElement implements ExecutableElement {
/// Return a list containing all of the executable elements defined within
/// this executable element.
List<ExecutableElement> get inheritedElements;
}
/// An object that controls how namespaces are combined.
///
/// Clients may not extend, implement or mix-in this class.
abstract class NamespaceCombinator {}
/// A parameter defined within an executable element.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ParameterElement
implements PromotableElement, ConstantEvaluationTarget {
/// Return the Dart code of the default value, or `null` if no default value.
String get defaultValueCode;
/// Return `true` if this parameter is covariant, meaning it is allowed to
/// have a narrower type in an override.
bool get isCovariant;
/// Return `true` if this parameter is an initializing formal parameter.
bool get isInitializingFormal;
/// Return `true` if this parameter is a named parameter. Named parameters
/// that are annotated with the `@required` annotation are considered
/// optional. Named parameters that are annotated with the `required` syntax
/// are considered required.
bool get isNamed;
/// Return `true` if this parameter is a required parameter. Required
/// parameters are always positional, unless the experiment 'non-nullable' is
/// enabled, in which case named parameters can also be required.
///
/// Note: regardless of the state of the 'non-nullable' experiment, this will
/// return `false` for a named parameter that is annotated with the
/// `@required` annotation.
// TODO(brianwilkerson) Rename this to `isRequired`.
bool get isNotOptional;
/// Return `true` if this parameter is an optional parameter. Optional
/// parameters can either be positional or named. Named parameters that are
/// annotated with the `@required` annotation are considered optional. Named
/// parameters that are annotated with the `required` syntax are considered
/// required.
bool get isOptional;
/// Return `true` if this parameter is both an optional and named parameter.
/// Named parameters that are annotated with the `@required` annotation are
/// considered optional. Named parameters that are annotated with the
/// `required` syntax are considered required.
bool get isOptionalNamed;
/// Return `true` if this parameter is both an optional and positional
/// parameter.
bool get isOptionalPositional;
/// Return `true` if this parameter is a positional parameter. Positional
/// parameters can either be required or optional.
bool get isPositional;
/// Return `true` if this parameter is both a required and named parameter.
/// Named parameters that are annotated with the `@required` annotation are
/// considered optional. Named parameters that are annotated with the
/// `required` syntax are considered required.
bool get isRequiredNamed;
/// Return `true` if this parameter is both a required and positional
/// parameter.
bool get isRequiredPositional;
/// Return the kind of this parameter.
@Deprecated('Use the getters isOptionalNamed, isOptionalPositional, '
'isRequiredNamed, and isRequiredPositional')
ParameterKind get parameterKind;
/// Return a list containing all of the parameters defined by this parameter.
/// A parameter will only define other parameters if it is a function typed
/// parameter.
List<ParameterElement> get parameters;
/// Return a list containing all of the type parameters defined by this
/// parameter. A parameter will only define other parameters if it is a
/// function typed parameter.
List<TypeParameterElement> get typeParameters;
/// Append the type, name and possibly the default value of this parameter to
/// the given [buffer].
void appendToWithoutDelimiters(StringBuffer buffer);
@deprecated
@override
FormalParameter computeNode();
}
/// A prefix used to import one or more libraries into another library.
///
/// Clients may not extend, implement or mix-in this class.
abstract class PrefixElement implements Element {
@override
LibraryElement get enclosingElement;
/// Return the empty list.
///
/// Deprecated: this getter was intended to return a list containing all of
/// the libraries that are imported using this prefix, but it was never
/// implemented. Due to lack of demand, it is being removed.
@deprecated
List<LibraryElement> get importedLibraries;
}
/// A variable that might be subject to type promotion. This might be a local
/// variable or a parameter.
///
/// Clients may not extend, implement or mix-in this class.
abstract class PromotableElement implements LocalElement, VariableElement {}
/// A getter or a setter. Note that explicitly defined property accessors
/// implicitly define a synthetic field. Symmetrically, synthetic accessors are
/// implicitly created for explicitly defined fields. The following rules apply:
///
/// * Every explicit field is represented by a non-synthetic [FieldElement].
/// * Every explicit field induces a getter and possibly a setter, both of which
/// are represented by synthetic [PropertyAccessorElement]s.
/// * Every explicit getter or setter is represented by a non-synthetic
/// [PropertyAccessorElement].
/// * Every explicit getter or setter (or pair thereof if they have the same
/// name) induces a field that is represented by a synthetic [FieldElement].
///
/// Clients may not extend, implement or mix-in this class.
abstract class PropertyAccessorElement implements ExecutableElement {
/// Return the accessor representing the getter that corresponds to (has the
/// same name as) this setter, or `null` if this accessor is not a setter or
/// if there is no corresponding getter.
PropertyAccessorElement get correspondingGetter;
/// Return the accessor representing the setter that corresponds to (has the
/// same name as) this getter, or `null` if this accessor is not a getter or
/// if there is no corresponding setter.
PropertyAccessorElement get correspondingSetter;
/// Return `true` if this accessor represents a getter.
bool get isGetter;
/// Return `true` if this accessor represents a setter.
bool get isSetter;
/// Return the field or top-level variable associated with this accessor. If
/// this accessor was explicitly defined (is not synthetic) then the variable
/// associated with it will be synthetic.
PropertyInducingElement get variable;
}
/// A variable that has an associated getter and possibly a setter. Note that
/// explicitly defined variables implicitly define a synthetic getter and that
/// non-`final` explicitly defined variables implicitly define a synthetic
/// setter. Symmetrically, synthetic fields are implicitly created for
/// explicitly defined getters and setters. The following rules apply:
///
/// * Every explicit variable is represented by a non-synthetic
/// [PropertyInducingElement].
/// * Every explicit variable induces a getter and possibly a setter, both of
/// which are represented by synthetic [PropertyAccessorElement]s.
/// * Every explicit getter or setter is represented by a non-synthetic
/// [PropertyAccessorElement].
/// * Every explicit getter or setter (or pair thereof if they have the same
/// name) induces a variable that is represented by a synthetic
/// [PropertyInducingElement].
///
/// Clients may not extend, implement or mix-in this class.
abstract class PropertyInducingElement implements VariableElement {
/// Return the getter associated with this variable. If this variable was
/// explicitly defined (is not synthetic) then the getter associated with it
/// will be synthetic.
PropertyAccessorElement get getter;
/// Return the propagated type of this variable, or `null` if type propagation
/// has not been performed, for example because the variable is not final.
@deprecated
DartType get propagatedType;
/// Return the setter associated with this variable, or `null` if the variable
/// is effectively `final` and therefore does not have a setter associated
/// with it. (This can happen either because the variable is explicitly
/// defined as being `final` or because the variable is induced by an
/// explicit getter that does not have a corresponding setter.) If this
/// variable was explicitly defined (is not synthetic) then the setter
/// associated with it will be synthetic.
PropertyAccessorElement get setter;
}
/// A combinator that cause some of the names in a namespace to be visible (and
/// the rest hidden) when being imported.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ShowElementCombinator implements NamespaceCombinator {
/// Return the offset of the character immediately following the last
/// character of this node.
int get end;
/// Return the offset of the 'show' keyword of this element.
int get offset;
/// Return a list containing the names that are to be made visible in the
/// importing library if they are defined in the imported library.
List<String> get shownNames;
}
/// A top-level variable.
///
/// Clients may not extend, implement or mix-in this class.
abstract class TopLevelVariableElement implements PropertyInducingElement {
@deprecated
@override
VariableDeclaration computeNode();
}
/// An element that defines a type.
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeDefiningElement implements Element {
/// Return the type defined by this element.
DartType get type;
}
/// A type parameter.
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeParameterElement implements TypeDefiningElement {
/// Return the type representing the bound associated with this parameter, or
/// `null` if this parameter does not have an explicit bound. Being able to
/// distinguish between an implicit and explicit bound is needed by the
/// instantiate to bounds algorithm.
DartType get bound;
@override
TypeParameterType get type;
/// Create the [TypeParameterType] with the given [nullabilitySuffix] for
/// this type parameter.
TypeParameterType instantiate({
@required NullabilitySuffix nullabilitySuffix,
});
}
/// An element that has type parameters, such as a class or a typedef. This also
/// includes functions and methods if support for generic methods is enabled.
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeParameterizedElement implements Element {
/// If the element defines a type, indicates whether the type may safely
/// appear without explicit type parameters as the bounds of a type parameter
/// declaration.
///
/// If the element does not define a type, returns `true`.
bool get isSimplyBounded;
/// Return a list containing all of the type parameters declared by this
/// element directly. This does not include type parameters that are declared
/// by any enclosing elements.
List<TypeParameterElement> get typeParameters;
}
/// A pseudo-elements that represents names that are undefined. This situation
/// is not allowed by the language, so objects implementing this interface
/// always represent an error. As a result, most of the normal operations on
/// elements do not make sense and will return useless results.
///
/// Clients may not extend, implement or mix-in this class.
abstract class UndefinedElement implements Element {}
/// An element included into a library using some URI.
///
/// Clients may not extend, implement or mix-in this class.
abstract class UriReferencedElement implements Element {
/// Return the URI that is used to include this element into the enclosing
/// library, or `null` if this is the defining compilation unit of a library.
String get uri;
/// Return the offset of the character immediately following the last
/// character of this node's URI, or `-1` for synthetic import.
int get uriEnd;
/// Return the offset of the URI in the file, or `-1` if this element is
/// synthetic.
int get uriOffset;
}
/// A variable. There are more specific subclasses for more specific kinds of
/// variables.
///
/// Clients may not extend, implement or mix-in this class.
abstract class VariableElement implements Element, ConstantEvaluationTarget {
/// Return a representation of the value of this variable.
///
/// Return `null` if either this variable was not declared with the 'const'
/// modifier or if the value of this variable could not be computed because of
/// errors.
DartObject get constantValue;
/// Return `true` if this variable element did not have an explicit type
/// specified for it.
bool get hasImplicitType;
/// Return a synthetic function representing this variable's initializer, or
/// `null` if this variable does not have an initializer. The function will
/// have no parameters. The return type of the function will be the
/// compile-time type of the initialization expression.
FunctionElement get initializer;
/// Return `true` if this variable was declared with the 'const' modifier.
bool get isConst;
/// Return `true` if this variable was declared with the 'final' modifier.
/// Variables that are declared with the 'const' modifier will return `false`
/// even though they are implicitly final.
bool get isFinal;
/// Return `true` if this variable uses late evaluation semantics.
///
/// This will always return `false` unless the experiment 'non-nullable' is
/// enabled.
@experimental
bool get isLate;
/// Return `true` if this variable is potentially mutated somewhere in a
/// closure. This information is only available for local variables (including
/// parameters) and only after the compilation unit containing the variable
/// has been resolved.
///
/// This getter is deprecated--it now returns `true` for all local variables
/// and parameters. Please use [FunctionBody.isPotentiallyMutatedInClosure]
/// instead.
@deprecated
bool get isPotentiallyMutatedInClosure;
/// Return `true` if this variable is potentially mutated somewhere in its
/// scope. This information is only available for local variables (including
/// parameters) and only after the compilation unit containing the variable
/// has been resolved.
///
/// This getter is deprecated--it now returns `true` for all local variables
/// and parameters. Please use [FunctionBody.isPotentiallyMutatedInClosure]
/// instead.
@deprecated
bool get isPotentiallyMutatedInScope;
/// Return `true` if this element is a static variable, as per section 8 of
/// the Dart Language Specification:
///
/// > A static variable is a variable that is not associated with a particular
/// > instance, but rather with an entire library or class. Static variables
/// > include library variables and class variables. Class variables are
/// > variables whose declaration is immediately nested inside a class
/// > declaration and includes the modifier static. A library variable is
/// > implicitly static.
bool get isStatic;
/// Return the declared type of this variable, or `null` if the variable did
/// not have a declared type (such as if it was declared using the keyword
/// 'var').
DartType get type;
/// Return a representation of the value of this variable, forcing the value
/// to be computed if it had not previously been computed, or `null` if either
/// this variable was not declared with the 'const' modifier or if the value
/// of this variable could not be computed because of errors.
DartObject computeConstantValue();
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/element/nullability_suffix.dart | // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Suffix indicating the nullability of a type.
///
/// This enum describes whether a `?` or `*` would be used at the end of the
/// canonical representation of a type. It's subtly different the notions of
/// "nullable", "non-nullable", "potentially nullable", and "potentially
/// non-nullable" defined by the spec. For example, the type `Null` is
/// nullable, even though it lacks a trailing `?`.
enum NullabilitySuffix {
/// An indication that the canonical representation of the type under
/// consideration ends with `?`. Types having this nullability suffix should
/// be interpreted as being unioned with the Null type.
question,
/// An indication that the canonical representation of the type under
/// consideration ends with `*`. Types having this nullability suffix are
/// called "legacy types"; it has not yet been determined whether they should
/// be unioned with the Null type.
star,
/// An indication that the canonical representation of the type under
/// consideration does not end with either `?` or `*`.
none
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/element/visitor.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Defines element visitors that support useful patterns for visiting the
/// elements in an [element model](element.dart).
///
/// Dart is an evolving language, and the element model must evolved with it.
/// When the element model changes, the visitor interface will sometimes change
/// as well. If it is desirable to get a compilation error when the structure of
/// the element model has been modified, then you should consider implementing
/// the interface [ElementVisitor] directly. Doing so will ensure that changes
/// that introduce new classes of elements will be flagged. (Of course, not all
/// changes to the element model require the addition of a new class of element,
/// and hence cannot be caught this way.)
///
/// But if automatic detection of these kinds of changes is not necessary then
/// you will probably want to extend one of the classes in this library because
/// doing so will simplify the task of writing your visitor and guard against
/// future changes to the element model. For example, the
/// [RecursiveElementVisitor] automates the process of visiting all of the
/// descendants of an element.
import 'package:analyzer/dart/element/element.dart';
/// An element visitor that will recursively visit all of the elements in an
/// element model (like instances of the class [RecursiveElementVisitor]). In
/// addition, when an element of a specific type is visited not only will the
/// visit method for that specific type of element be invoked, but additional
/// methods for the supertypes of that element will also be invoked. For
/// example, using an instance of this class to visit a [MethodElement] will
/// cause the method [visitMethodElement] to be invoked but will also cause the
/// methods [visitExecutableElement] and [visitElement] to be subsequently
/// invoked. This allows visitors to be written that visit all executable
/// elements without needing to override the visit method for each of the
/// specific subclasses of [ExecutableElement].
///
/// Note, however, that unlike many visitors, element visitors visit objects
/// based on the interfaces implemented by those elements. Because interfaces
/// form a graph structure rather than a tree structure the way classes do, and
/// because it is generally undesirable for an object to be visited more than
/// once, this class flattens the interface graph into a pseudo-tree. In
/// particular, this class treats elements as if the element types were
/// structured in the following way:
///
/// <pre>
/// Element
/// ClassElement
/// CompilationUnitElement
/// ExecutableElement
/// ConstructorElement
/// LocalElement
/// FunctionElement
/// MethodElement
/// PropertyAccessorElement
/// ExportElement
/// HtmlElement
/// ImportElement
/// LabelElement
/// LibraryElement
/// MultiplyDefinedElement
/// PrefixElement
/// TypeAliasElement
/// TypeParameterElement
/// UndefinedElement
/// VariableElement
/// PropertyInducingElement
/// FieldElement
/// TopLevelVariableElement
/// LocalElement
/// LocalVariableElement
/// ParameterElement
/// FieldFormalParameterElement
/// </pre>
///
/// Subclasses that override a visit method must either invoke the overridden
/// visit method or explicitly invoke the more general visit method. Failure to
/// do so will cause the visit methods for superclasses of the element to not be
/// invoked and will cause the children of the visited node to not be visited.
///
/// Clients may extend this class.
class GeneralizingElementVisitor<R> implements ElementVisitor<R> {
@override
R visitClassElement(ClassElement element) => visitElement(element);
@override
R visitCompilationUnitElement(CompilationUnitElement element) =>
visitElement(element);
@override
R visitConstructorElement(ConstructorElement element) =>
visitExecutableElement(element);
R visitElement(Element element) {
element.visitChildren(this);
return null;
}
R visitExecutableElement(ExecutableElement element) => visitElement(element);
@override
R visitExportElement(ExportElement element) => visitElement(element);
@override
R visitExtensionElement(ExtensionElement element) => visitElement(element);
@override
R visitFieldElement(FieldElement element) =>
visitPropertyInducingElement(element);
@override
R visitFieldFormalParameterElement(FieldFormalParameterElement element) =>
visitParameterElement(element);
@override
R visitFunctionElement(FunctionElement element) => visitLocalElement(element);
@override
R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) =>
visitElement(element);
@override
R visitGenericFunctionTypeElement(GenericFunctionTypeElement element) =>
visitElement(element);
@override
R visitImportElement(ImportElement element) => visitElement(element);
@override
R visitLabelElement(LabelElement element) => visitElement(element);
@override
R visitLibraryElement(LibraryElement element) => visitElement(element);
R visitLocalElement(LocalElement element) {
if (element is LocalVariableElement) {
return visitVariableElement(element);
} else if (element is ParameterElement) {
return visitVariableElement(element);
} else if (element is FunctionElement) {
return visitExecutableElement(element);
}
return null;
}
@override
R visitLocalVariableElement(LocalVariableElement element) =>
visitLocalElement(element);
@override
R visitMethodElement(MethodElement element) =>
visitExecutableElement(element);
@override
R visitMultiplyDefinedElement(MultiplyDefinedElement element) =>
visitElement(element);
@override
R visitParameterElement(ParameterElement element) =>
visitLocalElement(element);
@override
R visitPrefixElement(PrefixElement element) => visitElement(element);
@override
R visitPropertyAccessorElement(PropertyAccessorElement element) =>
visitExecutableElement(element);
R visitPropertyInducingElement(PropertyInducingElement element) =>
visitVariableElement(element);
@override
R visitTopLevelVariableElement(TopLevelVariableElement element) =>
visitPropertyInducingElement(element);
@override
R visitTypeParameterElement(TypeParameterElement element) =>
visitElement(element);
R visitVariableElement(VariableElement element) => visitElement(element);
}
/// A visitor that will recursively visit all of the element in an element
/// model. For example, using an instance of this class to visit a
/// [CompilationUnitElement] will also cause all of the types in the compilation
/// unit to be visited.
///
/// Subclasses that override a visit method must either invoke the overridden
/// visit method or must explicitly ask the visited element to visit its
/// children. Failure to do so will cause the children of the visited element to
/// not be visited.
///
/// Clients may extend this class.
class RecursiveElementVisitor<R> implements ElementVisitor<R> {
@override
R visitClassElement(ClassElement element) {
element.visitChildren(this);
return null;
}
@override
R visitCompilationUnitElement(CompilationUnitElement element) {
element.visitChildren(this);
return null;
}
@override
R visitConstructorElement(ConstructorElement element) {
element.visitChildren(this);
return null;
}
@override
R visitExportElement(ExportElement element) {
element.visitChildren(this);
return null;
}
@override
R visitExtensionElement(ExtensionElement element) {
element.visitChildren(this);
return null;
}
@override
R visitFieldElement(FieldElement element) {
element.visitChildren(this);
return null;
}
@override
R visitFieldFormalParameterElement(FieldFormalParameterElement element) {
element.visitChildren(this);
return null;
}
@override
R visitFunctionElement(FunctionElement element) {
element.visitChildren(this);
return null;
}
@override
R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
element.visitChildren(this);
return null;
}
@override
R visitGenericFunctionTypeElement(GenericFunctionTypeElement element) {
element.visitChildren(this);
return null;
}
@override
R visitImportElement(ImportElement element) {
element.visitChildren(this);
return null;
}
@override
R visitLabelElement(LabelElement element) {
element.visitChildren(this);
return null;
}
@override
R visitLibraryElement(LibraryElement element) {
element.visitChildren(this);
return null;
}
@override
R visitLocalVariableElement(LocalVariableElement element) {
element.visitChildren(this);
return null;
}
@override
R visitMethodElement(MethodElement element) {
element.visitChildren(this);
return null;
}
@override
R visitMultiplyDefinedElement(MultiplyDefinedElement element) {
element.visitChildren(this);
return null;
}
@override
R visitParameterElement(ParameterElement element) {
element.visitChildren(this);
return null;
}
@override
R visitPrefixElement(PrefixElement element) {
element.visitChildren(this);
return null;
}
@override
R visitPropertyAccessorElement(PropertyAccessorElement element) {
element.visitChildren(this);
return null;
}
@override
R visitTopLevelVariableElement(TopLevelVariableElement element) {
element.visitChildren(this);
return null;
}
@override
R visitTypeParameterElement(TypeParameterElement element) {
element.visitChildren(this);
return null;
}
}
/// A visitor that will do nothing when visiting an element. It is intended to
/// be a superclass for classes that use the visitor pattern primarily as a
/// dispatch mechanism (and hence don't need to recursively visit a whole
/// structure) and that only need to visit a small number of element types.
///
/// Clients may extend this class.
class SimpleElementVisitor<R> implements ElementVisitor<R> {
@override
R visitClassElement(ClassElement element) => null;
@override
R visitCompilationUnitElement(CompilationUnitElement element) => null;
@override
R visitConstructorElement(ConstructorElement element) => null;
@override
R visitExportElement(ExportElement element) => null;
@override
R visitExtensionElement(ExtensionElement element) => null;
@override
R visitFieldElement(FieldElement element) => null;
@override
R visitFieldFormalParameterElement(FieldFormalParameterElement element) =>
null;
@override
R visitFunctionElement(FunctionElement element) => null;
@override
R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => null;
@override
R visitGenericFunctionTypeElement(GenericFunctionTypeElement element) => null;
@override
R visitImportElement(ImportElement element) => null;
@override
R visitLabelElement(LabelElement element) => null;
@override
R visitLibraryElement(LibraryElement element) => null;
@override
R visitLocalVariableElement(LocalVariableElement element) => null;
@override
R visitMethodElement(MethodElement element) => null;
@override
R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null;
@override
R visitParameterElement(ParameterElement element) => null;
@override
R visitPrefixElement(PrefixElement element) => null;
@override
R visitPropertyAccessorElement(PropertyAccessorElement element) => null;
@override
R visitTopLevelVariableElement(TopLevelVariableElement element) => null;
@override
R visitTypeParameterElement(TypeParameterElement element) => null;
}
/// An AST visitor that will throw an exception if any of the visit methods that
/// are invoked have not been overridden. It is intended to be a superclass for
/// classes that implement the visitor pattern and need to (a) override all of
/// the visit methods or (b) need to override a subset of the visit method and
/// want to catch when any other visit methods have been invoked.
///
/// Clients may extend this class.
class ThrowingElementVisitor<R> implements ElementVisitor<R> {
@override
R visitClassElement(ClassElement element) => _throw(element);
@override
R visitCompilationUnitElement(CompilationUnitElement element) =>
_throw(element);
@override
R visitConstructorElement(ConstructorElement element) => _throw(element);
@override
R visitExportElement(ExportElement element) => _throw(element);
@override
R visitExtensionElement(ExtensionElement element) => _throw(element);
@override
R visitFieldElement(FieldElement element) => _throw(element);
@override
R visitFieldFormalParameterElement(FieldFormalParameterElement element) =>
_throw(element);
@override
R visitFunctionElement(FunctionElement element) => _throw(element);
@override
R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) =>
_throw(element);
@override
R visitGenericFunctionTypeElement(GenericFunctionTypeElement element) =>
_throw(element);
@override
R visitImportElement(ImportElement element) => _throw(element);
@override
R visitLabelElement(LabelElement element) => _throw(element);
@override
R visitLibraryElement(LibraryElement element) => _throw(element);
@override
R visitLocalVariableElement(LocalVariableElement element) => _throw(element);
@override
R visitMethodElement(MethodElement element) => _throw(element);
@override
R visitMultiplyDefinedElement(MultiplyDefinedElement element) =>
_throw(element);
@override
R visitParameterElement(ParameterElement element) => _throw(element);
@override
R visitPrefixElement(PrefixElement element) => _throw(element);
@override
R visitPropertyAccessorElement(PropertyAccessorElement element) =>
_throw(element);
@override
R visitTopLevelVariableElement(TopLevelVariableElement element) =>
_throw(element);
@override
R visitTypeParameterElement(TypeParameterElement element) => _throw(element);
R _throw(Element element) {
throw new Exception(
'Missing implementation of visit${element.runtimeType}');
}
}
| 0 |
mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart | mirrored_repositories/chat_ui_stream_iii_example/firebase/functions/build/packages/analyzer/dart/element/type.dart | // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Defines the type model. The type model is part of the
/// [element model](../dart_element_element/dart_element_element-library.html)
/// in that most types are defined by Dart code (the types `dynamic` and `void`
/// being the notable exceptions). All types are represented by an instance of a
/// subclass of [DartType].
///
/// Other than `dynamic` and `void`, all of the types define either the
/// interface defined by a class (an instance of [InterfaceType]) or the type of
/// a function (an instance of [FunctionType]).
///
/// We make a distinction between the declaration of a class (a [ClassElement])
/// and the type defined by that class (an [InterfaceType]). The biggest reason
/// for the distinction is to allow us to more cleanly represent the distinction
/// between type parameters and type arguments. For example, if we define a
/// class as `class Pair<K, V> {}`, the declarations of `K` and `V` represent
/// type parameters. But if we declare a variable as `Pair<String, int> pair;`
/// the references to `String` and `int` are type arguments.
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart' show InterfaceTypeImpl;
import 'package:analyzer/src/generated/type_system.dart' show TypeSystem;
/// The type associated with elements in the element model.
///
/// Clients may not extend, implement or mix-in this class.
abstract class DartType {
/// Return the name of this type as it should appear when presented to users
/// in contexts such as error messages.
///
/// Clients should not depend on the content of the returned value as it will
/// be changed if doing so would improve the UX.
String get displayName;
/// Return the element representing the declaration of this type, or `null` if
/// the type has not, or cannot, be associated with an element. The former
/// case will occur if the element model is not yet complete; the latter case
/// will occur if this object represents an undefined type.
Element get element;
/// Return `true` if this type represents the bottom type.
bool get isBottom;
/// Return `true` if this type represents the type 'Future' defined in the
/// dart:async library.
bool get isDartAsyncFuture;
/// Return `true` if this type represents the type 'FutureOr<T>' defined in
/// the dart:async library.
bool get isDartAsyncFutureOr;
/// Return `true` if this type represents the type 'bool' defined in the
/// dart:core library.
bool get isDartCoreBool;
/// Return `true` if this type represents the type 'double' defined in the
/// dart:core library.
bool get isDartCoreDouble;
/// Return `true` if this type represents the type 'Function' defined in the
/// dart:core library.
bool get isDartCoreFunction;
/// Return `true` if this type represents the type 'int' defined in the
/// dart:core library.
bool get isDartCoreInt;
/// Returns `true` if this type represents the type 'List' defined in the
/// dart:core library.
bool get isDartCoreList;
/// Returns `true` if this type represents the type 'Map' defined in the
/// dart:core library.
bool get isDartCoreMap;
/// Return `true` if this type represents the type 'Null' defined in the
/// dart:core library.
bool get isDartCoreNull;
/// Return `true` if this type represents the type 'num' defined in the
/// dart:core library.
bool get isDartCoreNum;
/// Return `true` if this type represents the type `Object` defined in the
/// dart:core library.
bool get isDartCoreObject;
/// Returns `true` if this type represents the type 'Set' defined in the
/// dart:core library.
bool get isDartCoreSet;
/// Return `true` if this type represents the type 'String' defined in the
/// dart:core library.
bool get isDartCoreString;
/// Returns `true` if this type represents the type 'Symbol' defined in the
/// dart:core library.
bool get isDartCoreSymbol;
/// Return `true` if this type represents the type 'dynamic'.
bool get isDynamic;
/// Return `true` if this type represents the type 'Object'.
bool get isObject;
/// Return `true` if this type represents the type 'void'.
bool get isVoid;
/// Return the name of this type, or `null` if the type does not have a name,
/// such as when the type represents the type of an unnamed function.
String get name;
/// Implements the function "flatten" defined in the spec, where T is this
/// type:
///
/// If T = Future<S> then flatten(T) = flatten(S).
///
/// Otherwise if T <: Future then let S be a type such that T << Future<S>
/// and for all R, if T << Future<R> then S << R. Then flatten(T) = S.
///
/// In any other circumstance, flatten(T) = T.
@Deprecated('Use TypeSystem.flatten() instead.')
DartType flattenFutures(TypeSystem typeSystem);
/// Return `true` if this type is assignable to the given [type]. A type
/// <i>T</i> may be assigned to a type <i>S</i>, written <i>T</i> ⇔
/// <i>S</i>, iff either <i>T</i> <: <i>S</i> or <i>S</i> <: <i>T</i>.
@Deprecated('Use TypeSystem.isAssignableTo() instead.')
bool isAssignableTo(DartType type);
/// Indicates whether `this` represents a type that is equivalent to `dest`.
///
/// This is different from `operator==`. Consider for example:
///
/// typedef void F<T>(); // T not used!
///
/// `operator==` would consider F<int> and F<bool> to be different types;
/// `isEquivalentTo` considers them to be equivalent.
@Deprecated('operator== was fixed. Use it instead.')
bool isEquivalentTo(DartType dest);
/// Return `true` if this type is more specific than the given [type].
@Deprecated('Use TypeSystem.isSubtypeOf() instead.')
bool isMoreSpecificThan(DartType type);
/// Return `true` if this type is a subtype of the given [type].
bool isSubtypeOf(DartType type);
/// Return `true` if this type is a supertype of the given [type]. A type
/// <i>S</i> is a supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff
/// <i>T</i> is a subtype of <i>S</i>.
@Deprecated('Use TypeSystem.isSubtypeOf() instead.')
bool isSupertypeOf(DartType type);
/// If this type is a [TypeParameterType], returns its bound if it has one, or
/// [objectType] otherwise.
///
/// For any other type, returns `this`. Applies recursively -- if the bound is
/// itself a type parameter, that is resolved too.
DartType resolveToBound(DartType objectType);
/// Return the type resulting from substituting the given [argumentTypes] for
/// the given [parameterTypes] in this type. The specification defines this
/// operation in section 2:
/// <blockquote>
/// The notation <i>[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ...,
/// y<sub>n</sub>]E</i> denotes a copy of <i>E</i> in which all occurrences of
/// <i>y<sub>i</sub>, 1 <= i <= n</i> have been replaced with
/// <i>x<sub>i</sub></i>.
/// </blockquote>
/// Note that, contrary to the specification, this method will not create a
/// copy of this type if no substitutions were required, but will return this
/// type directly.
///
/// Note too that the current implementation of this method is only guaranteed
/// to work when the parameter types are type variables.
DartType substitute2(
List<DartType> argumentTypes, List<DartType> parameterTypes);
}
/// The type of a function, method, constructor, getter, or setter. Function
/// types come in three variations:
///
/// * The types of functions that only have required parameters. These have the
/// general form <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>.
/// * The types of functions with optional positional parameters. These have the
/// general form <i>(T<sub>1</sub>, …, T<sub>n</sub>, [T<sub>n+1</sub>
/// …, T<sub>n+k</sub>]) → T</i>.
/// * The types of functions with named parameters. These have the general form
/// <i>(T<sub>1</sub>, …, T<sub>n</sub>, {T<sub>x1</sub> x1, …,
/// T<sub>xk</sub> xk}) → T</i>.
///
/// Clients may not extend, implement or mix-in this class.
abstract class FunctionType implements ParameterizedType {
/// Deprecated: use [typeFormals].
@deprecated
List<TypeParameterElement> get boundTypeParameters;
/// Return a map from the names of named parameters to the types of the named
/// parameters of this type of function. The entries in the map will be
/// iterated in the same order as the order in which the named parameters were
/// defined. If there were no named parameters declared then the map will be
/// empty.
Map<String, DartType> get namedParameterTypes;
/// The names of the required positional parameters of this type of function,
/// in the order that the parameters appear.
List<String> get normalParameterNames;
/// Return a list containing the types of the normal parameters of this type
/// of function. The parameter types are in the same order as they appear in
/// the declaration of the function.
List<DartType> get normalParameterTypes;
/// The names of the optional positional parameters of this type of function,
/// in the order that the parameters appear.
List<String> get optionalParameterNames;
/// Return a map from the names of optional (positional) parameters to the
/// types of the optional parameters of this type of function. The entries in
/// the map will be iterated in the same order as the order in which the
/// optional parameters were defined. If there were no optional parameters
/// declared then the map will be empty.
List<DartType> get optionalParameterTypes;
/// Return a list containing the parameters elements of this type of function.
/// The parameter types are in the same order as they appear in the
/// declaration of the function.
List<ParameterElement> get parameters;
/// Return the type of object returned by this type of function.
DartType get returnType;
/// The formal type parameters of this generic function.
/// For example `<T> T -> T`.
///
/// These are distinct from the [typeParameters] list, which contains type
/// parameters from surrounding contexts, and thus are free type variables
/// from the perspective of this function type.
List<TypeParameterElement> get typeFormals;
@override
FunctionType instantiate(List<DartType> argumentTypes);
/// Return `true` if this type is a subtype of the given [type].
///
/// A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>
/// is a subtype of the function type <i>(S<sub>1</sub>, …,
/// S<sub>n</sub>) → S</i>, if all of the following conditions are met:
///
/// * Either
/// * <i>S</i> is void, or
/// * <i>T ⇔ S</i>.
///
/// * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> ⇔
/// S<sub>i</sub></i>.
///
/// A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>,
/// [T<sub>n+1</sub>, …, T<sub>n+k</sub>]) → T</i> is a subtype of
/// the function type <i>(S<sub>1</sub>, …, S<sub>n</sub>,
/// [S<sub>n+1</sub>, …, S<sub>n+m</sub>]) → S</i>, if all of the
/// following conditions are met:
///
/// * Either
/// * <i>S</i> is void, or
/// * <i>T ⇔ S</i>.
///
/// * <i>k</i> >= <i>m</i> and for all <i>i</i>, 1 <= <i>i</i> <= <i>n+m</i>,
/// <i>T<sub>i</sub> ⇔ S<sub>i</sub></i>.
///
/// A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>,
/// {T<sub>x1</sub> x1, …, T<sub>xk</sub> xk}) → T</i> is a
/// subtype of the function type <i>(S<sub>1</sub>, …, S<sub>n</sub>,
/// {S<sub>y1</sub> y1, …, S<sub>ym</sub> ym}) → S</i>, if all of
/// the following conditions are met:
/// * Either
/// * <i>S</i> is void,
/// * or <i>T ⇔ S</i>.
///
/// * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> ⇔
/// S<sub>i</sub></i>.
/// * <i>k</i> >= <i>m</i> and <i>y<sub>i</sub></i> in <i>{x<sub>1</sub>,
/// …, x<sub>k</sub>}</i>, 1 <= <i>i</i> <= <i>m</i>.
/// * For all <i>y<sub>i</sub></i> in <i>{y<sub>1</sub>, …,
/// y<sub>m</sub>}</i>, <i>y<sub>i</sub> = x<sub>j</sub> => Tj ⇔
/// Si</i>.
///
/// In addition, the following subtype rules apply:
///
/// <i>(T<sub>1</sub>, …, T<sub>n</sub>, []) → T <:
/// (T<sub>1</sub>, …, T<sub>n</sub>) → T.</i><br>
/// <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T <: (T<sub>1</sub>,
/// …, T<sub>n</sub>, {}) → T.</i><br>
/// <i>(T<sub>1</sub>, …, T<sub>n</sub>, {}) → T <:
/// (T<sub>1</sub>, …, T<sub>n</sub>) → T.</i><br>
/// <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T <: (T<sub>1</sub>,
/// …, T<sub>n</sub>, []) → T.</i>
///
/// All functions implement the class `Function`. However not all function
/// types are a subtype of `Function`. If an interface type <i>I</i> includes
/// a method named `call()`, and the type of `call()` is the function type
/// <i>F</i>, then <i>I</i> is considered to be a subtype of <i>F</i>.
@override
bool isSubtypeOf(DartType type);
@override
FunctionType substitute2(
List<DartType> argumentTypes, List<DartType> parameterTypes);
/// Return the type resulting from substituting the given [argumentTypes] for
/// this type's parameters. This is fully equivalent to
/// `substitute(argumentTypes, getTypeArguments())`.
@deprecated // use instantiate
FunctionType substitute3(List<DartType> argumentTypes);
}
/// The type introduced by either a class or an interface, or a reference to
/// such a type.
///
/// Clients may not extend, implement or mix-in this class.
abstract class InterfaceType implements ParameterizedType {
/// Return a list containing all of the accessors (getters and setters)
/// declared in this type.
List<PropertyAccessorElement> get accessors;
/// Return a list containing all of the constructors declared in this type.
List<ConstructorElement> get constructors;
@override
ClassElement get element;
/// Return a list containing all of the interfaces that are implemented by
/// this interface. Note that this is <b>not</b>, in general, equivalent to
/// getting the interfaces from this type's element because the types returned
/// by this method will have had their type parameters replaced.
List<InterfaceType> get interfaces;
/// Return a list containing all of the methods declared in this type.
List<MethodElement> get methods;
/// Return a list containing all of the mixins that are applied to the class
/// being extended in order to derive the superclass of this class. Note that
/// this is <b>not</b>, in general, equivalent to getting the mixins from this
/// type's element because the types returned by this method will have had
/// their type parameters replaced.
List<InterfaceType> get mixins;
/// Return the type representing the superclass of this type, or null if this
/// type represents the class 'Object'. Note that this is <b>not</b>, in
/// general, equivalent to getting the superclass from this type's element
/// because the type returned by this method will have had it's type
/// parameters replaced.
InterfaceType get superclass;
/// Return a list containing all of the super-class constraints that this
/// mixin declaration declares. The list will be empty if this class does not
/// represent a mixin declaration.
List<InterfaceType> get superclassConstraints;
/// Return the element representing the getter with the given [name] that is
/// declared in this class, or `null` if this class does not declare a getter
/// with the given name.
PropertyAccessorElement getGetter(String name);
/// Return the element representing the method with the given [name] that is
/// declared in this class, or `null` if this class does not declare a method
/// with the given name.
MethodElement getMethod(String name);
/// Return the element representing the setter with the given [name] that is
/// declared in this class, or `null` if this class does not declare a setter
/// with the given name.
PropertyAccessorElement getSetter(String name);
@override
InterfaceType instantiate(List<DartType> argumentTypes);
/// Return `true` if this type is a direct supertype of the given [type]. The
/// implicit interface of class <i>I</i> is a direct supertype of the implicit
/// interface of class <i>J</i> iff:
///
/// * <i>I</i> is Object, and <i>J</i> has no extends clause.
/// * <i>I</i> is listed in the extends clause of <i>J</i>.
/// * <i>I</i> is listed in the implements clause of <i>J</i>.
/// * <i>I</i> is listed in the with clause of <i>J</i>.
/// * <i>J</i> is a mixin application of the mixin of <i>I</i>.
@Deprecated('This method was used internally, and is not used anymore.')
bool isDirectSupertypeOf(InterfaceType type);
/// Return `true` if this type is a subtype of the given [type]. An interface
/// type <i>T</i> is a subtype of an interface type <i>S</i>, written <i>T</i>
/// <: <i>S</i>, iff <i>[bottom/dynamic]T</i> « <i>S</i> (<i>T</i> is
/// more specific than <i>S</i>). If an interface type <i>I</i> includes a
/// method named <i>call()</i>, and the type of <i>call()</i> is the function
/// type <i>F</i>, then <i>I</i> is considered to be a subtype of <i>F</i>.
@override
bool isSubtypeOf(DartType type);
/// Return the element representing the constructor that results from looking
/// up the constructor with the given [name] in this class with respect to the
/// given [library], or `null` if the look up fails. The behavior of this
/// method is defined by the Dart Language Specification in section 12.11.1:
/// <blockquote>
/// If <i>e</i> is of the form <b>new</b> <i>T.id()</i> then let <i>q<i> be
/// the constructor <i>T.id</i>, otherwise let <i>q<i> be the constructor
/// <i>T<i>. Otherwise, if <i>q</i> is not defined or not accessible, a
/// NoSuchMethodException is thrown.
/// </blockquote>
ConstructorElement lookUpConstructor(String name, LibraryElement library);
/// Return the element representing the getter that results from looking up
/// the getter with the given [name] in this class with respect to the given
/// [library], or `null` if the look up fails. The behavior of this method is
/// defined by the Dart Language Specification in section 12.15.1:
/// <blockquote>
/// The result of looking up getter (respectively setter) <i>m</i> in class
/// <i>C</i> with respect to library <i>L</i> is:
/// * If <i>C</i> declares an instance getter (respectively setter) named
/// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
/// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
/// superclass <i>S</i>, then the result of the lookup is the result of
/// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
/// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
/// </blockquote>
PropertyAccessorElement lookUpGetter(String name, LibraryElement library);
/// Return the element representing the getter that results from looking up
/// the getter with the given [name] in the superclass of this class with
/// respect to the given [library], or `null` if the look up fails. The
/// behavior of this method is defined by the Dart Language Specification in
/// section 12.15.1:
/// <blockquote>
/// The result of looking up getter (respectively setter) <i>m</i> in class
/// <i>C</i> with respect to library <i>L</i> is:
/// * If <i>C</i> declares an instance getter (respectively setter) named
/// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
/// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
/// superclass <i>S</i>, then the result of the lookup is the result of
/// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
/// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
/// </blockquote>
PropertyAccessorElement lookUpGetterInSuperclass(
String name, LibraryElement library);
/// Look up the member with the given [name] in this type and all extended
/// and mixed in classes, and by default including [thisType]. If the search
/// fails, this will then search interfaces.
///
/// Return the element representing the member that was found, or `null` if
/// there is no getter with the given name.
///
/// The [library] determines if a private member name is visible, and does not
/// need to be supplied for public names.
PropertyAccessorElement lookUpInheritedGetter(String name,
{LibraryElement library, bool thisType: true});
/// Look up the member with the given [name] in this type and all extended
/// and mixed in classes, starting from this type. If the search fails,
/// search interfaces.
///
/// Return the element representing the member that was found, or `null` if
/// there is no getter with the given name.
///
/// The [library] determines if a private member name is visible, and does not
/// need to be supplied for public names.
ExecutableElement lookUpInheritedGetterOrMethod(String name,
{LibraryElement library});
/// Look up the member with the given [name] in this type and all extended
/// and mixed in classes, and by default including [thisType]. If the search
/// fails, this will then search interfaces.
///
/// Return the element representing the member that was found, or `null` if
/// there is no getter with the given name.
///
/// The [library] determines if a private member name is visible, and does not
/// need to be supplied for public names.
MethodElement lookUpInheritedMethod(String name,
{LibraryElement library, bool thisType: true});
/// Look up the member with the given [name] in this type and all extended
/// and mixed in classes, and by default including [thisType]. If the search
/// fails, this will then search interfaces.
///
/// Return the element representing the member that was found, or `null` if
/// there is no getter with the given name.
///
/// The [library] determines if a private member name is visible, and does not
/// need to be supplied for public names.
PropertyAccessorElement lookUpInheritedSetter(String name,
{LibraryElement library, bool thisType: true});
/// Return the element representing the method that results from looking up
/// the method with the given [name] in this class with respect to the given
/// [library], or `null` if the look up fails. The behavior of this method is
/// defined by the Dart Language Specification in section 12.15.1:
/// <blockquote>
/// The result of looking up method <i>m</i> in class <i>C</i> with respect to
/// library <i>L</i> is:
/// * If <i>C</i> declares an instance method named <i>m</i> that is
/// accessible to <i>L</i>, then that method is the result of the lookup.
/// Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the
/// lookup is the result of looking up method <i>m</i> in <i>S</i> with
/// respect to <i>L</i> Otherwise, we say that the lookup has failed.
/// </blockquote>
MethodElement lookUpMethod(String name, LibraryElement library);
/// Return the element representing the method that results from looking up
/// the method with the given [name] in the superclass of this class with
/// respect to the given [library], or `null` if the look up fails. The
/// behavior of this method is defined by the Dart Language Specification in
/// section 12.15.1:
/// <blockquote>
/// The result of looking up method <i>m</i> in class <i>C</i> with respect to
/// library <i>L</i> is:
/// * If <i>C</i> declares an instance method named <i>m</i> that is
/// accessible to <i>L</i>, then that method is the result of the lookup.
/// Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the
/// * lookup is the result of looking up method <i>m</i> in <i>S</i> with
/// respect to <i>L</i>.
/// * Otherwise, we say that the lookup has failed.
/// </blockquote>
MethodElement lookUpMethodInSuperclass(String name, LibraryElement library);
/// Return the element representing the setter that results from looking up
/// the setter with the given [name] in this class with respect to the given
/// [library], or `null` if the look up fails. The behavior of this method is
/// defined by the Dart Language Specification in section 12.16:
/// <blockquote>
/// The result of looking up getter (respectively setter) <i>m</i> in class
/// <i>C</i> with respect to library <i>L</i> is:
/// * If <i>C</i> declares an instance getter (respectively setter) named
/// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
/// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
/// superclass <i>S</i>, then the result of the lookup is the result of
/// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
/// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
/// </blockquote>
PropertyAccessorElement lookUpSetter(String name, LibraryElement library);
/// Return the element representing the setter that results from looking up
/// the setter with the given [name] in the superclass of this class with
/// respect to the given [library], or `null` if the look up fails. The
/// behavior of this method is defined by the Dart Language Specification in
/// section 12.16:
/// <blockquote>
/// The result of looking up getter (respectively setter) <i>m</i> in class
/// <i>C</i> with respect to library <i>L</i> is:
/// * If <i>C</i> declares an instance getter (respectively setter) named
/// <i>m</i> that is accessible to <i>L</i>, then that getter (respectively
/// setter) is the result of the lookup. Otherwise, if <i>C</i> has a
/// superclass <i>S</i>, then the result of the lookup is the result of
/// looking up getter (respectively setter) <i>m</i> in <i>S</i> with
/// respect to <i>L</i>. Otherwise, we say that the lookup has failed.
/// </blockquote>
PropertyAccessorElement lookUpSetterInSuperclass(
String name, LibraryElement library);
@override
InterfaceType substitute2(
List<DartType> argumentTypes, List<DartType> parameterTypes);
/// Return the type resulting from substituting the given arguments for this
/// type's parameters. This is fully equivalent to `substitute2(argumentTypes,
/// getTypeArguments())`.
@deprecated // use instantiate
InterfaceType substitute4(List<DartType> argumentTypes);
/// Returns a "smart" version of the "least upper bound" of the given types.
///
/// If these types have the same element and differ only in terms of the type
/// arguments, attempts to find a compatible set of type arguments.
///
/// Otherwise, returns the same result as [DartType.getLeastUpperBound].
// TODO(brianwilkerson) This needs to be deprecated and moved to TypeSystem.
static InterfaceType getSmartLeastUpperBound(
InterfaceType first, InterfaceType second) =>
InterfaceTypeImpl.getSmartLeastUpperBound(first, second);
}
/// A type that can track substituted type parameters, either for itself after
/// instantiation, or from a surrounding context.
///
/// For example, given a class `Foo<T>`, after instantiation with S for T, it
/// will track the substitution `{S/T}`.
///
/// This substitution will be propagated to its members. For example, say our
/// `Foo<T>` class has a field `T bar;`. When we look up this field, we will get
/// back a [FieldElement] that tracks the substituted type as `{S/T}T`, so when
/// we ask for the field type we will get `S`.
///
/// Clients may not extend, implement or mix-in this class.
abstract class ParameterizedType implements DartType {
/// Return a list containing the actual types of the type arguments. If this
/// type's element does not have type parameters, then the array should be
/// empty (although it is possible for type arguments to be erroneously
/// declared). If the element has type parameters and the actual type does not
/// explicitly include argument values, then the type "dynamic" will be
/// automatically provided.
List<DartType> get typeArguments;
/// Return a list containing all of the type parameters declared for this
/// type.
List<TypeParameterElement> get typeParameters;
/// Return the type resulting from instantiating (replacing) the given
/// [argumentTypes] for this type's bound type parameters.
ParameterizedType instantiate(List<DartType> argumentTypes);
}
/// The type introduced by a type parameter.
///
/// Clients may not extend, implement or mix-in this class.
abstract class TypeParameterType implements DartType {
/// Return the type representing the bound associated with this parameter,
/// or `dynamic` if there was no explicit bound.
DartType get bound;
/// An object that can be used to identify this type parameter with `==`.
///
/// Depending on the use, [bound] may also need to be taken into account.
/// A given type parameter, it may have different bounds in different scopes.
/// Always consult the bound if that could be relevant.
ElementLocation get definition;
@override
TypeParameterElement get element;
}
| 0 |
Subsets and Splits