@@ -54,7 +54,7 @@ CompilationUnit parseCompilationUnit(String contents,
5454 FeatureSet featureSet}) {
5555 // TODO(paulberry): make featureSet a required parameter
5656 featureSet ?? = FeatureSet .fromEnableFlags ([]);
57- Source source = new StringSource (contents, name);
57+ Source source = StringSource (contents, name);
5858 return _parseSource (contents, source, featureSet,
5959 suppressErrors: suppressErrors, parseFunctionBodies: parseFunctionBodies);
6060}
@@ -79,17 +79,17 @@ CompilationUnit parseDartFile(String path,
7979 FeatureSet featureSet}) {
8080 // TODO(paulberry): Make featureSet a required parameter
8181 featureSet ?? = FeatureSet .fromEnableFlags ([]);
82- String contents = new File (path).readAsStringSync ();
83- var sourceFactory = new SourceFactory (
84- [ new ResourceUriResolver (PhysicalResourceProvider .INSTANCE )]);
82+ String contents = File (path).readAsStringSync ();
83+ var sourceFactory =
84+ SourceFactory ([ ResourceUriResolver (PhysicalResourceProvider .INSTANCE )]);
8585
8686 var absolutePath = pathos.absolute (path);
8787 var source = sourceFactory.forUri (pathos.toUri (absolutePath).toString ());
8888 if (source == null ) {
89- throw new ArgumentError ("Can't get source for path $path " );
89+ throw ArgumentError ("Can't get source for path $path " );
9090 }
9191 if (! source.exists ()) {
92- throw new ArgumentError ("Source $source doesn't exist" );
92+ throw ArgumentError ("Source $source doesn't exist" );
9393 }
9494
9595 return _parseSource (contents, source, featureSet,
@@ -118,15 +118,15 @@ CompilationUnit parseDirectives(String contents,
118118 {String name, bool suppressErrors = false , FeatureSet featureSet}) {
119119 // TODO(paulberry): make featureSet a required parameter.
120120 featureSet ?? = FeatureSet .fromEnableFlags ([]);
121- var source = new StringSource (contents, name);
122- var errorCollector = new _ErrorCollector ();
123- var reader = new CharSequenceReader (contents);
124- var scanner = new Scanner (source, reader, errorCollector)
121+ var source = StringSource (contents, name);
122+ var errorCollector = _ErrorCollector ();
123+ var reader = CharSequenceReader (contents);
124+ var scanner = Scanner (source, reader, errorCollector)
125125 ..configureFeatures (featureSet);
126126 var token = scanner.tokenize ();
127- var parser = new Parser (source, errorCollector, featureSet: featureSet);
127+ var parser = Parser (source, errorCollector, featureSet: featureSet);
128128 var unit = parser.parseDirectives (token);
129- unit.lineInfo = new LineInfo (scanner.lineStarts);
129+ unit.lineInfo = LineInfo (scanner.lineStarts);
130130
131131 if (errorCollector.hasErrors && ! suppressErrors) throw errorCollector.group;
132132
@@ -142,15 +142,15 @@ String stringLiteralToString(StringLiteral literal) {
142142CompilationUnit _parseSource (
143143 String contents, Source source, FeatureSet featureSet,
144144 {bool suppressErrors = false , bool parseFunctionBodies = true }) {
145- var reader = new CharSequenceReader (contents);
146- var errorCollector = new _ErrorCollector ();
147- var scanner = new Scanner (source, reader, errorCollector)
145+ var reader = CharSequenceReader (contents);
146+ var errorCollector = _ErrorCollector ();
147+ var scanner = Scanner (source, reader, errorCollector)
148148 ..configureFeatures (featureSet);
149149 var token = scanner.tokenize ();
150- var parser = new Parser (source, errorCollector, featureSet: featureSet)
150+ var parser = Parser (source, errorCollector, featureSet: featureSet)
151151 ..parseFunctionBodies = parseFunctionBodies;
152152 var unit = parser.parseCompilationUnit (token)
153- ..lineInfo = new LineInfo (scanner.lineStarts);
153+ ..lineInfo = LineInfo (scanner.lineStarts);
154154
155155 if (errorCollector.hasErrors && ! suppressErrors) throw errorCollector.group;
156156
@@ -165,7 +165,7 @@ class _ErrorCollector extends AnalysisErrorListener {
165165
166166 /// The group of errors collected.
167167 AnalyzerErrorGroup get group =>
168- new AnalyzerErrorGroup .fromAnalysisErrors (_errors);
168+ AnalyzerErrorGroup .fromAnalysisErrors (_errors);
169169
170170 /// Whether any errors where collected.
171171 bool get hasErrors => _errors.isNotEmpty;
0 commit comments