Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–201 unchanged (201 lines)
202 FlowScope blindScope, boolean outcome) {
203 if (condition.getType() == CALL && condition.getChildCount() == 2) {
204 Node callee = condition.getFirstChild();
205 Node param = condition.getLastChild();
206 if (callee.getType() == GETPROP && param.isQualifiedName()) {
207 JSType paramType = getTypeIfRefinable(param, blindScope);
208 if (paramType != null) {
209 Node left = callee.getFirstChild();
210 Node right = callee.getLastChild();
211 if (left.getType() == NAME && "goog".equals(left.getString()) &&
212 right.getType() == STRING) {
213 Function<TypeRestriction, JSType> restricter =
214 restricters.get(right.getString());
215 if (restricter != null) {
216 return restrictParameter(param, paramType, blindScope, restricter,
217 outcome);
218 }
219 }
220 }
221 }
222 }
223 return nextPreciserScopeKnowingConditionOutcome(
224 condition, blindScope, outcome);
225 }
226
227 private FlowScope restrictParameter(Node parameter, JSType type,
228 FlowScope blindScope, Function<TypeRestriction, JSType> restriction,
…lines 229–253 unchanged (25 lines)

After

…lines 1–201 unchanged (201 lines)
202 FlowScope blindScope, boolean outcome) {
203 if (condition.getType() == CALL && condition.getChildCount() == 2) {
204 Node callee = condition.getFirstChild();
205 Node param = condition.getLastChild();
206 if (callee.getType() == GETPROP && param.isQualifiedName()) {
207 JSType paramType = getTypeIfRefinable(param, blindScope);
208 Node left = callee.getFirstChild();
209 Node right = callee.getLastChild();
210 if (left.getType() == NAME && "goog".equals(left.getString()) &&
211 right.getType() == STRING) {
212 Function<TypeRestriction, JSType> restricter =
213 restricters.get(right.getString());
214 if (restricter != null) {
215 return restrictParameter(param, paramType, blindScope, restricter,
216 outcome);
217 }
218 }
219 }
220 }
221 return nextPreciserScopeKnowingConditionOutcome(
222 condition, blindScope, outcome);
223 }
224
225 private FlowScope restrictParameter(Node parameter, JSType type,
226 FlowScope blindScope, Function<TypeRestriction, JSType> restriction,
…lines 227–251 unchanged (25 lines)

Before

program
block_comment "/*\n * Copyright 2007 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
. "."
identifier "CALL"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
. "."
identifier "GETPROP"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
. "."
identifier "NAME"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
. "."
identifier "STRING"
; ";"
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Function"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "ImmutableMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeRegistry"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "ObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "Visitor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
block_comment "/**\n * A reverse abstract interpreter (RAI) for specific clo"...
class_declaration
class "class"
identifier "ClosureReverseAbstractInterpreter"
superclass
extends "extends"
type_identifier "ChainableReverseAbstractInterpreter"
class_body
{ "{"
block_comment "/**\n * For when {@code goog.isArray} returns true.\n */"
field_declaration (+91 nodes collapsed)
block_comment "/**\n * For when {@code goog.isArray} returns false.\n */"
field_declaration (+61 nodes collapsed)
block_comment "/**\n * For when {@code goog.isObject} returns true. This i"...
field_declaration (+91 nodes collapsed)
block_comment "/**\n * For when {@code goog.isObject} returns false.\n */"
field_declaration (+65 nodes collapsed)
block_comment "/** Functions used to restrict types. */"
field_declaration (+21 nodes collapsed)
block_comment "/**\n * Creates a {@link ClosureReverseAbstractInterpreter}"...
constructor_declaration (+758 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
type_identifier "FlowScope"
identifier "getPreciserScopeKnowingConditionOutcome"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "condition"
, ","
formal_parameter
type_identifier "FlowScope"
identifier "blindScope"
, ","
formal_parameter
boolean_type "boolean"
identifier "outcome"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression (+25 nodes collapsed)
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "callee"
= "="
method_invocation
identifier "condition"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "param"
= "="
method_invocation
identifier "condition"
. "."
identifier "getLastChild"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression (+22 nodes collapsed)
block
{ "{"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "paramType"
= "="
method_invocation
identifier "getTypeIfRefinable"
argument_list
( "("
identifier "param"
, ","
identifier "blindScope"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "paramType"
!= "!="
null_literal "null"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "left"
= "="
method_invocation
identifier "callee"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "right"
= "="
method_invocation
identifier "callee"
. "."
identifier "getLastChild"
argument_list
( "("
) ")"
; ";"
if_statement (+105 nodes collapsed)
} "}"
} "}"
} "}"
return_statement
return "return"
method_invocation
identifier "nextPreciserScopeKnowingConditionOutcome"
argument_list
( "("
identifier "condition"
, ","
identifier "blindScope"
, ","
identifier "outcome"
) ")"
; ";"
} "}"
method_declaration (+109 nodes collapsed)
class_declaration (+60 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2007 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
. "."
identifier "CALL"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
. "."
identifier "GETPROP"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
. "."
identifier "NAME"
; ";"
import_declaration
import "import"
static "static"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
. "."
identifier "STRING"
; ";"
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration (+23 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Function"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "ImmutableMap"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "JSTypeRegistry"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "FunctionType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "ObjectType"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "jstype"
. "."
identifier "Visitor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
block_comment "/**\n * A reverse abstract interpreter (RAI) for specific clo"...
class_declaration
class "class"
identifier "ClosureReverseAbstractInterpreter"
superclass
extends "extends"
type_identifier "ChainableReverseAbstractInterpreter"
class_body
{ "{"
block_comment "/**\n * For when {@code goog.isArray} returns true.\n */"
field_declaration (+91 nodes collapsed)
block_comment "/**\n * For when {@code goog.isArray} returns false.\n */"
field_declaration (+61 nodes collapsed)
block_comment "/**\n * For when {@code goog.isObject} returns true. This i"...
field_declaration (+91 nodes collapsed)
block_comment "/**\n * For when {@code goog.isObject} returns false.\n */"
field_declaration (+65 nodes collapsed)
block_comment "/** Functions used to restrict types. */"
field_declaration (+21 nodes collapsed)
block_comment "/**\n * Creates a {@link ClosureReverseAbstractInterpreter}"...
constructor_declaration (+758 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
type_identifier "FlowScope"
identifier "getPreciserScopeKnowingConditionOutcome"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "condition"
, ","
formal_parameter
type_identifier "FlowScope"
identifier "blindScope"
, ","
formal_parameter
boolean_type "boolean"
identifier "outcome"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression (+25 nodes collapsed)
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "callee"
= "="
method_invocation
identifier "condition"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "param"
= "="
method_invocation
identifier "condition"
. "."
identifier "getLastChild"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression (+22 nodes collapsed)
block
{ "{"
local_variable_declaration
type_identifier "JSType"
variable_declarator
identifier "paramType"
= "="
method_invocation
identifier "getTypeIfRefinable"
argument_list
( "("
identifier "param"
, ","
identifier "blindScope"
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "left"
= "="
method_invocation
identifier "callee"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "right"
= "="
method_invocation
identifier "callee"
. "."
identifier "getLastChild"
argument_list
( "("
) ")"
; ";"
if_statement (+105 nodes collapsed)
} "}"
} "}"
return_statement
return "return"
method_invocation
identifier "nextPreciserScopeKnowingConditionOutcome"
argument_list
( "("
identifier "condition"
, ","
identifier "blindScope"
, ","
identifier "outcome"
) ")"
; ";"
} "}"
method_declaration (+109 nodes collapsed)
class_declaration (+60 nodes collapsed)
} "}"