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

Side by Side Diff: pkg/analyzer/lib/src/generated/constant.dart

Issue 2590883004: Put a TypeProvider on the TypeSystem implementations. (Closed)
Patch Set: Rebase Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.constant; 5 library analyzer.src.generated.constant;
6 6
7 import 'package:analyzer/context/declared_variables.dart'; 7 import 'package:analyzer/context/declared_variables.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/error/listener.dart'; 9 import 'package:analyzer/error/listener.dart';
10 import 'package:analyzer/src/dart/constant/evaluation.dart'; 10 import 'package:analyzer/src/dart/constant/evaluation.dart';
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 * The type system primitives. 112 * The type system primitives.
113 */ 113 */
114 final TypeSystem _typeSystem; 114 final TypeSystem _typeSystem;
115 115
116 /** 116 /**
117 * Initialize a newly created evaluator to evaluate expressions in the given 117 * Initialize a newly created evaluator to evaluate expressions in the given
118 * [source]. The [typeProvider] is the type provider used to access known 118 * [source]. The [typeProvider] is the type provider used to access known
119 * types. 119 * types.
120 */ 120 */
121 ConstantEvaluator(this._source, this._typeProvider, {TypeSystem typeSystem}) 121 ConstantEvaluator(this._source, this._typeProvider, {TypeSystem typeSystem})
122 : _typeSystem = typeSystem ?? new TypeSystemImpl(); 122 : _typeSystem = typeSystem ?? new TypeSystemImpl(_typeProvider);
123 123
124 EvaluationResult evaluate(Expression expression) { 124 EvaluationResult evaluate(Expression expression) {
125 RecordingErrorListener errorListener = new RecordingErrorListener(); 125 RecordingErrorListener errorListener = new RecordingErrorListener();
126 ErrorReporter errorReporter = new ErrorReporter(errorListener, _source); 126 ErrorReporter errorReporter = new ErrorReporter(errorListener, _source);
127 DartObjectImpl result = expression.accept(new ConstantVisitor( 127 DartObjectImpl result = expression.accept(new ConstantVisitor(
128 new ConstantEvaluationEngine(_typeProvider, new DeclaredVariables(), 128 new ConstantEvaluationEngine(_typeProvider, new DeclaredVariables(),
129 typeSystem: _typeSystem), 129 typeSystem: _typeSystem),
130 errorReporter)); 130 errorReporter));
131 if (result != null) { 131 if (result != null) {
132 return EvaluationResult.forValue(result); 132 return EvaluationResult.forValue(result);
133 } 133 }
134 return EvaluationResult.forErrors(errorListener.errors); 134 return EvaluationResult.forErrors(errorListener.errors);
135 } 135 }
136 } 136 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/type.dart ('k') | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698