// 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. library vm.bytecode.options; /// Collection of options for bytecode generator. class BytecodeOptions { static Map commandLineFlags = { 'annotations': 'Emit Dart annotations', 'local-var-info': 'Emit debug information about local variables', 'show-bytecode-size-stat': 'Show bytecode size breakdown', 'source-positions': 'Emit source positions', }; bool enableAsserts; bool causalAsyncStacks; bool emitSourcePositions; bool emitSourceFiles; bool emitLocalVarInfo; bool emitAnnotations; bool omitAssertSourcePositions; bool showBytecodeSizeStatistics; Map environmentDefines; BytecodeOptions( {this.enableAsserts = false, this.causalAsyncStacks, this.emitSourcePositions = false, this.emitSourceFiles = false, this.emitLocalVarInfo = false, this.emitAnnotations = false, this.omitAssertSourcePositions = false, this.showBytecodeSizeStatistics = false, this.environmentDefines = const {}}) { causalAsyncStacks ??= environmentDefines['dart.developer.causal_async_stacks'] == 'true'; } void parseCommandLineFlags(List flags) { if (flags == null) { return; } for (String flag in flags) { switch (flag) { case 'source-positions': emitSourcePositions = true; break; case 'local-var-info': emitLocalVarInfo = true; break; case 'annotations': emitAnnotations = true; break; case 'show-bytecode-size-stat': showBytecodeSizeStatistics = true; break; default: throw 'Unexpected bytecode flag $flag'; } } } }