Reviewers: MikeSamuel,


Please review this at http://codereview.appspot.com/154170

Affected files:
  M     src/com/google/caja/ancillary/linter/VariableLiveness.java
  M     src/com/google/caja/parser/js/Parser.java
  M     tests/com/google/caja/plugin/ExpressionSanitizerTest.java


Index: tests/com/google/caja/plugin/ExpressionSanitizerTest.java
===================================================================
--- tests/com/google/caja/plugin/ExpressionSanitizerTest.java (revision 3846)
+++ tests/com/google/caja/plugin/ExpressionSanitizerTest.java   (working copy)
@@ -32,18 +32,15 @@
  * @author [email protected] (Mike Samuel)
  */
 public class ExpressionSanitizerTest extends CajaTestCase {
-  private PluginMeta meta;

   @Override
   protected void setUp() throws Exception {
     super.setUp();
-    meta = new PluginMeta();
   }

   @Override
   protected void tearDown() throws Exception {
     super.tearDown();
-    meta = null;
   }

   public final void testBasicRewriting() throws Exception {
Index: src/com/google/caja/parser/js/Parser.java
===================================================================
--- src/com/google/caja/parser/js/Parser.java   (revision 3846)
+++ src/com/google/caja/parser/js/Parser.java   (working copy)
@@ -15,7 +15,6 @@
 package com.google.caja.parser.js;

 import com.google.caja.lexer.FilePosition;
-import com.google.caja.lexer.JsLexer;
 import com.google.caja.lexer.JsTokenQueue;
 import com.google.caja.lexer.JsTokenType;
 import com.google.caja.lexer.Keyword;
@@ -323,7 +322,7 @@

     Mark startOfPrologue = tq.mark();
     List<Directive> directives = Lists.newArrayList();
-
+
     while (tq.peek().type == JsTokenType.STRING) {
       Mark startOfDirective = tq.mark();
       Token<JsTokenType> quotedString = tq.pop();
@@ -361,7 +360,7 @@
         tq.rewind(startOfDirective);
         break;
       }
-
+
       String decoded = StringLiteral.getUnquotedValueOf(quotedString.text);
if (!Directive.RecognizedValue.isDirectiveStringRecognized(decoded)) {
         mq.addMessage(
Index: src/com/google/caja/ancillary/linter/VariableLiveness.java
===================================================================
--- src/com/google/caja/ancillary/linter/VariableLiveness.java (revision 3846) +++ src/com/google/caja/ancillary/linter/VariableLiveness.java (working copy)
@@ -210,8 +210,7 @@
       return processLabeledStmtWrapper((LabeledStmtWrapper) s, onEntry);
     } else if (s instanceof DirectivePrologue) {
       // TODO: New node type, not yet supported by linter
-      // return processDirectivePrologue((DirectivePrologue) s, onEntry);
-      return processNoop(onEntry);
+      return processDirectivePrologue((DirectivePrologue) s, onEntry);
     } else {
       throw new RuntimeException(s.getClass().getName());
     }
@@ -679,7 +678,7 @@
   private static LiveCalc processDirectivePrologue(
       DirectivePrologue d, LiveSet onEntry) {
     // TODO: New node type, not yet supported by linter
-    return null;
+    return processNoop(onEntry);
   }

   /**


Reply via email to