amber-lang / amber-lang/amber

Review prototype/legacy usage of tuples

Open
#1,024 0 comments 0 reactions 0 assignees View on GitHub
rust
Dominant language
Rust
Stars
5.2k
Forks
145
Avg merge
5d 3h
Merged PRs (30d)
7

Description

## Tuple expressions and patterns

### src/compiler.rs
- L157: `Ok(()) => Ok((block, meta)),`
- L175: `.map(|meta| (file.path.clone(), meta.block.clone()))`
- L181: `result.push((path, block));`
- L184: `result.push((self.path.clone().unwrap_or(String::from("unknown")), block));`
- L370: `Ok((block, meta))`
- L379: `Ok((messages, code))`

### src/main.rs
- L237: `(bash_code, !messages.is_empty())`

### src/modules/block.rs
- L136: `.map(|(index, statement)| (index, statement.get_docs_item_name()))`
- L137: `.filter_map(|(index, name)| name.map(|n| (n, index)))`

### src/modules/builtin/nameof.rs
- L94: `self.function_variant = Some((fun_decl.id, variant_id));`

### src/modules/command/cmd.rs
- L41: `(self.strings, self.interps) = parse_interpolated_region(meta, &InterpolatedRegionType::Command)?;`
- L111: `match (is_statement, has_failure_handler) {`

### src/modules/condition/ifchain.rs
- L75: `self.false_block = Some((comments, false_block));`
- L92: `self.cond_blocks.push((comments, cond, block));`
- L131: `new_chain.push((comments, cond, block));`
- L152: `new_chain.push((comments, cond, block));`

### src/modules/expression/access.rs
- L21: `match (&index.value, &self.kind) {`

### src/modules/expression/binop/and.rs
- L18: `match (left, right) {`
- L44: `(true_facts, false_facts)`

### src/modules/expression/binop/eq.rs
- L69: `if let (FragmentKind::VarExpr(left), FragmentKind::VarExpr(right)) = (left, right) {`

### src/modules/expression/binop/mod.rs
- L62: `match (left.get_type(), right.get_type()) {`

### src/modules/expression/binop/neq.rs
- L69: `if let (FragmentKind::VarExpr(left), FragmentKind::VarExpr(right)) = (left, right) {`

### src/modules/expression/binop/or.rs
- L21: `match (left, right) {`
- L47: `(true_facts, false_facts)`

### src/modules/expression/binop/range.rs
- L74: `(self.from.get_integer_value(), self.to.get_integer_value())`
- L241: `return (`
- L303: `(offset, length)`

### src/modules/expression/expr.rs
- L98: `_ => (HashMap::new(), HashMap::new()),`

### src/modules/expression/interpolated_region.rs
- L103: `Ok((strings, interps))`
- L143: `return Ok((strings, interps));`

### src/modules/expression/literal/text.rs
- L34: `(self.strings, self.interps) =`

### src/modules/expression/ternop/ternary.rs
- L112: `if let (Type::Array(t), Type::Array(f)) = (&true_type, &false_type) {`
- L125: `if let (Some(true_expr), Some(false_expr)) = (&self.true_expr, &self.false_expr) {`

### src/modules/expression/typeop/cast.rs
- L67: `match (l_type, r_type) {`

### src/modules/expression/typeop/is.rs
- L47: `return (true_facts, false_facts);`
- L49: `(HashMap::new(), HashMap::new())`

### src/modules/expression/unop/not.rs
- L23: `(false_facts, true_facts)`

### src/modules/function/declaration.rs
- L72: `match (arg.is_ref, kind) {`

### src/modules/function/declaration_utils.rs
- L27: `(index_begin, index_end, is_failable)`

### src/modules/function/invocation.rs
- L67: `(self.line, self.col) = tok.pos;`
- L146: `if let (Type::Array(inner), Type::Array(expected_inner)) = (arg_expr.get_type(), &fun_arg.kind) {`
- L161: `(self.kind, self.variant_id) = handle_function_parameters(meta, self.id, function_unit.clone(), &types, &var_refs, self.name_tok.clone())?;`

### src/modules/function/invocation_utils.rs
- L83: `if let Some(variant_id) = meta.parsing_functions.get(&(fun.id, args.to_vec())) {`
- L84: `return Ok((fun.returns.clone(), *variant_id));`
- L90: `.insert((fun.id, args.to_vec()), variant_id);`
- L153: `meta.parsing_functions.remove(&(fun.id, args.to_vec()));`
- L166: `Ok((`
- L171: `Ok((fun.returns.clone(), 0))`
- L231: `Some(fun) => Ok((fun.returns.clone(), fun.variant_id)),`

### src/modules/imports/import.rs
- L48: `match (found_fn, found_var) {`

### src/modules/loops/iter_loop.rs
- L97: `match (self.iter_index.as_ref(), self.iter_index_global_id) {`

### src/modules/loops/utils/iter_loop_range.rs
- L41: `(range.from.get_integer_value(), range.to.get_integer_value())`
- L70: `match (self.iter_index.as_ref(), self.iter_index_global_id) {`
- L73: `(`
- L78: `_ => (FragmentKind::Empty, FragmentKind::Empty),`
- L164: `(`
- L169: `(`

### src/modules/shorthand/add.rs
- L58: `if let (Type::Array(inner_left), Type::Array(inner_right)) = (&self.kind, &right_type) {`

### src/modules/types.rs
- L27: `match (self, other) {`
- L31: `(Type::Array(current), Type::Array(other)) => match (&**current, &**other) {`
- L80: `if let (Type::Array(const_type), Type::Array(other_type)) = (self, other) {`
- L102: `match (self, other) {`
- L157: `left = match (left, right) {`

### src/modules/variable/mod.rs
- L225: `match (&index.kind, &index.value) {`

### src/modules/variable/set.rs
- L109: `if let (Type::Array(inner_var), Type::Array(inner_right)) = (&self.var_type, &expr_type)`

### src/optimizer/ephemeral_vars.rs
- L20: `(&block.statements[i], &block.statements[i + 1])`

### src/optimizer/unused_vars.rs
- L41: `let mut transitive_variables = HashMap::from([(name.clone(), vec![0_usize])]);`

### src/testing.rs
- L68: `tests.push((file.clone(), name, code.clone()));`
- L190: `failed.lock().unwrap().push((i + 1, test_name_display, msg));`

### src/tests/mod.rs
- L91: `(`

### src/translate/compare.rs
- L20: `ComparisonOperator::Gt => (ComparisonOperator::Gt, None),`
- L21: `ComparisonOperator::Ge => (ComparisonOperator::Gt, Some(ComparisonOperator::Eq)),`
- L22: `ComparisonOperator::Lt => (ComparisonOperator::Lt, None),`
- L23: `ComparisonOperator::Le => (ComparisonOperator::Lt, Some(ComparisonOperator::Eq)),`
- L24: `ComparisonOperator::Eq => (ComparisonOperator::Eq, None),`
- L141: `(len_stmt, len_expr)`
- L183: `(var_stmt, var_expr)`

### src/translate/compute.rs
- L81: `let (left, right) = (`

### src/translate/fragments/var_expr.rs
- L226: `match (&self.kind, index.map(|var| *var)) {`

### src/utils/import_cache.rs
- L123: `.map(|meta| (meta.pub_funs.clone(), meta.pub_vars.clone()))`

## Tuple types (signatures/annotations)

### src/main.rs
- L214: `fn compile_input(input: PathBuf, options: CompilerOptions) -> (String, bool) {`

### src/modules/expression/binop/and.rs
- L26: `pub fn extract_facts(&self) -> (HashMap, HashMap) {`

### src/modules/expression/binop/or.rs
- L29: `pub fn extract_facts(&self) -> (HashMap, HashMap) {`

### src/modules/expression/binop/range.rs
- L230: `pub fn get_array_index(&self, meta: &mut TranslateMetadata) -> (FragmentKind, FragmentKind) {`

### src/modules/expression/expr.rs
- L91: `pub fn extract_facts(&self) -> (HashMap, HashMap) {`

### src/modules/expression/parentheses.rs
- L23: `pub fn extract_facts(&self) -> (HashMap, HashMap) {`

### src/modules/expression/typeop/is.rs
- L36: `pub fn extract_facts(&self) -> (HashMap, HashMap) {`

### src/modules/expression/unop/not.rs
- L21: `pub fn extract_facts(&self) -> (HashMap, HashMap) {`

### src/modules/function/declaration_utils.rs
- L9: `pub fn skip_function_body(meta: &mut ParserMetadata) -> (usize, usize, bool) {`

### src/modules/loops/utils/iter_loop_range.rs
- L18: `fn translate_range_loop_index_fragments(&self) -> (FragmentKind, FragmentKind);`
- L69: `fn translate_range_loop_index_fragments(&self) -> (FragmentKind, FragmentKind) {`

### src/tests/mod.rs
- L81: `pub fn eval_bash>(code: T) -> (String, String) {`

### src/translate/compare.rs
- L18: `fn get_bash_lexical_operators(&self) -> (ComparisonOperator, Option) {`
- L126: `) -> (VarStmtFragment, VarExprFragment) {`
- L175: `) -> (VarStmtFragment, VarExprFragment) {`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.