Get rid of Meta elsewhere
This commit is contained in:
parent
8a34034819
commit
69c215eac9
@ -419,8 +419,9 @@ impl Pattern {
|
||||
fn to_subpattern(&self, symbol_table: &SymbolTable) -> Subpattern {
|
||||
use self::Pattern::*;
|
||||
match self {
|
||||
TupleStruct( Meta { n: QualifiedName{ components, .. }, fqsn, .. }, inner_patterns) => {
|
||||
match fqsn.as_ref().and_then(|fqsn| symbol_table.lookup_by_fqsn(&fqsn)) {
|
||||
TupleStruct( Meta { n: QualifiedName{ components, id }, .. }, inner_patterns) => {
|
||||
let fqsn = symbol_table.get_fqsn_from_id(&id);
|
||||
match fqsn.and_then(|fqsn| symbol_table.lookup_by_fqsn(&fqsn)) {
|
||||
Some(symbol) => handle_symbol(Some(symbol), inner_patterns, symbol_table),
|
||||
None => {
|
||||
panic!("Symbol {:?} not found", components);
|
||||
@ -433,12 +434,12 @@ impl Pattern {
|
||||
},
|
||||
Ignored => Subpattern { tag: None, subpatterns: vec![], guard: None, bound_vars: vec![] },
|
||||
Literal(lit) => lit.to_subpattern(symbol_table),
|
||||
VarOrName(Meta { n: QualifiedName { components, .. }, fqsn, .. }) => {
|
||||
VarOrName(Meta { n: QualifiedName { components, id }, .. }) => {
|
||||
// if fqsn is Some, treat this as a symbol pattern. If it's None, treat it
|
||||
// as a variable.
|
||||
println!("Calling VarOrName reduction with : {:?}", components);
|
||||
|
||||
match fqsn.as_ref().and_then(|fqsn| symbol_table.lookup_by_fqsn(&fqsn)) {
|
||||
let fqsn = symbol_table.get_fqsn_from_id(&id);
|
||||
match fqsn.and_then(|fqsn| symbol_table.lookup_by_fqsn(&fqsn)) {
|
||||
Some(symbol) => handle_symbol(Some(symbol), &vec![], symbol_table),
|
||||
None => {
|
||||
let name = if components.len() == 1 {
|
||||
|
@ -147,8 +147,11 @@ impl<'a> ScopeResolver<'a> {
|
||||
/// this might be a variable or a pattern. if a variable, set to none
|
||||
fn qualified_name_in_pattern(&mut self, meta_qualified_name: &mut Meta<QualifiedName>, ) {
|
||||
let inner_name = meta_qualified_name.node();
|
||||
let ref id = inner_name.id;
|
||||
let fqsn = lookup_name_in_scope(inner_name);
|
||||
meta_qualified_name.fqsn = if self.symbol_table.lookup_by_fqsn(&fqsn).is_some() { Some(fqsn) } else { None };
|
||||
if self.symbol_table.lookup_by_fqsn(&fqsn).is_some() {
|
||||
self.symbol_table.map_id_to_fqsn(&id, fqsn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user