Skip to content

Many fixes#14

Merged
kevmoo merged 8 commits into
masterfrom
updates
Jul 20, 2017
Merged

Many fixes#14
kevmoo merged 8 commits into
masterfrom
updates

Conversation

@kevmoo

@kevmoo kevmoo commented Jul 20, 2017

Copy link
Copy Markdown
Collaborator

No description provided.

@kevmoo

kevmoo commented Jul 20, 2017

Copy link
Copy Markdown
Collaborator Author

Follow-on from #13

@kevmoo kevmoo changed the title WIP: Updates Many fixes Jul 20, 2017
@kevmoo
kevmoo requested a review from natebosch July 20, 2017 15:33
// Then we need to add `?.toList()
expression += "?.toList()";
if (!isList) {
// Then we need to add `?.toList()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

avoid comments that only repeat what the code is doing - if you want to keep a comment here it should say why we need this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ack

}

return expression;
return "$expression /* unsafe */";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This went from 46 lines to 80 lines - consider breaking out some composed methods

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ack

var subFieldValue =
_fieldToJsonMapValue(substitute, valueType, depth + 1);

// In this case, we're going to create a new Map with matching reified

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

more comments that only say what is happening...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ack

expression += "?.toList()";
}

return expression;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

there are lots of early returns in this method - it's a little hard to keep track

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah – can look at in a future PR. Added a note.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

...or just refactor!

keyArg.isObject ||
_coreStringChecker.isExactlyType(keyArg);

var safeValue = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[optional] more declarative is safeValue = valueType.isDynamic || valueType.isObject || _stringBoolNumChecker.isAssignableFromType(valueType);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Nice!


// convert

var substitute = "v$depth";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[nit] mixing single and double quotes in this file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kevmoo

kevmoo commented Jul 20, 2017

Copy link
Copy Markdown
Collaborator Author

@natebosch PTAL

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.

2 participants