| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/visitor.dart'; | 9 import 'package:analyzer/dart/element/visitor.dart'; |
| 10 import 'package:analyzer/exception/exception.dart'; | 10 import 'package:analyzer/exception/exception.dart'; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 '''); | 76 '''); |
| 77 | 77 |
| 78 Source addPackageSource(String packageName, String filePath, String content) { | 78 Source addPackageSource(String packageName, String filePath, String content) { |
| 79 packageMap[packageName] = [(newFolder('/pubcache/$packageName'))]; | 79 packageMap[packageName] = [(newFolder('/pubcache/$packageName'))]; |
| 80 File file = newFile('/pubcache/$packageName/$filePath', content); | 80 File file = newFile('/pubcache/$packageName/$filePath', content); |
| 81 return file.createSource(); | 81 return file.createSource(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 Source addSource(String path, String content, [Uri uri]) { | 84 Source addSource(String path, String content, [Uri uri]) { |
| 85 if (path.startsWith('/')) { |
| 86 path = provider.convertPath(path); |
| 87 } |
| 85 driver.addFile(path); | 88 driver.addFile(path); |
| 86 driver.changeFile(path); | 89 driver.changeFile(path); |
| 87 _fileContentOverlay[path] = content; | 90 _fileContentOverlay[path] = content; |
| 88 return provider.getFile(path).createSource(); | 91 return provider.getFile(path).createSource(); |
| 89 } | 92 } |
| 90 | 93 |
| 91 Element findElementInUnit(CompilationUnit unit, String name, | 94 Element findElementInUnit(CompilationUnit unit, String name, |
| 92 [ElementKind kind]) { | 95 [ElementKind kind]) { |
| 93 return findChildElement(unit.element, name, kind); | 96 return findChildElement(unit.element, name, kind); |
| 94 } | 97 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 final _ElementVisitorFunction function; | 179 final _ElementVisitorFunction function; |
| 177 | 180 |
| 178 _ElementVisitorFunctionWrapper(this.function); | 181 _ElementVisitorFunctionWrapper(this.function); |
| 179 | 182 |
| 180 @override | 183 @override |
| 181 visitElement(Element element) { | 184 visitElement(Element element) { |
| 182 function(element); | 185 function(element); |
| 183 super.visitElement(element); | 186 super.visitElement(element); |
| 184 } | 187 } |
| 185 } | 188 } |
| OLD | NEW |