@@ -3052,20 +3052,22 @@ async fn error_severity(resolve_options: Vc<ResolveOptions>) -> Result<ResolvedV
3052
3052
/// ModulePart represents a part of a module.
3053
3053
///
3054
3054
/// Currently this is used only for ESMs.
3055
- #[ turbo_tasks:: value]
3055
+ #[ derive(
3056
+ Serialize , Deserialize , Debug , Clone , PartialEq , Eq , Hash , TraceRawVcs , TaskInput , NonLocalValue ,
3057
+ ) ]
3056
3058
pub enum ModulePart {
3057
3059
/// Represents the side effects of a module. This part is evaluated even if
3058
3060
/// all exports are unused.
3059
3061
Evaluation ,
3060
3062
/// Represents an export of a module.
3061
- Export ( ResolvedVc < RcStr > ) ,
3063
+ Export ( RcStr ) ,
3062
3064
/// Represents a renamed export of a module.
3063
3065
RenamedExport {
3064
- original_export : ResolvedVc < RcStr > ,
3065
- export : ResolvedVc < RcStr > ,
3066
+ original_export : RcStr ,
3067
+ export : RcStr ,
3066
3068
} ,
3067
3069
/// Represents a namespace object of a module exported as named export.
3068
- RenamedNamespace { export : ResolvedVc < RcStr > } ,
3070
+ RenamedNamespace { export : RcStr } ,
3069
3071
/// A pointer to a specific part.
3070
3072
Internal ( u32 ) ,
3071
3073
/// A pointer to a specific part, but with evaluation.
@@ -3079,76 +3081,64 @@ pub enum ModulePart {
3079
3081
Facade ,
3080
3082
}
3081
3083
3082
- #[ turbo_tasks:: value_impl]
3083
3084
impl ModulePart {
3084
- #[ turbo_tasks:: function]
3085
- pub fn evaluation ( ) -> Vc < Self > {
3086
- ModulePart :: Evaluation . cell ( )
3085
+ pub fn evaluation ( ) -> Self {
3086
+ ModulePart :: Evaluation
3087
3087
}
3088
- # [ turbo_tasks :: function ]
3089
- pub fn export ( export : RcStr ) -> Vc < Self > {
3090
- ModulePart :: Export ( ResolvedVc :: cell ( export) ) . cell ( )
3088
+
3089
+ pub fn export ( export : RcStr ) -> Self {
3090
+ ModulePart :: Export ( export)
3091
3091
}
3092
- # [ turbo_tasks :: function ]
3093
- pub fn renamed_export ( original_export : RcStr , export : RcStr ) -> Vc < Self > {
3092
+
3093
+ pub fn renamed_export ( original_export : RcStr , export : RcStr ) -> Self {
3094
3094
ModulePart :: RenamedExport {
3095
- original_export : ResolvedVc :: cell ( original_export ) ,
3096
- export : ResolvedVc :: cell ( export ) ,
3095
+ original_export,
3096
+ export,
3097
3097
}
3098
- . cell ( )
3099
3098
}
3100
- #[ turbo_tasks:: function]
3101
- pub fn renamed_namespace ( export : RcStr ) -> Vc < Self > {
3102
- ModulePart :: RenamedNamespace {
3103
- export : ResolvedVc :: cell ( export) ,
3104
- }
3105
- . cell ( )
3099
+
3100
+ pub fn renamed_namespace ( export : RcStr ) -> Self {
3101
+ ModulePart :: RenamedNamespace { export }
3106
3102
}
3107
- # [ turbo_tasks :: function ]
3108
- pub fn internal ( id : u32 ) -> Vc < Self > {
3109
- ModulePart :: Internal ( id) . cell ( )
3103
+
3104
+ pub fn internal ( id : u32 ) -> Self {
3105
+ ModulePart :: Internal ( id)
3110
3106
}
3111
- # [ turbo_tasks :: function ]
3112
- pub fn internal_evaluation ( id : u32 ) -> Vc < Self > {
3113
- ModulePart :: InternalEvaluation ( id) . cell ( )
3107
+
3108
+ pub fn internal_evaluation ( id : u32 ) -> Self {
3109
+ ModulePart :: InternalEvaluation ( id)
3114
3110
}
3115
- # [ turbo_tasks :: function ]
3116
- pub fn locals ( ) -> Vc < Self > {
3117
- ModulePart :: Locals . cell ( )
3111
+
3112
+ pub fn locals ( ) -> Self {
3113
+ ModulePart :: Locals
3118
3114
}
3119
- # [ turbo_tasks :: function ]
3120
- pub fn exports ( ) -> Vc < Self > {
3121
- ModulePart :: Exports . cell ( )
3115
+
3116
+ pub fn exports ( ) -> Self {
3117
+ ModulePart :: Exports
3122
3118
}
3123
- # [ turbo_tasks :: function ]
3124
- pub fn facade ( ) -> Vc < Self > {
3125
- ModulePart :: Facade . cell ( )
3119
+
3120
+ pub fn facade ( ) -> Self {
3121
+ ModulePart :: Facade
3126
3122
}
3127
3123
}
3128
3124
3129
- #[ turbo_tasks:: value_impl]
3130
- impl ValueToString for ModulePart {
3131
- #[ turbo_tasks:: function]
3132
- async fn to_string ( & self ) -> Result < Vc < RcStr > > {
3133
- Ok ( Vc :: cell ( match self {
3134
- ModulePart :: Evaluation => "module evaluation" . into ( ) ,
3135
- ModulePart :: Export ( export) => format ! ( "export {}" , export. await ?) . into ( ) ,
3125
+ impl Display for ModulePart {
3126
+ fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
3127
+ match self {
3128
+ ModulePart :: Evaluation => f. write_str ( "module evaluation" ) ,
3129
+ ModulePart :: Export ( export) => write ! ( f, "export {}" , export) ,
3136
3130
ModulePart :: RenamedExport {
3137
3131
original_export,
3138
3132
export,
3139
- } => {
3140
- let original_export = original_export. await ?;
3141
- let export = export. await ?;
3142
- format ! ( "export {} as {}" , original_export, export) . into ( )
3143
- }
3133
+ } => write ! ( f, "export {} as {}" , original_export, export) ,
3144
3134
ModulePart :: RenamedNamespace { export } => {
3145
- format ! ( "export * as {}" , export. await ? ) . into ( )
3135
+ write ! ( f , "export * as {}" , export)
3146
3136
}
3147
- ModulePart :: Internal ( id) => format ! ( "internal part {}" , id) . into ( ) ,
3148
- ModulePart :: InternalEvaluation ( id) => format ! ( "internal part {}" , id) . into ( ) ,
3149
- ModulePart :: Locals => "locals" . into ( ) ,
3150
- ModulePart :: Exports => "exports" . into ( ) ,
3151
- ModulePart :: Facade => "facade" . into ( ) ,
3152
- } ) )
3137
+ ModulePart :: Internal ( id) => write ! ( f , "internal part {}" , id) ,
3138
+ ModulePart :: InternalEvaluation ( id) => write ! ( f , "internal part {}" , id) ,
3139
+ ModulePart :: Locals => f . write_str ( "locals" ) ,
3140
+ ModulePart :: Exports => f . write_str ( "exports" ) ,
3141
+ ModulePart :: Facade => f . write_str ( "facade" ) ,
3142
+ }
3153
3143
}
3154
3144
}
0 commit comments