@@ -233,16 +233,12 @@ module Angular2 {
233233 */
234234 class PipeRefExpr extends Expr , @angular_pipe_ref {
235235 /** Gets the identifier node naming the pipe. */
236- Identifier getIdentifier ( ) {
237- result = getChildExpr ( 0 )
238- }
236+ Identifier getIdentifier ( ) { result = getChildExpr ( 0 ) }
239237
240238 /** Gets the name of the pipe being referenced. */
241239 string getName ( ) { result = getIdentifier ( ) .getName ( ) }
242240
243- override string getAPrimaryQlClass ( ) {
244- result = "Angular2::PipeRefExpr"
245- }
241+ override string getAPrimaryQlClass ( ) { result = "Angular2::PipeRefExpr" }
246242 }
247243
248244 /**
@@ -252,32 +248,24 @@ module Angular2 {
252248 * `f` is a `PipeRefExpr` and the call itself is a `PipeCallExpr`.
253249 */
254250 class PipeCallExpr extends CallExpr {
255- PipeCallExpr ( ) {
256- getCallee ( ) instanceof PipeRefExpr
257- }
251+ PipeCallExpr ( ) { getCallee ( ) instanceof PipeRefExpr }
258252
259253 /** Gets the name of the pipe being invoked, such as `f` in `x | f`. */
260- string getPipeName ( ) {
261- result = getCallee ( ) .( PipeRefExpr ) .getName ( )
262- }
254+ string getPipeName ( ) { result = getCallee ( ) .( PipeRefExpr ) .getName ( ) }
263255 }
264256
265257 /**
266258 * A reference to a variable in a template expression, corresponding
267259 * to a property on the component class.
268260 */
269261 class TemplateVarRefExpr extends Expr {
270- TemplateVarRefExpr ( ) {
271- this = any ( TemplateTopLevel tl ) .getScope ( ) .getAVariable ( ) .getAnAccess ( )
272- }
262+ TemplateVarRefExpr ( ) { this = any ( TemplateTopLevel tl ) .getScope ( ) .getAVariable ( ) .getAnAccess ( ) }
273263 }
274264
275265 /** The top-level containing an Angular expression. */
276266 class TemplateTopLevel extends TopLevel , @angular_template_toplevel {
277267 /** Gets the expression in this top-level. */
278- Expr getExpression ( ) {
279- result = getChildStmt ( 0 ) .( ExprStmt ) .getExpr ( )
280- }
268+ Expr getExpression ( ) { result = getChildStmt ( 0 ) .( ExprStmt ) .getExpr ( ) }
281269
282270 /** Gets the data flow node representing the initialization of the given variable in this scope. */
283271 DataFlow:: Node getVariableInit ( string name ) {
@@ -299,9 +287,7 @@ module Angular2 {
299287 )
300288 }
301289
302- override string getValue ( ) {
303- result = this .( Expr ) .getStringValue ( )
304- }
290+ override string getValue ( ) { result = this .( Expr ) .getStringValue ( ) }
305291 }
306292
307293 /**
@@ -365,18 +351,15 @@ module Angular2 {
365351 /**
366352 * Gets the `selector` property of the `@Component` decorator.
367353 */
368- string getSelector ( ) {
369- decorator .getOptionArgument ( 0 , "selector" ) .mayHaveStringValue ( result )
370- }
354+ string getSelector ( ) { decorator .getOptionArgument ( 0 , "selector" ) .mayHaveStringValue ( result ) }
371355
372356 /** Gets an HTML element that instantiates this component. */
373- HTML:: Element getATemplateInstantiation ( ) {
374- result .getName ( ) = getSelector ( )
375- }
357+ HTML:: Element getATemplateInstantiation ( ) { result .getName ( ) = getSelector ( ) }
376358
377359 /** Gets an argument that flows into the `name` field of this component. */
378360 DataFlow:: Node getATemplateArgument ( string name ) {
379- result = getAttributeValueAsNode ( getATemplateInstantiation ( ) .getAttributeByName ( "[" + name + "]" ) )
361+ result =
362+ getAttributeValueAsNode ( getATemplateInstantiation ( ) .getAttributeByName ( "[" + name + "]" ) )
380363 }
381364
382365 /**
@@ -393,14 +376,20 @@ module Angular2 {
393376 HTML:: Element getATemplateElement ( ) {
394377 result .getFile ( ) = getTemplateFile ( )
395378 or
396- result .getParent * ( ) = HTML:: getHtmlElementFromExpr ( decorator .getOptionArgument ( 0 , "template" ) .asExpr ( ) , _)
379+ result .getParent * ( ) =
380+ HTML:: getHtmlElementFromExpr ( decorator .getOptionArgument ( 0 , "template" ) .asExpr ( ) , _)
397381 }
398382
399383 /**
400384 * Gets an access to the given template variable within the template body of this component.
401385 */
402386 DataFlow:: SourceNode getATemplateVarAccess ( string name ) {
403- result = getATemplateElement ( ) .getAnAttribute ( ) .getCodeInAttribute ( ) .( TemplateTopLevel ) .getAVariableUse ( name )
387+ result =
388+ getATemplateElement ( )
389+ .getAnAttribute ( )
390+ .getCodeInAttribute ( )
391+ .( TemplateTopLevel )
392+ .getAVariableUse ( name )
404393 }
405394 }
406395
@@ -414,14 +403,10 @@ module Angular2 {
414403 }
415404
416405 /** Gets the value of the `name` option passed to the `@Pipe` decorator. */
417- string getPipeName ( ) {
418- decorator .getOptionArgument ( 0 , "name" ) .mayHaveStringValue ( result )
419- }
406+ string getPipeName ( ) { decorator .getOptionArgument ( 0 , "name" ) .mayHaveStringValue ( result ) }
420407
421408 /** Gets a reference to this pipe. */
422- DataFlow:: Node getAPipeRef ( ) {
423- result .asExpr ( ) .( PipeRefExpr ) .getName ( ) = getPipeName ( )
424- }
409+ DataFlow:: Node getAPipeRef ( ) { result .asExpr ( ) .( PipeRefExpr ) .getName ( ) = getPipeName ( ) }
425410 }
426411
427412 private class ComponentSteps extends PreCallGraphStep {
@@ -464,28 +449,25 @@ module Angular2 {
464449 * attribute. There is no AST node for the implied for-of loop.
465450 */
466451 private class ForLoopAttribute extends HTML:: Attribute {
467- ForLoopAttribute ( ) {
468- getName ( ) = "*ngFor"
469- }
452+ ForLoopAttribute ( ) { getName ( ) = "*ngFor" }
470453
471454 /** Gets a data-flow node holding the value being iterated over. */
472- DataFlow:: Node getIterationDomain ( ) {
473- result = getAttributeValueAsNode ( this )
474- }
455+ DataFlow:: Node getIterationDomain ( ) { result = getAttributeValueAsNode ( this ) }
475456
476457 /** Gets the name of the variable holding the element of the current iteration. */
477- string getIteratorName ( ) {
478- result = getValue ( ) .regexpCapture ( " *let +(\\w+).*" , 1 )
479- }
458+ string getIteratorName ( ) { result = getValue ( ) .regexpCapture ( " *let +(\\w+).*" , 1 ) }
480459
481460 /** Gets an HTML element in which the iterator variable is in scope. */
482- HTML:: Element getAnElementInScope ( ) {
483- result .getParent * ( ) = getElement ( )
484- }
461+ HTML:: Element getAnElementInScope ( ) { result .getParent * ( ) = getElement ( ) }
485462
486463 /** Gets a reference to the iterator variable. */
487464 DataFlow:: Node getAnIteratorAccess ( ) {
488- result = getAnElementInScope ( ) .getAnAttribute ( ) .getCodeInAttribute ( ) .( TemplateTopLevel ) .getAVariableUse ( getIteratorName ( ) )
465+ result =
466+ getAnElementInScope ( )
467+ .getAnAttribute ( )
468+ .getCodeInAttribute ( )
469+ .( TemplateTopLevel )
470+ .getAVariableUse ( getIteratorName ( ) )
489471 }
490472 }
491473
@@ -496,9 +478,7 @@ module Angular2 {
496478 private class ForLoopStep extends TaintTracking:: AdditionalTaintStep {
497479 ForLoopAttribute attrib ;
498480
499- ForLoopStep ( ) {
500- this = attrib .getIterationDomain ( )
501- }
481+ ForLoopStep ( ) { this = attrib .getIterationDomain ( ) }
502482
503483 override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
504484 pred = this and
@@ -528,14 +508,17 @@ module Angular2 {
528508 private class BuiltinPipeStep extends TaintTracking:: AdditionalTaintStep , DataFlow:: CallNode {
529509 string name ;
530510
531- BuiltinPipeStep ( ) {
532- this = getAPipeCall ( name )
533- }
511+ BuiltinPipeStep ( ) { this = getAPipeCall ( name ) }
534512
535513 override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
536514 succ = this and
537515 exists ( int i | pred = getArgument ( i ) |
538- i = 0 and name = [ "async" , "i18nPlural" , "json" , "keyvalue" , "lowercase" , "uppercase" , "titlecase" , "slice" ]
516+ i = 0 and
517+ name =
518+ [
519+ "async" , "i18nPlural" , "json" , "keyvalue" , "lowercase" , "uppercase" , "titlecase" ,
520+ "slice"
521+ ]
539522 or
540523 i = 1 and name = "date" // date format string
541524 )
@@ -551,9 +534,7 @@ module Angular2 {
551534 * A `<mat-table>` element.
552535 */
553536 class MatTableElement extends HTML:: Element {
554- MatTableElement ( ) {
555- getName ( ) = "mat-table"
556- }
537+ MatTableElement ( ) { getName ( ) = "mat-table" }
557538
558539 /** Gets the data flow node corresponding to the `[dataSource]` attribute. */
559540 DataFlow:: Node getDataSourceNode ( ) {
@@ -566,13 +547,20 @@ module Angular2 {
566547 HTML:: Element getATableCell ( string rowBinding ) {
567548 result .getName ( ) = "mat-cell" and
568549 result .getParent + ( ) = this and
569- rowBinding = result .getAttributeByName ( "*matCellDef" ) .getValue ( ) .regexpCapture ( " *let +(\\w+).*" , 1 )
550+ rowBinding =
551+ result .getAttributeByName ( "*matCellDef" ) .getValue ( ) .regexpCapture ( " *let +(\\w+).*" , 1 )
570552 }
571553
572554 /** Gets a data flow node that refers to one of the rows from the data source. */
573555 DataFlow:: Node getARowRef ( ) {
574556 exists ( string rowBinding |
575- result = getATableCell ( rowBinding ) .getChild * ( ) .getAnAttribute ( ) .getCodeInAttribute ( ) .( TemplateTopLevel ) .getAVariableUse ( rowBinding )
557+ result =
558+ getATableCell ( rowBinding )
559+ .getChild * ( )
560+ .getAnAttribute ( )
561+ .getCodeInAttribute ( )
562+ .( TemplateTopLevel )
563+ .getAVariableUse ( rowBinding )
576564 )
577565 }
578566 }
@@ -590,9 +578,7 @@ module Angular2 {
590578 private class MatTableTaintStep extends TaintTracking:: AdditionalTaintStep {
591579 MatTableElement table ;
592580
593- MatTableTaintStep ( ) {
594- this = table .getDataSourceNode ( )
595- }
581+ MatTableTaintStep ( ) { this = table .getDataSourceNode ( ) }
596582
597583 override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
598584 pred = this and
@@ -614,7 +600,8 @@ module Angular2 {
614600 /** A taint step into the data array of a `MatTableDataSource` instance. */
615601 private class MatTableDataSourceStep extends TaintTracking:: AdditionalTaintStep , DataFlow:: NewNode {
616602 MatTableDataSourceStep ( ) {
617- this = DataFlow:: moduleMember ( "@angular/material/table" , "MatTableDataSource" ) .getAnInstantiation ( )
603+ this =
604+ DataFlow:: moduleMember ( "@angular/material/table" , "MatTableDataSource" ) .getAnInstantiation ( )
618605 }
619606
620607 override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
0 commit comments