<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[182106] trunk/Source/WebInspectorUI</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182106">182106</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-27 22:04:23 -0700 (Fri, 27 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: TypeProfiler doesn't work on files with ES6 Class Syntax
https://bugs.webkit.org/show_bug.cgi?id=143169

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2015-03-27
Reviewed by Timothy Hatcher.

* UserInterface/Models/ScriptSyntaxTree.js:
(WebInspector.ScriptSyntaxTree.prototype._recurse):
(WebInspector.ScriptSyntaxTree.prototype._createInternalSyntaxTree):
(WebInspector.ScriptSyntaxTree):
Add basic support for Esprima's ES6 Class/Method/Spread nodes.
There are more ES6 features that should be covered, but this
covers all the features we use in Web Inspector source, so
Type Profiling can work with our own source.

Treat Methods like getters / setters right now because their
syntax is very similiar to getters/setters. There is a bug
handling generic ES6 cleanup to better name things.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsScriptSyntaxTreejs">trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (182105 => 182106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-03-28 04:42:48 UTC (rev 182105)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-03-28 05:04:23 UTC (rev 182106)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2015-03-27  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: TypeProfiler doesn't work on files with ES6 Class Syntax
+        https://bugs.webkit.org/show_bug.cgi?id=143169
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/ScriptSyntaxTree.js:
+        (WebInspector.ScriptSyntaxTree.prototype._recurse):
+        (WebInspector.ScriptSyntaxTree.prototype._createInternalSyntaxTree):
+        (WebInspector.ScriptSyntaxTree):
+        Add basic support for Esprima's ES6 Class/Method/Spread nodes.
+        There are more ES6 features that should be covered, but this
+        covers all the features we use in Web Inspector source, so
+        Type Profiling can work with our own source.
+
+        Treat Methods like getters / setters right now because their
+        syntax is very similiar to getters/setters. There is a bug
+        handling generic ES6 cleanup to better name things.
+
+2015-03-27  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: Uncaught TDZ Exception with Type Profiler
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=143167
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsScriptSyntaxTreejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js (182105 => 182106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js        2015-03-28 04:42:48 UTC (rev 182105)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js        2015-03-28 05:04:23 UTC (rev 182106)
</span><span class="lines">@@ -303,6 +303,20 @@
</span><span class="cx">             this._recurse(node.callee, callback, state);
</span><span class="cx">             this._recurseArray(node.arguments, callback, state);
</span><span class="cx">             break;
</span><ins>+        case WebInspector.ScriptSyntaxTree.NodeType.ClassBody:
+            callback(node, state);
+            this._recurseArray(node.body, callback, state);
+            break;
+        case WebInspector.ScriptSyntaxTree.NodeType.ClassDeclaration:
+            callback(node, state);
+            this._recurse(node.superClass, callback, state);
+            this._recurse(node.body, callback, state);
+            break;
+        case WebInspector.ScriptSyntaxTree.NodeType.ClassExpression:
+            callback(node, state);
+            this._recurse(node.superClass, callback, state);
+            this._recurse(node.body, callback, state);
+            break;
</ins><span class="cx">         case WebInspector.ScriptSyntaxTree.NodeType.ContinueStatement:
</span><span class="cx">             callback(node, state);
</span><span class="cx">             this._recurse(node.label, callback, state);
</span><span class="lines">@@ -375,6 +389,11 @@
</span><span class="cx">             this._recurse(node.object, callback, state);
</span><span class="cx">             this._recurse(node.property, callback, state);
</span><span class="cx">             break;
</span><ins>+        case WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition:
+            callback(node, state);
+            this._recurse(node.key, callback, state);
+            this._recurse(node.value, callback, state);
+            break;
</ins><span class="cx">         case WebInspector.ScriptSyntaxTree.NodeType.NewExpression:
</span><span class="cx">             callback(node, state);
</span><span class="cx">             this._recurse(node.callee, callback, state);
</span><span class="lines">@@ -402,6 +421,10 @@
</span><span class="cx">             callback(node, state);
</span><span class="cx">             this._recurseArray(node.expressions, callback, state);
</span><span class="cx">             break;
</span><ins>+        case WebInspector.ScriptSyntaxTree.NodeType.SpreadElement:
+            callback(node, state);
+            this._recurse(node.argument, callback, state);
+            break;
</ins><span class="cx">         case WebInspector.ScriptSyntaxTree.NodeType.SwitchStatement:
</span><span class="cx">             callback(node, state);
</span><span class="cx">             this._recurse(node.discriminant, callback, state);
</span><span class="lines">@@ -535,6 +558,28 @@
</span><span class="cx">                 body: this._createInternalSyntaxTree(node.body)
</span><span class="cx">             };
</span><span class="cx">             break;
</span><ins>+        case &quot;ClassBody&quot;:
+            result = {
+                type: WebInspector.ScriptSyntaxTree.NodeType.ClassBody,
+                body: node.body.map(this._createInternalSyntaxTree.bind(this))
+            };
+            break;
+        case &quot;ClassDeclaration&quot;:
+            result = {
+                type: WebInspector.ScriptSyntaxTree.NodeType.ClassDeclaration,
+                id: this._createInternalSyntaxTree(node.id),
+                superClass: this._createInternalSyntaxTree(node.superClass),
+                body: this._createInternalSyntaxTree(node.body),
+            };
+            break;
+        case &quot;ClassExpression&quot;:
+            result = {
+                type: WebInspector.ScriptSyntaxTree.NodeType.ClassExpression,
+                id: this._createInternalSyntaxTree(node.id),
+                superClass: this._createInternalSyntaxTree(node.superClass),
+                body: this._createInternalSyntaxTree(node.body),
+            };
+            break;            
</ins><span class="cx">         case &quot;ConditionalExpression&quot;:
</span><span class="cx">             result = {
</span><span class="cx">                 type: WebInspector.ScriptSyntaxTree.NodeType.ConditionalExpression,
</span><span class="lines">@@ -659,6 +704,19 @@
</span><span class="cx">                 computed: node.computed
</span><span class="cx">             };
</span><span class="cx">             break;
</span><ins>+        case &quot;MethodDefinition&quot;:
+            result = {
+                type: WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition,
+                key: this._createInternalSyntaxTree(node.key),
+                value: this._createInternalSyntaxTree(node.value),
+                computed: node.computed,
+                kind: node.kind,
+                static: node.static
+            };
+            // FIXME: &lt;https://webkit.org/b/143171&gt; Web Inspector: Improve Type Profiler Support for ES6 Syntax
+            result.value.isGetterOrSetter = true;
+            result.value.getterOrSetterRange = result.key.range;
+            break;
</ins><span class="cx">         case &quot;NewExpression&quot;:
</span><span class="cx">             result = {
</span><span class="cx">                 type: WebInspector.ScriptSyntaxTree.NodeType.NewExpression,
</span><span class="lines">@@ -708,6 +766,12 @@
</span><span class="cx">                 expressions: node.expressions.map(this._createInternalSyntaxTree.bind(this))
</span><span class="cx">             };
</span><span class="cx">             break;
</span><ins>+        case &quot;SpreadElement&quot;:
+            result = {
+                type: WebInspector.ScriptSyntaxTree.NodeType.SpreadElement,
+                argument: this._createInternalSyntaxTree(node.argument),
+            };
+            break;
</ins><span class="cx">         case &quot;SwitchStatement&quot;:
</span><span class="cx">             result = {
</span><span class="cx">                 type: WebInspector.ScriptSyntaxTree.NodeType.SwitchStatement,
</span><span class="lines">@@ -805,31 +869,35 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WebInspector.ScriptSyntaxTree.NodeType = {
</span><del>-    AssignmentExpression: Symbol(&quot;assignment-expression&quot;),
</del><span class="cx">     ArrayExpression: Symbol(&quot;array-expression&quot;),
</span><span class="cx">     ArrayPattern: Symbol(&quot;array-pattern&quot;),
</span><ins>+    AssignmentExpression: Symbol(&quot;assignment-expression&quot;),
+    BinaryExpression: Symbol(&quot;binary-expression&quot;),
</ins><span class="cx">     BlockStatement: Symbol(&quot;block-statement&quot;),
</span><del>-    BinaryExpression: Symbol(&quot;binary-expression&quot;),
</del><span class="cx">     BreakStatement: Symbol(&quot;break-statement&quot;),
</span><span class="cx">     CallExpression: Symbol(&quot;call-expression&quot;),
</span><span class="cx">     CatchClause: Symbol(&quot;catch-clause&quot;),
</span><ins>+    ClassBody: Symbol(&quot;class-body&quot;),
+    ClassDeclaration: Symbol(&quot;class-declaration&quot;),
+    ClassExpression: Symbol(&quot;class-expression&quot;),
</ins><span class="cx">     ConditionalExpression: Symbol(&quot;conditional-expression&quot;),
</span><span class="cx">     ContinueStatement: Symbol(&quot;continue-statement&quot;),
</span><ins>+    DebuggerStatement: Symbol(&quot;debugger-statement&quot;),
</ins><span class="cx">     DoWhileStatement: Symbol(&quot;do-while-statement&quot;),
</span><del>-    DebuggerStatement: Symbol(&quot;debugger-statement&quot;),
</del><span class="cx">     EmptyStatement: Symbol(&quot;empty-statement&quot;),
</span><span class="cx">     ExpressionStatement: Symbol(&quot;expression-statement&quot;),
</span><del>-    ForStatement: Symbol(&quot;for-statement&quot;),
</del><span class="cx">     ForInStatement: Symbol(&quot;for-in-statement&quot;),
</span><span class="cx">     ForOfStatement: Symbol(&quot;for-of-statement&quot;),
</span><ins>+    ForStatement: Symbol(&quot;for-statement&quot;),
</ins><span class="cx">     FunctionDeclaration: Symbol(&quot;function-declaration&quot;),
</span><span class="cx">     FunctionExpression: Symbol(&quot;function-expression&quot;),
</span><span class="cx">     Identifier: Symbol(&quot;identifier&quot;),
</span><span class="cx">     IfStatement: Symbol(&quot;if-statement&quot;),
</span><ins>+    LabeledStatement: Symbol(&quot;labeled-statement&quot;),
</ins><span class="cx">     Literal: Symbol(&quot;literal&quot;),
</span><del>-    LabeledStatement: Symbol(&quot;labeled-statement&quot;),
</del><span class="cx">     LogicalExpression: Symbol(&quot;logical-expression&quot;),
</span><span class="cx">     MemberExpression: Symbol(&quot;member-expression&quot;),
</span><ins>+    MethodDefinition: Symbol(&quot;method-definition&quot;),
</ins><span class="cx">     NewExpression: Symbol(&quot;new-expression&quot;),
</span><span class="cx">     ObjectExpression: Symbol(&quot;object-expression&quot;),
</span><span class="cx">     ObjectPattern: Symbol(&quot;object-pattern&quot;),
</span><span class="lines">@@ -837,8 +905,9 @@
</span><span class="cx">     Property: Symbol(&quot;property&quot;),
</span><span class="cx">     ReturnStatement: Symbol(&quot;return-statement&quot;),
</span><span class="cx">     SequenceExpression: Symbol(&quot;sequence-expression&quot;),
</span><ins>+    SpreadElement: Symbol(&quot;spread-element&quot;),
+    SwitchCase: Symbol(&quot;switch-case&quot;),
</ins><span class="cx">     SwitchStatement: Symbol(&quot;switch-statement&quot;),
</span><del>-    SwitchCase: Symbol(&quot;switch-case&quot;),
</del><span class="cx">     ThisExpression: Symbol(&quot;this-expression&quot;),
</span><span class="cx">     ThrowStatement: Symbol(&quot;throw-statement&quot;),
</span><span class="cx">     TryStatement: Symbol(&quot;try-statement&quot;),
</span><span class="lines">@@ -847,5 +916,5 @@
</span><span class="cx">     VariableDeclaration: Symbol(&quot;variable-declaration&quot;),
</span><span class="cx">     VariableDeclarator: Symbol(&quot;variable-declarator&quot;),
</span><span class="cx">     WhileStatement: Symbol(&quot;while-statement&quot;),
</span><del>-    WithStatement: Symbol(&quot;with-statement&quot;)
</del><ins>+    WithStatement: Symbol(&quot;with-statement&quot;),
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>