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

Side by Side Diff: pkg/analyzer/lib/context/declared_variables.dart

Issue 2345773003: Use declared variables to select the correct configuration for resolution (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « pkg/analysis_server/lib/src/status/ast_writer.dart ('k') | pkg/analyzer/lib/dart/ast/ast.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.context.declared_variables; 5 library analyzer.context.declared_variables;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/constant/value.dart'; 9 import 'package:analyzer/dart/constant/value.dart';
10 import 'package:analyzer/src/dart/constant/value.dart'; 10 import 'package:analyzer/src/dart/constant/value.dart';
(...skipping 17 matching lines...) Expand all
28 Iterable<String> get variableNames => _declaredVariables.keys; 28 Iterable<String> get variableNames => _declaredVariables.keys;
29 29
30 /** 30 /**
31 * Define a variable with the given [name] to have the given [value]. 31 * Define a variable with the given [name] to have the given [value].
32 */ 32 */
33 void define(String name, String value) { 33 void define(String name, String value) {
34 _declaredVariables[name] = value; 34 _declaredVariables[name] = value;
35 } 35 }
36 36
37 /** 37 /**
38 * Return the raw string value of the variable with the given [name],
39 * or `null` of the variable is not defined.
40 */
41 String get(String name) => _declaredVariables[name];
42
43 /**
38 * Return the value of the variable with the given [name] interpreted as a 44 * Return the value of the variable with the given [name] interpreted as a
39 * 'boolean' value. If the variable is not defined (or [name] is `null`), a 45 * 'boolean' value. If the variable is not defined (or [name] is `null`), a
40 * DartObject representing "unknown" is returned. If the value cannot be 46 * DartObject representing "unknown" is returned. If the value cannot be
41 * parsed as a boolean, a DartObject representing 'null' is returned. The 47 * parsed as a boolean, a DartObject representing 'null' is returned. The
42 * [typeProvider] is the type provider used to find the type 'bool'. 48 * [typeProvider] is the type provider used to find the type 'bool'.
43 */ 49 */
44 DartObject getBool(TypeProvider typeProvider, String name) { 50 DartObject getBool(TypeProvider typeProvider, String name) {
45 String value = _declaredVariables[name]; 51 String value = _declaredVariables[name];
46 if (value == null) { 52 if (value == null) {
47 return new DartObjectImpl(typeProvider.boolType, BoolState.UNKNOWN_VALUE); 53 return new DartObjectImpl(typeProvider.boolType, BoolState.UNKNOWN_VALUE);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 */ 90 */
85 DartObject getString(TypeProvider typeProvider, String name) { 91 DartObject getString(TypeProvider typeProvider, String name) {
86 String value = _declaredVariables[name]; 92 String value = _declaredVariables[name];
87 if (value == null) { 93 if (value == null) {
88 return new DartObjectImpl( 94 return new DartObjectImpl(
89 typeProvider.stringType, StringState.UNKNOWN_VALUE); 95 typeProvider.stringType, StringState.UNKNOWN_VALUE);
90 } 96 }
91 return new DartObjectImpl(typeProvider.stringType, new StringState(value)); 97 return new DartObjectImpl(typeProvider.stringType, new StringState(value));
92 } 98 }
93 } 99 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/status/ast_writer.dart ('k') | pkg/analyzer/lib/dart/ast/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698