<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>148563</bug_id>
          
          <creation_ts>2015-08-27 22:50:25 -0700</creation_ts>
          <short_desc>Web Inspector: Improve ScriptSyntaxTree a bit</short_desc>
          <delta_ts>2015-08-28 12:31:57 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Joseph Pecoraro">joepeck</assigned_to>
          <cc>bburg</cc>
    
    <cc>commit-queue</cc>
    
    <cc>graouts</cc>
    
    <cc>joepeck</cc>
    
    <cc>mattbaker</cc>
    
    <cc>nvasilyev</cc>
    
    <cc>saam</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1121599</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-08-27 22:50:25 -0700</bug_when>
    <thetext>* SUMMARY
Improve ScriptSyntaxTree a bit.

- Share and fix ClassDeclaration and ClassExpression recursion to visit the identifier (node.id)
- Include the kind with a VariableDeclaration (&quot;var&quot;, &quot;let&quot;, &quot;const&quot;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121600</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2015-08-27 22:50:44 -0700</bug_when>
    <thetext>&lt;rdar://problem/22470522&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121601</commentid>
    <comment_count>2</comment_count>
      <attachid>260126</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-08-27 22:51:40 -0700</bug_when>
    <thetext>Created attachment 260126
[PATCH] Proposed Fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121602</commentid>
    <comment_count>3</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-08-27 22:52:33 -0700</bug_when>
    <thetext>=</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121664</commentid>
    <comment_count>4</comment_count>
      <attachid>260126</attachid>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2015-08-28 05:14:32 -0700</bug_when>
    <thetext>Comment on attachment 260126
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=260126&amp;action=review

&gt; Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js:881
&gt; +                kind: node.kind

Shoulder map this to an enum?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121733</commentid>
    <comment_count>5</comment_count>
      <attachid>260126</attachid>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2015-08-28 10:30:52 -0700</bug_when>
    <thetext>Comment on attachment 260126
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=260126&amp;action=review

&gt;&gt; Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js:881
&gt;&gt; +                kind: node.kind
&gt; 
&gt; Shoulder map this to an enum?

Should we*</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121771</commentid>
    <comment_count>6</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-08-28 11:37:41 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Comment on attachment 260126 [details]
&gt; [PATCH] Proposed Fix
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=260126&amp;action=review
&gt; 
&gt; &gt;&gt; Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js:881
&gt; &gt;&gt; +                kind: node.kind
&gt; &gt; 
&gt; &gt; Shoulder map this to an enum?
&gt; 
&gt; Should we*

Currently we just carry over all the other basic properties from esprima right now. Ultimately we would want our own enum types here (and in all other nodes) if we really want ScriptSyntaxTree to abstract any parser.

FWIW, there has been discussion of standardizing JS ASTs and their types in ESTree:
https://github.com/estree/estree
https://github.com/estree/estree/blob/master/es6.md

Esprima _very_ closely matches that. I did notice a few minor differences that can be sorted out later (what is a MetaProperty?). But ultimately if JS AST generators produce ESTree ASTs swapping out any parser would be trivial.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121775</commentid>
    <comment_count>7</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2015-08-28 11:43:47 -0700</bug_when>
    <thetext>Also interesting JavaScript &quot;CSTs&quot;:
https://github.com/mdevils/cst

&gt; CST means Concrete Syntax Tree. Unlike an AST (Abstract Syntax Tree),
&gt; a CST contains all the information from the JavaScript source file:
&gt; whitespace, punctuators, comments. This information is extremely
&gt; useful for code style checkers and other code linters. CST is also
&gt; useful for cases when you need to apply modifications to existing
&gt; JavaScript files while preserving the initial file formatting.
&gt; 
&gt; This CST implementation is designed to be 100% compatible with JS AST
&gt; (https://github.com/estree/estree).

I think an issue I ran into just yesterday could have benefitted from original source information instead of just token information. Likewise, our PrettyPrinter could be written to use this. Using ASTs we lacked whitespace information that was useful to keep &quot;as authored&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121785</commentid>
    <comment_count>8</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2015-08-28 12:05:39 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Comment on attachment 260126 [details]
&gt; [PATCH] Proposed Fix
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=260126&amp;action=review
&gt; 
&gt; &gt;&gt; Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js:881
&gt; &gt;&gt; +                kind: node.kind
&gt; &gt; 
&gt; &gt; Shoulder map this to an enum?
&gt; 
&gt; Should we*

I think we should. We could follow what we do for node types here
and just make everything a Symbol.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121790</commentid>
    <comment_count>9</comment_count>
      <attachid>260126</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-08-28 12:31:54 -0700</bug_when>
    <thetext>Comment on attachment 260126
[PATCH] Proposed Fix

Clearing flags on attachment: 260126

Committed r189118: &lt;http://trac.webkit.org/changeset/189118&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1121791</commentid>
    <comment_count>10</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-08-28 12:31:57 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>260126</attachid>
            <date>2015-08-27 22:51:40 -0700</date>
            <delta_ts>2015-08-28 12:31:54 -0700</delta_ts>
            <desc>[PATCH] Proposed Fix</desc>
            <filename>improves.patch</filename>
            <type>text/plain</type>
            <size>3295</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJJbnNwZWN0b3JVSS9DaGFuZ2VMb2cgYi9Tb3VyY2UvV2Vi
SW5zcGVjdG9yVUkvQ2hhbmdlTG9nCmluZGV4IGRlN2JiYzguLjRiNmVmNDMgMTAwNjQ0Ci0tLSBh
L1NvdXJjZS9XZWJJbnNwZWN0b3JVSS9Da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hbGxiYWNrLCBzdGF0
ZSk7Ci0gICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSBXZWJJbnNwZWN0b3IuU2NyaXB0
U3ludGF4VHJlZS5Ob2RlVHlwZS5GdW5jdGlvbkV4cHJlc3Npb246CiAgICAgICAgICAgICBjYWxs
YmFjayhub2RlLCBzdGF0ZSk7CiAgICAgICAgICAgICB0aGlzLl9yZWN1cnNlKG5vZGUuaWQsIGNh
bGxiYWNrLCBzdGF0ZSk7CkBAIC04ODYsNyArODc3LDggQEAgV2ViSW5zcGVjdG9yLlNjcmlwdFN5
bnRheFRyZWUgPSBjbGFzcyBTY3JpcHRTeW50YXhUcmVlIGV4dGVuZHMgV2ViSW5zcGVjdG9yLk9i
amUKICAgICAgICAgY2FzZSAiVmFyaWFibGVEZWNsYXJhdGlvbiI6CiAgICAgICAgICAgICByZXN1
bHQgPSB7CiAgICAgICAgICAgICAgICAgdHlwZTogV2ViSW5zcGVjdG9yLlNjcmlwdFN5bnRheFRy
ZWUuTm9kZVR5cGUuVmFyaWFibGVEZWNsYXJhdGlvbiwKLSAgICAgICAgICAgICAgICBkZWNsYXJh
dGlvbnM6IG5vZGUuZGVjbGFyYXRpb25zLm1hcCh0aGlzLl9jcmVhdGVJbnRlcm5hbFN5bnRheFRy
ZWUuYmluZCh0aGlzKSkKKyAgICAgICAgICAgICAgICBkZWNsYXJhdGlvbnM6IG5vZGUuZGVjbGFy
YXRpb25zLm1hcCh0aGlzLl9jcmVhdGVJbnRlcm5hbFN5bnRheFRyZWUuYmluZCh0aGlzKSksCisg
ICAgICAgICAgICAgICAga2luZDogbm9kZS5raW5kCiAgICAgICAgICAgICB9OwogICAgICAgICAg
ICAgYnJlYWs7CiAgICAgICAgIGNhc2UgIlZhcmlhYmxlRGVjbGFyYXRvciI6Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>