{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/prepack/pulls/comments/168168050","pull_request_review_id":96489596,"id":168168050,"diff_hunk":"@@ -221,90 +223,153 @@ function evaluateJSXAttributes(\n   strictCode: boolean,\n   env: LexicalEnvironment,\n   realm: Realm\n-): { attributes: Map<string, Value>, children: ArrayValue | Value | null } {\n-  let attributes = new Map();\n+): { key: Value, props: ObjectValue | AbstractObjectValue, ref: Value } {\n+  let props = Create.ObjectCreate(realm, realm.intrinsics.ObjectPrototype);\n   let children = evaluateJSXChildren(astChildren, strictCode, env, realm);\n+  let key = realm.intrinsics.null;\n+  let ref = realm.intrinsics.null;\n   let defaultProps = getDefaultProps(elementType, env, realm);\n+  // to be used if we need to create an abstract props\n+  let abstractPropsArgs = [];\n+\n+  let containsAbstractSpreadAttribute = false;\n+  let containsAbstractKey = false;\n+  let containsAbstractRef = false;\n+  let spreadAttributesCount = 0;\n+  let spreadAttributesWithInitialPropsHintCount = 0;\n+  let attributesAssigned = 0;\n+\n+  const setProp = (name: string, value: Value, isDefaultProps: boolean): void => {\n+    if (name === \"children\") {\n+      if (isDefaultProps && children !== null) {","path":"src/evaluators/JSXElement.js","position":65,"original_position":65,"commit_id":"ef22dac0fc96a30d743224903117d45c0bb6dfdb","original_commit_id":"ef22dac0fc96a30d743224903117d45c0bb6dfdb","user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars0.githubusercontent.com/u/810438?v=4","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"body":"What is special about default props and children here? I would expect default props to work the same way whether the prop is “children” or any other prop. This special case is confusing and I’m not a fan of `isDefaultProps` argument here. The code below intentionally tries to treat “default props” as just props that were assigned early. This special case undermines that. ","created_at":"2018-02-14T13:08:31Z","updated_at":"2018-02-14T13:16:43Z","html_url":"https://github.com/facebook/prepack/pull/1447#discussion_r168168050","pull_request_url":"https://api.github.com/repos/facebook/prepack/pulls/1447","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/facebook/prepack/pulls/comments/168168050"},"html":{"href":"https://github.com/facebook/prepack/pull/1447#discussion_r168168050"},"pull_request":{"href":"https://api.github.com/repos/facebook/prepack/pulls/1447"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/prepack/pulls/1447","id":169084727,"html_url":"https://github.com/facebook/prepack/pull/1447","diff_url":"https://github.com/facebook/prepack/pull/1447.diff","patch_url":"https://github.com/facebook/prepack/pull/1447.patch","issue_url":"https://api.github.com/repos/facebook/prepack/issues/1447","number":1447,"state":"open","locked":false,"title":"[WIP] Improve the ReactElement logic for evaluation to improve folding cases","user":{"login":"trueadm","id":1519870,"avatar_url":"https://avatars0.githubusercontent.com/u/1519870?v=4","gravatar_id":"","url":"https://api.github.com/users/trueadm","html_url":"https://github.com/trueadm","followers_url":"https://api.github.com/users/trueadm/followers","following_url":"https://api.github.com/users/trueadm/following{/other_user}","gists_url":"https://api.github.com/users/trueadm/gists{/gist_id}","starred_url":"https://api.github.com/users/trueadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trueadm/subscriptions","organizations_url":"https://api.github.com/users/trueadm/orgs","repos_url":"https://api.github.com/users/trueadm/repos","events_url":"https://api.github.com/users/trueadm/events{/privacy}","received_events_url":"https://api.github.com/users/trueadm/received_events","type":"User","site_admin":false},"body":"Currently, there are too many cases where ReactElement evaluation bails out. This PR aims to solve many of those cases:\r\n\r\n- [x] Introduce a `reactHint` for abstract `props` that we have no `key` or `ref`\r\n- [x] Refactor JSX evaluation to properly handle and deal with JSX spreads\r\n- [x] Ensure all react-tests run both transpiled and non-transpiled so the `React.createElement` route can be evaluated and tested\r\n- [ ] Refactor React.createElement mock to work like the JSX evaluator\r\n- [ ] Ensure that we internally pass around `reactHint` in cases of `Object.assign`\r\n- [ ] Rather than throw an error, unsafely make a warning that we've detected cases where `key` and `ref` could not properly be determined ahead-of-time","created_at":"2018-02-14T11:26:44Z","updated_at":"2018-02-14T13:16:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"547a33b4ab495e7bb537074b4a19aa55ed319723","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":279345275,"url":"https://api.github.com/repos/facebook/prepack/labels/CLA%20Signed","name":"CLA Signed","color":"009900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/prepack/pulls/1447/commits","review_comments_url":"https://api.github.com/repos/facebook/prepack/pulls/1447/comments","review_comment_url":"https://api.github.com/repos/facebook/prepack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/prepack/issues/1447/comments","statuses_url":"https://api.github.com/repos/facebook/prepack/statuses/ef22dac0fc96a30d743224903117d45c0bb6dfdb","head":{"label":"trueadm:new-create-element","ref":"new-create-element","sha":"ef22dac0fc96a30d743224903117d45c0bb6dfdb","user":{"login":"trueadm","id":1519870,"avatar_url":"https://avatars0.githubusercontent.com/u/1519870?v=4","gravatar_id":"","url":"https://api.github.com/users/trueadm","html_url":"https://github.com/trueadm","followers_url":"https://api.github.com/users/trueadm/followers","following_url":"https://api.github.com/users/trueadm/following{/other_user}","gists_url":"https://api.github.com/users/trueadm/gists{/gist_id}","starred_url":"https://api.github.com/users/trueadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trueadm/subscriptions","organizations_url":"https://api.github.com/users/trueadm/orgs","repos_url":"https://api.github.com/users/trueadm/repos","events_url":"https://api.github.com/users/trueadm/events{/privacy}","received_events_url":"https://api.github.com/users/trueadm/received_events","type":"User","site_admin":false},"repo":{"id":101437011,"name":"prepack","full_name":"trueadm/prepack","owner":{"login":"trueadm","id":1519870,"avatar_url":"https://avatars0.githubusercontent.com/u/1519870?v=4","gravatar_id":"","url":"https://api.github.com/users/trueadm","html_url":"https://github.com/trueadm","followers_url":"https://api.github.com/users/trueadm/followers","following_url":"https://api.github.com/users/trueadm/following{/other_user}","gists_url":"https://api.github.com/users/trueadm/gists{/gist_id}","starred_url":"https://api.github.com/users/trueadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trueadm/subscriptions","organizations_url":"https://api.github.com/users/trueadm/orgs","repos_url":"https://api.github.com/users/trueadm/repos","events_url":"https://api.github.com/users/trueadm/events{/privacy}","received_events_url":"https://api.github.com/users/trueadm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/trueadm/prepack","description":"Prepack is a partial evaluator for JavaScript. Prepack rewrites a JavaScript bundle, resulting in JavaScript code that executes more efficiently.","fork":true,"url":"https://api.github.com/repos/trueadm/prepack","forks_url":"https://api.github.com/repos/trueadm/prepack/forks","keys_url":"https://api.github.com/repos/trueadm/prepack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trueadm/prepack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trueadm/prepack/teams","hooks_url":"https://api.github.com/repos/trueadm/prepack/hooks","issue_events_url":"https://api.github.com/repos/trueadm/prepack/issues/events{/number}","events_url":"https://api.github.com/repos/trueadm/prepack/events","assignees_url":"https://api.github.com/repos/trueadm/prepack/assignees{/user}","branches_url":"https://api.github.com/repos/trueadm/prepack/branches{/branch}","tags_url":"https://api.github.com/repos/trueadm/prepack/tags","blobs_url":"https://api.github.com/repos/trueadm/prepack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trueadm/prepack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trueadm/prepack/git/refs{/sha}","trees_url":"https://api.github.com/repos/trueadm/prepack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trueadm/prepack/statuses/{sha}","languages_url":"https://api.github.com/repos/trueadm/prepack/languages","stargazers_url":"https://api.github.com/repos/trueadm/prepack/stargazers","contributors_url":"https://api.github.com/repos/trueadm/prepack/contributors","subscribers_url":"https://api.github.com/repos/trueadm/prepack/subscribers","subscription_url":"https://api.github.com/repos/trueadm/prepack/subscription","commits_url":"https://api.github.com/repos/trueadm/prepack/commits{/sha}","git_commits_url":"https://api.github.com/repos/trueadm/prepack/git/commits{/sha}","comments_url":"https://api.github.com/repos/trueadm/prepack/comments{/number}","issue_comment_url":"https://api.github.com/repos/trueadm/prepack/issues/comments{/number}","contents_url":"https://api.github.com/repos/trueadm/prepack/contents/{+path}","compare_url":"https://api.github.com/repos/trueadm/prepack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trueadm/prepack/merges","archive_url":"https://api.github.com/repos/trueadm/prepack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trueadm/prepack/downloads","issues_url":"https://api.github.com/repos/trueadm/prepack/issues{/number}","pulls_url":"https://api.github.com/repos/trueadm/prepack/pulls{/number}","milestones_url":"https://api.github.com/repos/trueadm/prepack/milestones{/number}","notifications_url":"https://api.github.com/repos/trueadm/prepack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trueadm/prepack/labels{/name}","releases_url":"https://api.github.com/repos/trueadm/prepack/releases{/id}","deployments_url":"https://api.github.com/repos/trueadm/prepack/deployments","created_at":"2017-08-25T19:46:20Z","updated_at":"2017-11-08T22:31:18Z","pushed_at":"2018-02-14T11:41:37Z","git_url":"git://github.com/trueadm/prepack.git","ssh_url":"git@github.com:trueadm/prepack.git","clone_url":"https://github.com/trueadm/prepack.git","svn_url":"https://github.com/trueadm/prepack","homepage":"https://prepack.io","size":6047,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"19bf2d680dae2726db7c4dc864b5cd6785ecd89b","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":45147841,"name":"prepack","full_name":"facebook/prepack","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/prepack","description":"Prepack is a partial evaluator for JavaScript. Prepack rewrites a JavaScript bundle, resulting in JavaScript code that executes more efficiently.","fork":false,"url":"https://api.github.com/repos/facebook/prepack","forks_url":"https://api.github.com/repos/facebook/prepack/forks","keys_url":"https://api.github.com/repos/facebook/prepack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/prepack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/prepack/teams","hooks_url":"https://api.github.com/repos/facebook/prepack/hooks","issue_events_url":"https://api.github.com/repos/facebook/prepack/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/prepack/events","assignees_url":"https://api.github.com/repos/facebook/prepack/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/prepack/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/prepack/tags","blobs_url":"https://api.github.com/repos/facebook/prepack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/prepack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/prepack/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/prepack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/prepack/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/prepack/languages","stargazers_url":"https://api.github.com/repos/facebook/prepack/stargazers","contributors_url":"https://api.github.com/repos/facebook/prepack/contributors","subscribers_url":"https://api.github.com/repos/facebook/prepack/subscribers","subscription_url":"https://api.github.com/repos/facebook/prepack/subscription","commits_url":"https://api.github.com/repos/facebook/prepack/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/prepack/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/prepack/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/prepack/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/prepack/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/prepack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/prepack/merges","archive_url":"https://api.github.com/repos/facebook/prepack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/prepack/downloads","issues_url":"https://api.github.com/repos/facebook/prepack/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/prepack/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/prepack/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/prepack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/prepack/labels{/name}","releases_url":"https://api.github.com/repos/facebook/prepack/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/prepack/deployments","created_at":"2015-10-28T23:25:08Z","updated_at":"2018-02-14T08:57:35Z","pushed_at":"2018-02-14T11:41:39Z","git_url":"git://github.com/facebook/prepack.git","ssh_url":"git@github.com:facebook/prepack.git","clone_url":"https://github.com/facebook/prepack.git","svn_url":"https://github.com/facebook/prepack","homepage":"https://prepack.io","size":6745,"stargazers_count":11159,"watchers_count":11159,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":329,"mirror_url":null,"archived":false,"open_issues_count":147,"license":null,"forks":329,"open_issues":147,"watchers":11159,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/prepack/pulls/1447"},"html":{"href":"https://github.com/facebook/prepack/pull/1447"},"issue":{"href":"https://api.github.com/repos/facebook/prepack/issues/1447"},"comments":{"href":"https://api.github.com/repos/facebook/prepack/issues/1447/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/prepack/pulls/1447/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/prepack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/prepack/pulls/1447/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/prepack/statuses/ef22dac0fc96a30d743224903117d45c0bb6dfdb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gaearon"}}