@@ -74,36 +74,34 @@ class PragmaAnnotation {
7474 6 , 'assumeDynamic' ,
7575 forFunctionsOnly: true , internalOnly: true );
7676
77- static const PragmaAnnotation omitAsCasts = const PragmaAnnotation (
78- 7 , 'omitAsCasts' ,
77+ static const PragmaAnnotation asTrust = const PragmaAnnotation (7 , 'as:trust' ,
7978 forFunctionsOnly: false , internalOnly: false );
8079
81- static const PragmaAnnotation emitAsCasts = const PragmaAnnotation (
82- 8 , 'emitAsCasts' ,
80+ static const PragmaAnnotation asCheck = const PragmaAnnotation (8 , 'as:check' ,
8381 forFunctionsOnly: false , internalOnly: false );
8482
85- static const PragmaAnnotation omitImplicitChecks = const PragmaAnnotation (
86- 9 , 'omitImplicitChecks ' ,
83+ static const PragmaAnnotation typesTrust = const PragmaAnnotation (
84+ 9 , 'types:trust ' ,
8785 forFunctionsOnly: false , internalOnly: false );
8886
89- static const PragmaAnnotation emitImplicitChecks = const PragmaAnnotation (
90- 10 , 'emitImplicitChecks ' ,
87+ static const PragmaAnnotation typesCheck = const PragmaAnnotation (
88+ 10 , 'types:check ' ,
9189 forFunctionsOnly: false , internalOnly: false );
9290
93- static const PragmaAnnotation omitParameterChecks = const PragmaAnnotation (
94- 11 , 'omitParameterChecks ' ,
91+ static const PragmaAnnotation parameterTrust = const PragmaAnnotation (
92+ 11 , 'parameter:trust ' ,
9593 forFunctionsOnly: false , internalOnly: false );
9694
97- static const PragmaAnnotation emitParameterChecks = const PragmaAnnotation (
98- 12 , 'emitParameterChecks ' ,
95+ static const PragmaAnnotation parameterCheck = const PragmaAnnotation (
96+ 12 , 'parameter:check ' ,
9997 forFunctionsOnly: false , internalOnly: false );
10098
101- static const PragmaAnnotation omitImplicitDowncasts = const PragmaAnnotation (
102- 13 , 'omitImplicitDowncasts ' ,
99+ static const PragmaAnnotation downcastTrust = const PragmaAnnotation (
100+ 13 , 'downcast:trust ' ,
103101 forFunctionsOnly: false , internalOnly: false );
104102
105- static const PragmaAnnotation emitImplicitDowncasts = const PragmaAnnotation (
106- 14 , 'emitImplicitDowncasts ' ,
103+ static const PragmaAnnotation downcastCheck = const PragmaAnnotation (
104+ 14 , 'downcast:check ' ,
107105 forFunctionsOnly: false , internalOnly: false );
108106
109107 static const List <PragmaAnnotation > values = [
@@ -114,37 +112,29 @@ class PragmaAnnotation {
114112 noThrows,
115113 noSideEffects,
116114 assumeDynamic,
117- omitAsCasts ,
118- emitAsCasts ,
119- omitImplicitChecks ,
120- emitImplicitChecks ,
121- omitParameterChecks ,
122- emitParameterChecks ,
123- omitImplicitDowncasts ,
124- emitImplicitDowncasts ,
115+ asTrust ,
116+ asCheck ,
117+ typesTrust ,
118+ typesCheck ,
119+ parameterTrust ,
120+ parameterCheck ,
121+ downcastTrust ,
122+ downcastCheck ,
125123 ];
126124
127125 static const Map <PragmaAnnotation , Set <PragmaAnnotation >> implies = {
128- omitImplicitChecks : {omitParameterChecks, omitImplicitDowncasts },
129- emitImplicitChecks : {emitParameterChecks, emitImplicitDowncasts },
126+ typesTrust : {parameterTrust, downcastTrust },
127+ typesCheck : {parameterCheck, downcastCheck },
130128 };
131129 static const Map <PragmaAnnotation , Set <PragmaAnnotation >> excludes = {
132130 noInline: {tryInline},
133131 tryInline: {noInline},
134- omitImplicitChecks: {
135- emitImplicitChecks,
136- emitParameterChecks,
137- emitImplicitDowncasts
138- },
139- emitImplicitChecks: {
140- omitImplicitChecks,
141- omitParameterChecks,
142- omitImplicitDowncasts
143- },
144- omitParameterChecks: {emitParameterChecks},
145- emitParameterChecks: {omitParameterChecks},
146- omitImplicitDowncasts: {emitImplicitDowncasts},
147- emitImplicitDowncasts: {omitImplicitDowncasts},
132+ typesTrust: {typesCheck, parameterCheck, downcastCheck},
133+ typesCheck: {typesTrust, parameterTrust, downcastTrust},
134+ parameterTrust: {parameterCheck},
135+ parameterCheck: {parameterTrust},
136+ downcastTrust: {downcastCheck},
137+ downcastCheck: {downcastTrust},
148138 };
149139 static const Map <PragmaAnnotation , Set <PragmaAnnotation >> requires = {
150140 noThrows: {noInline},
@@ -279,7 +269,7 @@ EnumSet<PragmaAnnotation> processMemberAnnotations(
279269 reporter.reportErrorMessage (
280270 computeSourceSpanFromTreeNode (member), MessageKind .GENERIC , {
281271 'text' : "@pragma('dart2js:${annotation .name }') should always be "
282- "combined with @pragma('dart2js:${annotation .name }')."
272+ "combined with @pragma('dart2js:${other .name }')."
283273 });
284274 }
285275 }
@@ -477,13 +467,13 @@ class AnnotationsDataImpl implements AnnotationsData {
477467 if (member != null ) {
478468 EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
479469 if (annotations != null ) {
480- if (annotations.contains (PragmaAnnotation .omitImplicitChecks )) {
470+ if (annotations.contains (PragmaAnnotation .typesTrust )) {
481471 return CheckPolicy .trusted;
482- } else if (annotations.contains (PragmaAnnotation .emitImplicitChecks )) {
472+ } else if (annotations.contains (PragmaAnnotation .typesCheck )) {
483473 return CheckPolicy .checked;
484- } else if (annotations.contains (PragmaAnnotation .omitParameterChecks )) {
474+ } else if (annotations.contains (PragmaAnnotation .parameterTrust )) {
485475 return CheckPolicy .trusted;
486- } else if (annotations.contains (PragmaAnnotation .emitParameterChecks )) {
476+ } else if (annotations.contains (PragmaAnnotation .parameterCheck )) {
487477 return CheckPolicy .checked;
488478 }
489479 }
@@ -496,15 +486,13 @@ class AnnotationsDataImpl implements AnnotationsData {
496486 if (member != null ) {
497487 EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
498488 if (annotations != null ) {
499- if (annotations.contains (PragmaAnnotation .omitImplicitChecks )) {
489+ if (annotations.contains (PragmaAnnotation .typesTrust )) {
500490 return CheckPolicy .trusted;
501- } else if (annotations.contains (PragmaAnnotation .emitImplicitChecks )) {
491+ } else if (annotations.contains (PragmaAnnotation .typesCheck )) {
502492 return CheckPolicy .checked;
503- } else if (annotations
504- .contains (PragmaAnnotation .omitImplicitDowncasts)) {
493+ } else if (annotations.contains (PragmaAnnotation .downcastTrust)) {
505494 return CheckPolicy .trusted;
506- } else if (annotations
507- .contains (PragmaAnnotation .emitImplicitDowncasts)) {
495+ } else if (annotations.contains (PragmaAnnotation .downcastCheck)) {
508496 return CheckPolicy .checked;
509497 }
510498 }
@@ -517,15 +505,13 @@ class AnnotationsDataImpl implements AnnotationsData {
517505 if (member != null ) {
518506 EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
519507 if (annotations != null ) {
520- if (annotations.contains (PragmaAnnotation .omitImplicitChecks )) {
508+ if (annotations.contains (PragmaAnnotation .typesTrust )) {
521509 return CheckPolicy .trusted;
522- } else if (annotations.contains (PragmaAnnotation .emitImplicitChecks )) {
510+ } else if (annotations.contains (PragmaAnnotation .typesCheck )) {
523511 return CheckPolicy .checked;
524- } else if (annotations
525- .contains (PragmaAnnotation .omitImplicitDowncasts)) {
512+ } else if (annotations.contains (PragmaAnnotation .downcastTrust)) {
526513 return CheckPolicy .trusted;
527- } else if (annotations
528- .contains (PragmaAnnotation .emitImplicitDowncasts)) {
514+ } else if (annotations.contains (PragmaAnnotation .downcastCheck)) {
529515 return CheckPolicy .checked;
530516 }
531517 }
@@ -538,9 +524,9 @@ class AnnotationsDataImpl implements AnnotationsData {
538524 if (member != null ) {
539525 EnumSet <PragmaAnnotation > annotations = pragmaAnnotations[member];
540526 if (annotations != null ) {
541- if (annotations.contains (PragmaAnnotation .omitAsCasts )) {
527+ if (annotations.contains (PragmaAnnotation .asTrust )) {
542528 return true ;
543- } else if (annotations.contains (PragmaAnnotation .emitAsCasts )) {
529+ } else if (annotations.contains (PragmaAnnotation .asCheck )) {
544530 return false ;
545531 }
546532 }
0 commit comments