OLD | NEW |
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 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 const Required required = const Required(); | 62 const Required required = const Required(); |
63 | 63 |
64 class Required { | 64 class Required { |
65 final String reason; | 65 final String reason; |
66 const Required([this.reason]); | 66 const Required([this.reason]); |
67 } | 67 } |
68 '''); | 68 '''); |
69 | 69 |
70 Source addPackageSource(String packageName, String filePath, String content) { | 70 Source addPackageSource(String packageName, String filePath, String content) { |
71 packageMap[packageName] = [(newFolder('/pubcache/$packageName'))]; | 71 packageMap[packageName] = [(newFolder('/pubcache/$packageName/lib'))]; |
72 File file = newFile('/pubcache/$packageName/$filePath', content); | 72 File file = newFile('/pubcache/$packageName/lib/$filePath', content); |
73 return file.createSource(); | 73 return file.createSource(); |
74 } | 74 } |
75 | 75 |
76 Source addSource(String path, String content, [Uri uri]) { | 76 Source addSource(String path, String content, [Uri uri]) { |
77 if (path.startsWith('/')) { | 77 if (path.startsWith('/')) { |
78 path = provider.convertPath(path); | 78 path = provider.convertPath(path); |
79 } | 79 } |
80 File file = newFile(path, content); | 80 File file = newFile(path, content); |
81 Source source = file.createSource(uri); | 81 Source source = file.createSource(uri); |
82 driver.addFile(path); | 82 driver.addFile(path); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 * [engine.GeneralizingElementVisitor]. | 163 * [engine.GeneralizingElementVisitor]. |
164 */ | 164 */ |
165 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { | 165 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { |
166 final _ElementVisitorFunction function; | 166 final _ElementVisitorFunction function; |
167 _ElementVisitorFunctionWrapper(this.function); | 167 _ElementVisitorFunctionWrapper(this.function); |
168 visitElement(Element element) { | 168 visitElement(Element element) { |
169 function(element); | 169 function(element); |
170 super.visitElement(element); | 170 super.visitElement(element); |
171 } | 171 } |
172 } | 172 } |
OLD | NEW |