Ejemplo n.º 1
0
 internal void HandleUndeclaredVariable(string name, IndexSpan span, LocationResolver indexResolver)
 {
     if (!HasAlreadySeenErrorFor(name))
     {
         HandleError(JSError.UndeclaredVariable, span, indexResolver);
     }
 }
Ejemplo n.º 2
0
 public EncodedSpan CombineWith(LocationResolver resolver, EncodedSpan otherSpan)
 {
     return(new EncodedSpan(
                resolver,
                GetSpan(resolver).CombineWith(otherSpan.GetSpan(resolver))
                ));
 }
Ejemplo n.º 3
0
 internal JScriptException(JSError errorNumber, IndexSpan span, LocationResolver resolver) {
     m_valueObject = null;
     _span = span;
     _resolver = resolver;
     m_errorCode = errorNumber;
     SetHResult();
 }
Ejemplo n.º 4
0
 public EncodedSpan(LocationResolver resolver, int start, int length)
 {
     if (start < (1 << _offsetBits) && length < (1 << _lengthBits))
     {
         Span = start | (length << _offsetBits);
     }
     else
     {
         Span = resolver.AddSpan(start, length);
     }
 }
        private ResolutionVisitor(ActivationObject rootScope, LocationResolver indexResolver, ErrorSink errorSink) {
            // create the lexical and variable scope stacks and push the root scope onto them
            m_lexicalStack = new Stack<ActivationObject>();
            m_lexicalStack.Push(rootScope);

            m_variableStack = new Stack<ActivationObject>();
            m_variableStack.Push(rootScope);

            _locationResolver = indexResolver;
            _errorSink = errorSink;
        }
Ejemplo n.º 6
0
        public IndexSpan GetSpan(LocationResolver resolver)
        {
            if ((Span & 0x80000000) == 0)
            {
                return(new IndexSpan(
                           Span & ((1 << _offsetBits) - 1),
                           (Span >> _offsetBits) & ((1 << _lengthBits) - 1)
                           ));
            }

            return(resolver._spans[(int)(Span & ~(0x80000000))]);
        }
Ejemplo n.º 7
0
        private ResolutionVisitor(ActivationObject rootScope, LocationResolver indexResolver, ErrorSink errorSink)
        {
            // create the lexical and variable scope stacks and push the root scope onto them
            m_lexicalStack = new Stack <ActivationObject>();
            m_lexicalStack.Push(rootScope);

            m_variableStack = new Stack <ActivationObject>();
            m_variableStack.Push(rootScope);

            _locationResolver = indexResolver;
            _errorSink        = errorSink;
        }
Ejemplo n.º 8
0
        internal void HandleError(JSError errorId, IndexSpan span, LocationResolver resolver, bool forceToError = false) {
            var error = new JScriptException(errorId, span, resolver);

            if (forceToError) {
                error.IsError = true;
            } else {
                error.IsError = error.Severity < 2;
            }

            if (!OnCompilerError(error)) {

            }
        }
Ejemplo n.º 9
0
        internal void HandleError(JSError errorId, IndexSpan span, LocationResolver resolver, bool forceToError = false)
        {
            var error = new JScriptException(errorId, span, resolver);

            if (forceToError)
            {
                error.IsError = true;
            }
            else
            {
                error.IsError = error.Severity < 2;
            }

            if (!OnCompilerError(error))
            {
            }
        }
Ejemplo n.º 10
0
        public static void Apply(Node node, ActivationObject scope, LocationResolver indexResolver, ErrorSink errorSink)
        {
            if (node != null && scope != null)
            {
                // create the visitor and run it. This will create all the child
                // scopes and populate all the scopes with the var-decl, lex-decl,
                // and lookup references within them.
                var visitor = new ResolutionVisitor(scope, indexResolver, errorSink);
                node.Walk(visitor);

                // now that all the scopes are created and they all know what decls
                // they contains, create all the fields
                visitor.CreateFields(scope);

                // now that all the fields have been created in all the scopes,
                // let's go through and resolve all the references
                visitor.ResolveLookups(scope);

                // now that everything is declared and resolved as per the language specs,
                // we need to go back and add ghosted fields for older versions of IE that
                // incorrectly implement catch-variables and named function expressions.
                visitor.AddGhostedFields(scope);
            }
        }
        public static void Apply(Node node, ActivationObject scope, LocationResolver indexResolver, ErrorSink errorSink)
        {
            if (node != null && scope != null)
            {
                // create the visitor and run it. This will create all the child
                // scopes and populate all the scopes with the var-decl, lex-decl,
                // and lookup references within them.
                var visitor = new ResolutionVisitor(scope, indexResolver, errorSink);
                node.Walk(visitor);

                // now that all the scopes are created and they all know what decls
                // they contains, create all the fields
                visitor.CreateFields(scope);

                // now that all the fields have been created in all the scopes,
                // let's go through and resolve all the references
                visitor.ResolveLookups(scope);

                // now that everything is declared and resolved as per the language specs,
                // we need to go back and add ghosted fields for older versions of IE that
                // incorrectly implement catch-variables and named function expressions.
                visitor.AddGhostedFields(scope);
            }
        }
Ejemplo n.º 12
0
 public int GetStartIndex(LocationResolver resolver)
 {
     return(GetSpan(resolver).Start);
 }
Ejemplo n.º 13
0
 internal JsAst(EncodedSpan span, LocationResolver indexResolver)
     : base(span) {
     _locationResolver = indexResolver;
 }
Ejemplo n.º 14
0
 public IndexSpan GetSpan(LocationResolver parent)
 {
     return(EncodedSpan.GetSpan(parent));
 }
Ejemplo n.º 15
0
 public EncodedSpan(LocationResolver resolver, IndexSpan span)
     : this(resolver, span.Start, span.Length)
 {
 }
Ejemplo n.º 16
0
 public int GetStartIndex(LocationResolver parent)
 {
     return(GetSpan(parent).Start);
 }
Ejemplo n.º 17
0
 public int GetEndIndex(LocationResolver resolver)
 {
     return(GetSpan(resolver).End);
 }
Ejemplo n.º 18
0
 public IndexSpan GetNameSpan(LocationResolver resolver)
 {
     return(NameSpan);
 }
Ejemplo n.º 19
0
 public int GetEndIndex(LocationResolver parent)
 {
     return(GetSpan(parent).End);
 }
Ejemplo n.º 20
0
 internal void HandleUndeclaredVariable(string name, IndexSpan span, LocationResolver indexResolver) {
     if (!HasAlreadySeenErrorFor(name)) {
         HandleError(JSError.UndeclaredVariable, span, indexResolver);
     }
 }
Ejemplo n.º 21
0
 internal JsAst(EncodedSpan span, LocationResolver indexResolver)
     : base(span)
 {
     _locationResolver = indexResolver;
 }
Ejemplo n.º 22
0
 internal SourceLocation GetStart(LocationResolver jsAst)
 {
     return(jsAst.IndexToLocation(GetSpan(jsAst).Start));
 }
Ejemplo n.º 23
0
 internal SourceLocation GetEnd(LocationResolver jsAst)
 {
     return(jsAst.IndexToLocation(GetSpan(jsAst).End));
 }
 public IndexSpan GetNameSpan(LocationResolver locationResolver) {
     return NameSpan;
 }
Ejemplo n.º 25
0
 public IndexSpan GetNameSpan(LocationResolver locationResolver)
 {
     return(GetSpan(locationResolver));
 }