Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2313)

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 1045553002: Implement the new '??' operator in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix if_null_precedence_test for unchecked operation. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/analyzer_impl.dart ('k') | pkg/analyzer/lib/src/generated/html.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 4ad8d0117230c61aa8738e7d60ada590934a264d..defec2bf5d7dbba429f4132da756ded9d4b911de 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1043,6 +1043,8 @@ class AnalysisContextImpl implements InternalAnalysisContext {
this._options.dart2jsHint != options.dart2jsHint ||
(this._options.hint && !options.hint) ||
this._options.preserveComments != options.preserveComments ||
+ this._options.enableNullAwareOperators !=
+ options.enableNullAwareOperators ||
this._options.enableStrictCallChecks != options.enableStrictCallChecks;
int cacheSize = options.cacheSize;
if (this._options.cacheSize != cacheSize) {
@@ -1068,6 +1070,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
this._options.generateImplicitErrors = options.generateImplicitErrors;
this._options.generateSdkErrors = options.generateSdkErrors;
this._options.dart2jsHint = options.dart2jsHint;
+ this._options.enableNullAwareOperators = options.enableNullAwareOperators;
this._options.enableStrictCallChecks = options.enableStrictCallChecks;
this._options.hint = options.hint;
this._options.incremental = options.incremental;
@@ -4663,7 +4666,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
Stopwatch perfCounter = new Stopwatch()..start();
PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver(
typeProvider, unitSource, dartEntry, oldUnit,
- analysisOptions.incrementalApi);
+ analysisOptions.incrementalApi, analysisOptions);
bool success = resolver.resolve(newCode);
AnalysisEngine.instance.instrumentationService.logPerformance(
AnalysisPerformanceKind.INCREMENTAL, perfCounter,
@@ -5994,6 +5997,11 @@ abstract class AnalysisOptions {
bool get enableEnum;
/**
+ * Return `true` to enable null-aware operators (DEP 9).
+ */
+ bool get enableNullAwareOperators;
+
+ /**
* Return `true` to strictly follow the specification when generating
* warnings on "call" methods (fixes dartbug.com/21938).
*/
@@ -6087,6 +6095,11 @@ class AnalysisOptionsImpl implements AnalysisOptions {
bool dart2jsHint = true;
/**
+ * A flag indicating whether null-aware operators should be parsed (DEP 9).
+ */
+ bool enableNullAwareOperators = false;
+
+ /**
* A flag indicating whether analysis is to strictly follow the specification
* when generating warnings on "call" methods (fixes dartbug.com/21938).
*/
@@ -6151,6 +6164,7 @@ class AnalysisOptionsImpl implements AnalysisOptions {
analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
cacheSize = options.cacheSize;
dart2jsHint = options.dart2jsHint;
+ enableNullAwareOperators = options.enableNullAwareOperators;
enableStrictCallChecks = options.enableStrictCallChecks;
generateImplicitErrors = options.generateImplicitErrors;
generateSdkErrors = options.generateSdkErrors;
@@ -8954,8 +8968,8 @@ class IncrementalAnalysisTask extends AnalysisTask {
// Produce an updated token stream
CharacterReader reader = new CharSequenceReader(cache.newContents);
BooleanErrorListener errorListener = new BooleanErrorListener();
- IncrementalScanner scanner =
- new IncrementalScanner(cache.source, reader, errorListener);
+ IncrementalScanner scanner = new IncrementalScanner(
+ cache.source, reader, errorListener, context.analysisOptions);
scanner.rescan(cache.resolvedUnit.beginToken, cache.offset, cache.oldLength,
cache.newLength);
if (errorListener.errorReported) {
@@ -9548,7 +9562,8 @@ class ParseHtmlTask extends AnalysisTask {
ht.Token token = scanner.tokenize();
_lineInfo = new LineInfo(scanner.lineStarts);
RecordingErrorListener errorListener = new RecordingErrorListener();
- _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo);
+ _unit = new ht.HtmlParser(source, errorListener, context.analysisOptions)
+ .parse(token, _lineInfo);
_unit.accept(new RecursiveXmlVisitor_ParseHtmlTask_internalPerform(
this, errorListener));
_errors = errorListener.getErrorsForSource(source);
@@ -10781,6 +10796,8 @@ class ScanDartTask extends AnalysisTask {
Scanner scanner = new Scanner(
source, new CharSequenceReader(_content), errorListener);
scanner.preserveComments = context.analysisOptions.preserveComments;
+ scanner.enableNullAwareOperators =
+ context.analysisOptions.enableNullAwareOperators;
_tokenStream = scanner.tokenize();
_lineInfo = new LineInfo(scanner.lineStarts);
_errors = errorListener.getErrorsForSource(source);
« no previous file with comments | « pkg/analyzer/lib/src/analyzer_impl.dart ('k') | pkg/analyzer/lib/src/generated/html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698