mprobst marked an inline comment as done.

================
Comment at: lib/Format/TokenAnnotator.cpp:760
@@ +759,3 @@
+      if (CurrentToken->is(tok::kw_export)) {
+        // Find the 'from' part of export {...} from '...';
+        // The difference here is that "export {...};" should not be treated as
----------------
djasper wrote:
> Can you actually have:
> 
>   export {a as from};
> 
> ?
Good observation. Fixed by specifically looking for `from 'some tring';`.

================
Comment at: lib/Format/TokenAnnotator.cpp:763
@@ +762,3 @@
+        // an export.
+        while (CurrentToken) {
+          if (CurrentToken->is(tok::semi))
----------------
djasper wrote:
> Not a big fan of the code duplication in this loop. How about doing:
> 
>   if (Style.Language == FormatStyle::LK_JavaScript &&
>       ((Line.First->is(tok::kw_export) && CurrentToken->is(Keywords.kw_from)) 
> ||
>        isClosureImportStatement(*CurrentToken)))
>     return LT_ImportStatement;
> 
> in the lower loop? The ImportStatement variable can likely go away then.
Merged with the code below. My intent was to not do this check for JavaScript 
code that doesn't start with `import` or `export`, but merging seems fair, too.


http://reviews.llvm.org/D17440



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to