mirror of https://github.com/AMT-Cheif/drift.git
Document confusing code
This commit is contained in:
parent
968af8f56e
commit
535425e34f
|
@ -41,7 +41,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.6.0
|
test: ^1.6.0
|
||||||
build_runner: ^1.6.7
|
build_runner: ^1.6.7
|
||||||
build_test: ^1.3.4
|
build_test: ^1.3.6
|
||||||
json_serializable: ^4.0.0-nullsafety
|
json_serializable: ^4.0.0-nullsafety
|
||||||
|
|
||||||
executables:
|
executables:
|
||||||
|
|
|
@ -24,25 +24,21 @@ class AstPreparingVisitor extends RecursiveVisitor<void, void> {
|
||||||
final scope = e.scope = e.scope.createChild();
|
final scope = e.scope = e.scope.createChild();
|
||||||
final registeredTable = scope.resolve(e.tableName) as Table?;
|
final registeredTable = scope.resolve(e.tableName) as Table?;
|
||||||
|
|
||||||
|
// This is used so that tables can refer to their own columns. Code using
|
||||||
|
// tables would first register the table and then run analysis again.
|
||||||
if (registeredTable != null) {
|
if (registeredTable != null) {
|
||||||
scope.availableColumns = registeredTable.resolvedColumns;
|
scope.availableColumns = registeredTable.resolvedColumns;
|
||||||
for (final column in registeredTable.resolvedColumns) {
|
for (final column in registeredTable.resolvedColumns) {
|
||||||
scope.register(column.name, column);
|
scope.register(column.name, column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
visitChildren(e, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitCreateViewStatement(CreateViewStatement e, void arg) {
|
void visitCreateViewStatement(CreateViewStatement e, void arg) {
|
||||||
final scope = e.scope = e.scope.createChild();
|
e.scope = e.scope.createChild();
|
||||||
final registeredView = scope.resolve(e.viewName) as View?;
|
|
||||||
if (registeredView != null) {
|
|
||||||
scope.availableColumns = registeredView.resolvedColumns;
|
|
||||||
for (final column in registeredView.resolvedColumns) {
|
|
||||||
scope.register(column.name, column);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
visitChildren(e, arg);
|
visitChildren(e, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue