Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Lock down parser flow type exports#5674

Merged
jasonLaster merged 2 commits into
firefox-devtools:masterfrom
jasonLaster:asty
Mar 14, 2018
Merged

Lock down parser flow type exports#5674
jasonLaster merged 2 commits into
firefox-devtools:masterfrom
jasonLaster:asty

Conversation

@jasonLaster

Copy link
Copy Markdown
Contributor

Summary of Changes

  • adds flow types for utils/ast
  • exports types from parser/index
  • fixes a recursion issue caused by defining types in getSymbols

@jasonLaster jasonLaster force-pushed the asty branch 3 times, most recently from 41e05ba to 1c74c4b Compare March 14, 2018 20:13
Comment thread src/actions/preview.js
} else {
match = getExpressionFromCoords(editor.codeMirror, tokenPos);
} else {
match = findBestMatchExpression(symbols, tokenPos);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yikes. really helpful catch

location: BabelLocation,
parent?: ClassDeclaration
|};
import type { SimplePath } from "./utils/simple-path";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

just being consistent. i kinda like how it can be more concise, but we dont do it anywhere else

Comment thread src/utils/ast.js
import type { Position } from "../types";
import type { SymbolDeclarations } from "../workers/parser";

export function findBestMatchExpression(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your fix seems more like the right one, but I'll add that the immediate thing that jumped out to me when I looked is that this function's return type is still weird. It should be SymbolDeclaration | null or something, but it is SymbolDeclaration | {} right now. That means if you were in a file that doesn't have any identifiers, it still looks like it found something.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, true

@jasonLaster jasonLaster force-pushed the asty branch 3 times, most recently from 448abdb to c8a4325 Compare March 14, 2018 21:11
@jasonLaster jasonLaster merged commit bf65b79 into firefox-devtools:master Mar 14, 2018
@jasonLaster

Copy link
Copy Markdown
Contributor Author

cool, this will be fixed in the pause points work

jasonLaster added a commit to jasonLaster/debugger.html that referenced this pull request Mar 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants