Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static type inspection. #156

Merged
merged 95 commits into from
May 27, 2020
Merged

Static type inspection. #156

merged 95 commits into from
May 27, 2020

Conversation

JordanBoltonMN
Copy link
Contributor

Extends the existing POC for static type inspection.


export type TriedType = Result<Type.TType, CommonError.CommonError>;

export function tryScopeType(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns typing for each item in the given scope.

return ResultUtils.ensureResult(getLocalizationTemplates(settings.locale), () => inspectScopeType(state, nodeId));
}

export function tryType(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns typing for a single node.

@@ -141,6 +112,103 @@ export function letKeyValuePairs(
return maybeArrayWrapper === undefined ? [] : keyValuePairs(nodeIdMapCollection, maybeArrayWrapper);
}

export function fieldProjectionFieldSelectors(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several new helper functions for iterating over TXorNodes.

@@ -735,7 +735,7 @@ export function readRecursivePrimaryExpression<S extends IParserState = IParserS
const recursiveArrayNodeKind: Ast.NodeKind.ArrayWrapper = Ast.NodeKind.ArrayWrapper;
IParserStateUtils.startContext(state, recursiveArrayNodeKind);

const recursiveExpressions: Ast.TRecursivePrimaryExpression[] = [];
const recursiveExpressions: (Ast.InvokeExpression | Ast.ItemAccessExpression | Ast.TFieldAccessExpression)[] = [];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stricter typing.

@@ -1368,7 +1370,7 @@ export function readFieldSpecificationList<S extends IParserState = IParserState
);
const fields: Ast.ICsv<Ast.FieldSpecification>[] = [];
let continueReadingValues: boolean = true;
let maybeOpenRecordMarkerConstant: Ast.IConstant<Ast.MiscConstantKind.Ellipsis> | undefined = undefined;
let isOnOpenRecordMarker: boolean = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug fix where the open record constant marked as the child of the inccorrect node.

@@ -93,95 +107,3 @@ function functionParameterXorNodes(
? []
: NodeIdMapIterator.arrayWrapperCsvXorNodes(nodeIdMapCollection, maybeWrappedContent);
}

function examineParameter(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to TypeUtils

src/type/type.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants