OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.target_implementation; | 5 library fasta.target_implementation; |
6 | 6 |
7 import 'package:kernel/target/targets.dart' as backend show Target; | 7 import 'package:kernel/target/targets.dart' as backend show Target; |
8 | 8 |
9 import 'builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder; | 9 import 'builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder; |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 /// accept a single argument which is the name of the field. | 80 /// accept a single argument which is the name of the field. |
81 Builder getDuplicatedFieldInitializerError(Loader loader) { | 81 Builder getDuplicatedFieldInitializerError(Loader loader) { |
82 if (cachedDuplicatedFieldInitializerError != null) { | 82 if (cachedDuplicatedFieldInitializerError != null) { |
83 return cachedDuplicatedFieldInitializerError; | 83 return cachedDuplicatedFieldInitializerError; |
84 } | 84 } |
85 return cachedDuplicatedFieldInitializerError = loader.coreLibrary | 85 return cachedDuplicatedFieldInitializerError = loader.coreLibrary |
86 .getConstructor("_DuplicatedFieldInitializerError", | 86 .getConstructor("_DuplicatedFieldInitializerError", |
87 bypassLibraryPrivacy: true); | 87 bypassLibraryPrivacy: true); |
88 } | 88 } |
89 | 89 |
90 /// Returns a reference to the constructor of [FallThroughError] error. The | |
91 /// constructor is expected to accept no arguments. | |
92 Builder getFallThroughError(Loader loader) { | |
93 if (cachedFallThroughError != null) { | |
94 return cachedFallThroughError; | |
95 } | |
96 return cachedFallThroughError = | |
97 loader.coreLibrary.getConstructor("FallThroughError"); | |
98 } | |
99 | |
100 /// Returns a reference to the constructor used for creating `native` | 90 /// Returns a reference to the constructor used for creating `native` |
101 /// annotations. The constructor is expected to accept a single argument of | 91 /// annotations. The constructor is expected to accept a single argument of |
102 /// type String, which is the name of the native method. | 92 /// type String, which is the name of the native method. |
103 Builder getNativeAnnotation(Loader loader) { | 93 Builder getNativeAnnotation(Loader loader) { |
104 if (cachedNativeAnnotation != null) return cachedNativeAnnotation; | 94 if (cachedNativeAnnotation != null) return cachedNativeAnnotation; |
105 LibraryBuilder internal = loader.read(Uri.parse("dart:_internal"), -1); | 95 LibraryBuilder internal = loader.read(Uri.parse("dart:_internal"), -1); |
106 return cachedNativeAnnotation = internal.getConstructor("ExternalName"); | 96 return cachedNativeAnnotation = internal.getConstructor("ExternalName"); |
107 } | 97 } |
108 | 98 |
109 void loadExtraRequiredLibraries(Loader loader) { | 99 void loadExtraRequiredLibraries(Loader loader) { |
(...skipping 27 matching lines...) Expand all Loading... |
137 void readPatchFiles(LibraryBuilder library) { | 127 void readPatchFiles(LibraryBuilder library) { |
138 assert(library.uri.scheme == "dart"); | 128 assert(library.uri.scheme == "dart"); |
139 List<Uri> patches = uriTranslator.patches[library.uri.path]; | 129 List<Uri> patches = uriTranslator.patches[library.uri.path]; |
140 if (patches != null) { | 130 if (patches != null) { |
141 for (Uri patch in patches) { | 131 for (Uri patch in patches) { |
142 library.loader.read(patch, -1, fileUri: patch, isPatch: true); | 132 library.loader.read(patch, -1, fileUri: patch, isPatch: true); |
143 } | 133 } |
144 } | 134 } |
145 } | 135 } |
146 } | 136 } |
OLD | NEW |