Esempio n. 1
0
 public static UnifiedArgument Create(
     UnifiedExpression value, UnifiedIdentifier target = null,
     UnifiedSet <UnifiedModifier> modifiers            = null)
 {
     return(new UnifiedArgument {
         Modifiers = modifiers,
         Value = value,
         Target = target,
     });
 }
Esempio n. 2
0
 public static UnifiedLambda Create(
     UnifiedIdentifier name = null,
     UnifiedSet <UnifiedParameter> parameters = null,
     UnifiedBlock body = null)
 {
     return(new UnifiedLambda {
         Name = name,
         Parameters = parameters,
         Body = body,
     });
 }
Esempio n. 3
0
 public static UnifiedDelegateDefinition Create(
     UnifiedSet <UnifiedAnnotation> annotations = null,
     UnifiedSet <UnifiedModifier> modifiers     = null,
     UnifiedType type = null,
     UnifiedSet <UnifiedGenericParameter> genericParameters = null,
     UnifiedIdentifier name = null,
     UnifiedSet <UnifiedParameter> parameters = null)
 {
     return(new UnifiedDelegateDefinition {
         Name = name,
         Annotations = annotations,
         Type = type,
         GenericParameters = genericParameters,
         Modifiers = modifiers,
         Parameters = parameters,
     });
 }
 public static UnifiedPropertyDefinition Create(
     UnifiedSet <UnifiedAnnotation> annotations = null,
     UnifiedSet <UnifiedModifier> modifiers     = null,
     UnifiedType type = null, UnifiedIdentifier name = null,
     UnifiedSet <UnifiedParameter> parameters = null,
     UnifiedPropertyDefinitionPart getter     = null,
     UnifiedPropertyDefinitionPart setter     = null)
 {
     return(new UnifiedPropertyDefinition {
         Annotations = annotations,
         Modifiers = modifiers,
         Type = type,
         Name = name,
         Parameters = parameters,
         Getter = getter,
         Setter = setter,
     });
 }
Esempio n. 5
0
        public static UnifiedVariableDefinition FindDefinition(
            UnifiedIdentifier variable)
        {
            var scopes = variable.Ancestors<UnifiedBlock>();
            var name = variable.Name;
            UnifiedElement searched = variable;

            foreach (var scope in scopes) {
                var definition = scope
                        .DescendantsUntil(e2 => e2 is UnifiedBlock)
                        .TakeWhile(e => e != searched)
                        .OfType<UnifiedVariableDefinition>()
                        .FirstOrDefault(e => e.Name.Name == name);
                if (definition != null) {
                    return definition;
                }

                searched = scope;
            }
            return null;
        }
Esempio n. 6
0
 public static UnifiedVariableDefinition Create(
     UnifiedSet <UnifiedAnnotation> annotations = null,
     UnifiedSet <UnifiedModifier> modifiers     = null,
     UnifiedType type                       = null,
     UnifiedIdentifier name                 = null,
     UnifiedExpression initialValue         = null,
     UnifiedSet <UnifiedArgument> arguments = null,
     UnifiedIntegerLiteral bitField         = null,
     UnifiedBlock body                      = null)
 {
     return(new UnifiedVariableDefinition {
         Annotations = annotations,
         Arguments = arguments,
         BitField = bitField,
         Body = body,
         InitialValue = initialValue,
         Modifiers = modifiers,
         Name = name,
         Type = type,
     });
 }
Esempio n. 7
0
 public static UnifiedFunctionDefinition Create(
     UnifiedSet <UnifiedAnnotation> annotations = null,
     UnifiedSet <UnifiedModifier> modifiers     = null,
     UnifiedType type = null,
     UnifiedSet <UnifiedGenericParameter> genericParameters = null,
     UnifiedIdentifier name = null,
     UnifiedSet <UnifiedParameter> parameters = null,
     UnifiedSet <UnifiedType> throws          = null,
     UnifiedBlock body = null,
     UnifiedExpression annotationExpression = null)
 {
     return(new UnifiedFunctionDefinition {
         Name = name,
         Annotations = annotations,
         Type = type,
         GenericParameters = genericParameters,
         Modifiers = modifiers,
         Parameters = parameters,
         Throws = throws,
         Body = body,
         AnnotationExpression = annotationExpression,
     });
 }
Esempio n. 8
0
 public static UnifiedParameter ToParameter(
     this UnifiedIdentifier expression, UnifiedType type)
 {
     return(UnifiedParameter.Create(
                null, null, type, expression.ToSet()));
 }